Java中的贝塞尔库函数

发布于 2024-07-29 13:06:06 字数 362 浏览 4 评论 0原文

我正在 Java 中寻找与 Excel 函数 BESSELI 相匹配的贝塞尔函数,提供的说明:


返回修改后的贝塞尔函数,这相当于针对纯虚数参数计算的贝塞尔函数。

语法 BESSELI(x,n)

X 是计算函数的值。

N 是贝塞尔函数的阶数。 如果 n 不是整数,则它会被截断。


我发现了看起来很接近的东西,但是有许多不同类型的贝塞尔函数...

我的另一个选择是尝试导出近似值,但这听起来相当困难。 任何人都可以给我关于如何在 Java 中表示 Excel 函数的任何好的建议吗?

I'm looking for a bessel function in Java that matches the Excel function BESSELI, description provided:


Returns the modified Bessel function, which is equivalent to the Bessel function evaluated for purely imaginary arguments.

Syntax
BESSELI(x,n)

X is the value at which to evaluate the function.

N is the order of the Bessel function. If n is not an integer, it is truncated.


I have found things that look close, but there are many different types of bessel function...

My other option is to try and derive an approximation but that sounds quite tough. Can anyone give me any good advice on how to represent that excel function in Java?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

禾厶谷欠 2024-08-05 13:06:06

我想你应该能够很容易地移植其中之一:

http:// /www.astro.rug.nl/~gipsy/sub/bessel.c

I image that you should be able to port one of these quite easily:

http://www.astro.rug.nl/~gipsy/sub/bessel.c

耶耶耶 2024-08-05 13:06:06

JScience 提供了一个类SpecialMathsUtils 具有修改的贝塞尔函数。

如果 Excel 函数在其当前形式/实现中对您特别重要,您可以通过启动 Excel COM 对象并调用 Excel 中的方法来直接使用 Excel。 我在使用 JACOB 之前已经完成了此操作,并且工作正常。

但是,它确实取决于您的用例、性能标准和部署场景。

JScience provides a class SpecialMathsUtils with modified Bessel functions.

If the Excel function is particularly important to you in it's current form/implementation, you could use Excel directly by starting up an Excel COM object, and invoking the method within Excel. I've done this before using JACOB and it works ok.

However it does depend on your use case, performance criteria and deployment scenario.

笔芯 2024-08-05 13:06:06

找出一份《Numerical Recipes》的副本,您会发现它有 Fortran、C 和 C++ 版本(或者,如果您的库非常好,也有 Basic 和 Pascal 版本)并进行翻译。 按照奇异函数的通常标准,贝塞尔函数相当“简单”。 有关更多信息,您可以从 http://mathworld.wolfram.com/BesselFunction.html

Dig out a copy of Numerical Recipes, which you'll find in Fortran, C and C++ flavours (or, if your library is very good, also in Basic and Pascal) and translate. By the usual standards of exotic functions Bessel functions are quite 'easy'. for further info, you could start at http://mathworld.wolfram.com/BesselFunction.html

一生独一 2024-08-05 13:06:06

您可以使用数学函数数字图书馆:

http://dlmf.nist.gov/

以下是一些简短的内容关于Java编程和计算特殊函数的事情,这些都是我从经验中学到的。

如果您有足够的 CPU 能力来执行此操作,请尽可能使用 BigDecimal。 目前(2015 年 7 月),微软似乎在 .NET 框架中没有内部任意数值精度库。 这使得科学计算变得棘手。 我不明白他们是如何达到 VB6/VBA for Excel 那样的精度的。

另一方面,BigDecimal 相对容易使用。 一位朋友向我介绍了 BigDecimal,并在一本有关 Java 5 的 Murach 书中读到了它。我强烈建议使用 Oracle 文档:

http://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html

其次,有一个正如您可能已经观察到的那样,浮点误差与特殊函数近似中引入的数学数值误差之间的差异。 数学数值错误和浮点错误共同给应用程序开发带来困难。 使用许多不同的程序来检查你自己和你的计算。

第三,在许多情况下,BigDecimal 的字符串构造函数比双精度构造函数更可取。 请参阅上面的 Oracle 文档。

第四,在使用具有无限精度的 MathContext 的 BigDecimal 时要非常小心。 请注意,您可能必须使用 setScale 来引入应用程序需要多少位小数,以避免无限重复小数表达式以及 JVM 向您抛出的异常。

第五,首先尝试检查第一类修正贝塞尔函数的整数参数。 此外,您还可以根据可用的递归关系或根据其作为简并超几何函数的定义来计算贝塞尔函数。

最后,

祝你好运!

You could use the Digital Library of Mathematical Functions:

http://dlmf.nist.gov/

Here are few short things about programming in Java and calculating special functions which I have learned from experience.

If you have the CPU power to do so, use BigDecimal as much as possible. At the moment (July 2015), Microsoft seems not to have an in-house arbitrary numerical precision library in the .NET framework. This makes scientific computing tricky. How they achieved the precision they did in VB6/VBA for Excel eludes me.

BigDecimal, on the other hand, is relatively easy to use. I was introduced to BigDecimal by a friend and read about it in a Murach book on Java 5. I'd highly suggest the Oracle documentation:

http://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html

Secondly, there is a difference, as you have probably observed, between floating-point error and the mathematical-numerical error introduced in an approximation to a special function. Both the mathematical-numerical error and the floating-point error conspire to make things difficult for application development. Use a lot of different programs to check yourself and your calculation.

Thirdly, string constructors for BigDecimal are preferable to the double constructor in many cases. See the Oracle documentation above.

Fourthly, be very careful in using BigDecimal with the unlimited precision of MathContext. Be aware that you will probably have to use setScale to introduce how many decimal places you will need for your application to avoid infinitely repeating decimal expressions and the exceptions thrown to you by the JVM.

Fifthly, try to check integer arguments for the first-kind modified Bessel function first. Also, you can calculate Bessel functions either from the recursion relations available to you or from their definitions as degenerate hypergeometric functions.

Finally,

Good luck!

弥繁 2024-08-05 13:06:06

或者参考 Abramowitz 和 Stegun。 它们对所有这些功能都有很好的表现。 易于编程。

Or refer to Abramowitz and Stegun. They have very good representations of all these functions. Easy to program.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文