Question: I am trying to create a plot in python with 1000 individual curves on it. The variables a, b, and c are all needing to

I am trying to create a plot in python with 1000 individual curves on it. The variables a, b, and c are all needing to range from -1 to 1 and I must plot 10 points in that range. The function is psi=asin(pi*x)+bsin(2*pi*x)+csin(3*pi*x). I posted what I have so far. Any help with this would be appreciated!

I am trying to create a plot in python with 1000 individual

1 # importing the required modules 2 import matplotlib.pyplot as plt 3 import numpy as np 4 import math 5 # setting the x - coordinates 7 X = np.arange(0, 100, 1) 8 # setting the other variables 9 a = np.arange( -1, 10, 1) 10 b = np.arange(-1, 10, 1) 11 C = np.arange(-1, 10, P) 6 13 # setting the corresponding y -- coordinates 14 y = a*math.sin(x*3.14)+b*math.sin(2*x*3.14)+c math.sin(3*x*3.14) 15 16 # potting the points 17 plt.plot(x, y) # function to show the plot 20 plt.show() TypeError Traceback (most recent call last) in 12 13 # setting the corresponding y - coordinates --> 14 y = a*math.sin(x*3.14)+b*math.sin(2*x*3.14)+c* math.sin(3*x*3.14) 15 16 # potting the points TypeError: only size-1 arrays can be converted to Python scalars

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!