LaplaceClass_A11.mws
Tue Oct 11 09:20:59 MDT 2005
| > | restart; |
| > | with(plots, display): |
| > | step := (t,A) -> Heaviside(t-A); Our text's "step" function. |
| > | RHS := t -> (1 - step(t,1))*2*t + 2*step(t,1); |
| > | TRG := 0..4: |
| > | P_RHS := plot(RHS, TRG): Save driving-function plot for later. |
| > | #display(P_RHS); Checking if the driving function's entered properly. |
The differential equation: y'' + y = RHS with y(0) = 0 and y'(0) = 1.
| > | DEA := (D@@2)(y)(t) + y(t) = RHS(t); |
Set up the initial conditions:
| > | WIMPY := y(0) = 0, D(y)(0) = 1: |
Put together the argument sequence for "dsolve":
| > | IVP := {DEA, WIMPY}: |
| > | VARS := y(t): |
| > | CARGO := IVP, VARS: |
| > | SOLN := dsolve(CARGO); Solve the initial-value problem. |
Recover the solution for plotting and checking:
| > | yy := unapply( rhs(SOLN), t): Get solution as Maple function yy |
| > | P_SOLN := plot(yy, TRG, colour=BLACK): Plot the solution. |
| > | display(P_RHS, P_SOLN); Solution and driving function together. |
| > | ######################################################## |
Here we check the piecewise formula for the solution:
| > | assume(u < 1); |
| > | assume(v > 1); |
| > |
| > | yy(u); |
| > | yy(v); |
| > | ######################################################### |
| > |
| > |