[pstricks] A little help deciphering code and a question

Thomas Söll Thomas.Soell at onlinehome.de
Fri May 2 19:49:14 CEST 2014


Hallo Randy,

here ist a solution for your problem with calculatet intersection point.

Thomas

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


\begin{document}

\begin{pspicture}[showgrid=false,saveNodeCoors](-1,-1)(10,6)
\psset{xunit=2 ,yunit=0.6}
\psset{algebraic,plotstyle=curve}

\def\xE{4}

\definecolor{SuperLightBlue}{cmyk}{0.2,0,0,0}
\pstInterFF[dotscale=0.6]{0.25*x^2+1}{0.5*(x-4)^2}{3}{S}

\pscustom[fillstyle=solid,fillcolor=SuperLightBlue,linestyle=none]{%
      \psplot{0}{N-S.x}{0.25*x^2+1}
      \psline(*{N-S.x} {0.25*x^2+1})(0,0|*{N-S.x} {0.25*x^2+1})
      \closepath
}
\pscustom[fillstyle=solid,fillcolor=green!10,linestyle=none]{%
      \psplot{0}{N-S.x}{0.5*(x-4)^2}
      \psline(*{N-S.x} {0.5*(x-4)^2})(0,0|*{N-S.x} {0.5*(x-4)^2})
      \closepath
}
\pscustom[fillstyle=solid,fillcolor=yellow!40,linestyle=none]{%
      \psplot{N-S.x}{4}{0.25*x^2+1}
      \lineto(*{\xE} {0.5*(x-4)^2})
      \psplot{\xE}{N-S.x}{0.5*(x-4)^2}
      \closepath
}
\pscustom[fillstyle=solid,fillcolor=orange!40,linestyle=none]{%
      \psplot{0}{N-S.x}{0.25*x^2+1}
      \psplot{N-S.x}{\xE}{0.5*(x-4)^2}
      \lineto(\xE,0)
      \lineto(0,0)
      \closepath
}
\pscustom[fillstyle=solid,fillcolor=magenta!10,linestyle=none]{%
      \psplot{0}{N-S.x}{0.5*(x-4)^2}
      \psplot{N-S.x}{\xE}{0.25*x^2+1}
      \lineto(\xE,0|*{0} {0.5*(x-4)^2})
      \closepath
}

\psaxes[labels=none, ticks=none, linewidth=0.25pt](0,0)(4.5,8.25)%
[\footnotesize $q$ \textsf{(quantity)},90]%
[\footnotesize $p$ \textsf{(price/unit)},90]

\psplot[linecolor=blue]{0}{4}{0.5*(x-4)^2}
\psplot[linecolor=blue]{0}{4}{0.25*x^2+1}

\psline[linestyle=dotted](2,0)(2,2)
\psline[linestyle=dotted](0,2)(2,2)

\rput(1.3,6.25){\rnode{A}{\footnotesize \textsf{Producer Surplus}}}
\pnode(0.5,1.35){B}
\nccurve[angleA=180, angleB=135]{->}{A}{B}

\rput[r](-0.05,1){\footnotesize $p_0$}
\rput[r](-0.05,2){\footnotesize $p*$}
\rput[r](-0.05,8){\footnotesize $p_1$}
\rput[t](2,-0.1){\footnotesize $q*$}
\rput[t](4,-0.1){\footnotesize $q_1$}
\rput(3.3,3){\footnotesize \textsf{Supply}}
\rput(1.5,4.25){\footnotesize\textsf{Demand}}
\end{pspicture}

\end{document}



More information about the PSTricks mailing list