#2236 log(1/(1+%i)) gives error

closed
nobody
6
2011-08-03
2011-07-25
No

log(1/(1+%i));
sign: argument cannot be imaginary; found %i -- an error.

Error comes from simpln.

Looks like simpln needs to bind *complexsign* to T and do something intelligent....

Discussion

  • Barton Willis

    Barton Willis - 2011-07-25

    Changing $sign to $csign (two places?) might be all that is needed to fix this.

     
  • Dieter Kaiser

    Dieter Kaiser - 2011-08-03

    The error does not come from simpln and not from sign-log. Both functions are not called for the example of this bug report. The origin is the the code of the function $sign. A more simple example is

    (%i1) sign(log(%i));

    sign: argument cannot be imaginary; found %i
    -- an error. To debug this try: debugmode(true);

    Because the expression contains the imaginary unit, the function $sign calls rectform. The result is

    (%i2) rectform(log(%i));
    (%o2) %i*%pi/2

    But the sign of an imaginary expression gives an error:

    (%i3) sign(%i*%pi/2);

    sign: argument cannot be imaginary; found %i
    -- an error. To debug this try: debugmode(true);

    For the example of this bug report Maxima tries to get the sign of the following expression:

    (%i4) rectform(log(%i/(1+%i)));
    (%o4) %i*%pi/4-log(2)/2

    Again, the sign on an imaginary expression gives an error.

    At this point we might argue that it is not a bug to get an error. It is the design of the function $sign not to accept imaginary expressions.

    Dieter Kaiser

     
  • Stavros Macrakis

    The example sign(log(%i)) correctly gives an error, since the sign of log(%i) is not defined. But the original expression, log(1/(1+%i)), does not ask for the sign of anything, so the error is inappropriate. The problem is that simpln is calling $sign, which requires a real argument. As Barton says, fixing this may be as easy as $sign -> $csign.

     
  • Dieter Kaiser

    Dieter Kaiser - 2011-08-03

    Sorry, my error. I had a look at sign(log(1/(1+%i)) but not at the original
    example. To get this error in Maxima 5.25post we have to set logexpand to
    false:

    (%i1) log(1/(1+%i));
    (%o1) - log(%i + 1)
    (%i2) log(1/(1+%i)),logexpand:false;

    sign: argument cannot be imaginary; found %i
    -- an error. To debug this try: debugmode(true);
    (%i3) build_info();

    Maxima version: 5.25post
    Maxima build date: 21:36 8/3/2011
    Host type: i686-pc-linux-gnu
    Lisp implementation type: SBCL
    Lisp implementation version: 1.0.45

    (%i1) log(1/(1+%i));
    (%o1) - log(%i + 1)
    (%i2) log(1/(1+%i)),logexpand:false;

    sign: argument cannot be imaginary; found %i
    -- an error. To debug this try: debugmode(true);

    Dieter Kaiser

     
  • Dieter Kaiser

    Dieter Kaiser - 2011-08-03

    Fixed in simp.lisp revision 03.08.2011.
    Closing this bug report as fixed.
    Dieter Kaiser

     
  • Dieter Kaiser

    Dieter Kaiser - 2011-08-03
    • status: open --> closed
     

Log in to post a comment.