Subject: Best way to use a compiled function in findroot
From: Sergio Callegari
Date: Wed, 01 Sep 2010 13:02:05 +0200
On 31/08/2010 18:31, Robert Dodier wrote:
> On Tue, Aug 31, 2010 at 10:07 AM, Sergio Callegari
> <sergio.callegari at gmail.com> wrote:
>
>
>> (%i5) g(y):=block([x:gensym()],findroot('f(x)-y,x,-1,1));
>> (%o5) g(y) := block([x : gensym()], findroot('f(x) - y, x, - 1, 1))
>>
>> I get:
>>
>> (%i6) g(0);
>> (%o6) findroot(f(g900), g900, - 1, 1)
>>
> There is no findroot function. There is a function find_root, however.
>
>
>> g(y) := block([x : gensym()], findroot(lambda([x], f(x) - y), x, - 1, 1))
>>
>> g(0) hangs forever...
>>
> Did you omit the final semicolon?\
>
I wonder if I'll ever get used to the difference between wxmaxima
(impossible to cut and paste on the ml, but nice autosemicolon with
shift+enter) and the text mode maxima!
In any case, it still does not work
g(y) := block([x : gensym()], findroot(lambda([x], f(x) - y), x, - 1, 1));
(%o3) g(y) := block([x : gensym()], findroot(lambda([x], f(x) - y), x, -
1, 1))
(%i4) g(0);
(%o4) findroot(lambda([x], f(x) - y), g899, - 1, 1)
Sergio
> If the semicolon is present: launch maxima as maxima -g
> (enable Lisp debugger), then, when g(0) (entered as g(0); of course)
> is running, type control-C.
> If all goes well, it opens the Lisp debugger.
> Try to get a stack trace. Something like backtrace or :backtrace
> or :bt (it varies from one Lisp to another).
> Then post the stack trace.
>
> best,
>
> Robert Dodier
>