#403 realpart returns expr with %I/FIX

closed
nobody
None
5
2004-11-23
2003-09-18
No

realpart((%I*%E^-%I-%E^%I*%I)^a) returns the
expression itself. This is correct in a sense -- the
expression has an imaginary part of zero -- but the
result of realpart should not contain a %I.

Fix:

In risplit-expt:

;;If all else fails, we use the trigonometric form.
(cond ((and (=0 (cdr sp)) (=0 (cdr aa))
(freeof '$%i l)) ; NEW CLAUSE
(cons l 0))

Unfortunately, this is not a complete solution.

Consider (LOG(-2)-LOG(-1))^a. This, too, has a real
value, but contains non-real subexpressions. The fix for
that would be to remove the entire COND clause above.
Though that is overkill, it is probably better than not
removing it.

Better Fix:

remove that cond-clause completely.

Discussion

  • Raymond Toy

    Raymond Toy - 2004-11-23

    Logged In: YES
    user_id=28849

    cond-clause completely removed, as suggested.

     
  • Raymond Toy

    Raymond Toy - 2004-11-23
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks