kill(all)$

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

rem :part 1,part 2,website

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

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

declare(n,integer);

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

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

see : part 2

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

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

p2a:contrib_ode(eq2,y,x);

hypergeometric_representation;

hypergeometric_representation:true;

how to do representation of function
--------------------------------------------------

hypergeometric([],[],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

eq3:(x)*(1-x)*('diff(y,x,2))+(c-(a+b+1)*x)*('diff(y,x,1))-(a)*(b)*y=0;

relation between:eq2 and eq3
=======================

eq3a:[a+b=1,a*b=-n*(n+1)];

eq3b:solve(eq3a,[a,b]);

eq3b1:eq3b[1];
eq3b2:eq3b[2];

eq3b3:[c=1];

Function: hypergeometric ([a1, ..., ap],[b1, ... ,bq], x)

 ===============================================
 For the Gauss hypergeometric function, that is p = 2 and q = 1,
 floating point evaluation outside the unit circle is supported,
 but in general, it is not supported: 2F1 (= mathematics)
=>  pFq
================================================
2F1(a,b;c;x)
================================================
a1=a,a2=b,b1=c
================================================

default:option
-------------------

expand_hypergeometric ;

expand_hypergeometric is true (default is false) and one of the arguments a1 through ap is 
a negative integer (a polynomial case), hypergeometric returns an expanded polynomial. 

solution :shifted legendre polynomials
-----------------------------------------------------

p3a1:hypergeometric([-n,n+1],[1],(x));
expand_hypergeometric : true;
p3a2:makelist(subst([n=i],p3a1),i,0,2);
p3a3:ratsimp(p3a2);

roots polynomials
==============

p3a4:map(allroots,p3a3);

definition : legendre polynomials  (hypergeometric polynomials)
=========================

legendrep(n,x):=block(hypergeometric([-n,n+1],[1],(1-x)/2));

definition : shifted legendre polynomials  (hypergeometric polynomials)
=========================

shiftlegendrep(n,x):= legendrep(n,2*x-1);

see :part1,part2

shiftlegendrep(1,x);

list:polynomials of the shifted legendre ode
=================================

p4:makelist(shiftlegendrep(i,x),i,0,3);

n=0,1,2,3

p4a1:ratsimp(p4);

p4a2:[y,y,y,y];

p4a3:map("=",p4a2,p4a1);

plot shifted legendre polynomials (interval:[0,1])
=========================

wxplot2d(p4a1, [x,-0.1,1.1])$

rem :plot legendre polynomials (interval :[-1,1])
=======================

p5a:makelist(legendrep(i,x),i,0,3)$
p5b:ratsimp(p5a)$
p5c::[y,y,y,y]$
p5d:map("=",p5c,p5b)$
wxplot2d(p5b, [x,-1.1,1.1])$

? hgfred;

assume(x-1.0 > 0);

 legendre polynomial
=====================

p6a:hgfred([-n,n+1],[1],(1-x)/2);

shifted legendre polynomial
=====================

p6b:subst([x=2*x-1],p6a);

test: see part 1,part 2  (website)
=========================

p6c:subst([n=1],p6b);

p6c1:ev(p6c,nouns);