Author: Douglas Wilhelm Harder
This page shows how to find a solution to a first-order initial-value problem (IVP).
In Maple, if y(t) is a function, then the derivative is represented by D(y)(t). Arithmetic in Maple is similar to that in C++, with +, -, * and /, but unlike C++, ^ is used for exponentiation.
Suppose we have the IVP with an ordinary differential equation (ODE) and an initial condition (IC):
$y^{(1)}(t) + 3y(t) = \sin^2(t)$
$y(0) = 1$
Here is how you can convert this IVP into syntax that Maple can understand:
Notice that y(t) is not defined, and Maple will simply consider this to be an unknown function.
dsolve( {D(y)(t) + 3*y(t) = sin(t)^2, y(0) = 1}, y(t) );
$y(t) = - \frac{3 \cos(2t)}{26} - \frac{\sin(2t)}{13} + \frac{1}{6} + \frac{37 e^{-3t}}{39}$
Here is a slightly more difficult problem that you are unlikely to be able to solve:
$y^{(1)}(t) + 3ty(t) = \sin^2(t)$
$y(0) = 1$
You will note the variable coefficient in $3ty(t)$. However, Maple can still solve this:
# Make Maple use 'j' for the square root of -1: interface( imaginaryunit = 'j' ): dsolve( {D(y)(t) + 3*t*y(t) = sin(t)^2, y(0) = 1}, y(t) );
$y(t) = e^{-\frac{3t^2}{2}} + \frac{ je^{-\frac{3t^2}{2}} \sqrt{\pi}\sqrt{6} \left( e^{\frac{2}{3}} \textrm{erf}\left( \frac{j\sqrt{6}t}{2} + \frac{\sqrt{6}}{3} \right) + e^{\frac{2}{3}} \textrm{erf}\left( \frac{j\sqrt{6}t}{2} - \frac{\sqrt{6}}{3} \right) - 2 \textrm{erf}\left( \frac{j}{2} \sqrt{6} t \right) \right) }{24}$
Here, however, is an IVP that you can at least verify the answer thereof:
$y^{(1)}(t) + 3y^2(t) = 1$
$y(0) = 1$
dsolve( {D(y)(t) + y(t)^2 = 1, y(0) = 1}, y(t) );
$y(t) = \frac{ \sqrt{3} \tanh\left( \frac{\left(\sqrt{3} \textrm{arctanh}\left(\sqrt{3}\right) + 3t\right)\sqrt{3}}{3} \right) }{3}$