September 15th, 2012, 10:50 AM
I am trying to write a code to output a certain value (y) when given a value (x). It is something like as x increases by 1, y increases by the previous y value doubled. In other words, if x=2001 and y=32, when x=2002, y=64, when x=2003, y=128. How would I program something like this. Thanks.
September 15th, 2012, 11:33 AM
You need to ask a specific question, and you also need to show the code that you have currently.
September 15th, 2012, 03:09 PM
mathematically, given x0 and y0 you want to find y given x.
y0 * 2 raised to the power of (x-x0)
x0 is 2001
y0 is 32
what is y when x is 2003?
32 * (2 raised to the power of (2003-2001))
32 * 4 is 128
The formula tests correctly.
[/code] are essential for python code and Makefiles!
September 15th, 2012, 04:11 PM
It is something like y = y0*2**(x-x0).
Originally Posted by DHulse94