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