How to pass a power series to find_root



I guess my question is how to avoid passing in a list of all the functions in this example.

bffind_root(f(2,e)+g(4,e)+q(e), [f, q, g], x, 0, 1, 20)

and also how to get Maxima's find_root to work too.

Rich


--------------------------------------------------
From: "Richard Hennessy" <rich.hennessy at verizon.net>
Sent: Saturday, May 29, 2010 7:46 PM
To: "Maxima List" <maxima at math.utexas.edu>
Subject: Re: [Maxima] How to pass a power series to find_root

> I have attached the latest and greatest bffind_root to this email.
>
> --------------------------------------------------
> From: "Richard Hennessy" <rich.hennessy at verizon.net>
> Sent: Saturday, May 29, 2010 7:38 PM
> To: "Barton Willis" <willisb at unk.edu>; "Maxima List" <maxima at math.utexas.edu>
> Subject: Re: [Maxima] How to pass a power series to find_root
>
>> Okay I think I understand that nfloat() isn't helping but what about how to prevent evaluation of a function passed 
>> as
>> a parameter to another function.  makelist(f(5.9b-9, e), e, 1, 100) does not take a long time.  In fact it is pretty
>> fast. Something is different about makelist().  I think I remember reading that makelist was "designed for functions"
>> in some of the documents on the Wiki.
>>
>> I have a bffind_root() function that I wrote and when I call it it takes so long that I have yet to see it complete.
>> bffind_root() is defined in pw.mac.  It is just a simple binary search.  I have tried all kind of quoting of the f()
>> like '(f(5.9,e)) but it does not work.  Typing in f(5.9b-9,e) also never completes which makes sense.
>>
>> I have changed bffind_root() to take the function name as an extra parameter and that works but I would prefer a
>> better way.
>>
>> This is my power series.
>>
>> f(x,e):=sum(
>>    block([hbar : bfloat(6.6260693b-34/(2*%pi)), mu : 1b15, m : 9.109389754b-31],
>>        if  equal(_i ,0) then
>>        (
>>            a : 1,
>>            acc : 1,
>>            am2 : 0,
>>            am4 : 0,
>>            am6 : 0
>>        )
>>        elseif mod( _i , 2)=0 then
>>        (
>>            a : 2 * m / hbar^2 * (mu * am6 - am2 * e)/(_i * (_i - 1))
>>        ),
>>        if mod(_i , 2)=1 then
>>        (
>>            _num : 0
>>        )
>>        else
>>        (
>>            am6 : am4,
>>            am4 : am2,
>>            am2 : a,
>>            tmp : a*acc,
>>            acc : acc * x^2,
>>            _num : tmp
>>        ),
>> _num
>> ), _i, 0, 300)$
>>
>> bffind_root('f(5.9b-9, e), f, e, 4.047b-19,4.4947335b-19,30);  this works fine because I modified bffind_root() to
>> pass the function name as the second parameter.
>>
>> bffind_root('f(5.9b-9, e), e, 4.047b-19,4.4947335b-19,30);  this takes forever.
>>
>> find_root('f(5.9e-9, e), e, 4.047e-19,4.4947335e-19);  this takes forever.
>>
>> Thanks for advance for any help.
>>
>> Rich
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>



> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>