kill(all)$

maxima :introduction to chebyshev :polynomials,version 1.0
peter.vlasschaert@gmail.com,26/12/2020

load packages,option

load(lrats) $ ratprint:false $

trignometry :cos(nθ)
================

declare(n,integer)$

matchdeclare(aa,true);

defrule(r1,sin(aa),sqrt(1-(cos(aa))^2));

ruletrig(m):=expand(apply1(trigexpand(m),r1));

p0:'cos(0*θ)=cos(0*θ);

p1:cos(1*θ)=x;
p2:cos(2*θ)=ruletrig(cos(2*θ));
p3:cos(3*θ)=ruletrig(cos(3*θ));
p4:cos(4*θ)=ruletrig(cos(4*θ));

→  cos(n*θ) ,polynomials

p2a:lhs(p2)=subst([p1],rhs(p2));
p3a:lhs(p3)=subst([p1],rhs(p3));
p4a:lhs(p4)=subst([p1],rhs(p4));

def : T[n](x), chebyshev , first kind
===========================

T[mm](x):=trigsimp(subst([p1],
        ruletrig(cos(mm*θ))));

T[4](x);

T[n-1](x);

info :

p5:cos((n+1)*θ)=trigsimp(cos((n+1)*θ));

p5a:trigreduce(cos((n+1)*θ));

p5b:trigexpand(%);

p5c:apply1(%,r1);

end : info

find :recurrence relation:
===================
T[n+1](x) =f (T[n](x),T[n-1](x))

p6a:2*part(p5b,1);
p6b:factor(part(p5b,2)-part(p5b,1));
p6c:p6a+p6b;

p7a:subst([p1],p6a);
p7b:trigsimp(trigreduce(p6b));

p8:lhs(p5)=p7a+p7b;

p8a:'T[n+1](x)=2*x*'T[n](x)-'T[n-1](x);

rem :recurrence n ≥ 1

check:p8a
--------------

p8b:ev(p8a,nouns);

p8c:subst([n=1],p8a);

→ higher polynomials : T[0](x),T[1](x),are given .

'T[0](x)=ev(T[0](x),nouns);
'T[1](x)=ev(T[1](x),nouns);

→  T[2](x),use p8c

p8c1:lhs(p8c)= ev(rhs(p8c),nouns);

→ T[4](x),use p8a in general,n=3

p8c2:subst([n=3],p8a);

p8c2a:lhs(p8c2)=ev(rhs(p8c2),nouns);

p8c2b:lhs(p8c2a)=expand(rhs(p8c2a));

rem : check T[4](x),between trignometry & recurrence relation

is(rhs(p4a)=rhs(p8c2b));

What about relation : between θ & x
------------------------------------------------

→ use : p1

p9a:reverse(p1);

→ apply :acos

Function: acos (x)
    – Arc Cosine. ( math:cos^(-1)((x)))

matchdeclare(bb,true)$

defrule(r2,acos(cos(bb)),bb);

p9b:acos(p9a);

p9c:apply1(p9b,r2);

p9c1:reverse(p9c);

find zero's : T[n+1](x)
=================

p10:T[n+1](x)=0;

p10a:subst([p9c1],p10);

plot :cos(θ)
---------------

menu :Plot

wxplot2d([cos(θ),acos(θ)], [θ,0,14])$

p10b:solve(cos(θ),θ);

declare(kk,integer)$

p10c:subst(p10b,cos((2*kk+1)*θ))=0;

combination: p10a & p10c
==========

p10b:part(lhs(p10a),1)=part(lhs(p10c),1);

p10c:p10b/(n+1);

composition : polynomials n1,n2
-------------------------------------------
T[n1](T[n2](x)) = T[n1*n2](x)

p11a1:expand(T[2](T[3](x)));

p11a2:expand(T[3](T[2](x)));

p11a3:'T[6](x) = T[6](x);

check :{p11a1,p11a2} & p11a3

p11b1:is(p11a1=rhs(p11a3));
p11b2:is(p11a2=rhs(p11a3));

  sum :TT[n](x), chebyshev polynomials(= first kind)
