kill(all)$

maxima :point collocation  method,version 1.0,part 1
peter.vlasschaert@gmail.com,16/11/2020

load packages , option.
==================

load(lrats)$ ratprint:false$

powerdisp:true$

part 1 : simple polynoom
===================

problem :
=======
 →  ODE :dy/dx +y =0, domain : 0≤x≤1, x=0 → y(0) = 1

p1:'diff(y,x)+y =0;

1e) step :approximate solution 
------------------------------------------
a) 1e order ODE
b)  approximation second order polynoom : 'quadratic'

p1a:y=sum(a[i]*x^i,i,0,2);

2e)  initial value  :  x= 0 → y=1
------------------------------------------

p1b:subst([x=0,y=1],p1a);

p1b1:[reverse(p1b)];

use : p1a

p1b2:subst(p1b1,p1a);

3e)  residual  = R = 0 
------------------------------
find:  a[i] , i=1,2 
a) R=0   → x=1/3
b) R=0   → x=2/3

p1c:R = lhs(p1);

p1c1:subst([p1b2],p1c);

p1c1a: ev(p1c1,nouns);

a) R=0   → x=1/3

p1c1b1:subst([R=0,x=1/3],p1c1a);

b) R=0   → x=2/3

p1c1b2:subst([R=0,x=2/3],p1c1a);

4e)  find a[i], i=1,2
----------------------------

p1d:listofvars(p1c1b1);

p1d1:solve([p1c1b1,p1c1b2],p1d)[1];

5e) subst a[i], i=1,2,p1b2
------------------------------------

p1d2:subst(p1d1,p1b2);

p1d2a:float(p1d2);

wxplot2d([rhs(p1d2a)], [x,0,1])$

find :exact solution

a)  use ode2

p1e:ode2(p1,y,x);

b) find %c , x=0 → y=1;

p1e1:subst([x=0,y=1],p1e);

p1e1a:[reverse(p1e1)];

c) exact solution

p1e1b:subst(p1e1a,p1e);

wxplot2d([rhs(p1e1b)], [x,0,1])$

see : final result on the graph below
===========================

wxplot2d([rhs(p1d2a),rhs(p1e1b)], [x,0,1])$

rem :approximation very good one see wxplot2d,not always know exact solution.