kill(all)$

ortho collocation method : differential equation legendre (shifted form), version 1.0, part2
peter.vlasschaert@gmail.com,16/09/2019

load packages
---------------------

load(orthopoly)$
load(contrib_ode)$
load(lrats)$

rem:

 Category: Package contrib_ode:
----------------------------------------------

%c · %k1 · %k2 · Introduction to contrib_ode · bessel_simplify · contrib_ode · dgauss_a · dgauss_b · dkummer_m · dkummer_u ·
expintegral_e_simplify · gauss_a · gauss_b · kummer_m · kummer_u · method · ode_check · odelin 

DEF :legendre differential equation
-------------------------------------------------

declare(n,integer);

differential equation
----------------------------

eq1:(1-x^2)*'diff(y,x,2)-2*x*'diff(y,x)+n*(n+1)*y = 0;

defined domain :[-1,1],are roots of coef :'diff(y,x,2)

how to analysis : eq1,roots ?
======================

eq1arg1:args(lhs(eq1));

eq1arg2:ratcoeff(eq1arg1[1],('diff(y,x,2)));

eq1arg3:allroots(eq1arg2);

How to solve : legendre equation with maxima.

rem : ode2 doesn't work  => reason to load ()  = ' load(contrib_ode)$'

solution
-----------

pp1:contrib_ode(eq1,y,x);

 =>  x(1-x) diff(y,x,2) + [c-(a+b+1)x] diff(y,x) - aby = 0 'hypergeometric differential equation'
rem :gauss_a(\-n,n+1,1,\-(x\-1)/2)  ,gauss_b(\-n,n+1,1,\-(x\-1)/2) are two independent solution.
-------------------------------------------------------------------------------------------------------------------------------
(see : hypergeometric function : 2F1,internet )

method
-----------

method;

check : solution
----------------------

 ode_check(eq1,pp1[1]);

rem:
====

pr1:odelin(eq1,y,x);

set => list  :  setify
list  => set : listify

pr1a:listify(pr1);

parts of a list

pr1a1:pr1a[1];
pr1a2:pr1a[2];

DEF :shifted legendre differential equation
-----------------------------------------------------------

eq2:(v)*(1-v)*'diff(y,v,2)+(1-2*v)*'diff(y,v,1)+n*(n+1)*'diff(y,v,0)= 0;

rem: use 'map' with  'ratsimp,allows a separate simplification on each term.
syntax  =>  map('ratsimp, lhs(eq))

defined domain :[0,1],are roots of coef .:'diff(y,v,2)

How find "eq2" from "eq1":
-------------------------------------

a) How to solve : eq2, (maxima)
========================

q1a:odelin(eq2,y,v);

q1b:contrib_ode(eq2,y,v);

b) How find "eq2" from "eq1"
======================

corresponding : {-1 with 0, +1 with 1}

1e) how to find : a1,b1
-----------------------------

r1a: v=a1*x+b1;

r1a1:subst([v=0,x=-1],r1a);
r1a2:subst([v=1,x=1],r1a);

r1b:solve([r1a1,r1a2],[a1,b1])[1];

r1b1:ratsimp(subst(r1b,r1a));

r1b11:solve(r1b1,x)[1];

2e)  dy/dx  to  dy/dv
---------------------------
dy/dx = dy/dv*dv/dx

depends([y],[v]);

r1c1:'diff(v,x) =diff(rhs(r1b1),x);

r1c2:'diff(y,x) = subst([r1c1],'diff(y,v)*'diff(v,x));

3e)  d(dy/dx(y))/dx  to  d(dy/dv)/dv
----------------------------------------------

r1d:'diff(y,x,2)='diff(rhs(r1c2),v)*'diff(v,x);

r1d1:lhs(r1d) =subst([r1c1],rhs(r1d));

r1d2:lhs(r1d)=ev(rhs(r1d1),diff);

4e) final shifted legendre equation
-----------------------------------------------
use : eq1,{1e,2e,3e}

s1a:args(lhs(eq1));

s1b:[part(s1a[1],1),ratcoeff(s1a[2],('diff(y,x,1))),coeff(s1a[3],y)];

s1c:expand(subst([r1b11],s1b));

s1d1:factor(s1c);

s1d2:[rhs(r1d2),rhs(r1c2),y];

s1d3:sum(s1c[k]*s1d2[k],k,1,3)=0;

s1d4:ratsimp(lhs(s1d3))=rhs(s1d3);

same  : eq2 = s1d4

  =>     shifted legendre ode.solution 'y : y(x)'

s1d5:subst([v=x],s1d4);

definition from : part 1,shifted legendre polynomial.
=======================================

shifted_legendre_p (n, x) := legendre_p (n, 2*x - 1)$

sl1:makelist(shifted_legendre_p (i, rat(x)),i,0,3);

sl2:makelist(y,i,0,3);

sl3:map("=",sl2,sl1);

n values;
------------

sl3a:[0,1,2,3];

see :info, 'see above'
================

sp1:[sl3[3],n=2];

sp2:subst(sp1,s1d5);

sp3:ev(%,nouns);

rem : nouns are diff option : for 'ev'

check  : n=2 
------------------
ode :s1d5, 'see above'

sp4:expand(sp3);