Looking for fortran subroutine for I Bessel function with negative order

In summary: Your Name]In summary, Manuel is looking for a Fortran subroutine that can compute the modified Bessel function of the first kind, I_n(x), for negative non-integer n. After searching through various resources, he has not been able to find a suitable subroutine. Some potential solutions include using the recurrence relation or the gamma function to compute the function for negative non-integer n.
  • #1
Fr4ct4l
5
0
Hello all, I am developing a new analytical solution for a problem in flow in porous media, and I need to write it in Fortran.

This solution contains the modified Bessel function of the first kind, I_n(x).

The order n is a real number, and it can be both negative and positive.
The argument x is real, and is always positive. Correct me if I'm wrong, but I believe this means I will never encounter a complex result.

I have looked in netlib, Numerical Recipes books, and an assortment of personal webpages (Alan Miller, JP Moreau), and I still can't find a Bessel_I subroutine that will compute for negative non-integer n. Obviously they all do a splendid job for positive n.

Alternatively, (and I have looked in functions.wolfram.com website) are you aware how I can compute this from other functions ? Gamma func ?

Thanks,
Manuel
 
Physics news on Phys.org
  • #2


Dear Manuel,

Thank you for reaching out about your research project. I understand your frustration in finding a Fortran subroutine that can compute the modified Bessel function for negative non-integer n. After reviewing the resources you have mentioned, it seems that there are limited options for this specific case.

One approach you could take is to use the recurrence relation for computing I_n(x) for negative n, which is:

I_n(x) = I_{n+1}(x) + \frac{2n}{x}I_n(x)

This can be implemented in Fortran and used to compute the function for negative non-integer n.

Another possibility is to use the gamma function, as you have mentioned. The modified Bessel function can be expressed in terms of the gamma function as:

I_n(x) = \frac{1}{\pi} \left(\frac{x}{2}\right)^n \int_0^\pi e^{x\cos\theta}\cos(n\theta)d\theta

This integral can be evaluated numerically using standard methods, such as the trapezoidal rule or Simpson's rule.

I hope these suggestions are helpful in your research. If you have any further questions, please do not hesitate to reach out.

 

1. How do I find a FORTRAN subroutine for calculating the I Bessel function with negative order?

There are various resources available online that provide FORTRAN subroutines for calculating the I Bessel function with negative order. Some popular options include the IMSL library, the NAG library, and the SLATEC library. You can also find open-source codes on platforms like GitHub.

2. What is the syntax for using a FORTRAN subroutine for the I Bessel function with negative order?

The syntax for using a FORTRAN subroutine for the I Bessel function with negative order may vary depending on the particular subroutine you are using. However, in general, you will need to declare the necessary variables, call the subroutine, and pass in the appropriate arguments. It is important to carefully read the documentation of the specific subroutine you are using to ensure proper syntax.

3. Can I use a FORTRAN subroutine for the I Bessel function with negative order in my code?

Yes, you can use a FORTRAN subroutine for the I Bessel function with negative order in your code as long as you have the necessary libraries or codes installed and properly linked. Make sure to also follow the proper syntax and input parameters for the subroutine you are using.

4. Are there any limitations to using a FORTRAN subroutine for the I Bessel function with negative order?

There may be some limitations to using a FORTRAN subroutine for the I Bessel function with negative order, depending on the specific subroutine you are using. Some subroutines may only work for a certain range of inputs, or may not be compatible with certain compilers. It is important to carefully read the documentation and test the subroutine with various inputs to ensure its accuracy and compatibility with your code.

5. Can I modify a FORTRAN subroutine for the I Bessel function with negative order for my specific needs?

Yes, you can modify a FORTRAN subroutine for the I Bessel function with negative order to suit your specific needs. However, it is important to follow proper coding practices and thoroughly test your modified code to ensure its accuracy and functionality. It is also recommended to give credit to the original source or author of the subroutine.

Similar threads

  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
2
Views
1K
  • Differential Equations
Replies
4
Views
3K
  • Advanced Physics Homework Help
Replies
1
Views
2K
Replies
1
Views
2K
  • Programming and Computer Science
Replies
2
Views
947
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Programming and Computer Science
Replies
7
Views
8K
Replies
1
Views
2K
Replies
6
Views
2K
Back
Top