Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-25 Thread Michael Orlitzky
On 05/24/2016 10:14 PM, Vincent Delecroix wrote: >> >> What about sqrt(2*x^16 + 10*x^11 - 9*x^10 + x^7 + x^4 - 17*x^2 - x)? >> > > What is the problem with this expression? It is very easy to decide the > sign of any polynomial expression in one variable on any given interval. But how much comput

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Vincent Delecroix
On 24/05/16 20:05, Michael Orlitzky wrote: On 05/24/2016 10:20 AM, Vincent Delecroix wrote: The above is coherent. But I would prefer if simplify_real would raise an error if some argument of sqrt has a chance to be < 0. What about sqrt(2*x^16 + 10*x^11 - 9*x^10 + x^7 + x^4 - 17*x^2 - x)?

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Michael Orlitzky
On 05/24/2016 10:20 AM, Vincent Delecroix wrote: > > The above is coherent. But I would prefer if simplify_real would raise > an error if some argument of sqrt has a chance to be < 0. > What about sqrt(2*x^16 + 10*x^11 - 9*x^10 + x^7 + x^4 - 17*x^2 - x)? -- You received this message because y

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Vincent Delecroix
On 24/05/16 09:13, Eric Gourgoulhon wrote: Le mardi 24 mai 2016 16:03:55 UTC+2, Michael Orlitzky a écrit : If you're sure that every expression involved is real, that's still the correct answer, because x == 0. If sqrt(x) or sqrt(-x) might not be real, you're going to get nonsense calling

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Eric Gourgoulhon
Le mardi 24 mai 2016 16:03:55 UTC+2, Michael Orlitzky a écrit : > > > If you're sure that every expression involved is real, that's still the > correct answer, because x == 0. If sqrt(x) or sqrt(-x) might not be > real, you're going to get nonsense calling simplify_real() on them. > > Yes, I t

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Michael Orlitzky
On 05/24/2016 09:55 AM, Vincent Delecroix wrote: > Well > > sage: (sqrt(-x) * sqrt(x) * sqrt(-x) * sqrt(x)).simplify_real() > -x^2 > If you're sure that every expression involved is real, that's still the correct answer, because x == 0. If sqrt(x) or sqrt(-x) might not be real, you're going to g

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Vincent Delecroix
Well sage: (sqrt(-x) * sqrt(x) * sqrt(-x) * sqrt(x)).simplify_real() -x^2 Vincent On 24/05/16 08:13, Eric Gourgoulhon wrote: Le mardi 24 mai 2016 14:21:23 UTC+2, vdelecroix a écrit : Hi Eric, Thanks for sharing the `simplify_real`! However, I am not happy with this solution either. The m

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Eric Gourgoulhon
Le mardi 24 mai 2016 14:21:23 UTC+2, vdelecroix a écrit : > > Hi Eric, > > Thanks for sharing the `simplify_real`! > > However, I am not happy with this solution either. The method > simplify_real never checks the domain of functions. This is a complete > nonsense. > > sage: (sqrt(-x) * sqrt

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Vincent Delecroix
Hi Eric, Thanks for sharing the `simplify_real`! However, I am not happy with this solution either. The method simplify_real never checks the domain of functions. This is a complete nonsense. sage: (sqrt(-x) * sqrt(-x)).simplify_real() -x I would like simplify to do the following - if ther

[sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-24 Thread Eric Gourgoulhon
Hi Vincent, Note that with your assumptions, invoking simplify_real() does the job: sage: bool((sqrt(x) * sqrt(y) == sqrt(x*y)).simplify_real()) True This is because sage: sqrt(x*y).simplify_real() sqrt(x)*sqrt(y) Best regards, Eric. -- You received this message because you are subscribed

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-17 Thread Nils Bruin
On Tuesday, May 17, 2016 at 2:36:45 PM UTC-7, vdelecroix wrote: > > Nice! Thanks Nils. What about introducing the following scheme in all > relevant functions > > {{{ > if all variables are real: > turn maxima in real domain > > do what has to be done > > if all variables are real: >

Re: [sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-17 Thread Vincent Delecroix
On 17/05/16 16:26, Nils Bruin wrote: On Tuesday, May 17, 2016 at 1:27:40 PM UTC-7, vdelecroix wrote: Is there a way to let Sage knows about sqrt(xy) = sqrt(x) sqrt(y) in the case x and y real positive? Vincent Perhaps this is cheating: sage: maxima_calculus("domain:real") real sage: var("

[sage-support] Re: sqrt(x) * sqrt(y) versus sqrt(xy)

2016-05-17 Thread Nils Bruin
On Tuesday, May 17, 2016 at 1:27:40 PM UTC-7, vdelecroix wrote: > > Is there a way to let Sage knows about sqrt(xy) = sqrt(x) sqrt(y) in the > case x and y real positive? > > Vincent Perhaps this is cheating: sage: maxima_calculus("domain:real") real sage: var("x,y"); sage: bool(sqrt(x)*sqr