An Extensible Differential Equation Solver †
Barton L. Willis Department of Mathematics University of Nebraska at Kearney
Kearney, Nebraska 68849, USA June 7, 2001
Abstract
We describe a method for solving linear second order differential equations in terms of hyperge- ometric and other (less well known) special functions. Intended as a method for computer algebra systems, the solver described in this article uses a database of functions to construct an anstatz for the solution. A user may extend the solver by appending functions to the database. An overview of a Macsyma language implementation, with sample calculations, is given.
1 Introduction
This article describes a method for finding symbolic solutions to linear second order differential equations.
Briefly, the solver tries to solve the differential equation (DE)
y0 0(x)+p(x)y0(x)+q(x)y(x)=0 (1) by making an anstatz of the form
y(x)=m(x)F(ξ(x)); (2) where the functions F andξare selected from a user extensible database; all that is demanded of F is that it satisfy a DE of the form
F00(x)=u(x)F(x):
There are no restrictions placed on the function u. We’ll show that the functions m andξare related by m2ξ0= constant;
thus the database doesn’t contain possible values for m. Typically,ξ is a polynomial, rational, or power function; however, the method of this paper does not place any limitations onξ.
We begin by deriving some equations. After that, some details of a Macsyma language implementation are discussed along with some sample calculations.
†This article was formally reviewed following the procedures described inTHISBULLETIN, 32(2), issue 124, 1998, pp 5–6.
2 Formulation
To begin, we eliminate the y0term from the differential equation
y00+p y0+q y=0; (3)
where p and q are functions, by making the substitution [1]
y!exp
1 2
Z
p
y: Introducing v= 2 p0+p2 4 q
=4;the new equation for y is
y00 v y=0: (4)
Throughout this paper, we denote the composition of function f with function g by f(g). Using this notation, we assume that a fundamental solution set to (4) is
fmF1(ξ);mF2(ξ)g; (5)
where m andξare functions of the independent variable x andfF1;F2gis a fundamental solution set to the differential equation
F0 0(ξ) u(ξ)F(ξ)=0: Denoting the wronskian by W , a short calculation gives
W(mF1(ξ);mF2(ξ))=m2ξ0W(F1;F2)(ξ):
Provided that m2ξ06=0, we conclude that
W(mF1(ξ);mF2(ξ))6=0 as it must if (5) is a fundamental solution set.
Substituting y=mF(ξ)into (4) gives the condition
θ mξ00+2m0ξ0F0(ξ)+ mξ02u(ξ) mv+m00
F(ξ)=0: (6) This expression must vanish when F !F1and when F!F2. We will now show that the coefficients of F(ξ)and F0(ξ)must both vanish in order thatθvanish. To simplify notation, defineαto be the coefficient of F(ξ)andβto be the coefficient of F0(ξ). With this notation, we expressθas
θ=αF(ξ)+βF0(ξ): (7)
Setting F first to F1and then to F2yields the conditions
0 =αF1(ξ)+βF10(ξ);
0 =αF2(ξ)+βF20(ξ):
Alternatively, in matrix form, we have
0 0
=
F1(ξ) F10(ξ) F2(ξ) F20(ξ)
αβ
:
The coefficient matrix is nonsingular since its determinant is W(F1;F2)(ξ); therefore,αandβboth vanish.
From 0=α=mξ00+2m0ξ0, it follows that m2ξ0 is constant. Without loss of generality, we’ll assume that
m2ξ0=1: (8)
Settingβto zero and solving for m00gives
m00= v ξ02u(ξ)m: (9)
Substituting m!(ξ0) 1=2in (9), gives
0=ψ 2ξ0ξ000+3ξ002+4u(ξ)ξ04 4vξ02: (10) If a solution to this equation is found, we’ve found a general solution to (4). To solve (10), we draw candidate functions forξfrom the database and demand thatψvanish. Typically, the candidate functions ξ depend on one or more parameters; for example, ξ(x)= p1xp2, where p1 and p2 are parameters. For each choice forξ, we try to makeψvanish by adjusting the parameters.
3 Algorithm Details
The author implemented the method of this paper in the Macsyma language [2]. This code has been tested under Maxima 5.4 [4] and under Macsyma 422.0 [3].
The main task of the of the algorithm is The code selects elements from the database until either a solution is found or all combinations have been exhausted.to try to find the parameter values that make ψ [see (10)] vanish. The author’s code, called MAM(short for Macsyma Anstatz Method) considers two cases:
1. If ψ is a sum of distinct powers, the coefficients of the powers are set to zero and the resulting equations are solved.
2. Ifψis a sum of powers with the powers depending on the parameters, we recursively equate pairs of exponents, gather the coefficients of like powers into an equation set and attempt to solve the equations.
As long as the function u is rational and ξis rational or a sum of powers (possibly noninteger powers), these two cases are sufficient. For other cases, heuristics (possibly using Taylor polynomials ofψ) could be attempted; however,MAMdoes not attempt to solve these cases.
Generally, the parameters are constrained by inequalities; for example, ifξ(x)= p1xp2, where p1and p2 are the parameters, we demand that p16=0 and p2 6=0: Occasionally, a constraint may involve an unbound variable. When this happens, MAM returns the solution to the DE along with the constraints involving the unbound variables.
4 Results
The most significant difference between the solver described in this article and other DE solvers is that the method of this paper doesn’t try to solve a DE using a fixed set of functions. If a user suspects that a DE has a solution expressible in terms of spheroidal wave functions, it is easy to append information to the solver’s database about these functions. In this section, a few sample calculations fromMAMare given.
For our first example,MAMfinds a fundamental solution set of y00= 4 x3 22 x2+15 x 1
y 6(x 1)x 4 x3 8 x2+3
y0 9(x 1)2x(2 x 1)
to be
3
p
x 1 ex(1 x)=3fWa(1=6; 1=2;2x(x 1)=3);Wb(1=6; 1=2;2x(x 1)=3)g; where Waand Wbare the Whittaker functions [5]. As a more exotic example, we solve
y00= 192 x12 269 x8+122 x4 9
y 12(x 1)2x2(x+1)2(x2+1)2 in terms of the spheroidal wave functions SWaand SWbas
4
p
x4 1
SWa 1=2;5=3;1;x2
;SWb 1=2;5=3;1;x2
:
Another example using the spheroidal wave functions is given by the DE
y00 = 2(x 1)2(x+1)2y0 4 x µ x4 (103+µ)x2+13
y
(x 1)2x(x+1)2
:
MAMsolves it as
(
SWa( 19;70;µ; x)
(x 1)9x(x+1)9
;
SWb( 19;70;µ; x)
(x 1)9x(x+1)9
)
Finally, we show that a user may include functions in the database that are not standard special functions.
For example, let a general solution to
y00(x)=
x+a x
+
b x2
y
be defined by
y(x)=c1
D
1(a;b; x)+c2D
2(a;b; x):The functions
D
1 andD
2 are not standard special functions. Appending these functions the database allowsMAMto solvey00(x)=x(3 x+1)(5 x+7)y 4(x+1)5
as
D
1
15 4
;
19 4
;
1 x+1
jx+1j;
D
2
15 4
;
19 4
;
1 x+1
jx+1j
:
For our final example,MAMsolves a Schr¨odinger equation for an anharmonic oscillator y00(x)=4 x4 µ2
y(x):
as
(
D
1 163; µ2;x2
p
x ;
D
2 163; µ2;x2
p
x
)
:
5 Discussion
The method given in this article is part algorithm and part heuristic. Its greatest strength over other DE solvers is its extendibility. Unlike other solvers, the method we presented in this article isn’t constrained to a fixed set of functions to solve DEs.
As described, the algorithm is limited to second order linear differential equations. The method, how- ever, can be extended to linear systems, higher order equations, and even partial differential equations.
References
[1] Daniel Zwillinger. Handbook of Differential Equations. Academic Press, Boston, Mass., 1989.
[2] Barton Willis. MAM, An extensible differential equation solver for Macsyma. Software may be re- quested [email protected].
[3] Macsyma Inc. Arlington, Mass., USA. Macsyma Version 422.0, 1999.
[4] Maxima 5.4 Software may be downloaded from
www.ma.utexas.edu/users/wfs/maxima.html
[5] Milton Abramowitz and Irene A. Stegun. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Dover, New York, 1970.