# Cannot Plot Function

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]

-
Can you post copyable Mathematica code please? – Szabolcs Feb 27 '14 at 3:56
I don't know how to do that. Could you explain how? – Pierre M Fiorini Feb 27 '14 at 3:59
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. – Szabolcs Feb 27 '14 at 4:07
fyi, I get errors !Mathematica graphics – Nasser Feb 27 '14 at 4:08
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. – Pierre M Fiorini Feb 27 '14 at 4:14

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"}]


-
Thanks for your help - Much appreciated. – Pierre M Fiorini Feb 27 '14 at 18:23

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]


-
I am not sure. I'm still researching this. – Pierre M Fiorini Feb 27 '14 at 16:53