kill(all)$

load packages :

load(lrats)$

heat : homogeneous problem (bc = 0),(ic = f(x),@t=0),version 1.0 (part 1)
peter.vlasschaert@gmail.com,24/07/2019.

ref : elementary applied partial differential equations
        with fourier series and boundary value problems
        (richard haberman,prentice hall)

Model 1 ( cartesian coordinates : u(x,t), unsteady = du/dt ≠ 0)
======
x: space 
t : time         > 0
u : physical quantity ( here : temperature)
D : constant  > 0
l   : length ( for example : rod) , 0<x<l

conditions
---------------

pde :D* 'diff(u,x,2) = 'diff(u,t) 
bc :  u(0,t) =0
        u(l,t  ) = 0
ic  :  u(x,0) = f(x)

type : linear homogeneous partial differential equation.
           bc : linear homogeneous boundary conditions.

How to solve  => separation of variables.

assume(D>0);

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

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

p3:'diff(X(x),x,2)/X(x)='diff(T(t),t,1)/(D*T(t));

two : odes

assume(β>0);

p3a:(lhs(p3) =- β^2)*X(x);
p3b:(rhs(p3) = -β^2)*D*T(t);

solve : two odes with desolve.
=======================

X(x) : ?
======

p4a:desolve(p3a,X(x));

p4a1:lhs(p4a) =C1*sin(x*β)+C2*cos(x*β);

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

p4b:desolve(p3b,T(t));

p4b1:lratsubst([T(0) = C3],p4b);

a) boundary condition  ' into X(x).
=========================

1e) bc :  x=0  u(0,t)  => X(0) =0
--------------------------------------

p5a:subst([x=0],p4a1);

given : problem 'above'

p5a1:rhs(p5a) =0;

result : X(x)
=========

p5a11:subst([p5a1],p4a1);

1e) bc :  x=l  u(l,t)  => X(l) =0
--------------------------------------
use : 'p5a1'

p5a2:subst([x=l],p5a1);

see : website
pde : separation variables heat equation.(problem :given :ic and bc),version 1.0

rem :  C1 arbitrary constant ≠0, X(l) = 0 => sin(l*β) = 0 only when :l*β = n*π

p5a3 :l*β = n*π;

solve for β: ?
==========

p5a4:solve(p5a3,β);

product solution (terminolgy of the book)
============

p6:lratsubst([p5a2,p4b1,p5a11],p2);

rem : C1*C3 =C4 ,with no lose generality

p6a:lratsubst([C1*C3=C4],p6);

p6b:lratsubst(p5a4,p6a);

superposition (= linear combination, M terms)
===================================
summation: (M terms) => ∞

p7:lratsubst([C4=C4[n]],p6b);

superposition : M terms
---------------------------------

p7a:lhs(p7) = sum(rhs(p7),n,1,M);

superposition : M terms → ∞ (limiting case)
----------------------------------------

p7b:lhs(p7a)='limit(rhs(p7a),M,∞);

p7c:lratsubst([M=∞],p7a);

How to find  C4[n] : from ic :initial condition '@t=0' => f(x)
===========================================

p8:lratsubst([t=0],p7c);

p8:fourier series

from ic : u(x,0)=f(x), Model 1
--------------------------------------

p8a:lratsubst([u(x,0)=f(x)],p8);

from : orthogonality relations we find C4[n]
----------------------------------------------------------
fourier coef. 'see above ,website'

assume(l>0);

p8b:C4[n] = 2/l*integrate(f(x)*sin((n*π*x)/l),x,0,l);

rem : integral ( same value : n=1,2,3,....)
==============================

p8c1:'integrate((sin((%pi*n*x)/l))^2,x,0,l) =lratsubst([n=1],integrate((sin((%pi*n*x)/l))^2,x,0,l));

p8c1:'integrate((sin((%pi*n*x)/l))^2,x,0,l) =lratsubst([n=5],integrate((sin((%pi*n*x)/l))^2,x,0,l));

1e) integral useful:energy or power 
2e) orthogonality of sines

final solution (from superposition : u(x,t))
==============================

p9:lratsubst([p8b],p7c);

example : f(x) =100  (initial condition:ic)
===============

p9a:lratsubst([f(x)=100],p9);

result : f(x) = 100

p9b:ev(p9a,nouns);