Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Legendre polynomials, P n ( x ) , are a system of orthogonal polynomials discovered in 1 7 8 2 by French mathematician Adrien

The Legendre polynomials, Pn(x), are a system of orthogonal polynomials discovered in 1782 by French mathematician Adrien-Marie Legendre. Pn(x) is given by Bonnet's recurrence relation
Pn(x)=2n-1nxPn-1(x)-n-1nPn-2(x)
for real x in the interval -1,1 and integer n>1 with Pn(x)=1 for n=0 and Pn(x)=x for n=1. A plot of Legendre polynomials for n=0 to 5 is shown in the figure below.
Develop a code that computes Pn(x) for values of n from 0 to 5 in an iterative structure that implements the recurrence relation using a recursive function for Pn(x). Observe Pn(x) is a function of Pn-1(x) and Pn-2(x). Thus, define a recursive function
that invokes a call to itself via Pn(n-1,x) and Pn(n-2,x). Print values of Pn(x) in intervals of x=0.5. Example output:
x:,-1.000,-0.500,0.000,0.500,1.000
n=0:,1.000,1.000,1.000,1.000,1.000
n=1:,-1.000,-0.500,0.000,0.500,1.000
n=2:,1.000,-0.125,-0.500,-0.125,1.000
n=3:,-1.000,0.438,-0.000,-0.438,1.000
n=4:,1.000,-0.289,0.375,-0.289,1.000
n=5:,-1.000,-0.090,0.000,0.090,1.000
Use the Matplotlib library to generate the figure above and render your plot within your Jupyter Notebook. Once you have your algorithm working, increase the resolution of your plot by using 100(or more) linearly spaced values for x on the interval -1,1.
"code with python"
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Describe the historical development of humanitarian reform.

Answered: 1 week ago