diff options
author | Karl Berry <karl@freefriends.org> | 2018-02-04 21:38:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-02-04 21:38:21 +0000 |
commit | 1d37fde2e023b21781cbcfa6c4d826e879b21c54 (patch) | |
tree | e8a2070e23c8962eef427b8a2277f3a2eca27109 /Master/texmf-dist/tex | |
parent | 46ee79bdff3d640ffdb5af64fe7d566c7a56d465 (diff) |
pstricks-add (4feb18)
git-svn-id: svn://tug.org/texlive/trunk@46541 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex | 61 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty | 34 |
2 files changed, 68 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex index 4c276769710..4d505053b27 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.tex 718 2018-01-30 09:11:28Z herbert $ +%% $Id: pstricks-add.tex 722 2018-02-03 20:39:07Z herbert $ %% %% This is file `pstricks-add.tex', %% @@ -31,8 +31,8 @@ \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi \ifx\PSTmathLoaded\endinput\else \input pst-math \fi % -\def\fileversion{3.85} -\def\filedate{2018/01/29} +\def\fileversion{3.85a} +\def\filedate{2018/02/03} \let\pstricksaddFV\fileversion \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % @@ -725,6 +725,8 @@ a add \psset{StepType=lower} % alternative StepType=upper/inf/sup/Riemann \define@boolkey[psset]{pstricks-add}[Pst@]{noVerticalLines}[true]{}% \psset{noVerticalLines=false} +\define@boolkey[psset]{pstricks-add}[Pst@]{drawLines}[true]{}% +\psset{drawLines=true} % \newcount\pst@stepcount \pst@stepcount=1 @@ -752,23 +754,30 @@ a add /Area 0 def % \ifcase\psk@StepType % 0->lower, height is always f(x) - x scx 0 moveto + \ifPst@drawLines x scx 0 moveto \fi #3 { Func dup dx mul Area add /Area ED - scy dup x scx exch \ifPst@noVerticalLines moveto \else lineto \fi + \ifPst@drawLines scy dup x scx exch \ifPst@noVerticalLines moveto \else lineto \fi + \else pop \fi /x x dx add def - x scx exch lineto - x scx 0 \ifPst@noVerticalLines moveto \else lineto \fi + \ifPst@drawLines + x scx exch lineto + x scx 0 \ifPst@noVerticalLines moveto \else lineto \fi + \fi } repeat \or % 1-> upper, height is always f(x+dx) - x scx 0 moveto + \ifPst@drawLines x scx 0 moveto \fi #3 { /x x dx add def Func \ifPst@saveSumValue dup dx mul Area add /Area ED \fi - scy dup x dx sub scx exch - \ifPst@noVerticalLines moveto \else lineto \fi - x scx exch lineto - x scx 0 \ifPst@noVerticalLines moveto \else lineto \fi + \ifPst@drawLines + scy dup x dx sub scx exch + \ifPst@noVerticalLines moveto \else lineto \fi + x scx exch lineto + x scx 0 \ifPst@noVerticalLines moveto \else lineto \fi + \else + pop + \fi } repeat \ifPst@saveSumValue \fi @@ -784,8 +793,8 @@ a add /t x def % save x value eps3 { Func \ifPst@saveSumValue dup dx mul Area add /Area ED \fi - dup - Max lt { /Max exch def } { dup Min gt { /Min exch def }{ pop } ifelse } ifelse + dup + Max lt { /Max exch def } { dup Min gt { /Min exch def }{ pop } ifelse } ifelse /x x dt add def } repeat /x t def % restore @@ -794,19 +803,21 @@ a add closepath } repeat /dx dx scx def - xMinMax aload length 3 div cvi { - /yMax ED /yMin ED /x ED - x yMin moveto - dx 0 \ifPst@noVerticalLines rmoveto \else rlineto \fi - x dx add yMax lineto - dx neg 0 \ifPst@noVerticalLines rmoveto \else rlineto \fi - x yMin \ifPst@noVerticalLines moveto \else lineto \fi - closepath - } repeat - \ifPst@saveSumValue + \ifPst@drawLines + xMinMax aload length 3 div cvi { + /yMax ED /yMin ED /x ED + x yMin moveto + dx 0 \ifPst@noVerticalLines rmoveto \else rlineto \fi + x dx add yMax lineto + dx neg 0 \ifPst@noVerticalLines rmoveto \else rlineto \fi + x yMin \ifPst@noVerticalLines moveto \else lineto \fi + closepath \fi + } repeat \or % 3->inf(imum) - x scx 0 moveto +% \ifPst@drawLines + x scx 0 moveto +% \fi #3 { \ifPst@algebraic Func \else #4 \fi \ifPst@saveSumValue dup dx mul Area add /Area ED \fi diff --git a/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty b/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty index c7b73696431..97fdcfab764 100644 --- a/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty +++ b/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.sty 718 2018-01-30 09:11:28Z herbert $ +%% $Id: pstricks-add.sty 721 2018-02-03 20:37:57Z herbert $ % \RequirePackage{pstricks} \RequirePackage{pst-plot} @@ -7,7 +7,7 @@ \RequirePackage{pst-math} \RequirePackage{multido} -\ProvidesPackage{pstricks-add}[2010/02/11 v. 0.14 package wrapper for +\ProvidesPackage{pstricks-add}[2018/02/03 v. 0.15 package wrapper for pstricks-add.tex (hv)] \input{pstricks-add.tex} \ProvidesFile{pstricks-add.tex} @@ -16,4 +16,34 @@ \ProvidesFile{pstricks-add.pro} [2009/12/17 v. 0.23, PostScript prologue file (hv)] \@addtofilelist{pstricks-add.pro}}{}% + +\RequirePackage{xparse} + +\ExplSyntaxOn +\DeclareExpandableDocumentCommand\psCalc{m}{\fp_to_decimal:n{#1}}% +\ExplSyntaxOff + +\def\psRiemannSum(#1,#2)#3#4{% (x0,x1) n f(#1) + \def\psFunction@##1{#4}% + \edef\ps@@dx{\psCalc{(#2-#1)/#3}}% + \edef\ps@@dxHalf{\psCalc{\ps@@dx/2}}% +% \typeout{dx=\ps@dx}% + \def\psRightSumValue{0}% + \def\psLeftSumValue{0}% + \def\psMiddleSumValue{0}% + \def\psDiffSumValue{0}% + \Multido{\rA=#1+\ps@@dx,\rB=\ps@@dx+\ps@@dx,\rC=\ps@@dxHalf+\ps@@dx}{#3}{% + \def\ps@rightY{\psCalc{\psFunction@{\rB}}}% + \def\ps@leftY{\psCalc{\psFunction@{\rA}}}% + \def\ps@middleY{\psCalc{\psFunction@{\rC}}}% +% \typeout{\ps@leftY, \ps@rightY }% + \edef\psLeftSumValue{\psCalc{\psLeftSumValue+\ps@@dx*\ps@leftY}}% + \edef\psRightSumValue{\psCalc{\psRightSumValue+\ps@@dx*\ps@rightY}}% + \edef\psMiddleSumValue{\psCalc{\psMiddleSumValue+\ps@@dx*\ps@middleY}}% + \edef\psDiffSumValue{\psCalc{\psDiffSumValue+abs(\ps@@dx*(\ps@rightY-\ps@leftY))}}% +% \typeout{\psLeftSumValue , \psRightSumValue }% + }% end \Multido +} + + \endinput |