Menu ▾ ▴

#5264 sign(a+b) -> pnz or error, depending on whether a or b is declared imaginary

None
closed
nobody
sign (84)
5
16 hours ago
7 days ago
No

sign, which is real mode, looks at a sum's term one by one and stops as soon as it finds one for which it cannot determine the sign. Therefore the same sum a+b can either result in pnz or an error, depending on which variable is declared imaginary:

(%i1) declare(a, imaginary)$

(%i2) sign(a+b);
sign: argument cannot be non-real; found a
-- an error. To debug this try: debugmode(true);

(%i3) (remove(a, imaginary), declare(b, imaginary))$

(%i4) sign(a+b);
(%o4) pnz

This is similar to how the mtimes simplifier once used to return 0 as soon as one factor simplified to 0 - ignoring any potential errors like division by zero or log(0) that might occur during simplification of the remaining factors.

Discussion

  • David Scherfgen

    David Scherfgen - 16 hours ago
    • status: open --> closed
     
  • David Scherfgen

    David Scherfgen - 16 hours ago

    Fixed by commit [77d43d].

     

    Related

    Commit: [77d43d]


Log in to post a comment.