To solve the equation of the previous example with the function desolve, we introduce names for the two equations:
diff_eq1: 'diff(f(x),x,2) + 'diff(g(x),x) + 3*f(x) = 15*exp(-x);
2 d d - x (%o1) -- (g(x)) + --- (f(x)) + 3 f(x) = 15 %e dx 2 dx
diff_eq2: 'diff(g(x), x, 2) - 4*'diff(f(x), x) + 3*g(x) = 15*sin(2*x);
2 d d (%o2) --- (g(x)) - 4 (-- (f(x))) + 3 g(x) = 15 sin(2 x) 2 dx dx
Now we form a named system of equations:
ode_syst: [diff_eq1, diff_eq2];
2 d d - x (%o3) [-- (g(x)) + --- (f(x)) + 3 f(x) = 15 %e , dx 2 dx 2 d d --- (g(x)) - 4 (-- (f(x))) + 3 g(x) = 15 sin(2 x)] 2 dx dx
The initial values are specified in the same manner as in the previous example:
atvalue (f(x), x=0, 35);
35
atvalue ('diff(f(x),x),x=0, -48);
- 48
atvalue (g(x), x=0, 27);
27
atvalue ('diff(g(x), x), x=0, -55);
- 55
Now we call desolve:
desolve(ode_syst, [f(x), g(x)]);
and obtain a list of two equations, the solution of the given system.
- x (%o8) [f(x) = - 15 sin(3 x) + 2 cos(2 x) + 30 cos(x) + 3 %e , - x g(x) = 30 cos(3 x) + sin(2 x) - 60 sin(x) - 3 %e ]