Menu

#2212 sign of atanh

open
nobody
None
5
2 days ago
2011-06-21
No

Wrong (atanh(2.0) is not real, for example)

(%i2) (assume(z > 1), sign(atanh(z)));
(%o2) pos

Discussion

  • David Scherfgen

    David Scherfgen - 3 days ago

    Note that csign(atanh(z)) returns complex.
    According to the manual, sign cannot return complex. So should sign raise an error when it's guaranteed to be non-real? It does this in the following case:

    ~~~
    (%i1) assume(x<0)$
    (%i2) sign(sqrt(x));
    sign: argument cannot be imaginary; found sqrt(q)
    -- an error. To debug this try: debugmode(true);
    ~~~

    But not for log, not even with an explicit negative argument:

    ~~~
    (%i3) sign(log(-1));
    (%o3) pnz
    ~~~

     

    Last edit: David Scherfgen 3 days ago
  • Stavros Macrakis

    Yes, sign should ideally raise an error when the argument is never real.

    But it should return a result when the result is real somewhere. For example, sign(sqrt(sin(x)-1)) => zero (correct), even though it is only real and zero when x is a multiple of %pi.

    Now consider sign(%i*x). Maxima gives an error because it is syntactically complex. But it is zero when x=0, so going by the previous example, it too should return zero.

    That said, Maxima cannot tell in general whether an expression is everywhere non-real. A simple example is sign(sqrt(-sin(x)^2-cos(x)^2)) => zero. Of course we can fix particular cases like this, but it will never cover all cases.

    We can't expect sign to be perfect. Perhaps the manual should be clear that this is a "best effort" function, and in particular that pnz doesn't mean that the value is real, but only that Maxima couldn't determine whether it was real.

    It's all a bit messy....

     
    • Raymond Toy

      Raymond Toy - 2 days ago

      But it should return a result when the result is real somewhere. For example, sign(sqrt(sin(x)-1)) => zero (correct), even though it is only real and zero when x is a multiple of %pi.

      Is that really how sign is supposed to work? The docs kind of hint at that, but I was certainly surprised about that. I don't think anyone would expect zero as the answer either.

       

Log in to post a comment.

MongoDB Logo MongoDB