Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use desolve_laplace to do this. The initial conditions are given as ics=[0,1,7] meaning $y(0)=1$ and $y'(0)=7$.

var('y,t,s')
y=function('y',t)
ode=diff(y,t,2)-6*diff(y,t)-27*y==0
desolve_laplace(ode,y,ics=[0,1,7])

For teaching purposes, II've often not set the conditions up front, but will substitute for them later in the computation. For example,

var('y,t,s')
y=function('y',t)
ode=diff(y,t,2)-6*diff(y,t)-27*y==0
transformed=laplace(ode,t,s)
ans=solve(transformed,laplace(y,t,s))
f=ans[0].rhs()
y0=1
yprime0=7
f=f.subs(y(t=0)==y0)
f=f.subs(diff(y,t)(t=0)==yprime0)
inverse_laplace(f,s,t)