Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Any reasonable way to do this??

  • 13-01-2014 6:11pm
    #1
    Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭


    I need to program a way to do the following, with some constraints on how.

    Given real numbers X and Y where X < Y, I need to create 10 exponential steps from X to Y which would be graphically represented somethingexpcdf.gif like this:

    So, lets suppose X is 1.5 and Y is 2.5. I need a simple (non-recursive) equation which spits out 10 exponentially decreasing steps from 1.5 to 2.5 ..

    The best I can come up with is something like:
    F(t) = X + X(e^rt) where r is the rate and t is the step number....

    But that falls down in that is doesnt consider Y at all.
    It describes the write sort of arc but its not really what I'm looking for.


    I've been looking at this for so long I cant see the wood for the trees I feel...


Comments

  • Registered Users, Registered Users 2 Posts: 2,149 ✭✭✭ZorbaTehZ


    If I follow you correctly, then this may work

    [latex]F(t)=\log \left(\frac{1}{10} t \left(e^Y-e^X\right) + e^X\right)[/latex]

    Edit: the plus has disappeared (on my screen at least), so the function is F(t)=\log \left(\frac{1}{10} t \left(e^Y-e^X\right) + e^X\right).


  • Registered Users, Registered Users 2 Posts: 338 ✭✭ray giraffe


    To make each step half the size of the previous step do:

    [latex]\displaystyle F(t) = X + (Y-X) \left( \frac{1-0.5^t}{1-0.5^{10}} \right)[/latex]

    For X=5 and Y=14:

    5
    9.504398827
    11.75659824
    12.88269795
    13.4457478
    13.72727273
    13.86803519
    13.93841642
    13.97360704
    13.99120235
    14



    To make each step a quarter of the previous step do:

    [latex]\displaystyle F(t) = X + (Y-X) \left( \frac{1-0.25^t}{1-0.25^{10}} \right)[/latex]

    For X=5 and Y=14:

    5
    11.75000644
    13.43750805
    13.85938345
    13.9648523
    13.99121951
    13.99781132
    13.99945927
    13.99987125
    13.99997425
    14

    t runs from 0 to 10, so that's 11 numbers (with 10 gaps)

    Ray :)


  • Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭DeVore


    OFFS!!!! I was so close to that and turned back from it! :)

    Many thanks Ray, that looks exactly like what I need!! And thanks Zorba, thats a very comprehensive answer too!


Advertisement