[SciPy-user] plot curve of a series of equations
Bevan Jenkins
bevan.jenkins@ew.govt...
Thu Apr 23 15:26:56 CDT 2009
Thanks Gary,
Gary Ruben <gruben <at> bigpond.net.au> writes:
>
> Like this? This basically just what you said, so I'm not sure what your
> exact question is. Is it just the use of eval that you weren't clear on?
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> eqs = [
> ['24 + 18.75*x + 4.79616e-013*x**2 + 31.25*x**3', 7.800, 7.600],
> ['28 + 22.5*x + 5.68434e-013*x**2 + 0*x**3', 8.000, 7.800],
> ]
>
> for i in eqs:
> xr = np.linspace(i[2], i[1], 10)
> x = xr - i[2]
> y = eval(i[0])
> plt.plot(xr,y)
> plt.show()
>
> Gary R.
Yes that is what I am looking for. Sorry if I wasn't clear but maybe i didn't
have it clear in my head. Eval is new to me but also combing the upper limits,
lower limits and equations into the one variable is mcuh tidier than what I
had in mind. I was thinking of
for i in eqs:
but then struggling to get the approriate limits.
Thanks,
Bevan
More information about the SciPy-user
mailing list