kill(all)$

solve pde (part 5), use laplace transform. 'version 1.0'
peter.vlasschaert@gmail.com,11/12/2018

load 'packages'
------------------------

load(orthopoly)$
load(lrats)$
load(facexp)$
load(odes)$

load("C:/math/laplaceInv.mac");

assume(s>0);

pde : x*diff(u(x,t),x) + diff(u(x,t),x,1,t,1) +2*u(x,t) = 0, t > 0
           =========================================
           domain : x ≥ 0 , t ≥ 0

BC :   u(0,t)  =e^(-a*t)
IC   :   u(x,0) =1

eq: x*diff(u(x,t),x) + diff(u(x,t),x,1,t,1) +2*u(x,t) = 0;
bc :[u(0,t)  =%e^(-a*t)];
ic : [u(x,0) =1];

bc[1];

solve : pde with bc,ic
--------------------------------

1e) laplace transformation 'eq'
=========================

p1:laplace(eq,t,s);

p1a:laplace(u(x,t),t,s) =v;

2e) subst ic into 'p1'
=================

p2:subst([ic[1],p1a],p1);

3e) solve ode2 , 'p2'
================

p3:ode2(p2,v,x);

find : %c
---------------------------------
========================================================
BC: x=0 => v  ?
because : 'function of time , so we must also take laplace from 'BC'
========================================================
BC : x=0 => v=laplace(rhs(bc[1]),t,s)
========================================================

p3a:subst([x=0,v=laplace(rhs(bc[1]),t,s)],p3);

p3b:solve(p3a,%c);

p3c:subst(p3b,p3);

4e) inverse laplace transform 'p3d'
=============================

p4:laplaceInv(rhs(p3c),s,t);

p4a:collectterms(%,%e^(-t*x));

p4b:u(x,t)=factor(p4a);

5e) check solution : 'p4' into 'eq'
===========================

p5:subst([p4b],eq);

p5a:ev(p5,nouns);

p5b:ratsimp(p5a);

p5c:is(p5b);

ic:other check : u(x,t) => u(x,0) =1 
============================

p6:subst([t=0,a=0],p4b);

bc:other check : u(x,t) => u(0,t) =e^(-a*t)
=================================

p6a:subst([x=0],p4b);

rem : because bc is function of time, need also take 'laplacetransform of BC'