kill(all)$

load : packages
============

load(lrats)$

pde : separation variables for principal of the heat equation.(not general solution),version 1.0
peter.vlasschaert@gmail.com,21/07/2019

D : constant

same : solution for a diffusion pde or heat pde : 1D
---------------------------------------------------------------------

assume(D>0);

pde : solve.
=========

p1:D*diff(u(x,t),x,2) = diff(u(x,t),t);

p2:u(x,t)  = X(x)*T(t);

p3:lratsubst(p2,p1);

1e) option: ev => diff
================

p4a:ev(p3,diff);

2e) option: ev => nouns (general)
=========================

p4b:ev(p3,nouns);

divide : 'p4a or p4b' by p2 :' rhs'.
--------------------------------------------

p5:p4b/rhs(p2);

p5a:p5/D;

rem : p5a only can be separated when equal to constant:α.

assume(α>0);

pde : result here in two ode
====================

==================================
pde : (p)artial (d)ifferential (e)quation.
=> p1

ode : two (o)rdinary  (d)ifferential (e)quation.
==================================
=> 'p5b1,p5b2'

p5b1:(lhs(p5a) = α^2)*X(x);
p5b2:(rhs(p5a) = α^2)*D*T(t);

We use not :ode2 => We use laplace transformation : desolve
===============================================

Menu:equations : Solve ode with laplace.

solve : p5b1
==========

p5c1:desolve([p5b1],[X(x)]);

=>   no problem : physics 
(space part : physical problem:)

solve : p5b2
=========

p5c2:desolve([p5b2],[T(t)]);

=>     problem : physics
(time part : physical problem   :  t →∞, T must be finite,for real problems)

p5c2a:lhs(p5c2)$
p5c2b:rhs(p5c2)$

p5d2a:limit(p5c2a,t,∞) = limit(p5c2b,t,∞);

p5d2b:lhs(p5d2a) = ev(rhs(p5d2a),nouns);

rem : T(0) some initial condition : called ic : condition.
suppose : T(0) is finite value.
=========================================
example : T(0)=1

p5d3c:lratsubst([T(0) = 1],p5d2b);

not physical problem :
example : T =temperature, t for long time => T very high temperature.
=> normal temperature goes down : t → ∞ then T = 0

solution : problem.
==============
physical law : t → ∞ then T = 0

constant : α^2 = -β^2

assume(β>0);

p6:[α^2 = -β^2];

solution : replace α^2 into p5c2
--------------------------------------------

p6a:lratsubst(p6,p5c2);

p6a1:lhs(p6a)$
p6a2:rhs(p6b)$

check problem : time :t  → ∞

p6b:limit(p6a1,t,∞) = limit(p6a2,t,∞);

we found the solution
================

principal : separation of variables. (1D heat or 1D diffusion equation)

solution : T(t) : ?
==========

p7a: p6a;

solution : X(x) : ?
==========
use :'p6','p5b1'

p7b1:lratsubst(p6,p5b1);

use :desolve 'see above'

p7b2:desolve(p7b1,[X(x)]);

general solution 'p7b2'
==================

p7b3:X(x) = C1*sin(x*β) +C2*cos(x*β);

find C1,C2
========

p7b3a:[C1=ratcoeff(rhs(p7b2),sin(β*x)),C2=ratcoeff(rhs(p7b2),cos(β*x))];

solution :u(x,t)
==========
'p2' and use 'p7a, p7b3' and 'p7b3a'

p8a:[p7a,p7b3];

p8b:p7b3a;

p8c:lratsubst(p8a,p2);

principal : solution.
==============

p8c1:expand(p8c);

general : solution
=============
infinite : fourier series, n=1,2,3,...,∞

p9:[u(x,t)=U[n](x,t),X(x)=XX[n](x,t),T(t) = TT[n](x,t)];

to find depends 'n': you need :'bc': (b)oundary (c)ondition, for specefic problem.
=> X(x) , implicit depends also 'ic' : initial conditions.

p9a:lratsubst(p9,p2);

infinite : fourier series
=================

p9b:u(x,t) = sum(lhs(p9a),n,1,∞);