========================================

ceiling :
======

ceiling(2.3);
ceiling(2.5);
ceiling(2.7);

floor :
====

floor(2.3);
floor(2.5);
floor(2.7);

p12:TT[n](x):=sum((-1)^r*n!/((2*r)!*(n-2*r)!)*(1-x^2)^r
           *x^(n-2*r),r,0,floor(n/2));

p12a1:expand(TT[3](x));

p12a2:expand(TT[6](x));

check : against 'p11a3', computation with T[n](x)

p12a3:is(p12a2=rhs(p11a3));

p12b:makelist(expand(TT[n](x)),n,0,4);

same result: T[n](x)

other relation (=complex relations)
==========================

first step : make definition 

p13a1:TTT[n](v):=v(n*θ);

second : operator 'v', analog T[n](x), x = argument =variable

p13a2:TTT[n](cos);

thrid step:Menu →Simplify →Complex simplification →exponentialize

p13a3:exponentialize(p13a2);

fourth step :expand

p13a4:expand(p13a3);

→ Euler equation :

p13a41:exp(%i*θ) = (rectform(exp(%i*θ)));

p13a42:Euleq(n):=exp(%i*n*θ) = (rectform(exp(%i*θ)))^n;

p13a43:Euleq(n);

fifth  step :Euleq();

p13a5:lratsubst([Euleq(n)],part(p13a4,1));
p13a6:lratsubst([Euleq(-n)],part(p13a4,2));

→ result

p13a7:p13a5+p13a6;

Sixth step:use 

→ fundamental equation :trignometry

p13a8:(cos(θ))^2+(sin(θ))^2=1;

→ subst : p9a into 'p13a8'

p13a81:[reverse(p9a)];

→ solve :sin(θ)

p13a82:[solve(p13a8,sin(θ))[2]];

p13a82a:lratsubst(p13a81,p13a82);

→ subst:p13a7 replace,sin(θ),cos(θ)

p13a83:lratsubst([p13a81[1],p13a82a[1]],p13a7);

seventh: use cos(θ)=x,sin(θ)=sqrt(1-x^2)

p14:'TTT[n](cos)=p13a83;

p14a:ev(p14,nouns);

%i : complex : sqrt(-1)

p14b:sqrt(-1);

differentation:TTT[n](cos)
==========

p14c:TTT[n](cos);

→ first differentation   (with respect to θ)

p14c1:'diff(p14c,θ)=diff(p14c,θ);

→ second differentation (with respect  to θ)

p14c2:'diff(p14c,θ,2)=diff(p14c,θ,2);

Chebyshev differential equation(check solution : first kind,T[n](x))
==================================================   
n =integer

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

find : ode2

p15a:ode2(p15,y,x);

find : contrib_ode

load(contrib_ode)$

p15a1:contrib_ode(p15,y,x);

proof : T[n](x) into p15
==================

p15b:subst(y=T[n](x),p15);

p15b1:ev(p15b,diff);/*see :p14c2 */

p15b1a:xthru(p15b1);

problem :verification can be the use , inverse function :asin,acos,atan.....'see above'

TTTT[n](x):=cos(n*acos(x));/*alternative : T[n](x)*/

p15b2:subst([y=TTTT[n](x)],p15);

simplification: see manuel
====================

→ combine , Maxima commands

p15b2a:combine(ev(p15b2,diff));

→ xthru,      Maxima commands, final result of the proof

p15b2b:xthru(ev(p15b2,diff));

→ fundamental equation :trignometry,use :p13a8

find: sin(n*acos(x))
===============

p16a1:[θ = n*acos(x)];

p16a1a:solve(p16a1sin(n*acos(x)),acos(x));

p16a2:subst(p16a1,p13a8);

p16a3:solve(p16a2,sin(n*acos(x)))[2];

p16a4:lhs(p16a3)=subst([p9c],rhs(p16a3));/*TTTT[n](x)*/

rem :p15b2a, get proof also
======================

subst(p16a1a,p15b2a);

subst([p9a],%);/* x=cos(θ) */

ratsimp(%);