Jump to content
• What is your GameDev Story?

• Advertisement

Equation help

This topic is 4901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

*please see my new question below* [Edited by - hyn on August 18, 2005 5:39:21 PM]

Share this post

Share on other sites
Advertisement
x = x / (2 - y^inf)

?

Share this post

Share on other sites
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

Share this post

Share on other sites
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

Share this post

Share on other sites
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]

Share this post

Share on other sites
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

Share this post

Share on other sites
Darragh, that's exactly what I needed.

Thanks you.

Share this post

Share on other sites
Closed. Looks like homework with no justification. See Forum FAQ.

Share this post

Share on other sites

This topic is 4901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

This topic is now closed to further replies.

• Advertisement
• Advertisement
• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• Popular Now

• 15
• 9
• 11
• 9
• 9
• Advertisement
• Forum Statistics

• Total Topics
634135
• Total Posts
3015752
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!