# Mathematica Bessel function derivative in sum

1. Jul 27, 2017

### joshmccraney

Hi PF!

I'm trying to put the first derivative of the modified Bessel function of the first kind evaluated at some point say $\alpha$ in a sum where the $ith$ function is part of the index. What I have so far is
Code (Text):

n=3;
alpha = 2;
DBesselI[L_, x_] := D[BesselI[L, x], {x, 1}]
Sum[BesselI[L, alpha], {L, 1, n}]

But I don't think this is working. Any help would be awesome!

2. Jul 27, 2017

### Orodruin

Staff Emeritus
You are using the modified Bessel function, not its derivative that you defined in the previous line, in the sum ...

3. Jul 27, 2017

### joshmccraney

Ahh shoot,
Shoot, this is a typo on my part copying into PF. Instead if I use
Code (Text):

n=3;
alpha = 2;
DBesselI[L_, x_] := D[BesselI[L, x], {x, 1}]
Sum[DBesselI[L, alpha], {L, 1, n}]

I still get an error. In fact, even if I simply try evaluating
Code (Text):
DBesselI[1, alpha]
I receive an error. Any ideas?

4. Jul 27, 2017

### Orodruin

Staff Emeritus
It might help if you quote the error message.

5. Jul 27, 2017

### joshmccraney

It reads "2 is not a valid variable." and then iterates "$\partial_{\{2,1\}}BesselI[1,3]$". Any ideas?

6. Jul 28, 2017

### Orodruin

Staff Emeritus
Try
Code (Text):

DBesselI[L_, x_] = D[BesselI[L, x], {x, 1}]

instead. When you use := it is a delayed definition. The RHS will be evaluated only once the function is called. Since you were calling it with x = 2, it thinks you want to differentiate with respect to 2, i.e., it executes
Code (Text):

D[BesselI[L,2],{2,1}]