rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

polarform returns a rectangular expression for float argumen #1601

Closed rtoy closed 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:22:13 Created by robert_dodier on 2006-01-16 14:35:52 Original: https://sourceforge.net/p/maxima/bugs/859


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)

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:22:14 Created by rtoy on 2006-02-01 15:33:19 Original: https://sourceforge.net/p/maxima/bugs/859/#4f02


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))))

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:22:18 Created by robert_dodier on 2006-09-08 05:41:29 Original: https://sourceforge.net/p/maxima/bugs/859/#b3a0


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:22:21 Created by dgildea on 2007-12-09 17:05:45 Original: https://sourceforge.net/p/maxima/bugs/859/#56d4


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:22:25 Created by dgildea on 2007-12-09 17:05:45 Original: https://sourceforge.net/p/maxima/bugs/859/#fadf


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)