This question is meant to be answered in Python 3.5. PLEASE ONLY ANSWER IF YOU H
ID: 3785450 • Letter: T
Question
This question is meant to be answered in Python 3.5. PLEASE ONLY ANSWER IF YOU HAVE THE CODE REQUIRED.
The following is the procedure provided. I just need help constructing my python codes to do the following.
Use "import numpy.polynomial.legendre as lpoly" to load the module for working with Legendre polynomials.
1) plot the first 5 legendre polynomials between -1 and +1
2) use "scipy.optimize.brentq" to determine the zeros of the 5th order Legendre polynomial
3) write a function to find zeros using the "secant method" as described in https://en.wikipedia.org/wiki/Secant_method. This is essentially the same as Newton's method, but uses a discrete approximation for the derivative.
4) apply your function to determine the zeros of the 5th order Legendre polynomial
Explanation / Answer
1.) import scipy.special as sp
sp.legendre(2)
poly1d([ 1.5, 0. , -0.5])
sp.legendre(2)(np.linspace(-1,1,5))
2.)
3.)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.