Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python procedure to approximate the Gaussian function exp(-(x/3)^2 ) in the range -8 +8 using Chebyshev polynomials The Chebyshev module is as follows:

image text in transcribed

Write a Python procedure to approximate the Gaussian function exp(-(x/3)^2 ) in the range -8 +8 using Chebyshev polynomials The Chebyshev module is as follows:

import numpy as np import matplotlib.pyplot as plt

def chebyshev(x,n): x2 = x**2 if n == 0: return x*0.+1.0 elif n == 1: return x elif n == 2: return 2*x2 - 1.0 elif n ==3: return (4*x2-3)*x elif n == 4: return (8*x2 - 8)*x2 + 1.0 elif n == 5: return ((16*x2 -20)*x2 + 5)*x elif n == 6: return ((32*x2-48)*x2 + 18)*x2 - 1 elif n == 7: return (((64*x2 - 112)*x2 + 56)*x2 -7)*x elif n == 8: return (((128*x2 - 256)*x2 + 160)*x2 -32)*x2 + 1 elif n == 9: return ((((256*x2 - 576)*x2 + 432)*x2 - 120)*x2 + 9)*x elif n == 10: return ((((512*x2 - 1280)*x2 + 1120)*x2 - 400)*x2 + 50)*x2 - 1.0 elif n == 11: return (((((1024*x2 - 2816)*x2 + 2816)*x2 - 1232)*x2 + 220)*x2 -11)*x else: print( "Chebyshev order must be in range 0..11 value give is ") exit() if __name__ == '__main__': x = np.linspace(-1,1.0,100) plt.figure(1) for i in range(12): a = chebyshev(x,i) plt.plot(x,a) plt.show()

Write a Python procedure to approximate the Gaussian function exp(-(x/302) in the range -8 +8 using Chebyshev polynomials Chebyshev polynomials are used in the range -1 1 and are a set of orthogonal polynomials Tnex) that obey the orthogonality equation: 0 n m dx 12 n m o Proceed as follows: You need to express the Gaussian as -(x/3 (x) n In n -0 In order to find the wn you will need to (numerically?) integrate the function over the space and, using the orthogonality condition extract the wn. There is a module which explicitly identifies the Chebyshev polynomials up to order 12, It's not as fast as the library routine, but it is clearer. What is the best approximation that you can obtain using the Chebyshev polynomials given and what is the maximum error in the range? You should also plot the function and its approximation for your own satisfaction. Write a Python procedure to approximate the Gaussian function exp(-(x/302) in the range -8 +8 using Chebyshev polynomials Chebyshev polynomials are used in the range -1 1 and are a set of orthogonal polynomials Tnex) that obey the orthogonality equation: 0 n m dx 12 n m o Proceed as follows: You need to express the Gaussian as -(x/3 (x) n In n -0 In order to find the wn you will need to (numerically?) integrate the function over the space and, using the orthogonality condition extract the wn. There is a module which explicitly identifies the Chebyshev polynomials up to order 12, It's not as fast as the library routine, but it is clearer. What is the best approximation that you can obtain using the Chebyshev polynomials given and what is the maximum error in the range? You should also plot the function and its approximation for your own satisfaction

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

Students also viewed these Databases questions