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?

 Réponse acceptée

Walter Roberson
Walter Roberson le 23 Avr 2013

0 votes

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 commentaires

Valery
Valery le 24 Avr 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 le 28 Avr 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 le 30 Avr 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 le 30 Avr 2013
Symbolic Toolbox, then.
Valery
Valery le 3 Mai 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?

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by