Ask Your Question
2

How to simplify Bessel functions ?

asked 2024-10-16 10:53:18 +0100

CModera gravatar image

updated 2024-10-18 21:13:47 +0100

FrédéricC gravatar image

Hello,

I'm studying Helmholtz equation in cylindrical coordinates. I'm using a solution of the scalar Helmholtz equation to build a vector field that could be a solution of the vector Helmholtz equation.

Here is my code with an orthonormal basis in a 3D manifold with cylindrical coordinates. Normally, SVH should be equal to 0 (actually, it is), but Sage doesn't simplify. I've used the simplify function, but it doesn't work. Can someone help me?

%display latex

from sage.manifolds.operators import * 

E = Manifold(3,coordinates='cylindrical', name='E')  # 3D Manifold in cylindrical coord

Ecyl.<r,ph,z> = E.chart(r'r:(0,+oo) ph:(0,2*pi):\phi z')

k = var('k')

assume(k>=0)

to_orthonormal = E.automorphism_field()  # Orthonormal basis q

to_orthonormal[0,0] = 1

to_orthonormal[1,1] = 1/r

to_orthonormal[2,2] = 1

q = Ecyl.frame().new_frame(to_orthonormal, 'q')

E.set_default_frame(q)

eta = E.metric(name='eta', latex_name=r'\eta') #Minkowski metric

eta[0,0] = 1

eta[1,1] = 1

eta[2,2] = 1

h = E.scalar_field(bessel_J(0,sqrt(k^2)*r)*cos(0*z)*cos(0*ph), name='h')  #Helmholtz equation solution in cylindrical coord

k2 = -h.laplacian(eta)*h^(-1) # Determination of k^2

H = h*(r*q[0]+z*q[2])  #Definition of a vector field H such that O is a vectorial Helmholtz equation solution

O = H.curl(metric=eta)

SHV = O.laplacian(eta) + k2*O

SHV.display()

Sage solution :

-1/4*((2*bessel_J(2, k*r)*bessel_J(1, k*r) - bessel_J(3, k*r)*bessel_J(0, k*r) + bessel_J(1, k*r)*bessel_J(0, k*r))*k^3*r^2 - 2*(2*bessel_J(1, k*r)^2 - bessel_J(2, k*r)*bessel_J(0, k*r) + bessel_J(0, k*r)^2)*k^2*r + 4*k*bessel_J(1, k*r)*bessel_J(0, k*r))*z/(r^2*bessel_J(0, k*r))
edit retag flag offensive close merge delete

Comments

This is equivalent to 2*k^2*bessel_J(2, k)*bessel_J(1, k) - k^2*bessel_J(3, k)*bessel_J(0, k) + k^2*bessel_J(1, k)*bessel_J(0, k) - 4*k*bessel_J(1, k)^2 + 2*k*bessel_J(2, k)*bessel_J(0, k) - 2*k*bessel_J(0, k)^2 + 4*bessel_J(1, k)*bessel_J(0, k) being zero. Not clear how to reach this conclusion.

FrédéricC gravatar imageFrédéricC ( 2024-10-17 20:58:55 +0100 )edit

One could imagine to work out the differential equation satisfied by this expression.

FrédéricC gravatar imageFrédéricC ( 2024-10-17 21:00:43 +0100 )edit

Yeah that's it. Sage makes simplification naturally with spherical Bessel functions but couldn't with Bessel functions.

CModera gravatar imageCModera ( 2024-10-17 21:19:47 +0100 )edit

In wolframscript:

In[16]:= FullSimplify[-1/4*((2*BesselJ[2, k*r]*BesselJ[1, k*r] - BesselJ[3, k*r]
*BesselJ[0, k*r] + BesselJ[1, k*r]*BesselJ[0, k*r])*k^3*r^2 - 2*(2*BesselJ[1, k*
r]^2 - BesselJ[2, k*r]*BesselJ[0, k*r] + BesselJ[0, k*r]^2)*k^2*r + 4*k*BesselJ[
1, k*r]*BesselJ[0, k*r])*z/(r^2*BesselJ[0, k*r])]    

Out[16]= 0
achrzesz gravatar imageachrzesz ( 2024-10-18 15:08:17 +0100 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2024-10-18 22:05:43 +0100

Emmanuel Charpentier gravatar image

updated 2024-10-19 18:06:11 +0100

Following @achrzesz's inspiration :

sage: SR(str(SHV.display()))._sympy_().simplify()
0

And, BTW, using the gratis-but-not-free Wolfram engine :

sage: SR(str(SHV.display()))._mathematica_().FullSimplify()
0

I agree that the SR(str(SHV.display())) dirty trick is atrocious ; its sole virtue is to work in this case...

EDIT :

See below @FrédéricC's comment, which led me to :

sage: SHV[1].expr(method="sympy").simplify()
0

HTH,

edit flag offensive delete link more

Comments

2

more directly:

SHV[1].expr().simplify(algorithm='sympy')
FrédéricC gravatar imageFrédéricC ( 2024-10-19 08:58:45 +0100 )edit

@FrédéricC : nice ! Much better than my contraption...

Thanks a lot !

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-10-19 17:55:52 +0100 )edit
2

BTW, even shorter :

sage: SHV[1].expr(method="sympy").simplify()
0

HTH,

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-10-19 18:01:30 +0100 )edit
0

answered 2024-11-20 10:11:43 +0100

CModera gravatar image

It does work, but I'd like the simplifications to be made in the vector field so that I can use it in other calculations. Similarly with a scalar field, the method proposed doesn't work. Does anyone have any ideas?

edit flag offensive delete link more

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: 2024-10-16 10:53:18 +0100

Seen: 205 times

Last updated: 21 hours ago