Connecting Tech Pros Worldwide Forums | Help | Site Map

plz help - for repetition...

Newbie
 
Join Date: Mar 2009
Posts: 2
#1: Mar 10 '09
if i wanna do some programming

lets say... i hv

a[n]=a[n-1]+3*a[n-1]*(1.0^-10)

how to generate the answer if a[0]=(1.0^-10)

ive done but wen i compared the answer using calculator..the answer is wierd..they r not same..
i used "for" repetition..

thank you

JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Mar 10 '09

re: plz help - for repetition...


Quote:

Originally Posted by anizatie View Post

if i wanna do some programming

lets say... i hv

a[n]=a[n-1]+3*a[n-1]*(1.0^-10)

how to generate the answer if a[0]=(1.0^-10)

ive done but wen i compared the answer using calculator..the answer is wierd..they r not same..
i used "for" repetition..

thank you

If I rewrite that recurrent expression I get:

a[n] = (1+3*1^-10)*a[n-1]

If I solve this homogenous expression I get:

a[n] = (1+3*1^-10)^n*a[0]

Does this help a bit?

kind regards,

Jos
Newbie
 
Join Date: Mar 2009
Posts: 2
#3: Mar 11 '09

re: plz help - for repetition...


Quote:

Originally Posted by JosAH View Post

If I rewrite that recurrent expression I get:

a[n] = (1+3*1^-10)*a[n-1]

If I solve this homogenous expression I get:

a[n] = (1+3*1^-10)^n*a[0]

Does this help a bit?

kind regards,

Jos

Thank you... Jos.. ive got the solution just now..
instead of putting 1*10^-10, we should write 1.0e-10 in c++...
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#4: Mar 11 '09

re: plz help - for repetition...


Quote:

Originally Posted by anizatie View Post

Thank you... Jos.. ive got the solution just now..
instead of putting 1*10^-10, we should write 1.0e-10 in c++...

Ah, yes, but that's just a notational issue, not an algebraic, nor a numerical issue. the single letter 'e' or 'E' reads 'times ten raised to the power of' and a lot of programming languages use that notation. The '^' character is used for other operations.

kind regards,

Jos
Reply

Tags
mathematical problem