[SciPy-User] optimize.minimize - help me understand arrays as variables
Daπid
davidmenhur at gmail.com
Thu Jan 15 10:45:26 EST 2015
On 15 January 2015 at 16:00, KURT PETERS <peterskurt at msn.com> wrote:
> Geordie,
> I don't think that's the case. Everything I've ever learned about the
> Jacobian is that it's the partials of each function with respect to each
> variable... so two equations with two unknowns, would yield a 2x2.
Ah, but for a minimisation problem you can only have one equation. You
can't take the minimum of a vector function, because you can't say one
vector is smaller than the other (or, in other words, there are many
possible definitions of smaller, and you have to choose). |R^n is not
ordered.
In your case, your function to be minimised returns
np.linalg.norm(f3d), that is, a single number, f(\vec x). Therefore,
the jacobian is a vector: [d f(\vec x)/d x_0, d f(\vec x)/d x_1, d
f(\vec x)/d x_2].
I believe your results are incorrect because how you are defining f3d:
f3d = np.ones((np.max([3,N]),1)
There is no need for the extra dimension, just
f3d = np.ones(max(3, N))
And do the assignments to f3d[row]
/David.
More information about the SciPy-User
mailing list