1
$\begingroup$

I have a special function given as:

$${\rm f}\left(r\right) ={1 \over \beta\lambda}\,2^{r/\beta} \exp\left({\left[2^{r/\beta} - 1\right]K \over \lambda}\right)$$

I should find the Expectation of the random variable $r$. Mathematica was not able to solve the associated Integral function. So it returns:

$$ \int_0^{\infty}\left\{{1 \over \beta\lambda}\,2^{r/\beta} \exp\left({\left[2^{r/\beta} - 1\right]K \over \lambda}\right)\right\}\ r\,{\rm d}r $$

Does anyone recognize how I can reduce this function so I can solve it further?

==== Edit =====

This is the code I tried:

Integrate[ r*fr, {r, 0, \Infinity}, Assumptions->{K>=1, \lambda >=0, \beta >=0}]
$\endgroup$
3
  • $\begingroup$ Please post the code you've already tried. $\endgroup$ Mar 31, 2014 at 6:51
  • 1
    $\begingroup$ It looks like unless K/lambda <0 your integral is not convergent. Also, it doesn't look like f[r] it's normalized. $\endgroup$ Mar 31, 2014 at 10:04
  • $\begingroup$ Yes right. That's what @ubpdqn showed - $Re[\frac{a3}{a2}]<0$, that is $Re[\frac{K}{λ}]<0$. Unfortunately, I think I have a bigger problem, because both $K$ and $λ$ are positive in my model. $f(r)$ is actually correct. Although I removed a product term $K Log[2]$ from $f(r)$ which on testing does not seem to have any major effect. $\endgroup$
    – Afloz
    Mar 31, 2014 at 10:30

1 Answer 1

6
$\begingroup$

The integral is conditionally convergent. You can progress using substitution: $u=2^{\frac{r}{b}}\iff r= b\log_2 u $ Hence,$\frac{dr}{du}=\frac{b}{u\ln 2}$

You can do these substitutions in Mathematica:

f[r_, b_, la_, k_] := 2^(r/b) Exp[k (2^(r/b) - 1)/la]/(b la)
exp = f[x, a1, a2, a3] /. {2^(x/a1) -> u};
ex = D[a1 Log[2, u], u];
ans = Integrate[a1 Log[2, u] exp ex, {u, 1, Infinity}]

The symbolic integral is thence:

ConditionalExpression[-((a1 E^(-(a3/a2)) Gamma[0, -(a3/a2)])/(
  a3 Log[2]^2)), Re[a3/a2] < 0]

Now you can compare numerically:

N@Integrate[r f[r, 1, -1, 1], {r, 0, Infinity}]

yields

-1.24122

and using the symbolic integral:

N[ans /. {a1 -> 1, a2 -> -1, a3 -> 1}]

yields: -1.24122

A small sample:

Grid[Table[{1, j, 1, N@ans /. {a1 -> 1, a2 -> j, a3 -> 1}, 
   Integrate[r f[r, 1, j, 1], {r, 0, Infinity}]}, {j, 
   Range[-1, -0.1, 0.1]}], 
 Dividers -> {{False, False, False, True, {False}}, None}]

enter image description here

I arbitrarily chose some parameters to illustrate. Further insights regarding convergence can be obtained:

Manipulate[ 
 Plot[{r f[r, 1, j, 1], r f[r, 1, 1, j]}, {r, 0, 10}, 
  PlotRange -> {-1, 10}, 
  Epilog -> Text[Style[j, 20, Red], {6, 5}]], {j, -1, 1, 0.15}]

enter image description here

Obviously the parameter constraints (regions of interest) are up to users intention.

$\endgroup$
4
  • $\begingroup$ Great! Interesting work. It appears to me that $\lambda$ implies $a2$ which appears to be $ < 0$. This seems to contradict our original assumption that $\lambda >= 0$. Am I right? $\endgroup$
    – Afloz
    Mar 31, 2014 at 9:17
  • $\begingroup$ @Methyl see update $\endgroup$
    – ubpdqn
    Mar 31, 2014 at 9:25
  • $\begingroup$ You're quite correct. The solution here is conditioned on $Re[a3/a2] < 0$, that is $Re[\frac{K}{\lambda}] < 0$. Unfortunately, I think I have a bigger problem, both $K$ and $\lambda$ are positive in my model. $\endgroup$
    – Afloz
    Mar 31, 2014 at 9:56
  • $\begingroup$ Let me be the first to give well-deserved +1, a typically neat and clean answer by you. $\endgroup$
    – ciao
    Mar 31, 2014 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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