# A PostScript error when plotting an implicit function

This question was inspired by my answer for another question. I want to provide another solution with implicit function plot. Unfortunately the following code produces PostScript errors /undefinedresult in --exp--. How to fix it?

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-func}
\begin{document}
\begin{pspicture}(-2,-2)(2,2)
\psplotImp[linecolor=red,stepFactor=0.2,algebraic](-2,-2)(2,2){x^(2/3)+y^(2/3)-2^(2/3)}
\end{pspicture}
\end{document}

-

how should it be done? (-2)^0.667 is not possible, write it as (x^2)^(1/3)

use

\psplotImp[linecolor=red,stepFactor=0.1,
algebraic](-2.1,-2.1)(2.1,2.1){(x^2)^0.333+(y^2)^0.333-4^0.333}


and as already mentioned in the documentation use a clipping area smaller than the iteration area, which is needed to clip all the "moveto" lines, which could be seen in Heikos answer:

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-func}
\begin{document}
\begin{pspicture*}(-2,-2)(2,2)
\psplotImp[linecolor=red,stepFactor=0.1,
algebraic](-2.1,-2.1)(2.1,2.1){(x^2)^0.333+(y^2)^0.333-4^0.333}
\end{pspicture*}
\end{document}

-

The ghostscript interpreter has a little trouble to print the plot partially in the imaginary space. The range for x and y include negative numbers and the exponent is not an integer number. That is not supported by exp operator of PostScript:

exp: base exponent exp real

raises base to the exponent power. The operands may be either integers or r numbers. If the exponent has a fractional part, the result is meaningful only if the base is nonnegative. The result is always a real number.

Examples
9 0.5 exp ⇒ 3.0
-9 -1 exp ⇒ -0.111111

Errors: stackunderflow, typecheck, undefinedresult

In your case you get the latter error undefinedresult. The example works, if the range is limited to non-negative numbers.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-func}
\begin{document}
\begin{pspicture}(0,0)(2,2)
\psplotImp[linecolor=red,stepFactor=0.2,algebraic](0,0)(2,2){x^(2/3)+y^(2/3)-2^(2/3)}
\end{pspicture}
\end{document}


-
I will give a bounty of 100 later for this nice answer. – kiss my armpit Sep 29 '12 at 19:24