Re: need help evaluating a recursuive sequence on ti 86!!!!!!!!


[Prev][Next][Index][Thread]

Re: need help evaluating a recursuive sequence on ti 86!!!!!!!!



On Thu, 17 Dec 1998 07:01:40 GMT, "Ax-Man" <krw699@aol.com> wrote:

>Can anybody tell me how to evaluate a recursively defined sequence.
>
>a(1) = 2
>a(n) = a(n-1) + (4/a(n-1))
>
>I have a ti 86 and cannot find out how to do this.  my friends are able to
>do it on their 82's and 85's but I cant.  I need to evaluate it from
>1000-1009.
>
>Help
>
>Ken
Hi,

I don't know about the TI-86 but
the TI-85 cannot do true recursion and anyway
recursion is slower most of the time.  Imagine this : the
program must first display the point for Fn(1000).  To do this
it must compute all intermediates results from Fn(2) to Fn(999).
Next, it must display the point for Fn(1001) but to do that it
must recompute all intermediates results again and then add the
last value!

All recursive functions can be turned into iterative functions.
In BASIC, your function look like:

Answer=2
FOR i = 2 to 1010
   Answer = Answer + Answer / 4
NEXT i
print Answer

You wrote in another message that you want to plot the function.
I have included here 2 programs written for the TI-85 for that.
It shoulb be similar for the TI-86.   The first one
will plot only the values from 1000 to 1009 and it will
store then in the list LY.  Notice that it must compute all
preceding values anyway, that is why there is 2 "for" loops.
I have listed these values at the end of this text.
The second one will plot all values from 2 to 1010.

{^;^}
 / \  Benont Morrissette, remove "NOSPAM" in adress to reply
personnaly


Note: In the listings below, the key STO> is shown as ->
with spaces on either side.
-----------------start of RECURS1-----------------------
PROGRAM:RECURS1
 :FnOff
 :ClDrw
 :999 -> xMin
 :1010 -> xMax
 :1 -> xScl
 :89 -> yMin
 :91 -> yMax
 :.1 -> yScl
 :10 -> dimL LX
 :10 -> dimL LY
 :2 -> REP
 :1 -> IND
 :For(i,2,999)
 :REP+4/REP -> REP
 :End
 :For(i,1000,1009)
 :REP+4/REP -> REP
 :i -> LX(IND)
 :REP -> LY(IND)
 :IND+1 -> IND
 :End
 :xyLine LX,LY
-------------------end of RECURS1-----------------------
execution time : 9 seconds.

-----------------start of RECURS2-----------------------
PROGRAM:RECURS2
 :FnOff
 :ClDrw
 :0 -> xMin
 :1010 -> xMax
 :100 -> xScl
 :0 -> yMin
 :91 -> yMax
 :10 -> yScl
 :2 -> REP
 :For(i,2,1010)
 :REP+4/REP -> REP
 :PtOn(i,REP)
 :End
-------------------end of RECURS2-----------------------
execution time : 15 seconds.

 1000          89.51374618411995
 1001          89.55843205830706
 1002          89.6030956361307
 1003          89.647736950938
 1004          89.69235603599297
 1005          89.73695292447692
 1006          89.78152764948867
 1007          89.82608024404482
 1008          89.87061074108011
 1009          89.91511917344766


Follow-Ups: References: