# Bessel function simplification problem

Started by March 4, 2005
```All,

I'm trying to simplifiy the following equation for the zero'th order
modified Bessel function of the first kind.  I'm using the
approximation for the Bessel function as

Io(z) = exp(z)/sqrt(2*pi*z)

I would like to have the natural logarithm of this function

log(Io(z)) = log(exp(z) / sqrt(2*pi*z))

= z + log(1/sqrt(2*pi*z))

but i don't want to have to calculate the log of a sqrt function.
What I'd like is a simplification that gives me an easy way to calc
the log(Io(z)) for each value of z.  Any ideas?

CW
```
```Hello CW,

If Io(z) approx exp(z)/sqrt(2*pi*z)

then log(Io(z)) approx z-0.5*log(2*pi*z)

= z-log(z)/2 -A where constant A = log(2pi)/2

IHTH,

Clay

```
```"CW" <prada_white@yahoo.ca> wrote in message
> All,
>
> I'm trying to simplifiy the following equation for the zero'th order
> modified Bessel function of the first kind.  I'm using the
> approximation for the Bessel function as
>
> Io(z) = exp(z)/sqrt(2*pi*z)
>
> I would like to have the natural logarithm of this function
>
> log(Io(z)) = log(exp(z) / sqrt(2*pi*z))
>
>           = z + log(1/sqrt(2*pi*z))
>
> but i don't want to have to calculate the log of a sqrt function.
> What I'd like is a simplification that gives me an easy way to calc
> the log(Io(z)) for each value of z.  Any ideas?
>
> CW
Hi CW    loq(sqrt(x)) = log(x)/2 (I think) so you are trying to simplify
z-log(z)/2-log(2*pi).

good luck - Mike

```
```Sorry, i should have added that z is not bounded -1 < z < 1 so I'm not
sure that the Mclaurin series will help me.

what i can say about z is that it will be a real non-negative number.
Does that shed any more light?

CW

```
```"CW" <prada_white@yahoo.ca> wrote in message
> All,
>
> I'm trying to simplifiy the following equation for the zero'th order
> modified Bessel function of the first kind.  I'm using the
> approximation for the Bessel function as
>
> Io(z) = exp(z)/sqrt(2*pi*z)
>
> I would like to have the natural logarithm of this function
>
> log(Io(z)) = log(exp(z) / sqrt(2*pi*z))
>
>           = z + log(1/sqrt(2*pi*z))
>
> but i don't want to have to calculate the log of a sqrt function.
> What I'd like is a simplification that gives me an easy way to calc
> the log(Io(z)) for each value of z.  Any ideas?
>
> CW
Hi CW again : I should have said  z-log(z)/2 -log(2*pi)/2  sorry.
Mike

```
```CW wrote:

> All,
>
> I'm trying to simplifiy the following equation for the zero'th order
> modified Bessel function of the first kind.  I'm using the
> approximation for the Bessel function as
>
> Io(z) = exp(z)/sqrt(2*pi*z)
>
> I would like to have the natural logarithm of this function
>
> log(Io(z)) = log(exp(z) / sqrt(2*pi*z))
>
>            = z + log(1/sqrt(2*pi*z))
>
> but i don't want to have to calculate the log of a sqrt function.
> What I'd like is a simplification that gives me an easy way to calc
> the log(Io(z)) for each value of z.  Any ideas?
>
> CW

My first idea is that you've forgotten some basic concepts about logarithms.

log(a*b) = log(a) + log(b).
log(a^x) = x * log(a).

1/sqrt(2*pi*z) = (2*pi*z)^(-1/2)

therefore log(1/sqrt(2*pi*z)) = -(log(2*pi) + log(z))/2.

You still have to calculate the log, but you now don't have to calculate
the square root as well.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
```
```Of course, In my haste i forgot about the negative sign...sorry to
offend.

CW

```
```Thanks for all the quick responses Clay, Mike and Tim.

So I guess i'm down to calculating z-log(z)/2 upon each iteration, as
the other term can be precomputed.  So is the calculation of a log term
computationally expensive?  That was my main motivation for trying to
remove it.

CW

```
```"CW" <prada_white@yahoo.ca> wrote in message
> Thanks for all the quick responses Clay, Mike and Tim.
>
> So I guess i'm down to calculating z-log(z)/2 upon each iteration, as
> the other term can be precomputed.  So is the calculation of a log term
> computationally expensive?  That was my main motivation for trying to
> remove it.
>
> CW
>
Hi CW - in general yes. There are a whole load of tricks to simplify it
though most of which seem to have been discussed in this newsgroup so you
ought to find something to suit you in the archives if you are using fixed
point math. Also I believe that Ray Andraka published a trick on
www.dpsguru.com if you are using floating point.
best of luck - mike

```
```CW wrote:
> All,
>
> I'm trying to simplifiy the following equation for the zero'th order
> modified Bessel function of the first kind.  I'm using the
> approximation for the Bessel function as
>
> Io(z) = exp(z)/sqrt(2*pi*z)
>
> I would like to have the natural logarithm of this function
>
> log(Io(z)) = log(exp(z) / sqrt(2*pi*z))
>
>            = z + log(1/sqrt(2*pi*z))
>
> but i don't want to have to calculate the log of a sqrt function.
> What I'd like is a simplification that gives me an easy way to calc
> the log(Io(z)) for each value of z.  Any ideas?
>
> CW

If course, log(1/sqrt(x)) = -log(sqrt(x)) = -[log(x)]/2. Won't that do?

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```