# Plot a function with respect to two parameters that are not explicitly function parameters

$$function = |\delta|\frac{I_1(\kappa)}{I_0(\kappa)}$$
where $I_0(\kappa)$ and $I_1(\kappa)$ are the modified bessel functions of the first kind of order $0$ and $1$

I want to plot the function in a 3D space with respect to $|\delta|$ and $\tau$ where $\tau$ has the following relation with $\kappa$
$$\tau = I_0(\kappa)e^{-\kappa}$$
and $0\le|\delta|\le1$ and $0\le\tau\le1$
The result should seem like this: ## 1 Answer

Because of that exponential in the definition of τ, the sampling of the function is tricky, and so trying to use ParametricPlot3D with enough PlotPoints, as we would have to, kills the kernel on my machine. So let's take an indirect approach by first plotting the function for δ = 1. For this, we use ParametricPlot:

p1 = ParametricPlot[{E^-k BesselI[0, k], BesselI[1, k]/BesselI[0, k]}
, {k, 0, 1000}
, PlotPoints -> 200
, PlotRange -> {{0, 1}, All}]


resulting in As far as I'm concerned, this is really all that matters, since δ is just a scale factor. But since you want the full 3D plot, here's how I back-doored the solution. We first extract the points making up the line in the plot via

pts = First@Cases[Normal@p1, Line[a_] :> a, Infinity];


and then construct a function from these points that interpolates the curve, and at the same time scales by δ:

f[d_, t_] := d Interpolation[pts][t]


Finally, then

Plot3D[f[d, t], {d, 0, 1}, {t, 0.013, 1}, ViewPoint -> {2.5, 1.5, 1.5}]


renders the following plot very fast: Note that we have to start t at 0.013 because in the original plot, we took k out to 1000, and

E^-k BesselI[0, k] /. k -> 1000.
(* 0.01261724045589 *)


In order to get close to 0, you have to get k out farther, and this requires you to increase the PlotPoints by a lot (although I'm sure there's a way to tell ParametricPlot to sample more near k = 0).

### Reasons

Here is a brief explanation of why I chose this back-door method. The most obvious solution is to use ParametricPot3D:

ParametricPlot3D[{d, E^-k BesselI[0, k], d BesselI[1, k]/BesselI[0, k]}
, {k, 0, 1000}
, {d, 0, 1}
, PlotRange -> {{0, 1}, All}]


However, even if we increase PlotPoints to 100, it still doesn't get the tau -> 1 (k -> 0) behavior very well, due to the sampling and the exponential in the definition of tau: Increasing PlotPoints further regularly crashes the kernel on my machine, so I went the indirect route. There is probably some Option to tell ParametricPlot3D how to sample the space correctly, but I don't know what it is.

• Note that $\tau(0)=1$ and $\lim_{\kappa\to\infty}\tau(\kappa)=0$ – Sepideh Abadpour Oct 7 '15 at 9:27
• @sepideh. Yes that is correct. That's part of why the sampling in the plot is difficult. – march Oct 7 '15 at 15:17