Yesterday I was demonstrating to my calculus class Sage's ability to implement the method of Lagrange multipliers. I used a standard example, putting the following code into SageMath Cell:

var('x,y,l')
f(x,y)=10*x^(1/3)*y^(2/3)
g(x,y)=5*x-6*y
fx=diff(f,x)
fy=diff(f,y)
gx=diff(g,x)
gy=diff(g,y)
solve((fx(x,y)==l*gx(x,y),fy(x,y)==l*gy(x,y),g(x,y)==120),(x,y,l))

That works beautifully. Then I decided to show off Sage's powers by making a little change:

var('x,y,l')
f(x,y)=10*x^(1/3)*y^(2/3)
g(x,y)=5*x^2+6*y
fx=diff(f,x)
fy=diff(f,y)
gx=diff(g,x)
gy=diff(g,y)
solve((fx(x,y)==l*gx(x,y),fy(x,y)==l*gy(x,y),g(x,y)==120),(x,y,l))

SageCell now gives me a spinning symbol ("I'm working") for a while, then seems to exit without any result. On my local installation (Sage 9.2 on Windows) it returns an empty list, [].

What is curious is that the constraint equation 5x^2 + 6y=120 is easily solved for y...

Questions:

1) Shouldn't SageCell output an empty list here?

2) Is this a known limitation of "solve"?

Fernando

PS: It seems that if I add "algorithm='sympy'" then solutions are found.

--
==================================================================
Fernando Q. Gouvea
Carter Professor of Mathematics
Colby College
Mayflower Hill 5836
Waterville, ME 04901    
fqgou...@colby.edu         http://www.colby.edu/~fqgouvea



--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/62540dcf-47c4-4d54-bf35-2a2a8dd13a39%40colby.edu.

Reply via email to