[pstricks] Re: pst-infixplot + multido?

Herbert Voss LaTeX at zedat.fu-berlin.de
Sat Nov 5 14:04:17 CET 2005


Holger Baier wrote:

> ich möchte gerne mittes pst-infixplot und multido untersummen bzw
> obersummen bei "beliebigen" (sinnvollen) Funktionsgraphen möglichst
> einfach (!) grafisch darstellen.
> Ist das möglich? Die Lösung mit dem pst-plot paket ist etwas kompliziert
> und kryptisch! Oder gibt es noch andere Möglichkeiten??

please use the mailing list address

Herbert


\documentclass[a4paper]{article}
\usepackage{pstricks}
\usepackage{pstricks-add}
\parindent=0pt
\makeatletter
\define at key[psset]{pstricks-add}{SumType}{\pst at expandafter\psset@@SumType{#1}\@nil}%
\def\psset@@SumType#1#2\@nil{%
   \ifx#1b\let\psk at SumType\z@\else\let\psk at SumType\@ne\fi}
\psset{SumType=below} % alternative SumType=above
%
\def\psSum{\pst at object{psSum}}
\def\psSum at i(#1,#2)#3#4{%
   \begin at SpecialObj%
   \addto at pscode{
     \ifPst at algebraic /Func (#4) tx at addDict begin AlgParser end cvx def \fi
     /x #1  def
     /dx #2 #1 sub #3 div def
     /scx { \pst at number\psxunit mul } def /scy { \pst at number\psyunit mul 
} def
     #3 {
%      newpath
       x scx 0 moveto
       \ifnum\psk at SumType<1
         \ifPst at algebraic Func \else #4 \fi scy dup x scx exch lineto
         /x x dx add def
         x scx exch lineto x scx 0 lineto
       \else
       /x x dx add def
       \ifPst at algebraic Func \else #4 \fi scy dup x dx sub scx exch lineto
       x scx exch lineto x scx 0 lineto
       \fi
%      closepath
       stroke
     } repeat
   }%
   \end at SpecialObj%
}
\makeatother
\begin{document}

\begin{pspicture}(10,5)
   \psaxes{->}(10,5)
   \psplot[plotpoints=100,linewidth=1.5pt,%
       linecolor=blue,algebraic]{0}{10}{sqrt(x)}
   \psSum[algebraic,linecolor=cyan,SumType=above](0,9){9}{sqrt(x)} % 
doesn't work
   \psSum[linecolor=red, fillstyle=vlines](0,9){9}{x sqrt}
\end{pspicture}

\end{document}




More information about the PSTricks mailing list