Lab4 - Lab 4: Solving Differential Equations Using Maple...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: Lab 4: Solving Differential Equations Using Maple Goals In this lab you will learn how to use Maple to solve differential equations analytically (when that is possible) or numerically; then you will learn how to plot the solutions. In the prelab you will first learn how to write differential equations in Maple notation. A Maple primer We start with a quick review of Maple syntax as we need it to solve differential equations. If you are already comfortable with Maple you can skip directly to the prelab assignment. You need to be comfortable with the aspects of Maple described in this primer before you go to lab. Writing differential equations in Maple notation In what appears below, the input to Maple is typed after the prompt > and the output from Maple is indented. The derivative of an expression y ( t ) with respect to t is denoted in Maple by diff(y(t),t) . To enter the differential equation ty + 5 y = ln( t ) into Maple we type the line below and hit the return key. > t*diff(y(t),t)+5*y(t)=ln(t); t d dt y(t) ! + 5 y(t) = ln(t) The output produced by Maple is a pretty print of the equation. Note that we refer to y consistently as y ( t ) in communicating with Maple. It is useful to give the equation weve just entered a name, and also to add some spaces for readability. When you give something a name in Maple you use the assignment operator := , that is, a colon : followed by an equal sign = (with no spaces in between). In writing an equation however you use just the equal sign = . Lets go back and change the entry to > ex1 := t*diff(y(t),t) + 5*y(t) = ln(t); ex1 := t d dt y(t) ! + 5 y(t) = ln(t) 1 Note that you must end every entry with a semicolon or colon if you want Maple to pay attention. Use a colon only if you do not want to see the result; this can be useful if you expect the result to be a very long expression. Make sure to hit the return key after each command that you want Maple to execute. The second derivative of an expression y ( t ) with respect to t is denoted in communicating with Maple by diff(y(t),t,t) . Here is how you enter the differential equation y 00 + 4 y = t : > ex2 := diff(y(t),t,t) + 4*y(t) = t; ex2 := d 2 dt 2 y(t) ! + 4 y(t) = t You can guess how to write the third derivative. Again, when you give something a name in Maple you use the assignment operator := as in the following example. > b := x^2 + 3*sin(x) - 7; b := x 2 + 3 sin(x)- 7 Since b has been defined as the name of an expression, we can differentiate it, or plot it, or evaluate it at x = 3, and so on: > diff(b,x); 2 x + 3 cos(x) This is the command for plotting an expression: > plot(b, x =-Pi..2);-1-2-3 2-2 x-4-6 2-8 1 2 This is how you plot two functions on the same graph: > plot({b,diff(b,x)}, x =-Pi..2);-1-2-3 2-4-6-8 2-2 x 1 This is how you evaluate the expression at a point: > eval(b, x = 3); 2 + 3 sin(3) This is how you approximate your answer by a decimal. The ditto operator % refers to the last result output by Maple....
View Full Document

This note was uploaded on 01/30/2012 for the course MATH 216 taught by Professor Stenstones? during the Fall '07 term at University of Michigan.

Page1 / 15

Lab4 - Lab 4: Solving Differential Equations Using Maple...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online