2
$\begingroup$

I cannot plot this function as I am getting errors. I am not sure what I am doing wrong.

Seems to work when $$n \rightarrow 1,$$ but when $$n \rightarrow 2,$$ I get a whole bunch of errors and nothing is plotted.

Here is the code:

$$ \text{Plot}\left[\frac{n e^{-t (\lambda +\mu )} I_1\left(2 t \sqrt{\lambda \mu }\right) \left(\int_0^t \frac{e^{t (-\lambda -\mu )} I_1\left(2 t \sqrt{\lambda \mu }\right)}{\sqrt{\rho } t} \, dt\right){}^{n-1}}{\sqrt{\rho } t}\text{/.}\, \left\{\lambda \to 0.99,\mu \to 1,\rho \to \frac{1}{2},n\to \{2\}\right\},\{t,0,10\},\text{PlotRange}\to \text{All}\right]$$

Here is copyable code:

Plot[(n*BesselI[1, 2*t*Sqrt[λ*μ]]*            
      Integrate[(E^(t*(-λ - μ))*
           BesselI[1, 2*t*Sqrt[λ*μ]])/(t*Sqrt[ρ]), 
                {t, 0, t}]^(-1 + n))/
    E^(t*(λ + μ))/(t*Sqrt[ρ]) /. 
     {λ -> 0.99, μ -> 1, ρ -> 1/2, n -> {2}}, {t, 0., 10}, PlotRange -> All]
$\endgroup$
5
  • $\begingroup$ Can you post copyable Mathematica code please? $\endgroup$
    – Szabolcs
    Feb 27, 2014 at 3:56
  • $\begingroup$ I don't know how to do that. Could you explain how? $\endgroup$
    – PiE
    Feb 27, 2014 at 3:59
  • $\begingroup$ That's good enough, thank you. I cleaned up the formatting of the code slightly for readability. You can select the code and use Edit -> Copy As -> Input Text. Then when you paste it here, select it again and press the code button in the toolbar to format it. $\endgroup$
    – Szabolcs
    Feb 27, 2014 at 4:07
  • $\begingroup$ fyi, I get errors !Mathematica graphics $\endgroup$
    – Nasser
    Feb 27, 2014 at 4:08
  • $\begingroup$ I get those same errors too. I was hoping there could be a workaround. It works for $$n \rightarrow 1,$$ but when $$n > 1,$$ I get those errors. $\endgroup$
    – PiE
    Feb 27, 2014 at 4:14

2 Answers 2

1
$\begingroup$
fun[t_, n_, \[Rho]_, \[Lambda]_, \[Mu]_] := (n*
     BesselI[1, 2*t*Sqrt[\[Lambda]*\[Mu]]]*
     NIntegrate[(E^(s*(-\[Lambda] - \[Mu]))*
          BesselI[1, 2*s*Sqrt[\[Lambda]*\[Mu]]])/(s*Sqrt[\[Rho]]), {s,
         0, t}]^(-1 + n))/E^(t*(\[Lambda] + \[Mu]))/(t*Sqrt[\[Rho]])

Visualizing:

Manipulate[
 Plot[fun[t, j, 1/2, 0.99, 1], {t, 0, 10}, 
  PlotRange -> {0, 1}], {{j, 0.5, "n"}, 0.5, 2.5, 
  Appearance -> "Labeled"}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks for your help - Much appreciated. $\endgroup$
    – PiE
    Feb 27, 2014 at 18:23
1
$\begingroup$

Is this how the function supposed to look like?

 int[t1_, lam_, mu_, rao_] := NIntegrate[(E^(t*(-lam - mu))*
      BesselI[1, 2*t*Sqrt[lam*mu]])/(t*Sqrt[rao]), {t, 0, t1}];

f[t_, {lam_, mu_, rao_, n_}] := (n*BesselI[1, 2*t*Sqrt[lam*mu]]*
   int[t, lam, mu, rao]^(-1 + n))/E^(t*(lam + mu))/(t*Sqrt[rao]);

parm = {lam -> 0.99, mu -> 1, rao -> 1/2, n -> 2};
Plot[f[t, {lam, mu, rao, n} /. parm], {t, 0, 10}, PlotRange -> All, 
   Frame -> True, GridLines -> Automatic,  GridLinesStyle -> LightGray]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ I am not sure. I'm still researching this. $\endgroup$
    – PiE
    Feb 27, 2014 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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