Translated code and simplification of %pi in presence of numer=true
- Subject: Translated code and simplification of %pi in presence of numer=true
- From: Barton Willis
- Date: Sun, 19 Apr 2009 18:58:03 -0500
-----maxima-bounces at math.utexas.edu wrote: -----
>It?seems?to?me?that??foo(x):=x*%e seems?to?work?just?fine.
Compare:
MAXIMA> (defun $f (x) (mul x '$%pi))
MAXIMA> (defun $g (x) (mul x '$%e))
(%i9) [f(2), g(2)];
(%o9) [2*%pi,2*%e]
(%i10) [f(2), g(2)], numer;
(%o10) [2*%pi,5.43656365691809]
Replacing mul --> mul* doesn't change %o10 (the translator generates mul*).
Also:
(%i27) f(2);
1> (SIMPLIFYA 2 NIL)
<1 (SIMPLIFYA 2)
1> (SIMPLIFYA ((MTIMES) 2 $%PI) T)
2> (SIMPTIMES ((MTIMES) 2 $%PI) 1 T)
<2 (SIMPTIMES ((MTIMES SIMP) 2 $%PI))
<1 (SIMPLIFYA ((MTIMES SIMP) 2 $%PI))
1> (SIMPLIFYA ((MTIMES SIMP) 2 $%PI) NIL)
<1 (SIMPLIFYA ((MTIMES SIMP) 2 $%PI))
(%o27) 2*%pi
(%i28) g(2);
1> (SIMPLIFYA 2 NIL)
<1 (SIMPLIFYA 2)
1> (SIMPLIFYA ((MTIMES) 2 $%E) T)
2> (SIMPTIMES ((MTIMES) 2 $%E) 1 T)
<2 (SIMPTIMES 5.4365636569180902)
<1 (SIMPLIFYA 5.4365636569180902)
1> (SIMPLIFYA 5.4365636569180902 NIL)
<1 (SIMPLIFYA 5.4365636569180902)
(%o28) 5.43656365691809
The %e --> 2.718 conversion seems to happen inside simptimes, not
simplifya. Maybe
the old bit of code at the top of simplifya fixed the problem, but wasn't
it the
wrong fix?
Barton