[pstricks] psPolynomial
McGarry Vince
vmcgarry at austin.rr.com
Tue Apr 10 01:36:47 CEST 2007
> a trailing space.
> Please send me your tex file and the pst-func.tex
>
> Herbert
Here is the diff file for the version I have of been using. 0.47, of
pst-func and the version from CTAN, 0.48, although 4.8 seems to have
an earlier date than 0.47, as noted by Alan. I also have version
0.46, distributed with TeXLive-2007. Both 0.46 and 0.48 work fine.
Vince
%----------
31,32c31,32
< \def\fileversion{0.48} <---- version on CTAN
< \def\filedate{2006/11/20}
---
> \def\fileversion{0.47} <---- version I've been using recently
> \def\filedate{2007/02/01}
94,95c94,97
< \def\psPolynomial at i#1#2{{%
< \begin at OpenObj
---
> \def\psPolynomial at i#1#2{%
> \pst at killglue
> \begingroup
> \use at par
131a134,136
> \gdef\psplot at init{}%
> \@pstfalse
> \@nameuse{testqp@\psplotstyle}%
137,138c142,143
< \end at OpenObj
< }\ignorespaces}
---
> \endgroup
> \ignorespaces}
140a146
> \typeout{Typ: Line}
156c162,163
< \psk at plotpoints {
---
> xy moveto
> \psk at plotpoints 1 sub {
355,364c362,371
< /a #3 def
< /dx #4 #3 sub \psk at plotpoints\space div def
< /b #4 def
< /aa #1 def
< /dd #2 #1 sub \psk at plotpoints\space div def
< /t aa dd add def
< /scx { \pst at number\psxunit mul } def
< /scy { \pst at number\psyunit mul } def
< tx at FuncDict begin /SFunc { t #5 } def end
< a b \psk at Simpson % a b M on Stack
---
> /int at a #3 def
> /int at b #4 def
> /int at dx int at b int at a sub \psk at plotpoints\space div def % (b-a)/n
> /int at aa #1 def % xStart
> /int at dd #2 int at aa sub \psk at plotpoints\space div def % (xStart-
xEnd)/n
> /int at t int at aa int at dd add def % xStart+dd
> /int at scx { \pst at number\psxunit mul } def
> /int at scy { \pst at number\psyunit mul } def
> tx at FuncDict begin /SFunc { int at t #5 } def end % x-> f(x)
> int at a int at b \psk at Simpson % a b M on Stack
366,369c373,376
< scy t scx exch moveto
< /t t dd add def
< \psk at plotpoints 1 sub {
< a b \psk at Simpson % a b M on Stack
---
> int at scy int at t int at scx exch moveto % first point
> /int at t int at t int at dd add def
> \psk at plotpoints 1 sub {
> int at a int at b \psk at Simpson % a b M on Stack
371,372c378,379
< scy t scx exch lineto
< /t t dd add def
---
> int at scy int at t int at scx exch lineto
> /int at t int at t int at dd add def
407c414
< kOld scx 0 L kOld scx Y scy L k dx add scx Y scy L
---
> kOld scx 0 L kOld scx Y scy L k dx add scx Y scy L
418d424
< \ifPst at markZeros\else k dx add scx 0 L \fi % last line down to
x-axis
471c477
< \ifx\psplotstyle\cplotstyle\@nameuse{endplot@\psplotstyle}\else%
---
> \ifx\psplotstyle\cplotstyle \@nameuse{endplot@\psplotstyle} \else%
479,513d484
< \def\psPoisson{\pst at object{psPoisson}}
< \def\psPoisson at i#1#2{%
< \begin at SpecialObj%
< \addto at pscode{
< /scx { \pst at number\psxunit mul } def
< /scy { \pst at number\psyunit mul } def
< /N #1 def
< /lambda #2 def
< /elambda Euler #2 neg exp def % e^-lambda
< /dx \psFunc at barwidth 2 div def
< /kOld dx neg def
< kOld scx 0 moveto % starting point
< /Y elambda def % start value
< 0 1 N { % N times
< /k exch def % save loop variable
< k 0 eq { /kFaculty 1 def }{ /kFaculty kFaculty k mul def }
ifelse
< /Y lambda k exp kFaculty div elambda mul def
< kOld scx 0 L kOld scx Y scy L k dx add scx Y scy L
< \ifPst at markZeros k dx add scx 0 L \fi
< \ifPst at printValue
< gsave \psk at PSfont findfont \psk at fontscale scalefont setfont
< Y \psk at valuewidth string cvs
< k scx \psk at fontscale 2 div add
< Y scy \pst at number\pslabelsep add moveto
< 90 rotate show grestore
< \fi
< /kOld kOld 1 add def
< } for
< \ifPst at markZeros\else k dx add scx 0 L \fi % last line down to
x-axis
< }%
< \psk at fillstyle
< \pst at stroke
< \end at SpecialObj%
< }
< %
More information about the PSTricks
mailing list