error with find_root when functions containing more than one built-in constant like %pi
Subject: error with find_root when functions containing more than one built-in constant like %pi
From: Robert Dodier
Date: Mon, 29 Jan 2007 19:59:20 -0700
Stavros,
> What exactly is gained by separating exp(x) from %e^x? So far the
> only argument I have seen is that numerical evaluation doesn't do
> what's expected in some cases.
A motivation for simplifying %e^x --> exp(x) is that exp(x) is the
more fundamental notion; that exp(x) = %e^x for some number %e
is a theorem, not a definition.
> I would argue that the problem is in the numerical evaluation
> (numer, float, and float() in particular), not with the %e^x notation.
So long as %e^x is the preferred form, we will have to treat %e
differently from other constants (or tolerate numeric values
where there are none at present).
> > > exponentiation simplifications would have to be duplicated for exp.
> > I'll gladly do it myself, if it means that we can stop explaining
> > about %enumer.
> The problem with duplication is not the effort involved in copying the
> code; it is the effort involved in keeping two sets of code
> synchronized.
Well, what the code looks like is a secondary consideration.
How Maxima behaves from the user's perspective is the main question.
> > Well, who knows. If the user writes ev(%e^x/x, numer), then it's
> > no longer Maxima's problem if it's not useful.
>
> Huh? Why should the user expect ev(exp(x)/x,numer) to behave any differently?
Because it exp(x)/x contains neither a literal number nor a
symbolic constant (while %e^x/x contains a symbolic constant).
Getting back to find_root -- I've committed the following patch to
src/intpol.lisp, which fixes the problem with find_root (and nothing else).
--- intpol.lisp 26 Sep 2006 04:29:49 -0000 1.7
+++ intpol.lisp 30 Jan 2007 02:35:12 -0000
@@ -94,7 +94,7 @@
(cond (translp
`(($find_root_subr) , at form))
(t
- `((mprog) ((mlist) ((msetq) $numer t))
+ `((mprog) ((mlist) ((msetq) $numer t) ((msetq) $%enumer t))
(($find_root_subr) , at form)))))
((= (length form) 4)
(destructuring-let (((exp var . bnds) form))
@@ -106,7 +106,7 @@
,exp)
, at bnds))
(t
- `((mprog) ((mlist) ((msetq) $numer t))
+ `((mprog) ((mlist) ((msetq) $numer t) ((msetq) $%enumer t))
(($find_root_subr)
((lambda) ((mlist) ,var) ,exp)
, at bnds))))))
FWIW
Robert