# [Maxima] find_root and variable capture?

Zach elzacho at gmail.com
Fri Mar 7 11:07:47 CST 2008

```Dear Maxima people,

Please excuse my lack of knowledge of Maxima internals.  Also, I am pretty
sure this is all part of a long standing confusion I have about what gets
evaluated when, and the meaning of := and ::=.

So, the previous post asking why Maxima "suck[s] so much" got me trying to
recreate his problem.  I stumbled upon this:

f(y) := find_root(exp(x) - y, x, 0, 100);
plot2d(f(x), [x, .1, .9]);

This will plot a constant value at 0.56..., however, f(.1) is not equal to
f(.2) if I just type them in.  And,

plot2d(f(y), [y, .1, .9]);

will plot the root wrt. x of exp(x) - y.  Basically, what is happening here
is f(y) -> find_root(exp(x)-y, x, 0, 100) (what I intended), but, f(x) ->
find_root(exp(x)-x, x, 0, 100) = 0.56...  This sounds *very* similar to what
is known in the Lisp world as variable capture, where a macro expansion uses
a variable name that the user happens to be using.  Is it?  How can I define
a function that does an explicit find_root at each evaluation?  I guess I
would need a gensym, right?  Does Maxima have such a capability, or does it
not need it for some reason?  Please guide me in these troubled times...

Anyway, happy Friday everybody,
Zach

P.S. I am aware that exp(x)-y = 0 => x = log(y) but imagine I had put some
transcendental equation down where I might need to use a numerical root
finder.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20080307/1b370a44/attachment-0001.htm
```