# Another 3D plot question- good and ugly but no bad-

I have the following code with the intention to have a 3D plot:

f0[y_] :=1/(E^((1 + y)^2/2)*Sqrt[2*Pi])
f1[y_] :=1/(E^((-1 + y)^2/2)*Sqrt[2*Pi])

l[y_] :=f1[y]/f0[y]

t[x_] :=NIntegrate[f1[y]^x*f0[y]^(1 - x), {y, -Infinity, Infinity}]

epsilon0[x_] :=-Log[t[x]] + (x*NIntegrate[l[y]^x*f0[y]*Log[l[y]], {y, -Infinity, Infinity}])/t[x]

epsilon1[x_] :=-Log[t[x]] + ((-1 + x)*NIntegrate[l[y]^x*f0[y]*Log[l[y]], {y, -Infinity, Infinity}])/t[x]

Plot[epsilon0[x], {x, 0, 1}]
Plot[epsilon1[x], {x, 0, 1}]


I have the following figures ! !

Good:

However I want to have a single graph probably a 3D plot for epsilon0, epsilon1 and $x$

For example when $x=0.2$ we have $\epsilon_0=0.08$ and $\epsilon_1=1.28$ if I change $x\in[0,1]$ I will get a pair $(\epsilon_0,\epsilon_1)$ for each $x$ and this should be representable in 3D at least as points. But I couldt do it.

Ugly:

What is the 3D figure if we allow any pair of continuous densities $f_0$ and $f_1$ on $\mathbb{R}$ which have $D(f_0,f_1)=2$ and $D(f_1,f_0)=2$ where $D$ is the relative entropy or KL divergence?

• Why not ParametricPlot[{epsilon0[x], epsilon1[x]}, {x, 0, 1}] ? – b.gates.you.know.what Apr 5 '14 at 19:31
• @b.gatessucks honestly i didnt know it. Right now I plotted and it seems also nice. But the $x$ information is lost. I was thinking $x$ at the $z$ axis and the corresponding $(\epsilon_0,\epsilon_1)$ as a point on the 3d plane. – Seyhmus Güngören Apr 5 '14 at 19:40
• Then you can do ParametricPlot3D[{x, epsilon0[x], epsilon1[x]}, {x, 0, 1}]. I am confused because you picked the tag which answers your question. – b.gates.you.know.what Apr 5 '14 at 19:43
• @b.gatessucks ahahaha thats true! – Seyhmus Güngören Apr 5 '14 at 19:45
• Do we really need a parametricplot3d tag? As it seems it was created here. – Silvia Apr 6 '14 at 5:27

Detail : your functions are simple enough that the integrals can actually be evaluated analytically.

t2[x_] = Integrate[f1[y]^x*f0[y]^(1 - x), {y, -Infinity, Infinity}]
(* E^(2 (-1 + x) x) *)

epsilon02[x_] = -Log[t2[x]] +
(x*Integrate[l[y]^x*f0[y]*Log[l[y]], {y, -Infinity, Infinity}]) / t2[x]
(* 2 x (-1 + 2 x) - Log[E^(2 (-1 + x) x)] *)

epsilon12[x_] = -Log[t2[x]] +
((-1 + x) * Integrate[l[y]^x*f0[y]*Log[l[y]], {y, -Infinity, Infinity}]) / t2[x]
(* 2 (-1 + x) (-1 + 2 x) - Log[E^(2 (-1 + x) x)] *)

Simplify[epsilon02[x], Assumptions -> {0 <= x <= 1}]
(* 2 x^2 *)

Simplify[epsilon12[x], Assumptions -> {0 <= x <= 1}]
(* 2 (-1 + x)^2 *)

ParametricPlot3D[{epsilon02[x], epsilon12[x], x}, {x, 0, 1}] 