I am new to Python, and am having a problem: I want to write a function (Jacobian) which takes a function and a point as arguments, and returns the jacobian of that function at the given point.
Unsurprisingly, Jacobian relies on NumPy and SciPy. When I call Jacobian from another script, I get either:
- An error that says I cannot import a module into a function (when I have an import statement for NumPy/SciPy in
Jacobian) or - Errors that various NumPy/Scipy functions (e.g.
zeros()) are not defined, (when I omit the import statement to avoid the error mentioned above.
What am I doing wrong?
Also, if someone knows of an implementation of Jacobian, that would be useful as well. There doesn't seem to be one in SciPy.