Re: [sage-support] Re: limitations of "solve"?

2024-01-01 Thread Oscar Benjamin
I did go on to discuss this on the Maxima mailing list:
https://sourceforge.net/p/maxima/mailman/maxima-discuss/thread/CADB8Zm56axVDFXRLbJnxm7xnnbQiixBzg4VX1T91ucj%2B-tuGvA%40mail.gmail.com/#msg58347791

Apparently domain:complex as used by Sage is not a very well tested
configuration of Maxima.

There are most likely other effects besides the documented one about
sqrt(x^2) not simplifying to abs(x):

$ git grep domain src/simp.lisp
src/simp.lisp:(defmvar $limitdomain '$complex)
src/simp.lisp: (cond ((or (and $logexpand (eq $domain '$real))
src/simp.lisp:(cond ((or $numer_pbranch (eq $domain '$complex))
src/simp.lisp: (or (and (eq $domain '$real) (not
(apparently-complex-to-judge-by-$csign-p (cadr gr
src/simp.lisp: (and (eq $domain '$complex)
(apparently-real-to-judge-by-$csign-p (cadr gr)
src/simp.lisp: (or (and (eq $domain '$real) (not
(apparently-complex-to-judge-by-$csign-p (cadr gr
src/simp.lisp: (and (eq $domain '$complex)
(apparently-real-to-judge-by-$csign-p (cadr gr)
src/simp.lisp: (and (eq $domain '$real) $radexpand))
src/simp.lisp:   ((or (eq $domain '$complex) (not $radexpand)) (go up)))
src/simp.lisp:(and (eq $domain '$complex)
src/simp.lisp:(and (eq $domain '$real)
src/simp.lisp:  (eq $domain '$real))
src/simp.lisp: (eq $domain '$real)
src/simp.lisp:   ((and (eq $domain '$real)
src/simp.lisp: (eq $domain '$real)
src/simp.lisp:  (and (eq $domain '$real) (ratnump e) (oddp (caddr e)
src/simp.lisp:   ((eq $domain '$real)

--
Oscar

On Mon, 1 Jan 2024 at 21:55, Nils Bruin  wrote:
>
> The documented effect is usually of most impact:
>
> https://maxima.sourceforge.io/docs/manual/maxima_46.html#index-domain
>
> there may be other undocumented effects, but the one above tends to explain a 
> lot already.
>
> On Sunday 3 December 2023 at 06:26:20 UTC-8 Oscar Benjamin wrote:
>>
>> What does "set domain to complex" mean in terms of Maxima's settings?
>>
>> Maxima's solve seems to compute complex solutions by default:
>>
>> (%i21) solve(x^2 + 1);
>> (%o21) [x = - %i, x = %i]
>>
>> On Sun, 3 Dec 2023 at 13:37, Dima Pasechnik  wrote:
>> >
>> > Yes, Sage modifies the defaults of Maxima, in particular we set domain to 
>> > complex.
>> >
>> > On 3 December 2023 12:28:45 GMT, Oscar Benjamin  
>> > wrote:
>> > >On Wed, 29 Nov 2023 at 12:40, Eric Gourgoulhon  
>> > >wrote:
>> > >>
>> > >> Le mardi 28 novembre 2023 à 18:25:04 UTC+1, kcrisman a écrit :
>> > >>
>> > >> Yes. Maxima's attitude is that the square root of negative one is an 
>> > >> expression which might have multiple values, rather than just picking 
>> > >> one you hope might be consistent over branch points.
>> > >>
>> > >> To enforce Maxima to work in the real domain, avoiding to play too much 
>> > >> with complex square roots, one can add at the beginning of the Sage 
>> > >> session:
>> > >>
>> > >> maxima_calculus.eval("domain: real;")
>> > >>
>> > >> Then the second example in the initial message of this thread yields
>> > >>
>> > >> [[x == 2/5*sqrt(6)*sqrt(5), y == 16, l == 1/9*18750^(1/6)], [x == 
>> > >> -2/5*sqrt(6)*sqrt(5), y == 16, l == -1/9*18750^(1/6)]]
>> > >>
>> > >> instead of an empty list.
>> > >
>> > >When using Maxima (5.45.1) directly I get this result with default 
>> > >settings:
>> > >
>> > >(%i1) f: 10*x^(1/3)*y^(2/3)$
>> > >
>> > >(%i2) g: 5*x^2 + 6*y$
>> > >
>> > >(%i3) solve([diff(f,x)=l*diff(g,x), diff(f,y)=l*diff(g,y), g=120], 
>> > >[x,y,l]);
>> > > 1/6
>> > > 2 sqrt(6) 18750
>> > >(%o3) [[x = -, y = 16, l = ],
>> > > sqrt(5) 9
>> > > 1/6
>> > > 2 sqrt(6) 18750
>> > > [x = - -, y = 16, l = - ]]
>> > > sqrt(5) 9
>> > >
>> > >Does Sage modify some Maxima settings related to this or does it call
>> > >something other than solve?
>> > >
>> > >--
>> > >Oscar
>> > >
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/sage-support/6F4839F2-38B6-40F2-B080-EFCC1C0C3B65%40gmail.com.
>
> --
> 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/454c0dbc-ead3-45c4-9557-fdb2391a9ce9n%40googlegroups.com.

-- 
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...

Re: [sage-support] Re: limitations of "solve"?

2024-01-01 Thread Nils Bruin
The documented effect is usually of most impact:

https://maxima.sourceforge.io/docs/manual/maxima_46.html#index-domain

there may be other undocumented effects, but the one above tends to explain 
a lot already.

On Sunday 3 December 2023 at 06:26:20 UTC-8 Oscar Benjamin wrote:

> What does "set domain to complex" mean in terms of Maxima's settings?
>
> Maxima's solve seems to compute complex solutions by default:
>
> (%i21) solve(x^2 + 1);
> (%o21) [x = - %i, x = %i]
>
> On Sun, 3 Dec 2023 at 13:37, Dima Pasechnik  wrote:
> >
> > Yes, Sage modifies the defaults of Maxima, in particular we set domain 
> to complex.
> >
> > On 3 December 2023 12:28:45 GMT, Oscar Benjamin  
> wrote:
> > >On Wed, 29 Nov 2023 at 12:40, Eric Gourgoulhon  
> wrote:
> > >>
> > >> Le mardi 28 novembre 2023 à 18:25:04 UTC+1, kcrisman a écrit :
> > >>
> > >> Yes. Maxima's attitude is that the square root of negative one is an 
> expression which might have multiple values, rather than just picking one 
> you hope might be consistent over branch points.
> > >>
> > >> To enforce Maxima to work in the real domain, avoiding to play too 
> much with complex square roots, one can add at the beginning of the Sage 
> session:
> > >>
> > >> maxima_calculus.eval("domain: real;")
> > >>
> > >> Then the second example in the initial message of this thread yields
> > >>
> > >> [[x == 2/5*sqrt(6)*sqrt(5), y == 16, l == 1/9*18750^(1/6)], [x == 
> -2/5*sqrt(6)*sqrt(5), y == 16, l == -1/9*18750^(1/6)]]
> > >>
> > >> instead of an empty list.
> > >
> > >When using Maxima (5.45.1) directly I get this result with default 
> settings:
> > >
> > >(%i1) f: 10*x^(1/3)*y^(2/3)$
> > >
> > >(%i2) g: 5*x^2 + 6*y$
> > >
> > >(%i3) solve([diff(f,x)=l*diff(g,x), diff(f,y)=l*diff(g,y), g=120], 
> [x,y,l]);
> > > 1/6
> > > 2 sqrt(6) 18750
> > >(%o3) [[x = -, y = 16, l = ],
> > > sqrt(5) 9
> > > 1/6
> > > 2 sqrt(6) 18750
> > > [x = - -, y = 16, l = - ]]
> > > sqrt(5) 9
> > >
> > >Does Sage modify some Maxima settings related to this or does it call
> > >something other than solve?
> > >
> > >--
> > >Oscar
> > >
> >
> > --
> > 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...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/6F4839F2-38B6-40F2-B080-EFCC1C0C3B65%40gmail.com
> .
>

-- 
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/454c0dbc-ead3-45c4-9557-fdb2391a9ce9n%40googlegroups.com.


Re: [sage-support] Re: limitations of "solve"?

2023-12-03 Thread Oscar Benjamin
What does "set domain to complex" mean in terms of Maxima's settings?

Maxima's solve seems to compute complex solutions by default:

(%i21) solve(x^2 + 1);
(%o21)[x = - %i, x = %i]

On Sun, 3 Dec 2023 at 13:37, Dima Pasechnik  wrote:
>
> Yes, Sage modifies the defaults of Maxima, in particular we set domain to 
> complex.
>
> On 3 December 2023 12:28:45 GMT, Oscar Benjamin  
> wrote:
> >On Wed, 29 Nov 2023 at 12:40, Eric Gourgoulhon  
> >wrote:
> >>
> >> Le mardi 28 novembre 2023 à 18:25:04 UTC+1, kcrisman a écrit :
> >>
> >> Yes.  Maxima's attitude is that the square root of negative one is an 
> >> expression which might have multiple values, rather than just picking one 
> >> you hope might be consistent over branch points.
> >>
> >> To enforce Maxima to work in the real domain, avoiding to play too much 
> >> with complex square roots, one can add at the beginning of the Sage 
> >> session:
> >>
> >> maxima_calculus.eval("domain: real;")
> >>
> >> Then the second example in the initial message of this thread yields
> >>
> >> [[x == 2/5*sqrt(6)*sqrt(5), y == 16, l == 1/9*18750^(1/6)], [x == 
> >> -2/5*sqrt(6)*sqrt(5), y == 16, l == -1/9*18750^(1/6)]]
> >>
> >> instead of an empty list.
> >
> >When using Maxima (5.45.1) directly I get this result with default settings:
> >
> >(%i1) f: 10*x^(1/3)*y^(2/3)$
> >
> >(%i2) g: 5*x^2 + 6*y$
> >
> >(%i3) solve([diff(f,x)=l*diff(g,x), diff(f,y)=l*diff(g,y), g=120], [x,y,l]);
> >1/6
> >2 sqrt(6)  18750
> >(%o3) [[x = -, y = 16, l = ],
> > sqrt(5)  9
> >  1/6
> >2 sqrt(6)18750
> > [x = - -, y = 16, l = - 
> > ]]
> > sqrt(5)9
> >
> >Does Sage modify some Maxima settings related to this or does it call
> >something other than solve?
> >
> >--
> >Oscar
> >
>
> --
> 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/6F4839F2-38B6-40F2-B080-EFCC1C0C3B65%40gmail.com.

-- 
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/CAHVvXxQpSk-UpbgHEZ0dVaPFRcZ79SV0_vgC1Y%3DdGM_32T2KgA%40mail.gmail.com.


Re: [sage-support] Re: limitations of "solve"?

2023-12-03 Thread Oscar Benjamin
Oh, I see:

(%i23) domain: complex
;
(%o23)  complex
(%i24) f: 10*x^(1/3)*y^(2/3)$

(%i25) g: 5*x^2 + 6*y$

(%i26) solve([diff(f,x)=l*diff(g,x), diff(f,y)=l*diff(g,y), g=120], [x,y,l]);
(%o26)[]

On Sun, 3 Dec 2023 at 14:20, Oscar Benjamin  wrote:
>
> What does "set domain to complex" mean in terms of Maxima's settings?
>
> Maxima's solve seems to compute complex solutions by default:
>
> (%i21) solve(x^2 + 1);
> (%o21)[x = - %i, x = %i]
>
> On Sun, 3 Dec 2023 at 13:37, Dima Pasechnik  wrote:
> >
> > Yes, Sage modifies the defaults of Maxima, in particular we set domain to 
> > complex.
> >
> > On 3 December 2023 12:28:45 GMT, Oscar Benjamin 
> >  wrote:
> > >On Wed, 29 Nov 2023 at 12:40, Eric Gourgoulhon  
> > >wrote:
> > >>
> > >> Le mardi 28 novembre 2023 à 18:25:04 UTC+1, kcrisman a écrit :
> > >>
> > >> Yes.  Maxima's attitude is that the square root of negative one is an 
> > >> expression which might have multiple values, rather than just picking 
> > >> one you hope might be consistent over branch points.
> > >>
> > >> To enforce Maxima to work in the real domain, avoiding to play too much 
> > >> with complex square roots, one can add at the beginning of the Sage 
> > >> session:
> > >>
> > >> maxima_calculus.eval("domain: real;")
> > >>
> > >> Then the second example in the initial message of this thread yields
> > >>
> > >> [[x == 2/5*sqrt(6)*sqrt(5), y == 16, l == 1/9*18750^(1/6)], [x == 
> > >> -2/5*sqrt(6)*sqrt(5), y == 16, l == -1/9*18750^(1/6)]]
> > >>
> > >> instead of an empty list.
> > >
> > >When using Maxima (5.45.1) directly I get this result with default 
> > >settings:
> > >
> > >(%i1) f: 10*x^(1/3)*y^(2/3)$
> > >
> > >(%i2) g: 5*x^2 + 6*y$
> > >
> > >(%i3) solve([diff(f,x)=l*diff(g,x), diff(f,y)=l*diff(g,y), g=120], 
> > >[x,y,l]);
> > >1/6
> > >2 sqrt(6)  18750
> > >(%o3) [[x = -, y = 16, l = ],
> > > sqrt(5)  9
> > >  
> > > 1/6
> > >2 sqrt(6)18750
> > > [x = - -, y = 16, l = - 
> > > ]]
> > > sqrt(5)9
> > >
> > >Does Sage modify some Maxima settings related to this or does it call
> > >something other than solve?
> > >
> > >--
> > >Oscar
> > >
> >
> > --
> > 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/6F4839F2-38B6-40F2-B080-EFCC1C0C3B65%40gmail.com.

-- 
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/CAHVvXxRL812Rsnw-OnOH8n%2B5tDJXy8%3DsuOepRar9tBUnEtm27A%40mail.gmail.com.


Re: [sage-support] Re: limitations of "solve"?

2023-12-03 Thread Fernando Gouvea

Is there a way to change the default when calling "solve"?

Fernando

On 12/3/2023 8:37 AM, Dima Pasechnik wrote:

Yes, Sage modifies the defaults of Maxima, in particular we set domain to 
complex.

On 3 December 2023 12:28:45 GMT, Oscar Benjamin  
wrote:

On Wed, 29 Nov 2023 at 12:40, Eric Gourgoulhon  wrote:

Le mardi 28 novembre 2023 à 18:25:04 UTC+1, kcrisman a écrit :

Yes.  Maxima's attitude is that the square root of negative one is an 
expression which might have multiple values, rather than just picking one you 
hope might be consistent over branch points.

To enforce Maxima to work in the real domain, avoiding to play too much with 
complex square roots, one can add at the beginning of the Sage session:

maxima_calculus.eval("domain: real;")

Then the second example in the initial message of this thread yields

[[x == 2/5*sqrt(6)*sqrt(5), y == 16, l == 1/9*18750^(1/6)], [x == 
-2/5*sqrt(6)*sqrt(5), y == 16, l == -1/9*18750^(1/6)]]

instead of an empty list.

When using Maxima (5.45.1) directly I get this result with default settings:

(%i1) f: 10*x^(1/3)*y^(2/3)$

(%i2) g: 5*x^2 + 6*y$

(%i3) solve([diff(f,x)=l*diff(g,x), diff(f,y)=l*diff(g,y), g=120], [x,y,l]);
1/6
2 sqrt(6)  18750
(%o3) [[x = -, y = 16, l = ],
 sqrt(5)  9
  1/6
2 sqrt(6)18750
 [x = - -, y = 16, l = - ]]
 sqrt(5)9

Does Sage modify some Maxima settings related to this or does it call
something other than solve?

--
Oscar


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

Mother Nature -- unlike Ivy League admissions committees --
doesn't like suck-ups.
  -- David Brooks, The New York Times, 4/24/2005

--
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/b2e8c972-3127-47a4-8187-a5a16cf3f712%40colby.edu.


Re: [sage-support] Re: limitations of "solve"?

2023-12-03 Thread Dima Pasechnik
Yes, Sage modifies the defaults of Maxima, in particular we set domain to 
complex.

On 3 December 2023 12:28:45 GMT, Oscar Benjamin  
wrote:
>On Wed, 29 Nov 2023 at 12:40, Eric Gourgoulhon  wrote:
>>
>> Le mardi 28 novembre 2023 à 18:25:04 UTC+1, kcrisman a écrit :
>>
>> Yes.  Maxima's attitude is that the square root of negative one is an 
>> expression which might have multiple values, rather than just picking one 
>> you hope might be consistent over branch points.
>>
>> To enforce Maxima to work in the real domain, avoiding to play too much with 
>> complex square roots, one can add at the beginning of the Sage session:
>>
>> maxima_calculus.eval("domain: real;")
>>
>> Then the second example in the initial message of this thread yields
>>
>> [[x == 2/5*sqrt(6)*sqrt(5), y == 16, l == 1/9*18750^(1/6)], [x == 
>> -2/5*sqrt(6)*sqrt(5), y == 16, l == -1/9*18750^(1/6)]]
>>
>> instead of an empty list.
>
>When using Maxima (5.45.1) directly I get this result with default settings:
>
>(%i1) f: 10*x^(1/3)*y^(2/3)$
>
>(%i2) g: 5*x^2 + 6*y$
>
>(%i3) solve([diff(f,x)=l*diff(g,x), diff(f,y)=l*diff(g,y), g=120], [x,y,l]);
>1/6
>2 sqrt(6)  18750
>(%o3) [[x = -, y = 16, l = ],
> sqrt(5)  9
>  1/6
>2 sqrt(6)18750
> [x = - -, y = 16, l = - ]]
> sqrt(5)9
>
>Does Sage modify some Maxima settings related to this or does it call
>something other than solve?
>
>--
>Oscar
>

-- 
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/6F4839F2-38B6-40F2-B080-EFCC1C0C3B65%40gmail.com.


Re: [sage-support] Re: limitations of "solve"?

2023-12-03 Thread Oscar Benjamin
On Wed, 29 Nov 2023 at 12:40, Eric Gourgoulhon  wrote:
>
> Le mardi 28 novembre 2023 à 18:25:04 UTC+1, kcrisman a écrit :
>
> Yes.  Maxima's attitude is that the square root of negative one is an 
> expression which might have multiple values, rather than just picking one you 
> hope might be consistent over branch points.
>
> To enforce Maxima to work in the real domain, avoiding to play too much with 
> complex square roots, one can add at the beginning of the Sage session:
>
> maxima_calculus.eval("domain: real;")
>
> Then the second example in the initial message of this thread yields
>
> [[x == 2/5*sqrt(6)*sqrt(5), y == 16, l == 1/9*18750^(1/6)], [x == 
> -2/5*sqrt(6)*sqrt(5), y == 16, l == -1/9*18750^(1/6)]]
>
> instead of an empty list.

When using Maxima (5.45.1) directly I get this result with default settings:

(%i1) f: 10*x^(1/3)*y^(2/3)$

(%i2) g: 5*x^2 + 6*y$

(%i3) solve([diff(f,x)=l*diff(g,x), diff(f,y)=l*diff(g,y), g=120], [x,y,l]);
1/6
2 sqrt(6)  18750
(%o3) [[x = -, y = 16, l = ],
 sqrt(5)  9
  1/6
2 sqrt(6)18750
 [x = - -, y = 16, l = - ]]
 sqrt(5)9

Does Sage modify some Maxima settings related to this or does it call
something other than solve?

--
Oscar

-- 
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/CAHVvXxToSwyc4iY3tnrXaMd1T8mp%3D5%2BOFW95kyAe5YEkM-PGrA%40mail.gmail.com.


Re: [sage-support] Re: limitations of "solve"?

2023-11-29 Thread kcrisman


I wouldn't mind seeing those discussions if you have a link to send 
(perhaps only to me). 


A relatively recent one (mentioning Eric's workaround) is 
https://groups.google.com/g/sage-devel/c/h50LZVLVQI4/m/AieyOKHVAQAJ  

(Note that there were at times separate problems with the "abs_integrate" 
and "to_poly_solve" Maxima packages, though these sometimes overlapped. 
 And sometimes we may have used them not as intended.)

-- 
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/d1a26eb0-93ec-4032-8278-cb0f60637bcen%40googlegroups.com.


Re: [sage-support] Re: limitations of "solve"?

2023-11-28 Thread Oscar Benjamin
On Tue, 28 Nov 2023 at 17:25, kcrisman  wrote:
>
> 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.
>
> Yes.  Maxima's attitude is that the square root of negative one is an 
> expression which might have multiple values, rather than just picking one you 
> hope might be consistent over branch points.   (There are very long 
> discussions on this list about this from years ago, which I will spare you by 
> not linking to any of them.)  I would not be surprised if that came up here.

I wouldn't mind seeing those discussions if you have a link to send
(perhaps only to me).

--
Oscar

-- 
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/CAHVvXxQKe1HvcD%2BYL3CHTpyH7s2K_LeEEq6Z-wJKjAmYjw5jGQ%40mail.gmail.com.


Re: [sage-support] Re: limitations of "solve"?

2023-11-28 Thread Dima Pasechnik
one should not be using sagecell.sagemath.org server for teaching, it's not 
scaling well (compared to cocalc.com, say) under load.

unleashing undergraduates to compute on it surely gets things very slow there 

On 28 November 2023 15:45:33 GMT, Eric Gourgoulhon  
wrote:
>Hi, 
>
>I've also noticed two days ago that https://sagecell.sagemath.org/ is very 
>slow (actually does not terminate) even on elementary operations. 
>Maybe there is a problem with the server at the moment...
>
>Eric. 
>
>Le mardi 28 novembre 2023 à 16:36:30 UTC+1, Fernando Q. Gouvea a écrit :
>
>> 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 
>> fqgo...@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/8f554c04-42d9-4765-bd3a-a82bd2758bddn%40googlegroups.com.

-- 
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/FA17F134-394F-46B4-814B-0A75072F01F3%40gmail.com.