72 ordinary dierential equations f unapply rhs

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ential equation. Refer to the ?dsolve,numeric help page. Example: Taylor Series In its general form, a series method solution to an ODE requires the forming of a Taylor series about t = 0 for some function f (t). Thus, you must be able to obtain and manipulate the higher order derivatives of your function, f (t), f (t), f (t), and so on. Once you have obtained the derivatives, substitute them into the Taylor series representation of f (t). > taylor(f(t), t); 1 1 (2) (D )(f )(0) t2 + (D(3) )(f )(0) t3 + 2 6 1 1 (D(4) )(f )(0) t4 + (D(5) )(f )(0) t5 + O(t6 ) 24 120 As an example, consider Newton’s Law of Cooling: f(0) + D(f )(0) t + dθ 1 = − (θ − 20), dt 10 θ(0) = 100. Using the D operator, enter the above equation into Maple. > eq := D(theta) = -1/10*(theta-20); eq := D(θ) = − > ini := theta(0)=100; 1 θ+2 10 ini := θ(0) = 100 First obtain the required number of higher derivatives. Determine this number from the order of your Taylor series. If you use the default value of Order that Maple provides, > Order; 6 then you must generate derivatives up to order 256 • Chapter 7: Solving Calculus Problems > dev_order := Order - 1; dev _order := 5 Use seq to generate a sequence of the higher order derivatives of theta(t). > S := seq( (D@@(dev_order-n))(eq), n=1..dev_order ); 1 1 (D(4) )(θ), (D(4) )(θ) = − (D(3) )(θ), 10 10 1 1 (D(3) )(θ) = − (D(2) )(θ), (D(2) )(θ) = − D(θ), 10 10 1 D(θ) = − θ + 2 10 The fifth derivative is a function of the fourth derivative, the fourth a function of the third and so on. Therefore, if you make substitutions according to S, you can express all the derivatives as functions of theta. For example, the third element of S is the following. S := (D(5) )(θ) = − > S[3]; (D(3) )(θ) = − 1 (D(2) )(θ) 10 Substituting according to S on the right-hand side, yields > lhs(%) = subs( S, rhs(%) ); (D(3) )(θ) = − 1 1 θ+ 1000 50 To make this substitution on all the derivatives at once, use the map command. > L := map( z -> lhs(z) = eval(rhs(z), {S}), [S] ); 1 1 (D(3) )(θ), (D(4) )(θ) = (D(2) )(θ), 100 100 1 1 1 (D(3) )(θ) = D(θ), (D(2) )(θ) = θ− , 100 100 5 1 D(θ) = − θ + 2] 10 L := [(D(5) )(θ) = 7.2 Ordinary Differential Equations • 257 You must evaluate the derivatives at t = 0. > L(0); 1 (D(3) )(θ)(0), 100 1 (D(4) )(θ)(0) = (D(2) )(θ)(0), 100 1 1 1 (D(3) )(θ)(0) = D(θ)(0), (D(2) )(θ)(0) = θ(0) − , 100 100 5 1 D(θ)(0) = − θ(0) + 2] 10 Generate the Taylor series. [(D(5) )(θ)(0) = > T := taylor(theta(t), t); 1 1 (2) (D )(θ)(0) t2 + (D(3) )(θ)(0) 2 6 1 1 (D(4) )(θ)(0) t4 + (D(5) )(θ)(0) t5 + O(t6 ) t3 + 24 120 Substitute the derivatives into the series. T := θ(0) + D(θ)(0) t + > subs( op(L(0)), T ); 1 1 1 θ(0) + 2) t + ( θ(0) − ) t2 + 10 200 10 1 1 1 1 θ(0) + ) t3 + ( θ(0) − ) t4 + (− 6000 300 240000 12000 1 1 θ(0) + ) t5 + O(t6 ) (− 12000000 600000 Evaluate the series at the initial condition and convert it to a polynomial. θ(0) + (− > eval( %, ini ); 100 − 8 t + 13 14 1 22 t− t+ t− t5 + O(t6 ) 5 75 3000 150000 > p := convert(%, p...
View Full Document

This note was uploaded on 08/27/2012 for the course MATH 1100 taught by Professor Nil during the Spring '12 term at National University of Singapore.

Ask a homework question - tutors are online