16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.2. SECOND-ORDER MODELS 129<br />

Using the sequence command, we graph the numerical solution from x =0 to<br />

X in steps of size 1=d. Each numerical point is plotted as a size-16 blue circle.<br />

> gr1:=plot([seq([i/d,Ynum(i/d)],i=0..d*X)],style=point,<br />

symbol=circle,symbolsize=16,color=blue):<br />

The series solution is plotted as a solid thick curve over the same range of x,<br />

> gr2:=plot(Y[N],x=0..X,thickness=2):<br />

and the two graphs superimposed to produce Figure 3.5.<br />

> display(fgr1,gr2g,labels=["x","y"]);<br />

40<br />

30<br />

y<br />

20<br />

10<br />

0 1 2 x 3 4<br />

Figure 3.5: Comparison of numerical (circles) and series (curve) solutions.<br />

Of course, because of the imposition of the conditional statement, the ¯t of the<br />

series solution to the numerical points is very good.<br />

Vectoria hopes that Jennifer will like her solution to this problem. By<br />

modifying Vectoria's recipe, you should be able to solve the following problems,<br />

which also appeared on Jennifer's assignment.<br />

PROBLEMS:<br />

Problem 3-12: What's special about this ODE?<br />

Consider the following linear second-order ODE:<br />

xy 00 (x)+y 0 (x)+xy(x) =0; y(0) = 1;y 0 (0) = 0:<br />

(a) Show that Maple is able to produce a closed-form analytic solution. Identify<br />

the ODE and the \special" function that appears in the solution.<br />

(b) Derive a series solution for y(x), keeping su±cient terms to achieve 1%<br />

agreement with the analytic answer at x = X =10.<br />

(c) Plot the series derived in part (b) and the analytic solution together in the<br />

same ¯gure over the range x =0toX, representing the analytic answer<br />

by appropriately sized and spaced circles.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!