1.13 Differential EquationsΒΆ
The general approach used in integration also carries over to the solution of linear differential equations.
Let’s solve some differential equations. Let y be the unknown function in terms of x.
y := operator 'y
Type: BasicOperator
Here we solve a third order equation with polynomial coefficients.
deq := x^3 * D(y x, x, 3) + x^2 * D(y x, x, 2) - 2 * x * D(y x, x) + _
2 * y x = 2 * x^4
Type: Equation Expression Integer
solve(deq, y, x)
Type: Union(Record(particular: Expression Integer,basis: List Expression Integer),...)
Here we find all the algebraic function solutions of the equation.
deq := (x^2 + 1) * D(y x, x, 2) + 3 * x * D(y x, x) + y x = 0
Type: Equation Expression Integer
solve(deq, y, x)
Type: Union(Record(particular: Expression Integer,basis: List Expression Integer),...)
Coefficients of differential equations can come from arbitrary constant fields. For example, coefficients can contain algebraic numbers.
This example has solutions whose logarithmic derivative is an algebraic function of degree two.
eq := 2*x^3 * D(y x,x,2) + 3*x^2 * D(y x,x) - 2 * y x
Type: Expression Integer
solve(eq,y,x).basis
Type: List Expression Integer
Here’s another differential equation to solve.
deq := D(y x, x) = y(x) / (x + y(x) * log y x)
Type: Equation Expression Integer
solve(deq, y, x)
Type: Union(Expression Integer,...)
Rather than attempting to get a closed form solution of a differential equation, you instead might want to find an approximate solution in the form of a series.
Let’s solve a system of nonlinear first order equations and get a solution in power series. Tell FriCAS that x is also an operator.
x := operator 'x
Type: BasicOperator
Here are the two equations forming our system.
eq1 := D(x(t), t) = 1 + x(t)^2
Type: Equation Expression Integer
eq2 := D(y(t), t) = x(t) * y(t)
Type: Equation Expression Integer
We can solve the system around t=0 with the initial conditions x(0)=0 and y(0)=1. Notice that since we give the unknowns in the order [x,y], the answer is a list of two series in the order [series for x(t),series for y(t)].
seriesSolve([eq2, eq1], [x, y], t = 0, [y(0) = 1, x(0) = 0])
Type: List UnivariateTaylorSeries(Expression Integer,t,0)