[SciPy-User] Solve an arbitrary function
nicky van foreest
Fri Jul 31 02:19:21 CDT 2009
If you like a graphical approach you might give PyX a try, and have
postscript solve your problem:
2009/7/31 Robert Kern <email@example.com>:
> On Thu, Jul 30, 2009 at 23:03, Permafacture<firstname.lastname@example.org> wrote:
>> I'm new to this package, and am used to mathematica.
>> I've been reading through the tutorials and numpy lists of functions,
>> yet i cannot find the answer to this, though it would be trivial in
>> mathematica. Can someone show me an example of how to find the
>> intersection of a line and a polynomial?
>> for instance: y1=x1^2, y2=x2+1
>> Solving a system of linear equations is pretty straight forward, but
>> it isn't clear to me how to approach this in scipy. The most general
>> approach to this would probably be the most useful to me.
What would be the best place to document examples such as Robert's
below? I am afraid such examples get burried in the mailing list while
they are great examples of how to use fsolve, for instance.
> In : from scipy.optimize import fsolve
> In : import numpy as np
> In : def f(xy):
> ...: x, y = xy
> ...: z = np.array([y - x**2, y - x - 1.0])
> ...: return z
> In : fsolve(f, [1.0, 2.0])
> Out: array([ 1.61803399, 2.61803399])
> In : fsolve(f, [-0.5, 1.5])
> Out: array([-0.61803399, 0.38196601])
> Robert Kern
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
> -- Umberto Eco
> SciPy-User mailing list
More information about the SciPy-User