MathGroup Archive 2007

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

Search the Archive

Re: Self-teaching snag

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74599] Re: Self-teaching snag
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Tue, 27 Mar 2007 04:09:31 -0500 (EST)
  • References: <eu7re0$b6p$1@smc.vnet.net>

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