kill(all)$

solve pde (part 8), 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 : diff(u(x,t),x,2) =9* diff(u(x,t),t,2) , t > 0
           =========================================
           domain : x >0 , t > 0
           =========================================

 ==============================================

BC :   u(0,t)  =0
IC   :   u(x,0) = x*exp(-x),  diff(u(x,t),t),t=0) =0

  =============================================

eq:diff(u(x,t),t,2) - diff(u(x,t),x,2) = 0;
ic : [u(x,0) = x*exp(-x),at(diff(u(x,t),t),t=0) =0];
bc :[u(0,t)  =0];

bc[1];

assume(x>0,t>0);

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],ic[2],p1a],p1);

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

p3:ode2(p2,v,x);

only boundary condition : select  a) %k1= 0      , %k2=%c
                                                                b) %k1=%c   , %k2 =0
================================================

a=>
------

p3a:[%k1=0,%k2=%c];
p3b:subst(p3a,p3);

use BC : x=0 => v=0  from     (BC :   u(0,t)  =0)
------------------------------------------------------------------

find %c
=======

p3c:[x=0,v=0];
p3d:subst(p3c,p3b);

p3e:solve(p3d,%c);

subst '%c'  into  'p3b'
==================

p3f:subst(p3e,p3b);

p3g:combine(p3f);

use partial fraction : 'p3g'
=====================

Menu : Calculus :Partial fraction => s:variable
----------------------------------------------------------------------

p3h:lhs(p3g) = partfrac(rhs(p3g),s);

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

p4:u(x,t) = laplaceInv(rhs(p3h),s,t);

p4a:collectterms(%,unit_step(t-x/s));

p4b:lhs(p4a) =subst([s=1],rhs(p4a));

I find  error : 'laplaceInv', s removed   'p4'

draw solution : 'wxplot3d'
======================

=> a)
====

sol:rhs(p4b);

wxplot3d(sol,[x,0,2*π],[t,0,10],[azimuth,130],[elevation,45]);

draw 2d
=======

a =>
====

define(u(x,t),sol);

set_draw_defaults(
xrange=[0,2*π],yrange=[-1,1],ytics = 1/2,color = red,grid = true)$

s1:gr2d(title="u(x,1)",explicit(u(x,1),x,0,2*π))$
s2:gr2d(title="u(x,2)",explicit(u(x,2),x,0,2*π))$
s3:gr2d(title="u(x,3)",explicit(u(x,3),x,0,2*π))$
s4:gr2d(title="u(x,4)",explicit(u(x,4),x,0,2*π))$

wxdraw(s1,s2,s3,s4,columns=2)$

remfunction(u);

test  ?

u(1,2);

'-------------------------------------------------------------------------------------------------------------------------------------------'