[pstricks] Outputting a particular value of a function using PSTricks
Herbert Voss
LaTeX at zedat.fu-berlin.de
Sat Sep 17 15:07:24 CEST 2005
dpstory at uakron.edu wrote:
> Hi all,
>
> Is there a way of computing a particular value of a function, say sin(20), using PSTricks?
>
> I wish to typset a sentence like:
>
> y-coordinate: sin(20)
>
> This is part of a multido that is reading out the x and y coordinates in an animation we are
> trying to build.
for a TeX solution use the fp package or for a PS solution
the following code
Herbert
\documentclass[12pt]{article}
\usepackage{pstricks,multido}
%
\def\printValue#1{%
\pstVerb{gsave /Times findfont 100 scalefont setfont #1 10 string cvs
1 -1 scale show grestore}}
%
\parindent=0pt
\begin{document}
\makebox[2em]{\#} \makebox[5em]{$sin x$} \makebox[5em]{$cos x$}
\makebox[5em]{$\sqrt x$}\makebox[6em]{$sin^2 x+cos^2
x$}\\[3pt]
\multido{\iA=0+10}{36}{
\makebox[1em]{\iA}
\makebox[5em]{\printValue{\iA\space sin}}
\makebox[5em]{\printValue{\iA\space cos}}
\makebox[5em]{\printValue{\iA\space sqrt}}
\makebox[6em]{\printValue{\iA\space dup sin dup mul exch cos dup
mul add}}\\}
\end{document}
More information about the PSTricks
mailing list