On Sat, May 16, 2009 at 2:51 AM, Vinzent Steinberg
<vinzent.steinb...@googlemail.com> wrote:
> 2009/5/15 Ondrej Certik <ond...@certik.cz>
>>
>> On Fri, May 15, 2009 at 3:16 AM, Priit Laes <plaes...@gmail.com> wrote:
>> >
>> > Ühel kenal päeval, N, 2009-05-14 kell 23:32, kirjutas Ondrej Certik:
>> >> Hi,
>> >>
>> >> please review my spherical bessel patches:
>> >>
>> > I didn't check the math part, but in the jn_zeros() docstring there's
>> > method = "sympy" instead of "scipy" in one place.
>>
>> Ah, thanks for noticing:
>>
>> +    method = "sympy": uses the scipy's sph_jn and newton to find all
>> roots,
>> +            which if faster than method="sympy", but it requires scipy
>> and only
>>
>> this should be scipy.
>>
>> Apart from that, are there any other objections?
>
>> # The findroot() is fragile, it sometimes returns complex numbers,
>> # so we chop all complex parts (that are small anyway). Also we
>> # need to set the tolerance, as it sometimes fail without it.
>> def f_real(x):
>>     return f(complex(x).real)
>> root = findroot(f_real, x, solver="muller", tol=1e-9)
>> root = complex(root).real
>
> As mentioned in my other post, I don't get the point of using
> method='muller', especially if you are not interested in complex roots.
>
> I recommend to just use the default (secant), it won't give complex results
> for real starting points. Or you might want to use an intersection method,
> it would be more reliable and faster.

Unfortunately, it didn't converge for me at all. Any ideas why? I'll
try to write my own newton method and then see if it works.

>
> Do you think some of the functions should be rather implemented in mpmath?

which functions do you mean exactly? The jn_zeros? I don't mind. But
mpmath is sometimes very slow, e.g. I want to be able to use scipy
optionally. It can be in mpmath, I have no problems with that. But
then you would need the jn() function too in there, but that one uses
sympy a lot, so I don't think it's that easy.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com
To unsubscribe from this group, send email to 
sympy-patches+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sympy-patches?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to