# # Solutions to a couple of quiz problems in Maple. The first uses the # Wronskian and the second dsolve with type=numeric # > restart; # The first question requires no Maple. The issue is what happens to the # Wronskian of # two solutions to y''+x*y'+x^2*y=0 as x->Infinity. Well, here p=x, so # W'=-x*W so # W=c*exp(-int(p(x),x)=c*exp(-x^2/2). This goes to zero as x->Infinity. -------------------------------------------------------------------------------- > # The second question can be worked by hand or by computer. The computer # solution is only numeric. You need to (still) be conversant with dsolve. # Naturally, you call up the syntax rulebook: > ?dsolve # EXAMPLES: # > dsolve(diff(y(x),x$2) - y(x) = 1, y(x)); # y(x) = - 1 + _C1 exp(x) + _C2 exp(- x) # # > dsolve({diff(v(t),t)+2*t=0, v(1)=5}, v(t)); # 2 # v(t) = - t + 6 # > # Next, you write out the DE and some initial conditions. > dq:=diff(y(x),x$2)+x*diff(y(x),x)+x^2*y(x)=0; / 2 \ | d | / d \ 2 dq := |----- y(x)| + x |---- y(x)| + x y(x) = 0 | 2 | \ dx / \ dx / -------------------------------------------------------------------------------- > inits:=y(1)=1,D(y)(1)=0; inits := y(1) = 1, D(y)(1) = 0 > answer:=dsolve({dq,inits},y(x),numeric); answer := proc(rkf45_x) ... end > answer(2); d [x = 2, y(x) = .4741157266787145, ---- y(x) = -.9013535642279813] dx # Now the problem is how to display the results. This code string below # picks out the right hand side of the second entry in answer. That's # because the second entry is the formula for y itself. The object formed # is a list of points, with the first entry to each # point being 0.02*k=x, and the second, the corresponding value of y. -------------------------------------------------------------------------------- > yvals:=[seq([.02*k,rhs(answer(.02*k)[2])],k=1..200)]: -------------------------------------------------------------------------------- > plot(yvals); -------------------------------------------------------------------------------- > answer2:=dsolve({dq,y(1)=0,D(y)(1)=1},y(x),numeric); answer2 := proc(rkf45_x) ... end -------------------------------------------------------------------------------- > yvals2:=[seq([.02*k,rhs(answer2(.02*k)[2])],k=1..200)]: -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- > with(plots):p1:=plot(yvals):p2:=plot(yvals2):display({p1,p2}); -------------------------------------------------------------------------------- > ** Maple V Graphics ** # The two plots have interwoven zeros. As x increases, they're both # crashing toward zero. This was foreshadowed by the hand part of the # quiz, in which the Wronskian was called for. The Wronskian of two # solutions to the DE y''+xy'+x^2y=0 has the # property that W[y1,y2](x)=c*exp(-(1/2)*x^2). This negative squared # exponential, however, drops (at first slowly, then with great speed), # toward zero. So we should expect that the solutions will either become # close to zero, or at least close to each other, as x increases. > answer3:=dsolve({dq,y(0)=1,D(y)(0)=0},y(x),numeric); answer3 := proc(rkf45_x) ... end -------------------------------------------------------------------------------- > yvals3:=[seq([.02*k,rhs(answer3(.02*k)[2])],k=1..200)]:\ p3:=plot(yvals3):display(p3); -------------------------------------------------------------------------------- >