SM-5-Exercise2

4134 days ago by dmanna

#Generating Function of the m-point Strodt polynomials x,t=var('x,t') def mptStGF(m,x,t): Q=0 for j in range(m): Q=Q+exp(j*t/(m-1)) return m*exp(x*t)/Q 
       
#Pulls the nth m-point Strodt Polynomial from its generating function def P(m,n,x): f=taylor(mptStGF(m,x,t),t,0,n) out=f.coefficient(t^n)*factorial(n) if n==0: out=1 return out 
       
#List of first few 2-pt Strodt polynomials for n in range(11): P(2,n,x) 
       
1
x - 1/2
x^2 - x
x^3 - 3/2*x^2 + 1/4
x^4 - 2*x^3 + x
x^5 - 5/2*x^4 + 5/2*x^2 - 1/2
x^6 - 3*x^5 + 5*x^3 - 3*x
x^7 - 7/2*x^6 + 35/4*x^4 - 21/2*x^2 + 17/8
x^8 - 4*x^7 + 14*x^5 - 28*x^3 + 17*x
x^9 - 9/2*x^8 + 21*x^6 - 63*x^4 + 153/2*x^2 - 31/2
x^10 - 5*x^9 + 30*x^7 - 126*x^5 + 255*x^3 - 155*x
1
x - 1/2
x^2 - x
x^3 - 3/2*x^2 + 1/4
x^4 - 2*x^3 + x
x^5 - 5/2*x^4 + 5/2*x^2 - 1/2
x^6 - 3*x^5 + 5*x^3 - 3*x
x^7 - 7/2*x^6 + 35/4*x^4 - 21/2*x^2 + 17/8
x^8 - 4*x^7 + 14*x^5 - 28*x^3 + 17*x
x^9 - 9/2*x^8 + 21*x^6 - 63*x^4 + 153/2*x^2 - 31/2
x^10 - 5*x^9 + 30*x^7 - 126*x^5 + 255*x^3 - 155*x
#The next plots show asymptotic (in n) to trig functions plot(P(2,20,x),xmin=-5,xmax=5,ymin=-10^9,ymax=10^9) 
       
plot(P(2,40,x),xmin=-5,xmax=5,ymin=-2*10^28,ymax=2*10^28) 
       
plot(P(3,20,x),xmin=-5,xmax=5,ymin=-10^7,ymax=10^7) 
       
#PlotScaledRoots returns a plot of the roots of the (scaled) m-pt Strodt poly #Note: If the polynomials were not squarefree, this program would loop forever #Note: There is no particular reason for the color and size of the points from sage.rings.polynomial.complex_roots import complex_roots def PlotScaledRootsP(m,n): L=len(complex_roots(P(m,n,n*x),skip_squarefree=True)) l=[] for j in range(L): l.append((real(complex_roots(P(m,n,n*x),skip_squarefree=True)[j][0]).center(), imaginary(complex_roots(P(m,n,n*x),skip_squarefree=True)[j][0]).center())) return point(l,rgbcolor=hue(1),size=30) 
       
#In the next few lines, we look at roots of the 2 and 3-point Strodt polynomials #Note: I'm not really sure why this takes so long to evaluate PlotScaledRootsP(2,20) 
       
PlotScaledRootsP(2,25) 
       
PlotScaledRootsP(3,25)