The Laplace Trans! arm Method 249
!comments on Computer Software! The following nine MAPLE state-
ments calculate and print the general solution of the nonhomogeneous dif-
ferential equation y" + y' -2y = x^2 - 1 which appears in example 2.
with(inttrans):
alias(L(y(x)) =laplace(y(x), x, s)):
ali as(A = y(O)):
alias(B = D(y)(O)):
DE2:=diff(y(x), x$2)+diff(y(x), x) -2 * y(x) = x /\ 2 - 1;
laplace(DE2, x, s);
L(y(x))= solve(%, L(y(x)));
convert(%, parfrac, s);
invlaplace(%, s, x);
Unless you give MAPLE instructions to the contrary, it uses its own notation
for items. For example, in the second statement above, we use the ali as
command to tell MAPLE to print "L(y(x))" where it would normally print
"laplace(y(x), x, s)." Statement three instructs MAPLE to print "A" instead
of "y(O)" and statement four instructs it to print "B" instead of "D(y)(O),"
which is the MAPLE representation for y' (0). The fifth statement defines
t he differential equation. Notice that "diff(y(x ), x$2)" is MAPLE's notation
for ~:; = y"(x) and "diff(y(x),x)" is the notation for ~~ = y'(x). The
sixth statement instructs the computer to calculate and print the Laplace
transform of the differential equation DE2. The printed output is equivalent
to equation (5) of example 2. Since in MAPLE the % sign refers to the
previous statement, the seventh statement instructs the computer to so lve
the result (output) of the previous statement for L(y( x)). The printed output
of the seventh statement is equivalent to equation (6) of example 2. The
eighth statement instructs MAPLE to perform partial fraction expansion on
the result of the seventh statement. The output of the eighth statement
is equivalent to equation (7). The last statement causes the computer to
calculate the inverse Laplace transform of the output of the eighth statement.
The output of the final statement is equivalent to equation (8)- the general
solution of t he given differential equation.
You can find the general solution to other second order differential equa-
tions by changing the definition of the differential equation, DE2, in the fifth
statement. To so lve higher order differential equations, you must make addi-
tions as well. Furthermore, you can solve the initial value problem of exam-
ple 3 by changing the third statement to y(O) := 1:, by changing the fourth
statement to D(y)(O) := -1:, and by changing the fifth statement to DE:=
diff(y(x ), x$2) -4diff(y(x), x) + 5 y(x) = 2*exp(x)-sin(x);.