find_root issues



On Thu, Jun 07, 2007 at 06:06:33PM -0600, Robert Dodier wrote:
> On 6/7/07, Daniel Lakeland <dlakelan at street-artists.org> wrote:
> 
> > For the group: have we fixed or improved find_root with respect to its
> > first argument since my version of maxima (at work)??? (5.10.0)
> 
> No, the evaluation (or lack thereof) hasn't been changed.
> But let's take the opportunity to work on it now.
...
> I'm guessing the current evaluation scheme stems from a
> desire to get stuff like plot2d(find_root(foo(x, a), x, ...), [a, ...])
> to work. (I.e. find_root is embedded in a call to some other
> function.) I think that's a worthy goal; but I hope we can
> achieve that with less pain via (1) and (2) above.

I'm not qualified to comment on the implementation strategy, but I
think the goal is a good one. The way that I use find_root most
frequently is either to numerically solve a single equation on the
command line, or sometimes to create a function that numerically
inverts something... such as this goofy example which finds the
floating point logarithm of any number between 1 and exp(10000)

mylog(x) := find_root(exp(y)-x,y,0,10000);

obviously, I'd use it for something more complicated than this, but
the intent is clear I think. I can imagine also wanting to numerically
integrate a function like this, such as passing a find_root expression
to quad_quag or the like.

Pretty frequently I come up against a problem with find_root when I
have computed an expression that I want to zero out such as
find_root(%o14,x,0,1); and it will barf saying that the expression
contained in %o14 doesn't have an appropriate numerical value

(%i5) x^2-2*x;
				    2
(%o5) 				   x  - 2 x
(%i6) find_root(%o5,x,0,10);

Maxima encountered a Lisp error:

 Error in MACSYMA-TOP-LEVEL [or a callee]: ((MPLUS SIMP)
                                            ((MTIMES SIMP) -2 $X)
                                            ((MEXPT SIMP) $X 2)) is not of type (OR
                                                                                 RATIONAL
                                                                                 LISP:FLOAT).

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.


-- 
Daniel Lakeland
dlakelan at street-artists.org
http://www.street-artists.org/~dlakelan