#859 polarform returns a rectangular expression for float argumen

closed
nobody
5
2007-12-09
2006-01-16
No

polarform (1.0 + %i); =>

1.414213562373095 (.7071067811865475 %i +
.7071067811865476)

build_info(); =>

Maxima version: 5.9.2.19cvs
Maxima build date: 16:26 1/15/2006
host type: i686-redhat-linux-gnu
lisp-implementation-type: SBCL
lisp-implementation-version: 0.9.4

In 5.9.2:

polarform (1.0 + %i); => 1.414213562373095 *
%e^(0.78539816339745*%i)

Discussion

  • Raymond Toy

    Raymond Toy - 2006-02-01

    Logged In: YES
    user_id=28849

    FWIW, here is a replacement that preserves exponential form.
    But see also the discussion at

    http://www.math.utexas.edu/pipermail/maxima/2006/011955.html

    (defmfun $polarform (xx)
    (cond ((and (not (atom xx)) (memq (caar xx) '(mequal mlist
    $matrix)))
    (cons (car xx) (mapcar #'$polarform (cdr xx))))
    (t ((lambda (aas $%emode)
    (mul (car aas) `((mexpt simp) $%e ,(mul '$%i (cdr
    aas)))))
    (absarg xx) nil))))

     
  • Robert Dodier

    Robert Dodier - 2006-09-08
    • labels: 460522 --> Lisp Core - Complex
     
  • Dan Gildea

    Dan Gildea - 2007-12-09
    • status: open --> closed
     
  • Dan Gildea

    Dan Gildea - 2007-12-09

    Logged In: YES
    user_id=1797506
    Originator: NO

    In simp.lisp rev 1.46, made numeric evaluation of exp(%i*float) dependent on %emode,
    which is set to false inside polarform.

    (%i2) polarform(1.0 + %i);
    (%o2) 1.414213562373095*%e^(.7853981633974483*%i)
    (%i3) ev(%);
    (%o3) 1.414213562373095*(.7071067811865475*%i+.7071067811865476)
    (%i4) polarform(1+%i);
    (%o4) sqrt(2)*%e^(%i*%pi/4)
    (%i5) ev(%);
    (%o5) sqrt(2)*(sqrt(2)*%i/2+sqrt(2)/2)

    (%i6) %emode:false;
    (%o6) false
    (%i7) polarform(1.0 + %i);
    (%o7) 1.414213562373095*%e^(.7853981633974483*%i)
    (%i8) ev(%);
    (%o8) 1.414213562373095*%e^(.7853981633974483*%i)
    (%i9) polarform(1+%i);
    (%o9) sqrt(2)*%e^(%i*%pi/4)
    (%i10) ev(%);
    (%o10) sqrt(2)*%e^(%i*%pi/4)

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks