[pstricks] Modifying psPolynomial

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Tue Mar 16 16:59:49 CET 2004


Vince McGarry wrote:

> Yes, I did. Here is the entire input file. The macros I wrote replaced yours
> in pst-add.tex temporarily until I could determine what would work, so I
> changed the name to pst-addv.tex with the matching style file to call it
> from LaTex.

here is a solution without pstricks-add. It shows how
PostScript procedures can be used from within TeX

Herbert

\documentclass[12pt]{article}
\usepackage{pst-plot}
\SpecialCoor
\pagestyle{empty}

\def\coeff{0 -5 0 1}
\pstVerb{
	/Horner {
	[\coeff] aload length
	dup 2 add -1 roll
	exch 1 sub {
		dup 4 1 roll
		mul add exch
	} repeat
	pop } def
	/Y { dup Horner } def
}

\begin{document}

\begin{center}
\begin{pspicture*}(-5,-5)(5,5)
	\psgrid[subgriddiv=0,griddots=10]
	\psset{yunit=0.25}
	\psaxes[Dy=5]{->}(0,0)(-5,-20)(5,20)
	\psplot[linewidth=2pt,linecolor=red]{-5}{5}{x  Horner}
	\psdot[dotsize=0.25cm](! -2 Y) % Plots the point (-2,f(-2))
\end{pspicture*}
  \end{center}

\end{document}


-- 
http://www.pstricks.de/




More information about the PSTricks mailing list