Ask Your Question
1

Finding roots of equation made of Bessel functions, some of which have complex arguments

asked 2017-11-30 23:09:12 -0600

3nding gravatar image

updated 2017-12-01 10:16:14 -0600

tmonteil gravatar image

I want to find the roots (values or w) for an equation of spherical Bessel functions for L = 1 and \Omega^2 = 14.28 (capital Omega, not w):

My code is:

L = 1

ome = 14.28 #MeV

w = var('w')

Arg1 = sqrt(ome*(1-w^2))

Arg2 = I*sqrt(ome)*w

a = -I*sqrt(1-w^2)

b = spherical_bessel_J(L-1, Arg1)

c = spherical_bessel_J(L, Arg1)

d = spherical_bessel_J(L, Arg2)+I*spherical_bessel_Y(L, Arg2)

e = spherical_bessel_J(L-1, Arg2)+I*spherical_bessel_Y(L-1, Arg2)

eq = a*(b/c)*(d/e)-w == 0

eq.find_root(0, 1)

But I get an error on line 12, which specifies:

"TypeError: unable to convert 3.77888872553824*I to float; use abs() or real_part() as desired"

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-12-01 15:49:00 -0600

dan_fulea gravatar image

...numerically searching for the point, and using for this mpmath, we can try:

L   = 1
ome = 14.28    # MeV

from mpmath import *

def F(w):
    Arg1 =   sqrt(ome*(1-w^2))
    Arg2 = I*sqrt(ome)*w
    a   = -I*sqrt(1-w^2)

    b = spherical_bessel_J( L-1, Arg1 )
    c = spherical_bessel_J( L  , Arg1 )
    d = spherical_bessel_J( L  , Arg2 ) + I*spherical_bessel_Y( L  , Arg2 )
    e = spherical_bessel_J( L-1, Arg2 ) + I*spherical_bessel_Y( L-1, Arg2 )

    return ( a*b*d - w*c*e )

def Freal(w):
    return F(w).real

def Fimag(w):
    return F(w).imag

# plot( Freal, (0,1), (-3,3) )
# plot( Fimag, (0,1), (-3,3) )    # zero


mp.dps    = 50
mp.pretty = True
findroot( Freal, 0.001 )

This gives:

sage: findroot( Freal, 0.001 )
0.43191301404660550601425558556001915140268185509848

Note: Some other values for the starting point may work or not...

sage: findroot( Freal, 0.4 )
0.43191301404660550601425558556001915140268185509848
sage: findroot( Freal, 0.45 )
0.43191301404660550601425558556001915140268185509848
sage: findroot( Freal, 0.48 )
3.2351453864380279679802136973858464614625968140838
sage: findroot( Freal, 0.5 )
1.3949447484847503200790335008591392342171339970256

The last two values should be - of course - rejected.

Note: pari/gp also does a good job in finding numerical solutions of transcendental equations.

edit flag offensive delete link more

Comments

Thank you very much for the answer, this has been very helpful!

3nding gravatar image3nding ( 2018-01-13 12:25:29 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-11-30 22:55:27 -0600

Seen: 154 times

Last updated: Dec 01 '17