Subject: [ maxima-Bugs-609464 ] 1+%e,numer and %e^%e,numer
From: Dieter Kaiser
Date: Tue, 19 May 2009 22:12:29 +0200
Hello Richard,
I have thought about the problem of the extra test in simplifya, but I have
found no other solution. (I have not tried to find a complete new concept to
handle the constants. You know I have not your experience.)
Because we don't do the numerical evaluation for the symbol $%e in meval1, we
have to check again every symbol in simplifya to get the desired consistent
results. Perhaps the order of the tests can be optimized. I have chosen:
(defmfun simplifya (x y)
(cond ((and $numer $%enumer (atom x) (eq x '$%e))
(setq x %e-val))
...
When we add at last the following code to the function simpcheck every function
will simplify accordingly too:
(defmfun simpcheck (e flag)
(cond ((specrepp e) (specdisrep e))
(flag e)
;; Set $%enumer to allow numerical simplification
(t (let (($%enumer $numer)) (simplifya e nil)))))
We will get numerical results for sin(%e), gamma(%e), ... when $numer is TRUE,
but no numerical evaluation for $%e in expressions like sin(%e^x).
In one of my last postings I have reported a wrong change. The change has to be
added to the function pls and not plusin (I have tried both places):
(defun pls (x out)
(prog (fm plusflag)
(if (mtimesp x) (setq x (testtneg x)))
(when (and $numer (atom x) (eq x '$%e))
;; Numercical value for $%e when $numer is TRUE
(setq x %e-val))
...
With the four changes to the simplifier the numerical evaluation and
simplification of $%e is consistent and works for the user like the other
constants %i, %pi, ... Even nested expressions like %e^(%e^(2*x+1)) will work
fine. The testsuite and the share_testsuite will have no problems. Only one test
changes: gamma(%e),numer; will simplify to a numerical result.
The only way of doing this faster and without a change to the simplifier I have
found is to cut out the flag %enumer, but then %e^x will simplify to 2,17...^x.
So, should we implement the changes to the simplifier?
Dieter Kaiser
-----Urspr?ngliche Nachricht-----
Von: Richard Fateman [mailto:fateman at cs.berkeley.edu]
Gesendet: Montag, 18. Mai 2009 07:07
An: Dieter Kaiser
Cc: maxima at math.utexas.edu
Betreff: Re: [Maxima] [ maxima-Bugs-609464 ] 1+%e,numer and %e^%e,numer
Can these patches be put somewhere else? You are checking the setting
of $numer and $enumer an enormous number of times.
At least once for every atom in every expression that is ever simplified..
I think that this should be done in a different way, if at all possible.
for example,
have two core simplifiers. One for $numer=true and another where
$numer = nil. Then it doesn't have to be checked everywhere.
RJF