Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

In Maple, how do I plot the solutions to a second-order system of ordinary differential equations (ODEs) in the phase plane?

In Maple, use DEtools[DEplot] to plot the solutions to a second-order system of ordinary differential equations (ODEs) in the phase plane. There are alternative methods, but this is usually the best. Following is an example:

> eq1 := diff(v1(t), t) + v1(t) + 2*v2(t) = cos(t); > eq2 := diff(v2(t), t) - 2*v1(t) + v2(t) = sin(2*t); > init1 := v1(0) = 0; > init2 := v2(0) = 0;

# [1] Use built-in tool for [numerical] plotting:

> with(DEtools); > DEplot( {eq1, eq2}, [v1(t), v2(t)], 0 .. 3*Pi, {[0, 0, 0]}, scene=[v1, v2], stepsize=.1); ------------

# [2] Solve numerically, plot solution:

> soln := dsolve( {eq1, eq2, init1, init2}, {v1(t), v2(t)}, numeric): > V1 := proc(x) subs( soln(x), v1(t) ) end: > V2 := proc(x) subs( soln(x), v2(t) ) end: > plot( ['V1(t)', 'V2(t)', t=0 .. 3*Pi] );

# Note use of the single quotes, to delay evaluation.

# The single quotes may be avoided as follows, at a small cost:

> plot( [V1, V2, 0 .. 3*Pi] ); ----------- > readlib(unassign): unassign(v1, v2);

# Note: after [2], you must unassign v1 and v2 before the following # will work.

# [3] Solve analytically (if possible), and plot solution:

> solns := dsolve( {eq1, eq2, init1, init2}, {v1(t), v2(t)} ); > assign(solns); > plot( [v1(t), v2(t), t=0 .. 3*Pi] ); ------------

For more about statistical and mathematical software, email the UITS Stat/Math Center, visit the center's web page, or phone 812-855-4724 (IUB) or 317-278-4740 (IUPUI). The center is located in Bloomington at 410 N. Park Avenue, and is open for consultation by appointment Monday-Friday 9am-5pm.

This is document aflj in domain all.
Last modified on May 16, 2011.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.