Lab4 - Lab 4 Solving Dierential Equations Using Maple Goals...

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

View Full Document Right Arrow Icon
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 we’ve 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 = . Let’s 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
Image of page 1

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

View Full Document Right Arrow Icon
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 +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 0 -2 x -4 -6 2 -8 1 0 2
Image of page 2
This is how you plot two functions on the same graph: > plot({b,diff(b,x)}, x =-Pi..2); -1 -2 -3 2 0 -4 -6 0 -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.
Image of page 3

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern