[pstricks] Logarithmic range in PST-3d

Felix Hoffmann fhoffmann at iam.uni-bonn.de
Fri Nov 11 15:35:41 CET 2011


Hi list!

I want to plot the potential function H(x) of a mixture of the densities 
of two normal random variables (both of them are in R^2 so I need 
psplotThreeD), that is the negative logarithm of the sum of the 
densities. So essentially I want to plot the following function:
  -1.0*ln[0.31831*{2.718^(-0.5*(4*(x-3)^2+4*(y-3)^2))}  +  
0.31831*{2.718^(-0.5*(4*(x+3)^2+4*(y+3)^2))}]
I followed the instructions in Herbert's book PSTricks Vol. 2 of 
psplotThreeD, but it says "Error: /rangecheck in --ln--".

Interestingly, if I cancel the "4*" in the exponent, it all works and 
gives me a wonderful picture, but if I keep the "4*" it throws an error 
(I need the "4*" due to my variance of the single modes).

Here is the working example:

\documentclass[a4paper]{report}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

\usepackage{graphicx,pst-all,layout,pst-solides3d,pst-3dplot}

\begin{document}%\layout
\thispagestyle{empty}
\begin{pspicture}(-6.5,-6.5)(6.5,6.5)\psset{Alpha=30,Beta=15}
\psplotThreeD[plotstyle=curve, drawStyle=xyLines,hiddenLine=false, 
yPlotpoints=50,xPlotpoints=50,linewidth=0.5pt,algebraic=true,zThreeDunit=0.1](-7,7)(-7,7){-1.0*ln(0.31831*(2.718^(-0.5*((x-3)^2+(y-3)^2)))+0.31831*(2.718^(-0.5*((x+3)^2+(y+3)^2))))}
\pstThreeDCoor[xMin=-1,xMax=7,yMin=-1,yMax=7,zMin=-1,zMax=100,zThreeDunit=0.1]
\end{pspicture}
\end{document}

Here is the not working example:

\documentclass[a4paper]{report}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

\usepackage{graphicx,pst-all,layout,pst-solides3d,pst-3dplot}

\begin{document}%\layout
\thispagestyle{empty}
\begin{pspicture}(-6.5,-6.5)(6.5,6.5)\psset{Alpha=30,Beta=15}
\psplotThreeD[plotstyle=curve, drawStyle=xyLines,hiddenLine=false, 
yPlotpoints=50,xPlotpoints=50,linewidth=0.5pt,algebraic=true,zThreeDunit=0.1](-7,7)(-7,7){-1.0*ln(0.31831*(2.718^(-0.5*4*((x-3)^2+(y-3)^2)))+0.31831*(2.718^(-0.5*4*((x+3)^2+(y+3)^2))))}%{-1.0*ln(0.31831*2.718^(-0.5*(4*(x-3)^2+4*(y-3)^2))+0.31831*2.718^(-0.5*(4*(x 
+ 3)^2+4*(y + 3)^2)))}
\pstThreeDCoor[xMin=-1,xMax=7,yMin=-1,yMax=7,zMin=-1,zMax=100,zThreeDunit=0.1]

\end{pspicture}
\end{document}


I hope, that someone may give me a trick or hack to come by this 
problem. I guess it has something to do with the values, the logarithm 
accepts or some evaluation issues...

Thanks in advance,

Felix from Bonn








More information about the PSTricks mailing list