kill(all)$

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

load(lrats)$

use : lratsubst , 'command'

heat : principal : Fourier Transform , version 1.0
peter.vlasschaert@gmail.com, 22/07/2019

why : solve problems : 'temperature distribution u(x,t)'
===========
=> infinite rod 
===========
given : initial condition f(x ),  -∞<x <∞,heat equation ( = unsteady).

=>  T = period  , n = positiv integer

use : fourier series       (periodic functions          =  )       =>     f(x) = f(x+n*T)
use : fourier transform (non periodic functions   =  )       =>     frequency representation

a)  periodic functions
===============

example : sin(x), T= 2*π , n=2

p1:sin(x) =subst([T = 2*π],sin(x+2*T));

b) non periodic functions
===================

Def : Fourier transform: 'p2a'
--------------------------------

rem : remenber laplace transform:'p2'
L(f(t)) = integrate(%e^(-s*t)*f(t),t,0,inf)

p2:F(s) = integrate(f(t)*exp(-s*t),t,0,∞);;

p2a:F(ω) = integrate(f(t)*exp(-%i*ω*t),t,-∞,∞);;

rem : % i  = sqrt(-1), complex value
complex number :  z = a*%i+b = r*exp(%i*θ)

analog: with the Laplace transform
F(ω) =FT(f(t))

Def : inverse Fourier transform: 'p2b'
--------------------------------------------------

p2b:f(t) = 1/(2*π)* integrate(F(ω)*exp(%i*ω*t),ω,-∞,∞);;

c) fourier spectra:'p2c'
===================

p2ca:F(ω) =R(ω) + %i*X(ω);
p2cb:lhs(p2ca) =abs(F(ω))*exp(%i*φ(ω));

How : fourier transform: f(t) = exp(-a*t), a>0
-----------------------------------------------------------
piecewise function : f(t) = exp(-a*t)   t > 0
                                   f(t) = 0                t < 0

solution : problem

assume( a >0);

 p3:f(t) = exp(-a*t);

restricted integration : 
-∞ < t <+⇔  = >  0 <t < ∞
---------------------------------
use : p2a

p3a:p2a;

copy : 'p3a' ,rhs : copy =>paste

p3b:lhs(p3a) = integrate(f(t)*%e^(-%i*t*ω),t,t1,t2);
p3b1:[t1=0,t2=∞,p3];

∞;

p3b3:lratsubst(p3b1,p3b);

use : ev(expression ,integrate)

p3b4:ev(p3b3,nouns);

get real part : F(ω)
==============

p4a:realpart(rhs(p3b4));

get imagary part : F(ω)
==================

p4b:imagpart(rhs(p3b4));

get polar representation: F(ω)
=======================

p4c:polarform(rhs(p3b4));

general representation
==================
use : 'p2cb'
phase       : φ(ω)
amplitude : abs(F(ω))

p4d:rhs(p2cb);

How to find :phase 'abs(F(ω))'
----------------------------------
use : 'p4c' and 'p4d'

1e) amplitude : magnitude spectrum :| F(ω)|
==================================

p4da:lratsubst([%i=0],p4d=p4c);

2e) phase : phase spectrum :φ(ω)
==================================

p4db1 : lratsubst([p4da],p4c=p4d);

p4db2:p4db1*(1/rhs(p4da));

p4db3:solve(p4db2,φ(ω));

p4db4:p4db3[1];

rem: short way

p5:solve(p4db1,φ(ω));