intro :How to solve 1e order ODE : dy/dx+p*y = q
y = y(x), p=p(x), q=q(x)    =>  Laplace Transformation ?
peter.vlasschaert@gmail.com,                    28/09/2017

 Y = Y(t),p=p(t),q=q(t) => dy/dt = y'
 t = time. = >     y'+p*y = q  => Laplace Transformation ?

kill(all)$

definition :
 =>     Laplace Transform. ( = L{f(t)}) )

'laplace(f(t),t,s) = 'integrate(f(t)*exp(-s*t),t,0,inf);

depends([y,p,q],t);

1e order ODE

f:diff(y(t),t)+p(t)*y=q(t);

L      = Laplace Transformation( 1e order ODE)  : S = domain

p1:laplace(f, t, s);

L^(-1) = Inverse Laplace Transformation               : t = domain (x = domain,see below(+))

  L{g(t)} => L^(-1)[L{g(t)}] = g(t).

p2:ilt(p1, s, t);

IC = (I)nitial (C)ondition : y(0),value t=0.
use : (+)    t = x , y  = y 

kill(all)$

part 1 : differential 'df/dx' => Laplace Transform

df/dt  <->  s*L{f(t)} - f(0)
=>    df/dx <-> s.L{f(x)} - f(0)

first order differential, initial condition f(0)

p:2*x;
q:3*x+5;

p3:laplace('diff(f(x),x),x,s);

p4: f(0) = 2;

p5:ev(p3,p4);

part 2 : L{p*f(x)};

p6:laplace(p*f(x),x,s);

part 3 : part1+part2 - q= 0  : result  'Laplace Transformation'

p7:p5+p6-laplace(q,x,s)=0;

p71:laplace(f(x),x,s)=Y(s);

p8:ev(p7,p71);

p9:ode2(p8,Y(s),s);

solve : with ODE2 from maxima.(without first Laplace Transformation)

p12:diff(f(x),x)+p*f(x)=q;
p13:solve(p12,f(x));
p14:ev(ode2(p12,f(x),x))$
p15:ev(p14,%c=c1);

find : c1 , use 'p4'

p16:ev(p15,x=0);
p17:ev(p16,p4);
p18:solve(p17,c1)[1];

find :  f(x) with initial condition  f(0) =2 

p19:ev(p15,p18);

check : solution sub 'p12'

p20:ev(p12,p19);
p21:ev(p20,diff);
p22:ratsimp(p21);

p23:lhs(p71)=rhs(p9);
p231:ilt(p23,s,x);

initial condition : f(0) =2 <-> Y(0) = 2/s

p24 :Y(0) = laplace(rhs(p4),x,s);

special functions :
Handbook of Mathematical Functions
Abramowitz, Stegun

erf(z)   =>  erfc(z) = 1-erf(z).

p26:'erf(z)   = 2/z^(1/2)*'integrate(exp(-z^2),z,0,z);
p27:'erfc(z) = 2/z^(1/2)*'integrate(exp(-z^2),z,z,inf);

gamma_incomplete(a,z)

p28:'gamma_incomplete(a,z)='integrate(z^(a-1)*exp(-z),z,z,inf);

find : %c  use 'p9'
gamma_incomplete: gamma_incomplete(0,0) is undefined.
=>    find by this method  no solution for f(x).

for 1e order ODE ,maxima find solution ,better by ODE2 'command'
=>   Laplace Transform :why " problems are in  'p8' ' division by zero.
      ( for  s=0 )  " 
=>   special functions :  erf(z) ,gamma_incomplete(a,z),...........