I have an MATLAB script that solves an inhomogeneous first-order linear IVP using the Laplace transform. (For this example, the script is set up to solve the IVP ,
.)
syms x(t) s X;
a0 = -3;
x0 = 4;
rhs = t^2;
lhs = diff(x,t) + a0*x;
ode = lhs - rhs
Lx = X;
LDx = s*X - x0;
LHS = LDx + a0*Lx;
RHS = laplace(rhs,t,s);
IVP = LHS - RHS;
IVP = collect(IVP,X);
X = solve(IVP, X);
X = partfrac(X);
sol = ilaplace(X, s, t)
check1 = diff(sol,t) - 3*sol
check2 = vpa(subs(sol, t, 0))
If I substitute "factor" for "collect", the script almost works on Octave with the symbolic package linking to SymPy, except for the "solve" command https://www.mathworks.com/help/symbolic/solve.html.
Is there any Octave (or SymPy, if that would function as a workaround) command that will function as a MATLAB symbolic toolbox "solve" command so I can solve the IVP with a Laplace transform with a script so I don't have to solve for X manually, then use "ilaplace"?
Thanks in advance for any assistance you can provide.