realpart(sqrt(a)) => cos(atan2(...))*...



Not sure that (sqrt(a)+conjugate(sqrt(a)))/2 is much better!

            -s

On Thu, Dec 13, 2012 at 12:16 PM, Henry Baker <hbaker1 at pipeline.com> wrote:

> This is only just one of the reasons why I've given up on "realpart(z)"
> and use
>
> (z+conjugate(z))/2
>
> instead.
>
> At 09:09 AM 12/13/2012, Stavros Macrakis wrote:
> >Currently,
> >
> >       realpart(sqrt(a)) =>
> >           cos(atan2(0,a)/2)*sqrt(abs(a))
> >
> >This is of course correct, but not very useful.
> >
> >For one thing, it gives an error for a=0.
> >For another, it doesn't simplify to sqrt(-a) with assume(a<=0). (Though
> it does simplify to sqrt(a) for a>=0.)
> >
> >Is there some way to force realpart to use asksign in cases like this?  I
> seem to remember that that was always what it did, but I couldn't find a
> discussion of a change in my mail archives.
> >
> >As we improve support for conditionals, another useful value would be (if
> a>0 then sqrt(a) else 0) -- or maybe (if a>=0 then sqrt(a) else 0).  But
> again, currently we have the problem that the simplifier doesn't do a very
> good job on expressions like this.
> >
> >            -s
>
>