3

Normal View

alt text


Zoomed-In View

alt text


"Minimal" Code Snippet

\documentclass[11pt,rgb]{article}
\usepackage{pst-func}
\renewcommand\pshlabel[1]{{\color{gray}\tiny#1}}
\renewcommand\psvlabel[1]{{\color{gray}\tiny#1}}
\usepackage{graphicx}
\usepackage{bera}
\begin{document}
\noindent\scalebox{2}{%
\begin{pspicture*}[showgrid=false](-3,-3)(3,3)
  \psframe[fillcolor=black,fillstyle=solid](-3,-3)(3,3)  
  \psaxes
  [%
   linecolor=gray,
   tickcolor=gray,
   linewidth=0.25pt,
   xlabelPos=top,
   xticksize=-0.05 0.05,
   yticksize=-0.05 0.05%
  ]{<->}(0,0)(-2,-1.75)(2,2)[$\color{gray}x$,0][$\color{gray}y$,90]
  \rput[br](-1.75,1.5){\Large\bf\color{cyan}We}
  \rput(1.75,-1){\Large\bf\color{white}PSTricks}
  \psplotImp[linecolor=red,linewidth=0.5pt](-2.5,-1.75)(2.5,2.5)%
  {x 2 exp 1.25 y mul x abs sqrt sub 2 exp add 2.5 sub}   
  \rput(0,-2.25){\color{yellow}$x^2 + \left(\frac{5y}{4}-\sqrt{|x|}\right)^2=\frac{5}{2}$}
\end{pspicture*}}
\end{document}  

I noticed the produced curve is NOT symmetric about y-axis. It has to be symmetric about y-axis actually.

3 Answers 3

6

that was not a minimal example ...

\documentclass{article}
\usepackage{pst-func}
\begin{document}

\noindent\psscalebox{2}{%
\begin{pspicture*}(-3,-3)(3,3)
  \psaxes[
   linecolor=gray,
   tickcolor=gray,
   linewidth=0.25pt,
   xlabelPos=top,
   labelFontSize=\scriptscriptstyle,
   labelsep=2pt,
   ticksize=-0.05 0.05
  ]{<->}(0,0)(-2,-1.75)(2,2)[$\color{gray}x$,0][$\color{gray}y$,90]
  \psplotImp[linecolor=red,linewidth=0.5pt,stepFactor=0.2,
     algebraic](-2.5,-1.75)(2.5,2.5){x^2+(5*y/4-sqrt(abs(x)))^2-2.5}
\end{pspicture*}}

\end{document}
12
  • @Herbert, thanks for informing stepFactor. I set it to 0.1 and the curve looks more smooth. Commented Dec 31, 2010 at 7:33
  • @Herbert, can we fill in the region enclosed by the curve with a solid color? Commented Dec 31, 2010 at 8:12
  • 1
    it is not a question of TeX or PostScript, it is a question of how an implizit defined function can be solved as a continuos series of points ...
    – user2478
    Commented Dec 31, 2010 at 9:33
  • 2
    @Pieter: it is possible, but you have to take all points of the curve and sort them in a way that it will be a continous curve. On PS side it is easy to save all found points in an array and then build the continous curve. I do not have the time by now, that'S all ...
    – user2478
    Commented Dec 31, 2010 at 10:00
  • 1
    @Pieter: no, not a question of the resulution. I need only a fist direction vector. As I wrote, it is in my brain, where verything works with light speed, but my fingers are very slow ... :-)
    – user2478
    Commented Dec 31, 2010 at 10:38
2

the same with a simple function in parameter notation:

\documentclass{article}
\usepackage{pst-func}
\begin{document}

\begin{pspicture*}(-3,-3)(3,3)
  \psaxes[linewidth=0.25pt,
   xlabelPos=top,
   labelFontSize=\scriptscriptstyle,
   labelsep=2pt,
   ticksize=0.05]{<->}(0,0)(-2,-1.75)(2,2)[$x$,0][$y$,90]
\pscustom[fillstyle=solid,fillcolor=red,opacity=0.4,
    linecolor=red,linewidth=1pt,algebraic]{%
  \psparametricplot{0}{2.5 .25 exp}{t^2  | 0.8*(sqrt(2.5-t^4)+t)}
  \psparametricplot{2.5 .25 exp}{0}{t^2  | 0.8*(-sqrt(2.5-t^4)+t)}
  \psparametricplot{0}{2.5 .25 exp}{-t^2 | 0.8*(-sqrt(2.5-t^4)+t)}
  \psparametricplot{2.5 .25 exp}{0}{-t^2 | 0.8*(sqrt(2.5-t^4)+t)}
}
\end{pspicture*}

\end{document}

alt text

4
  • thank for this additional answer. I get a new knowledge here, especially the notation {expr1|expr2}. Commented Dec 31, 2010 at 9:24
  • 1
    code is now simplified.
    – user2478
    Commented Dec 31, 2010 at 9:31
  • I just want to inform that there is a simpler polar expression that produces "almost" identical graph. Here it is \def\x(#1){sin(#1)^3} \def\y(#1){(13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t))/16}, I stole it from this answer. Commented Aug 23, 2012 at 6:32
  • 1
    the so called heart curves are all listed here: mathworld.wolfram.com/HeartCurve.html
    – user2478
    Commented Aug 23, 2012 at 7:27
1

Still version:

Simplifying the existing answers.

enter image description here

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-plot}

\def\x(#1){sin(#1)^3}
\def\y(#1){(13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t))/16}

\psset{algebraic,plotpoints=100}

\begin{document}

\begin{pspicture}[showgrid=bottom](-2,-2)(2,2)
    \psparametricplot[origin={0,0.15}]{0}{\psPiTwo}{\x(t)|\y(t)}
\end{pspicture}

\end{document}

Animated version:

enter image description here

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
\FPeval\Delta{round(2*pi/30:2)}

\def\x(#1){sin(#1)^3}
\def\y(#1){(13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t))/16}

\psset{algebraic,plotpoints=100}

\begin{document}
\multido{\n=0.00+\Delta}{31}{%
\begin{pspicture}[showgrid=false](-1.5,-1.5)(1.5,1.5)
    \psparametricplot[origin={0,0.15},linecolor=red]{0}{\n}{\x(t)|\y(t)}
\end{pspicture}}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .