ENGI 3424 Chapter 1 –
Demonstration of Maple for the solution of some
first order linear ordinary differential equations with constant coefficients,
using examples from the lecture notes.
Below are the commands from the Maple worksheet.
Open the worksheet in Maple to see the resulting expressions.
The output is shown here for the final command only.
> with(DEtools):
(this package must be open in order for Maple to understand the other
commands)
Example 1.1.2
> ode := diff(x(t),t) = k*x(t)*(1-x(t));
> dsolve(ode, x(t));
Example 1.1.3
> ode := m*diff(v(t),t) = m*g - b*v(t)^2;
> ics := v(0)=0;
> dsolve({ode,ics}, v(t));
Note: tanh x = sinh x / cosh x =
(1 – exp(–2x)) / (1 + exp(–2x)) ,
so that the answer above is consistent with the solution in the lecture
notes.
Example 1.2.4 (water filling a leaking cylindrical tank)
First, the roles of height and time are reversed, so that h is the
independent variable
and an explicit solution is found for time as a function of height.
The inverse hyperbolic tangent, arctanh(x), is also
(1/2) ln ((1+x)/(1–x)).
One can show that the solution below is equivalent to the solution in
the lecture notes.
> ode := A / diff(t(h),h) = Q - a*sqrt(2*g*h);
However, Maple struggles to find an explicit solution for height as a
function of time:
> ics := t(h0) = 0;
> dsolve({ode,ics}, t(h));
> ode := A * diff(h(t),t) = Q - a*sqrt(2*g*h(t));
> ics := h(0) = h0;
> dsolve({ode,ics}, h(t));
Example 1.3.1
> restart:
> ode := diff(y(x),x) + 2*y(x) = 6*exp(x);
> dsolve(ode, y(x));
Example 1.3.3
> ode := diff(y(x),x) - y(x) = sinh(x);
> dsolve(ode, y(x));
Example 1.3.4 - (linear only for x as a function of y )
> ode := (1 - 2*x*exp(2*y(x)))*diff(y(x),x) = exp(2*y(x));
> dsolve(ode, y(x));
> ode := (1 - 2*x(y)*exp(2*y))/diff(x(y),y) = exp(2*y);
> dsolve(ode, x(y));
Example 1.4.2 - reduction of order
> ode := diff(y(x),x,x) = (diff(y(x),x))^2;
> dsolve(ode, y(x));
Example 1.4.3 - reduction of order
> ode := diff(y(x),x,x) = 2*y(x)*diff(y(x),x);
> dsolve(ode, y(x));
Maple misses the singular solution, when _C1 = 0.