# Bessel Function Evaluation Problem in Mathematica

1. Jul 17, 2009

### S_David

Hello,

When I write:
Code (Text):
BesselK[1,2]
in the Mathematica editor, the output is the same as the input. But I want to evaluate it numerically. In other words, I want the output be a number. How can I do that?

Regards

2. Jul 17, 2009

### CompuChip

Did you try the N function?

Code (Text):

N[BesselK[1,2]]
BesselK[1,2] // N

In general, Mathematica only "evaluates" such functions for special arguments for which it knows exact values. In all other cases, it leaves the answer exact. You can force it to give a decimal representation using
N[expr]
or
N[expr, # of decimals]

Another way that often works is to give the arguments as floating numbers rather than exact values:
Code (Text):

BesselK[1., 2]
BesselK[1, 2.]
BesselK[1., 2.]

3. Jul 17, 2009

### S_David

Thank you CompuChip, but it didn't work, I still get the same expression. Why?

Regards

4. Jul 17, 2009

### Hepth

try again, the N method is correct.

In[30]:= N[BesselK[1, 2]]

Out[30]= 0.139866

make sure its not misspelled.

5. Jul 18, 2009

### S_David

Now it is working, but believe me, I wrote it correctly, and the result was not produced numerically, I don't know why. Anyway, thank you Hepth very much to confirm the N[] numerical evaluation method.

Regards

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook