10/30/2022, 12:38 PM
This looks much promising!
In Nov 21 someone proposed to base the computation of iterated sin() on a matrix of Bessel-functions, diagonalize and get iterated sin() as composition of
\( a_1 \sin(x) + a_3 \sin(3x)+a_5 \sin(5x) +... \)
See this link to MSE
Just fiddled a bit with it, using Pari/GP, here some code
Looks very good, I think!
Gottfried
In Nov 21 someone proposed to base the computation of iterated sin() on a matrix of Bessel-functions, diagonalize and get iterated sin() as composition of
\( a_1 \sin(x) + a_3 \sin(3x)+a_5 \sin(5x) +... \)
See this link to MSE
Just fiddled a bit with it, using Pari/GP, here some code
Code:
dpow(D,h) = for(k=1,#D,D[k]=D[k]^h); matdiagonal(D) \\ power of a diagonalmatrix, given only the vector of diagonal entries
MPow(e)=tmpM * dpow(tmpD,e) * tmpW[,1] \\ note: the diagonalization-matrices are to be recalculated if dimension parameter is changed
\\ in the OP in MSE the user needs only column 1 of tmpW
sinit(h,x='x)=my(coeffs); coeffs=2^(h-1)*MPow(h-1);sum(k=1,#coeffs,coeffs[k]*sin((2*k-1)*x))
\\ for further experiments it may be more sensible to keep the "coeffs" as global to better access them when comparing etc
dim=16
M=matrix(dim,dim,r,c,besselj(2*r-1,2*c-1)); \\ define Besselmatrix of size dim x dim
tmpM=mateigen(M);tmpW=tmpM^-1;tmpD=diag(tmpW*M*tmpM) \\ do diagonalization
\\ some tests
[ w1=sinit(3,1) ; s1=sin(sin(sin(1)));s1 - w1]
%372 =
[ 0.678430477361]
[ 0.678430477361]
[1.29470815679 E-23]
[x05=sinit(1/2,1); x1=sinit(1/2,x05) ; s1=sin(1); s1-x1]
%374 =
[ 0.908708429656]
[ 0.841470984758]
[ 0.841470984808]
[5.00517837623 E-11]
\\ ********* Increasing matrixsize ***************
\\ Using dim=32
\\
\\ ... don't forget to recompute matrices!
\\
[ w1=sinit(3,1) ; s1=sin(sin(sin(1)));s1 - w1]
%378 =
[ 0.678430477361]
[ 0.678430477361]
[1.75726847276 E-50]
[x05=sinit(1/2,1); x1=sinit(1/2,x05) ; s1=sin(1); s1-x1]
%380 =
[ 0.908708429743]
[ 0.841470984808]
[ 0.841470984808]
[9.73370904483 E-14]
Looks very good, I think!
Gottfried