Answering part of my question: it seems that sympy and maxima have
different attitudes towards fractional powers of negative numbers, which
may be the source of the problem.
If I change to g(x,y)=x^2+6*y then "solve" has no problem finding
x=2*sqrt(6), y=16.
Fernando
On 11/28/2023 10:36 AM, Fernando Q. Gouvea wrote:
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
[email protected] http://www.colby.edu/~fqgouvea
Let the majority eavesdrop if they like, but their tastes should be
firmly ignored.
-- Dwight Macdonald, in "Masscult & Midcult"
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-support/b9576228-7687-44ca-a81e-eaa0aea02630%40colby.edu.