MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Self-teaching snag


Todd Allen schrieb:
[*** snipp ***] 
>
> charge[0]=1.0 (* 100% *);
> charge[day_]:=(charge[day-1]-(0.05*charge[day-1]));
> charge[20]
[*** snipp ***] 

Allen,
your function is a recursively defined one. Problems like this can
be solved using RSolve:

lsg=RSolve[{charge[t]==charge[t-1]-0.05charge[t-1],
           charge[0]==1},charge[t],t]
charge[t_]=charge[t]/.lsg[[1]]

gives the explicit term
0.95^t

Gruss Peter
-- 
==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: Self-teaching snag
  • Next by Date: Thread function now working as expected
  • Previous by thread: Re: Re: Self-teaching snag
  • Next by thread: Re: Self-teaching snag