Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 7 down vote accepted

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}


enter image description here

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}
share|improve this answer

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}

Result

share|improve this answer
    
I will give a bounty of 100 later for this nice answer. –  Who is crazy first Sep 29 '12 at 19:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.