Hi Martin,

I can't imagine that such a change in the result is intended behaviour
of a simplify action. If it is, one should either stay away from it if
one is planning to do any numeric calculations or understand when to
use it and when not. I'm still struggling with that.

I am much more fond of the FullSimplify[] command in Mathematica:

In[32]:= Remove["Global`*"]

In[33]:= FullSimplify[(Sqrt[-zr^2 + 2*ys*zr + (2*cz - zr)^2 -
      2*ys*(2*cz - zr)] + 2*zr - 2*cz)/(2*zr - 2*cz)]

Out[33]= -((-cz + Sqrt[(cz - ys) (cz - zr)] + zr)/(cz - zr))

In[34]:= cz = 10
ys = 5
zr = 4


Out[34]= 10

Out[35]= 5

Out[36]= 4

In[37]:= N[(Sqrt[-zr^2 + 2*ys*zr + (2*cz - zr)^2 -
      2*ys*(2*cz - zr)] + 2*zr - 2*cz)/(2*zr - 2*cz)]
N[-((-cz + Sqrt[(cz - ys) (cz - zr)] + zr)/(cz - zr))]

Out[37]= 0.0871291

Out[38]= 0.0871291

Here, the equation simplifies to something that produces the same
result no matter what values I choose for the variables. That is, I
have only tried real numbers.
Anyway, simplify_full() should at least warn the user of possible
ambiguities, otherwise it can lead to undesired behaviour at the end
of the line.
See the thread I mentioned in the previous email to find an error
caused by simplify_full() even if I make the required assumptions and
stick to real numbers.

Sorry about the lengthy email, but I have seen numerous threads about
simplifying equations in the recent past, so I think these issues
should be discussed.

Cheers,
Stan

On Mar 9, 9:43 pm, Martin Rubey <martin.ru...@math.uni-hannover.de>
wrote:
> Maurizio <maurizio.gran...@gmail.com> writes:
> > What is the reason to have such a bugged function?
>
> I wouldn't consider
>
> > > sage: var('omgo zr ys cz')
> > > (omgo, zr, ys, cz)
> > > sage: omgo = (sqrt(-zr^2 + 2*ys*zr + (2*cz - zr)^2 - 2*ys*(2*cz - zr))
> > > + 2*zr- 2*cz)/(2*zr - 2*cz)
> > > sage: omgo.simplify_full()
> > > (I*sqrt(cz - ys)*sqrt(zr - cz) + zr - cz)/(zr - cz)
>
> a bug, at least not a priori.  it just seems that simplify_full
> assumes sqrt(a)*sqrt(b) = sqrt(a*b), which is reasonable in many
> circumstances.
>
> (I didn't check the details, though)
>
> Martin
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to