355f2001_recur - Linear Recurrence Relations in Maple Date:...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Linear Recurrence Relations in Maple Date: Nov 7, 2001 Last Revision: Nov 15, 2001 Maple 6 Bent E. Petersen [email protected] [email protected] Course: Mth 355 (a.k.a. Mth 399) Term: Fall 2001 File name: 355f2001_recur.mws Assignment 6 (problems at end) - due Nov 14, 2001. This worksheet contains a few comments on some of Maple’s recurrence relations support. It composed fairly quickly and is unlikely to be free of errors. If you find a serious error be sure to mention it in your solution report. > restart; Let’s load the plots package - just in case. > with(plots): Warning, the name changecoords has been redefined Example 1 The Maple function rsolve() is used to solve linear recurrence relations. Here is an example of an order 2 recurrence relation with initial conditions. > eqn1:=a(n)=a(n-1)+a(n-2); # Fibonacci := eqn1 = () a n + a n 1( ) a n 2 > init1:=a(0)=0,a(1)=1; := init1 , = a0 0 = a1 1 To solve we throw all the equations into one set and also specify for which variable to solve. > soln1:=rsolve({eqn1,init1},a);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
:= soln1 + 1 5 51 2 1 1 5 n 1 5 1 5 2 1 + 1 5 n + 1 5 That’s all there is to it! This expression is not in the usual Binet form, so you may want to try to get Maple to cast it in a more familiar form. Good luck! We can also use rsolve() to find the generating function for the solution. Note the single quotes surrounding genfunc in the following command. > gen1:=rsolve({eqn1,init1},a,’genfunc’(z)); := gen1 z − + + 1 zz 2 We can even define a procedure which will compute the a(n). > fun1:=rsolve({eqn1,init1},a,’makeproc’): The fun1() procedure can be use to plot the sequence a(n) > sq1:=seq([n,fun1(n)],n=0. .16); sq1 [] , 00 [ ] , 11 [ ] , 21 [ ] , 32 [ ] , 43 [ ] , 55 [ ] , 68 [ ] , 71 3 [ ] , 82 1 [ ] , 93 4 [ ] , 10 55 ,,,,,,, , , , , := , 11 89 [ ] , 12 144 [ ] , 13 233 [ ] , 14 377 [ ] , 15 610 [ ] , 16 987 ,,,,, > PLOT(POINTS(sq1),SYMBOL(BOX,16),TEXT([5,1000],"fun1 - Fibonacci sequence"));
Background image of page 2
We could plot a curve instead > PLOT(CURVES([sq1]),TEXT([5,900],"fun1 - Fibonacci sequence"));
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Here’s one (kludgy) way to get the characteristic polynomial and the characteristic root > subs(a(n)=x^n,a(n-1)=x^(n-1),a(n-2)=x^(n-2),eqn1)/x^(n-2): cpoly1:=simplify(%); := cpoly1 = x 2 + x 1 > croot1:=solve(cpoly1,x); := croot1 , + 1 2 1 2 5 1 2 1 2 5
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/11/2012 for the course MTH 141, 142, taught by Professor Mcallister during the Spring '08 term at SUNY Empire State.

Page1 / 12

355f2001_recur - Linear Recurrence Relations in Maple Date:...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online