Exercises on Differential Operators Exercise 1 L[i_]:=If[i==1,D[f[x],x]-f[x],D[L[i-1],x]-i L[i-1]] Do[Print[DSolve[{L[5]==0,{f[0],f'[0],f''[0],f'''[0],f''''[0]} \ ==IdentityMatrix[5][[i]]},f[x],x]],{i,5}] Exercise 2 a) DSolve[f''[x]-3f'[x]-4f[x]==e^x,f[x],x] DSolve[f''[x]-3f'[x]-4f[x]==0,f[x],x] b) DSolve[f'[x]-4f[x]==0,f[x],x] DSolve[f'[x]+f[x]==0,f[x],x] We notice that the solution of the homogeneous equation in part (a) is a linear combination of the solutions in part (b). Exercise 3 Clear[f,L] F[f_]:=D[f,x]-2f L[f_]:=F[F[F[f]]] a) L[E^(2x)] L[x E^(2x)] L[x^2 E^(2x)] b) L[f[x]]//Expand f[x]/.DSolve[L[f[x]]==0,f[x],x] B=Table[(%[[1]]-(%[[1]]/.{C[i]->0}))/.{C[i]->1},{i,3}] M=Table[D[B[[j]],{x,i-1}],{i,3},{j,3}]; M//TableForm W[0]=Det[M]/.{x->0} We can now conclude that the solutions in part (a) are a basis for the kernel of L, taking also into account the fact that the kernel has dimension 3. c) We can conjecture that (x^i)E^(r x) , with 0 <= i < f , will be solutions. L[f_]:=F[F[F[F[F[f]]]]] Do[Print[L[x^i E^(2x)]//Expand],{i,0,4}] Exercise 4 a) Clear[f,L] F1[f_]:=D[f,x]+2f F2[f_]:=F1[F1[f]]+3^2f L[f_]:=F2[F2[F2[f]]] L[x^i E^(-2x)Cos[3x]]//Expand/.{i->{0,1,2}} b) L1[i_]:=L[x^i E^(-2x)Sin[3x]]//Expand L2[i_]:=L[x^i E^(-2x)Cos[3x]]//Expand Do[Print[L1[i],",",L2[i]],{i,0,2}] c) L[f[x]]//Expand f[x]/.DSolve[L[f[x]]==0,f[x],x] B=Table[(%[[1]]-(%[[1]]/.{C[i]->0}))/.{C[i]->1},{i,6}] M=Table[D[B[[j]],{x,i-1}],{i,3},{j,3}]; M//TableForm W[0]=Det[M]/.{x->0} d) They are the same set of six linearly independent solutions. Exercise 5 Clear[f,L] L[f_]:=D[f,{x,3}]-6D[f,{x,2}]+11D[f,x]-6f L[f[x]] a) f[x]/.DSolve[L[f[x]]==0,f[x],x] b) B=Table[(%[[1]]-(%[[1]]/.{C[i]->0}))/.{C[i]->1},{i,3}] c) f[x]/.DSolve[L[f[x]]==E^(3x),f[x],x] Exercise 6 p=x^5+x^4+x^3+x^2+x+1 Clear[L,f] L[f_]:=Sum[Coefficient[p,x^i]D[f,{x,i}],{i,0,5}] L[f[x]] a) p//Factor b) f[x]/.DSolve[L[f[x]]==0,f[x],x] c) f[x]/.DSolve[{L[f[x]]==0,{f'[0],f''[0],f'''[0],f''''[0]}=={0,0,0,0}},f[x],x] d) DSolve[{L[f[x]]==0,{f[0],f'[0],f''[0],f'''[0],f''''[0]} \ =={0,0,0,0,0}},f[x],x] Check: f[x]=%%/.Solve[(%%/.{x->0})==0,C[5]] Exercise 7 Clear[f,F,L] F[f_]:=D[f,{x,3}]+D[f,{x,2}]+f L[f_]:=F[F[f]] L[f[x]] p=Sum[Coefficient[L[f[x]],D[f[x],{x,i}]]x^i,{i,0,6}] a) p//Factor b) s=x/.Solve[p==0,x]; sR=Re[s] sI=Im[s] We will have to use floating point representations here, otherwise the result gets too complicated for Mathematica. j=Mod[2i,6]+1; f=Sum[If[i<4,C[i]E^(sR[[j]]x)(Cos[sI[[j]]x]+I Sin[sI[[j]]x]), \ x C[i]E^(sR[[j]]x)(Cos[sI[[j]]x]+I Sin[sI[[j]]x])],{i,6}]; f//N Solution check (gives a floating point approximation close enough to 0): L[f//N]/.{x->5}//Simplify c) x/.Solve[p==1,x] We notice from above that f=E^(-x)is a particular solution for the nonhomogeneous equation. f=f+E^(-x); f//N Solve[Table[D[f//N,{x,i-1}]/.{x->0},{i,6}]=={0,0,1,0,0,0}, \ {C[1],C[2],C[3],C[4],C[5],C[6]}] (f//N)/.% Problems on Differential Operators Problem 1 DSolve[{17/32s''[t]-(3-5)s[t]==0,s[0]==-12,s'[0]==0},s[t],t] Plot[-12Cos[8t/Sqrt[17]],{t,0,6}] Problem 2 DSolve[{17/32s''[t]-(3-5)s[t]+s'[t]==0,s[0]==-12,s'[0]==0},s[t],t] Plot[E^(-16t/17)(-12Cos[8Sqrt[13]t/17]-24/Sqrt[13]Sin[8Sqrt[13]t/17]), \ {t,0,6}] Exercises on Recurrence Relations <j-1},{i,5},{j,5}]//MatrixForm Exercise 2 a) s[n]/.RSolve[{s[n+1]-s[n]==(n+1)^2,s[0]==0},s[n],n]//Factor b) s[n]/.RSolve[{s[n+1]-s[n]==(n+1)^3,s[0]==0},s[n],n]//Factor c) s[n]/.RSolve[{s[n+1]-s[n]==(n+1)^4,s[0]==0},s[n],n]//Factor d) s[n]/.RSolve[{s[n+1]-s[n]==(n+1)^5,s[0]==0},s[n],n]//Factor Exercise 3 We can conjecture that sums for even n's contain the factors n(1+n), whereis sums for odd n's contain (n^2)(1+n)^2. Verification: s[n]/.RSolve[{s[n+1]-s[n]==(n+1)^10,s[0]==0},s[n],n]//Factor s[n]/.RSolve[{s[n+1]-s[n]==(n+1)^15,s[0]==0},s[n],n]//Factor Exercise 4 Clear[n,s,L,F,d] d[s_]:=s/.{n->n+1} F[s_]:=d[s]-2s L[s_]:=F[F[F[s]]] a) L[2^n]//Expand L[n 2^n]//Expand L[n^2 2^n]//Expand b) K=Table[{2^(n-1),(n-1)2^(n-1),(n-1)^2 2^(n-1)},{n,3}]; K//MatrixForm Det[K] We can now conclude that the solutions in part (a) are a basis for the kernel of L, taking also into account the fact that the kernel has dimension 3. c) We conjecture that (n^i)(r^n) , with 0 <= i < f , will be solutions. L[s_]:=F[F[F[F[s]]]] Do[Print[L[n^i 2^n]//Expand],{i,0,3}] Exercise 5 F[s_]:=d[s]+2s L[s_]:=F[F[s]]+(3^2+2^2)s RSolve[L[s[n]]==0,s[n],n] Problems on Recurrence Relations Problem 1 a) One can imagine a recurrent scheme by which, in order to move i+1 disks once we need M[i+1]=2M[i]+1 moves, since we have to move the top n, then move the disk # n+1, then move back the top n. M[i]/.RSolve[{M[i+1]==2M[i]+1,M[0]==0},M[i],i] To achieve our goal, we'll need: S=Sum[1+%[[1]],{i,0,n-1}] i.e., S=-1+2^n b) (S/.{n->64})/((365+1/4)*24*60*60) %//N Problem 2 a) In this case, by the same type of reasoning as before, if Q[n] is the number of moves required to move n disks from an end pole to the center and P[n] from the center to an end pole, we have: P[n+1]=2P[n]+1+Q[n] and Q[n+1]=2Q[n]+P[n]+1. RSolve[{P[n+1]==2P[n]+1+Q[n],Q[n+1]==2Q[n]+P[n]+1,Q[0]==0,P[0]==0}, \ {P[n],Q[n]},n] i.e., Q=(-1+3^n)/2 b) (Q/.{n->64})/((365+1/4)*24*60*60) %//N Problem 3 a) If we denote with "r" the one-month old pairs of rabbits and with "R" the pairs of grown-ups, we have: R[n+1]=R[n]+r[n] and r[n]=R[n-1], and therefore R[n+1]=R[n]+R[n-1]. 2R[n]/.RSolve[{R[n+1]==R[n]+R[n-1],R[0]==n0,R[1]==n0},R[n],n] \ //Factor b) %[[1]]/.{n0->1}/.{n->12*10}//Expand