0
$\begingroup$

I have a product Exp[-I*Pi*x]*BesselK[-1, 2.43*Ix]. Now, Exp[-I*Pi*x] grows larger and larger as $x$ increases for imaginary large values, while BesselK[-1, 2.43*Ix] decreases. At a particular large imaginary value of $x$, while the product is finite, Exp[-I*Pi*x] is very large while BesselK[-1, 2.43*Ix] is around $10^{-300}$ and Mathematica sets the latter to be equal to zero, which makes the product become equal to zero.

Is there a way to tell Mathematica not to do this?

The exact input is:

Exp[-I*Pi*x]*BesselK[-1, 2.43*I*x] /. x -> I*290 // N  

This returns -1.97747*10^88 - 2.456351670414645*10^700I
If I write: Exp[-I*Pi*x]*BesselK[-1, 2.43*I*x] /. x -> I*291 // N
then it returns 0. - 6.445487767605421*10^702 I
So, there is a jump in the transition of x=290 to x=291

$\endgroup$

closed as off-topic by Bob Hanlon, m_goldberg, gpap, Öskå, José Antonio Díaz Navas Aug 25 '18 at 11:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, m_goldberg, gpap, Öskå, José Antonio Díaz Navas
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ What is the exact input that produces what? Do you really mean ix or rather I x? $\endgroup$ – Henrik Schumacher Aug 20 '18 at 20:05
  • 1
    $\begingroup$ What is ix? Somthing like I x? $\endgroup$ – Ulrich Neumann Aug 20 '18 at 20:06
  • $\begingroup$ Oh, yes, I meant Ix. I will edit the question. $\endgroup$ – TheQuantumMan Aug 20 '18 at 20:06
  • $\begingroup$ What is "some number"? $\endgroup$ – Henrik Schumacher Aug 20 '18 at 20:09
  • 1
    $\begingroup$ Can't reproduce this. $\endgroup$ – Jens Aug 20 '18 at 20:15
2
$\begingroup$

Use arbitrary precision rather than machine precision.

$Version

(* "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)"

Exp[x]*BesselK[-1, I x] /. x -> I*290.`20

(* 5.3594789574372585*10^124 - 3.6455728547082617*10^124 I *)

Exp[x]*BesselK[-1, I x] /. x -> I*290 // N[#, 20] &

(* 5.3594789574372584720*10^124 - 3.6455728547082616665*10^124 I *)

EDIT:

expr = Exp[-I Pi x]*BesselK[-1, I x] /. x -> I*706 // N[#, 650] &;

expr // NumberForm[#, 6] &

enter image description here

$\endgroup$
  • $\begingroup$ Exp[-IPix]*BesselK[-1, 2.43*I*x] /. x -> I*291 // N[#, 20] & There still exists a jump between 290 and 291. $\endgroup$ – TheQuantumMan Aug 20 '18 at 20:32
  • 3
    $\begingroup$ That's because you used the machine number 2.43. Calculations with machine numbers yield machine numbers without any precision tracking. Raising the precision to 20 afterward does nothing useful. $\endgroup$ – John Doty Aug 20 '18 at 20:41
  • $\begingroup$ @JohnDoty If you put $1$ at the place of $2.43$, you get the jump between 705I and 705 I. But, that is by using //N and not //N[#,20]. (There seems to be a problem in my version with //N[#,20]) $\endgroup$ – TheQuantumMan Aug 20 '18 at 20:50
  • 1
    $\begingroup$ Yes. //N takes you explicitly into the domain of machine numbers. So, implicitly, does 2.43. With machine numbers you get speed without precision control. But 1 is exact, and //N[#,20] gives you a controlled precision result. $\endgroup$ – John Doty Aug 20 '18 at 20:56
  • $\begingroup$ @TheQuantumMan - You need to include the & after the //N[#,20] i.e., //N[#,20]& See Function $\endgroup$ – Bob Hanlon Aug 20 '18 at 21:00
0
$\begingroup$

How about

fn[x_] := Exp[-I*Pi*x]*BesselK[-1, 243/100*I*x]

fn[I*290`20]
(*-1.9774702657848900*10^88 - 2.4563516704146749*10^700 I*)

fn[I*291`20]
(*-4.0216330025933670*10^88 - 6.445487767605888*10^702 I*)

fn[I*706`20]
(*-4.610286369132861*10^216 - 6.271805320261515*10^1706 I*)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.