Besselj returns Inf - why?

Hello.
When I try to compute besselj(n,x) with n=1 or 2 and x =702i and higher Matlab returns Inf. Why? And how can I compute besselj with any x?

 Risposta accettata

Walter Roberson
Walter Roberson il 23 Apr 2013
How much time and memory do you have??
For n = 1 and x = 2.1E19 * i, the result is
4.106839360E+9120184119968288370 * i
that's 4*(10^(10^20))
Do you really need to be able to represent numbers larger than that?? To how many decimal places??

5 Commenti

Valery
Valery il 24 Apr 2013
The problem is that Matlab does not give me an answer even with x=702*i and higher (x=701*i is ok). My laptop has 8GB of RAM. I tried to compute this with Matlab 2012a and 2013a. What version of Matlab do you use?
Can anyone give me a tip how to fix this?
Walter Roberson
Walter Roberson il 28 Apr 2013
702*i is the point at which the answer exceeds realmax (about 1E308). If you are going to use double precision, your limit is between 701*i and 702*i. To go for larger values you need to switch to a symbolic package such as MuPAD (in the MATLAB Symbolic Toolbox), or Maple (maplesoft.com) or Mathematica (wolfram.com).
You asked how to compute besselj "with any x". I worked through and found the limit for Maple: once x exceeds 2.1E19 * i, you hit Maple's limit of 10^1000000000000000000000. But 2.1E19*i is a lot smaller than "any x" could be -- 2.1E19 is only a small bit more than 2^64.
Define your limits and someone might be able to come up with a software package that handles those limits.
Valery
Valery il 30 Apr 2013
Thanks a lot for the explanation. I did not literally mean that I need to calculate besselj for "any x", the limit 2.1E19*i which you noted for Maple excessively satisfies my needs.
Walter Roberson
Walter Roberson il 30 Apr 2013
Symbolic Toolbox, then.
Valery
Valery il 3 Mag 2013
Hello again.
I tried to use Mupad for besselJ function and here is what I get:
I tried this code:
y:=besselJ(1,702*i) got this result J0(702 i) (Mupad does not evaluate it for some reason).
Then i tried:
DIGITS:=39: float(y)
and got J1.0(702.0 i).
Can you help me to figure out how to get the numerical result?

Accedi per commentare.

Più risposte (0)

Prodotti

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by