Question: I have a function w(x), and a) I need to calculate the derivative in each point within [-2,2]. b) I need to plot the derivatives.

I have a function w(x), and

a) I need to calculate the derivative in each point within [-2,2].

b) I need to plot the derivatives.

A solution for a, and b seperately please.

This is what I have currently.

a)

I have a function w(x), and a) I need to calculate the

b)

derivative in each point within [-2,2]. b) I need to plot the

import matplotlib.pyplot as plt import numpy as np def w(x): sum e for i in range(3): sum += np.cos((7**i)*np-pi*x)/(2**i) return sum np.linspace(-2,2,20) dx = x[1]-x[@] y = list(map(W, x)) dydx = np-gradient(y, dx) print(dydx) 1 2 import matplotlib.pyplot as plt import numpy as np 3 4 5 6 7 8 def w(x): sum = 0 for i in range(3): sum += np.cos((7**i)*np.pi*x)/(2**i) return sum 9 10 11 12 1 X = np.linspace(-2,2,100) dx X[1]-x[@] list(map(w, x)) dydx np.gradient(y, dx) 13 = 14 15 O in 17 18 19 20 plt.plot(dydx) plt.ylim([-20,20]) plt.xlabel("X") plt.ylabel("Y") plt.show() import matplotlib.pyplot as plt import numpy as np def w(x): sum e for i in range(3): sum += np.cos((7**i)*np-pi*x)/(2**i) return sum np.linspace(-2,2,20) dx = x[1]-x[@] y = list(map(W, x)) dydx = np-gradient(y, dx) print(dydx) 1 2 import matplotlib.pyplot as plt import numpy as np 3 4 5 6 7 8 def w(x): sum = 0 for i in range(3): sum += np.cos((7**i)*np.pi*x)/(2**i) return sum 9 10 11 12 1 X = np.linspace(-2,2,100) dx X[1]-x[@] list(map(w, x)) dydx np.gradient(y, dx) 13 = 14 15 O in 17 18 19 20 plt.plot(dydx) plt.ylim([-20,20]) plt.xlabel("X") plt.ylabel("Y") plt.show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!