Write a python procedure to approximate gaussian function

Assignment Help Computer Engineering
Reference no: EM132212262

Question :

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()

Reference no: EM132212262

Questions Cloud

Calculate the sum of consecutive integers from the lowest : Write pseudocode to calculate the SUM of consecutive integers from the lowest, L, through the highest, H, but without exceeding 100.
How can exponential growth curves be used : How can exponential growth curves be used to predict bank account balances Needs to have graphs, math equations and math workout along with detailed explanation
Write the pseudocode for a function that takes an input of n : Write the pseudocode for a function that takes an input of a n by m binary matrix, and outputs the perfect phylogeny tree, if it exists.
What is the amount of federal income tax : Sergio is single, is paid $2750 per week, and clams to withholding allowance. What is the amount of federal income tax withheld from Sergios gross wages.
Write a python procedure to approximate gaussian function : Write a Python procedure to approximate the Gaussian function exp(-(x/3)2 ) in the range -8 ? +8 using Chebyshev polynomials.
Discuss the potential tax benefits for someone earning : Jake while talking to a friend (Max) at a party is informed about a topic called “negative gearing”. Tax advantages were discussed so Jake is seeking.
Create a valid html web page in the csc344 directory : Write a Python program that collects, summarizes, and e-mails all the programming assignments for this course.
Bring out the scope planning concepts : Summarise what each paper is about and how the two papers interrelate with each other, in matters of scope planning - Describe briefly the inferred scope
Ask user for the mortgage amount he wishes to borrow : Ask user for the mortgage amount (amount) he wishes to borrow, number of years (years) to clear the loan, the annual interest rate (rate).

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd