I have the following code:
def f(x):
return x
def g(x):
return x*x
from math import sqrt
def h(x):
return sqrt(x)
def i(x):
return -x
def j(x):
return -x*x
def k(x):
return -sqrt(x)
functions = [f, g, h, i, j, k]
And now I'm trying to plot these functions.
I tried
plt.plot(f(x), g(x), h(x))
but I get the following error:
TypeError: only length-1 arrays can be converted to Python scalars
I figure this is because I'm using the square root which has two solutions. But really, I'm trying to do something like:
plt.plot(*functions)
Any advice?
