# solve differential equation by laplace; #lasolve(f_,x_) := block(_p:=laplace(f,x), _p2:=solve(replace(_p,y(s),y),y), inverselaplace(expand(_p2),s,x) ); lasolve(f_,t_,x) := block(_p:=laplace(f,t,s), _p2:=solve(replace(_p,x(s),x),x), inverselaplace(expand(_p2),s,t) ); lasolve(f_,t_,y) := block(_p:=laplace(f,t,s), _p2:=solve(replace(_p,y(s),y),y), inverselaplace(expand(_p2),s,t) ); lasolve(a_=b_,c_=d_):= lasolve(tox(a=b),toyt(c-d)); lasolve(x(n_,t_)=b_,d_+y(m_,t_)):= if(hasnot(bb,y(t)),block(bb:=replace(replace(-b,x,x(t)),y,y(t)),dd:= replace(replace(d,x,x(t)),y,y(t)),xx:=lasolve(bb+x(n,t),t,x), (x=xx and y=lasolve(replace(dd,x(t),xx)+y(m,t),t,y))), if(hasnot(dd,x(t)),block(bb:=replace(replace(-b,x,x(t)),y,y(t)),dd:= replace(replace(d,x,x(t)),y,y(t)),xx:=lasolve(dd+y(m,t),t,y), (y=xx and x=lasolve(replace(bb,y(t),xx)+x(n,t),t,x))) )); lasolve(f_) := block(_p:=laplace(f,x), _p2:=solve(replace(_p,y(s),y),y), inverselaplace(expand(_p2),s,x) );