On Sat, May 16, 2009 at 1:16 PM, Vinzent Steinberg <vinzent.steinb...@googlemail.com> wrote: > 2009/5/16 Ondrej Certik <ond...@certik.cz> >> >> 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. > > That's interesting. Could you please post the test case where it fails? > > Maybe there's just a bug in mpmath's secant or findroot.
Just pull my branch and run tests. Then change the findroot code and you'll see. 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 -~----------~----~----~----~------~----~------~--~---