function minimize cannot solve Lagrange Multipliers problem.
I've tried all sorts of initial conditions but this just won't converge. It is an easy Lagrange multipliers problem.
var("y z L")
F(x, y, z, L) = (x-3)^2 + (y-1)^2 + (z + 1)^2 + L*(x^2 + y^2 + z^2 - 4)
minimize(F, [4, 3, 2, 1], algorithm='ncg' )
Any thoughts? Are there ways of forcing it to use more iterations, or something??
It appears to have worked for me in SMC. Here is the output: Optimization terminated successfully. Current function value: 2.032982 Iterations: 3 Function evaluations: 57 Gradient evaluations: 3 Hessian evaluations: 3 (1.48641364243, 0.860982992316, 0.536302359521, 0.251059261969)
When I input the second line I get SyntaxError. With plus signs inserted I also get the succesful result. This is Sage-6.3beta5. SMC is Sage-6.2. Which version is your question about?
rws, I'm not sure where the plus signs went. They definitely belong. It must have been an error during cut-and-paste. I was using the Sage Single-Cell Server.
calc314, I'm sorry, but that's not correct. See where it says "Current function value: 2.032982"? That should be zero. Also, it does not match the symbolic solution at all. Perhaps this is a bug, and minimize should give an error message, since the minimum wasn't reached?