Equation help
I'm no mathematician, and i'm a bit unsure what you mean- but this may be the sort of thing you are talking about:
F(Xn) = Xn-1 * Y
where Y is a varying value and Xn-1 is the answer from the previous iteration
so if the intial value of x is 200 (the value for X0) and the value of Y is constantly at 0.5 - you should get the following results:
N____Xn-1______Y______Xn_____
1____200_______0.5____100____
2____100_______0.5____50_____
3____50________0.5____25_____
4____25________0.5____12.5___
...and so on
Hope this helps,
Darragh
F(Xn) = Xn-1 * Y
where Y is a varying value and Xn-1 is the answer from the previous iteration
so if the intial value of x is 200 (the value for X0) and the value of Y is constantly at 0.5 - you should get the following results:
N____Xn-1______Y______Xn_____
1____200_______0.5____100____
2____100_______0.5____50_____
3____50________0.5____25_____
4____25________0.5____12.5___
...and so on
Hope this helps,
Darragh
Thanks for your help.
I don't think Xn-1 is neccesary, since I shouldn't need an input from a previous calculation.
I think I've messed up forming up my question, so I'll try again:
I want to find a number between 0.4 (or so) and 1, from a function, f(x).
EDIT: actually, x doesn't have to have limits..
f(1000) = 0.25
f(900) = 0.28
f(700) = 0.3
f(500) = 0.5
f(200) = 0.8
f(100) = 0.9
f(50) = 0.95
f(1) = 0.99
f(0.5) = 0.999
Then I can just multiply x by f(x) to get what I need.
Thanks,
hyn
I don't think Xn-1 is neccesary, since I shouldn't need an input from a previous calculation.
I think I've messed up forming up my question, so I'll try again:
I want to find a number between 0.4 (or so) and 1, from a function, f(x).
EDIT: actually, x doesn't have to have limits..
f(1000) = 0.25
f(900) = 0.28
f(700) = 0.3
f(500) = 0.5
f(200) = 0.8
f(100) = 0.9
f(50) = 0.95
f(1) = 0.99
f(0.5) = 0.999
Then I can just multiply x by f(x) to get what I need.
Thanks,
hyn
For the specific values you gave:
f(x) = 1 - (x / 500) * 0.6
will give a linear range of values intersecting 0.4 at 500 (f(500) = 0.4) and 1 at 1 (f(1) = 1). This doesn't necessarily satisfy f(200) = 0.8; if you definitely need that to be true, it becomes a quadratic function.
EDIT: Okay, so you changed the rules. This is more tricky, since you appear to have an asymptote as x approaches 0, and a something-else-for-which-I-can't-remember-the-term as x approaches infinity. A variation on
1 - Cx
maybe?
[Edited by - TDragon on August 18, 2005 5:28:41 PM]
f(x) = 1 - (x / 500) * 0.6
will give a linear range of values intersecting 0.4 at 500 (f(500) = 0.4) and 1 at 1 (f(1) = 1). This doesn't necessarily satisfy f(200) = 0.8; if you definitely need that to be true, it becomes a quadratic function.
EDIT: Okay, so you changed the rules. This is more tricky, since you appear to have an asymptote as x approaches 0, and a something-else-for-which-I-can't-remember-the-term as x approaches infinity. A variation on
1 - Cx
maybe?
[Edited by - TDragon on August 18, 2005 5:28:41 PM]
Ah yes, I think i understand what you mean now. You want to have 0.4 as the lowest possible number produced by this function and 1.0 as the highest possible number.
I think this would do the trick:
f(x) = 0.4 + (0.6 / x )
So the folowing values should be produced:
x_______f(x)
1.0_____1.0
2.0_____0.7
3.0_____0.6
5.0_____0.52
10.0____0.46
100.0___0.406
As x grows larger the answer will verge towards 0.4 but never reach it ( in pure maths terms of course, with the finite precision of computers it will ). So long as you keep x >= 1.0 this should work- if x falls below 1.0 however the answer will grow to infinity as you get closer to 0.0 , which is not what you want.
Regards,
Darragh
I think this would do the trick:
f(x) = 0.4 + (0.6 / x )
So the folowing values should be produced:
x_______f(x)
1.0_____1.0
2.0_____0.7
3.0_____0.6
5.0_____0.52
10.0____0.46
100.0___0.406
As x grows larger the answer will verge towards 0.4 but never reach it ( in pure maths terms of course, with the finite precision of computers it will ). So long as you keep x >= 1.0 this should work- if x falls below 1.0 however the answer will grow to infinity as you get closer to 0.0 , which is not what you want.
Regards,
Darragh
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement