LearningGuide

# 2 writing data to a file 281 when you read the le

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: &gt; with(plots, odeplot): &gt; odeplot( sol3, [t, y(t)], 0..4 ); 7 6 y5 4 3 0 1 2 t 3 4 The DEtools package contains commands that can help you investigate, manipulate, plot, and solve diﬀerential equations. For details, refer to the ?DEtools help page. Interactive ODE Analyzer The dsolve[interactive](odesys,options) command launches a graphical user interface for the investigation and solution of ODE and ODE systems. 270 • Chapter 7: Solving Calculus Problems If odesys is not given in the call to dsolve[interactive], then odesys can be entered by using the interface; otherwise, the input equations are examined and used as a starting point for the application (these equations can be changed from within the graphical user interface). For details about the command and interface, see ?dsolve,interactive and ?worksheet,interactive,dsolveinterface. 7.3 Partial Diﬀerential Equations Partial diﬀerential equations (PDEs) are in general very diﬃcult to solve. Maple provides a number of commands for solving, manipulating, and plotting PDEs. Some of these commands are in the standard library, but most of them reside in the PDEtools package. The pdsolve Command The pdsolve command can solve many partial diﬀerential equations. This is the basic syntax of the pdsolve command. pdsolve( pde, var ) • pde is the partial diﬀerential equation • var is the variable with respect to which pdsolve solves The following is the one-dimensional wave equation. &gt; wave := diff(u(x,t), t,t) - c^2 * diff(u(x,t), x,x); wave := ( ∂2 ∂2 u(x, t)) − c2 ( 2 u(x, t)) ∂t2 ∂x To solve for u(x,t), ﬁrst load the PDEtools package. &gt; with(PDEtools): &gt; sol := pdsolve( wave, u(x,t) ); sol := u(x, t) = _F1(c t + x) + _F2(c t − x) Note the solution is in terms of two arbitrary functions, _F1 and _F2. To plot the solution you need a particular set of functions. 7.3 Partial Diﬀerential Equations &gt; f1 := xi -&gt; exp(-xi^2); • 271 f1 := ξ → e(−ξ 2) &gt; f2 := xi -&gt; piecewise(-1/2&lt;xi and xi&lt;1/2, 1, 0); f2 := ξ → piecewise( −1 1 &lt; ξ and ξ &lt; , 1, 0) 2 2 Substitute these functions into the solution. &gt; eval( sol, {_F1=f1, _F2=f2, c=1} ); u(x, t) = e(−(t+x) ) + 2 1 1 1 −t + x &lt; and t − x &lt; 2 2 0 otherwise Use the rhs command to select the solution. &gt; rhs(%); e(−(t+x) ) + 2 1 1 1 −t + x &lt; and t − x &lt; 2 2 0 otherwise The unapply command converts the expression to a function. &gt; f := unapply(%, x,t); f := (x, t) → e(−(t+x) ) + piecewise(−t + x &lt; Plot the solution. &gt; plot3d( f, -8..8, 0..5, grid=[40,40] ); 2 1 1 and t − x &lt; , 1, 0) 2 2 272 • Chapter 7: Solving Calculus Problems Changing the Dependent Variable in a PDE The following is the one-dimensional heat equation. &gt; heat := diff(u(x,t),t) - k*diff(u(x,t), x,x) = 0; heat := ( ∂2 ∂ u(x, t)) − k ( 2 u(x, t)) = 0 ∂t ∂x Try to ﬁnd a solution of the form X (x)T (t) to this equation. Use the aptly named HINT option of pdsolve to suggest a cou...
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