Using python
2. Make a plot of the function in Question 1 for E-4, 4] Show transcribed image text 2. Make a plot of the function in Question 1 for E-4, 4]
Answer
import matplotlib.pyplotas plt
import numpy as np
import math
# Ques 1 solution
# generate equally spaced 41 points between -4 and 4
x =np.linspace( –4, 4 , num = 41)
# Ques 2 solution
# list to store corresponding h(x) for x
h = []
# calculate the list y
for i inrange(0 ,len(x)):
# calculate (x)
h_x =math.exp(–x[i]* x[i]/ 2
OR
OR