# ZUSATZ zu KAPITEL 12/13. # (REKURSIVE FOLGEN) # # Einige weitere Beispiele aus "Ubung 6. # =========================== # Aufgabe 8: # ------------- # a[1]=0 , a[n+1]=1/(4-3*a[n]) , n=1,2,3,... # __________________________________________________ # # Verfahren nach Kap. 13: # ------------------------------ > restart; > rsolve({a(1)=0,a(n+1)=1/(4-3*a(n))},a(n)); > asympt(",n); > limit(",n=infinity); # Verfahren nach Kap.12: # ----------------------------- > b:= proc(n) local j, result; result:=0; for j from 2 to n do > 1/(4-3*result); result:="; od end; > b(1); > seq(evalf(b(k)),k=2..10); > solve(a=1/(4-3*a),a); # ========================================= # # "Ubung 6, Aufgabe 9 b). # ----------------------------- # a(1)=1, a(n+1)=sqrt(1+a[n]^2/n) , n=1,2,... # # Verfahren nach Kap. 13: # ------------------------------ > rsolve({a(1)=1, a(n+1)=sqrt(1+a(n)^2/n)}, a(n)); > asympt(",n); Error, (in asympt) unable to compute series # # Verfahren nach Kap. 12: # ------------------------------ > c:=proc(n) local j, result; result:=1; for j from 2 to n do > sqrt(1+result^2/j); result:="; od end; > c(1); > seq(evalf(c(k)),k=2..10); # Der zweite der folgenden beiden Befehle braucht zuviel Zeit: # unterbrechen! > evalf(c(100));evalf(c(1000)); Warning, computation interrupted # Mit "evalhf" geht es schneller: > cc:=proc(n) local j, result; result:=1; for j from 2 to n do > evalhf(sqrt(1+result^2/j)); result:="; od end; > cc(100); cc(1000);cc(10000);cc(100000); ==================================================== # Aufgabe 7. # Eine Rekursion mit zwei Ver"anderlichen. # Arithmetisch-geometrisches Mittel. # -------------------------------------------------- # Verfahren nach Kap. 13. # ------------------------------ # a(1)=a , b(1)=b , a(n+1)=sqrt((a(n)*b(n)) , b(n+1)=(a(n)+b(n))/2 . > ?rsolve # Im Prinzip kann "rsolve" mehrere Ver"anderliche behandeln, aber nur # lineare Gleichungen. > rsolve({a(1)=a,b(1)=b,a(n+1)=sqrt(a(n)*b(n)),b(n+1)=(a(n)+b(n))/2},{a( > n),b(n)}); > asympt(",n); Error, (in asympt) unable to compute series # Verfahren nach Kap. 12. # ------------------------------ > AG:=proc(n,a,b) local resultA, resultB, j; resultA:=a;resultB:=b;for j > from 2 to n do sqrt(resultA*resultB); (resultA+resultB)/2;resultA:=""; > resultB:=""; od ; [resultA, resultB]; end; > AG(1,a,b); > AG(2,a,b); > AG(3,a,b);AG(4,a,b);AG(5,a,b); # Spezialfall a=b=1: > seq(evalf(AG(n,1,1)),n=2..10); > AG(40,1,1); > AG(40,1/2,1/2); # Spezialfall a=b: > AG(3,a,a);AG(4,a,a);AG(5,a,a); > simplify(AG(5,a,a)); > assume(a>0); > simplify(AG(5,a,a)); > AG(5,a,a)[1]; > seq(simplify(AG(j,a,a)[1]),j=3..5); > a:='a'; > about(a); > limit('AG(n,1/4,1/3)[1]','n'=infinity); Error, (in AG) unable to execute for statement # Die triviale L"osung findet Maple: > solve({a=sqrt(a*b),b=(a+b)/2},{a,b}); # Dasselbe Programm mit numerischer Ausgabe: > AGnum:=proc(n,a,b) local resultA, resultB, j; > resultA:=a;resultB:=b;for j from 2 to n do > evalhf(sqrt(resultA*resultB)); > evalhf((resultA+resultB)/2);resultA:=""; > resultB:="";[resultA,resultB]; od end; > seq(AGnum(j,1/4,1/3),j=2..5); > seq(AGnum(j,1/4,6),j=2..7); # Literatur: # Abramowitz-Stegun: Handbook of Mathematical Functions. # Dover 1965, S.598, # #17.6, Ellpitische Integrale. # # Fichtenholz: Differential - und Integralrechnung I, # Dt. Verlag d. Wiss., 1966, # 35, S. 61 # Band II, # 315. # ---------------------------------------------------------------------- # # Der gemeinsame Grenzwert mu der Folgen (a[n] ) und (b[n] ) # erf"ullt G=Pi/(2*mu). Dabei ist G das folgende Elliptische Integral: # (Wir w"ahlen feste Werte f"ur a und b.) > a:=1/4;b:=1/3; > Int(1/sqrt((a*cos(t))^2+(b*sin(t))^2),t=0..Pi/2)=int(1/sqrt((a*cos(t)) > ^2+(b*sin(t))^2),t=0..Pi/2); > evalf("); # Probe: Es sollte gelten mu=pi/(2*G) . > G:=rhs("); > evalf(Pi/(2*G)); # Stimmt !