The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.
I need to put together some formula that, as a function of time, will gradually turn one number into another number. And the larger the original number is, the longer it should take. I'm having trouble coming up with it for some reason. Help?
Deviant Hands on
0
Posts
amateurhourOne day I'll be professionalhourThe woods somewhere in TennesseeRegistered Userregular
I need to put together some formula that, as a function of time, will gradually turn one number into another number. And the larger the original number is, the longer it should take. I'm having trouble coming up with it for some reason. Help?
Do you have some examples of formulas you've started with? Not a lot of people here are just going to solve it for you when it sounds like they're doing your homework.
I need to put together some formula that, as a function of time, will gradually turn one number into another number. And the larger the original number is, the longer it should take. I'm having trouble coming up with it for some reason. Help?
Do you have some examples of formulas you've started with? Not a lot of people here are just going to solve it for you when it sounds like they're doing your homework.
There are no examples. This is part of a code I'm working on. Up until now, what I was doing was finding out a certain value using 2 other variables I have, multiplying it by a time tracking variable and subtracting it until I eventually reached a constant known value, of 0. The problem is I'm trying to do this not just for 0, but for any value X.
Deviant Hands on
0
amateurhourOne day I'll be professionalhourThe woods somewhere in TennesseeRegistered Userregular
edited December 2007
okay, so, for example, you need a formula that would, over time, turn the number one into the number two, but not by specific time measurements?
While I'm not sure exactly what you're doing, I'm going to guess that you might be more satisfied with:
f(t)=a+(b-a)t/abs(b-a)
abs here is the absolute value
this will transition from a to b, and it's 'speed' will be based on how far apart the two numbers are.
the function will be smooth as a and b are moving, but you'll have to worry about you're time scale, because as the numbers change the time for the transition to complete will also change.
While I'm not sure exactly what you're doing, I'm going to guess that you might be more satisfied with:
f(t)=a+(b-a)t/abs(b-a)
abs here is the absolute value
this will transition from a to b, and it's 'speed' will be based on how far apart the two numbers are.
the function will be smooth as a and b are moving, but you'll have to worry about you're time scale, because as the numbers change the time for the transition to complete will also change.
This could be a problem since t could very well end up larger than abs(b-a), as b and a change.
* f(0) = a
* f(infinity) = b
* k is a function of a - the larger a gets, the larger k gets.
For example, k = a, although that particular relationship has the disadvantage that a cannot equal 0.
* f(3k) will get you within 5% of the final answer
Posts
Do you have some examples of formulas you've started with? Not a lot of people here are just going to solve it for you when it sounds like they're doing your homework.
There are no examples. This is part of a code I'm working on. Up until now, what I was doing was finding out a certain value using 2 other variables I have, multiplying it by a time tracking variable and subtracting it until I eventually reached a constant known value, of 0. The problem is I'm trying to do this not just for 0, but for any value X.
f(t) = a + (b-a)*t/a
so that f(0)=a
f(a)=b
meaning a bigger a results in a slower transition.
alright, so you've got x, and x has to become y, over the course of z.
why not just set up a factor system, with an a to z arrangement?
Like as a becomes b, use a time factor of say, one minute, then for b to become c, plug the formula for a (squared)
Does that make sense, or is that not what you're looking for?
edit: beat'd
also, double checked, and it works. I input 1 for (a) and 2 for (b) and as 0, 1, and 2 for t. f(t) increased each time.
f(t)=a+(b-a)t/abs(b-a)
abs here is the absolute value
this will transition from a to b, and it's 'speed' will be based on how far apart the two numbers are.
the function will be smooth as a and b are moving, but you'll have to worry about you're time scale, because as the numbers change the time for the transition to complete will also change.
This could be a problem since t could very well end up larger than abs(b-a), as b and a change.
f(t) = b + (a - b) e ^ (-t/k)
Where:
* f(0) = a
* f(infinity) = b
* k is a function of a - the larger a gets, the larger k gets.
For example, k = a, although that particular relationship has the disadvantage that a cannot equal 0.
* f(3k) will get you within 5% of the final answer
?