Graphics, Figures & TablesPSTricks | Unexpected behaviour of \psGaussI from pst-func

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

PSTricks | Unexpected behaviour of \psGaussI from pst-func

Post by svend_tveskaeg »

Hi all.

Consider the following MWE:

Code: Select all

% Compile using
%
% latex <filename>.tex
% dvips -Ppdf -D1200 <filename>.dvi
% ps2pdf <filename>.ps
%
% and open with Adobe Reader.

\documentclass[danish]{article}
\usepackage{babel}
\usepackage{pst-func}
\usepackage{animate}

\newcommand*{\normalC}[1]{
\psset{xunit=1,yunit=5cm}
 \begin{pspicture}(-5.5,-0.25)(6,1.35)
  \psaxes[Dy=0.2,comma]{->}(0,0)(-5.3,0)(5.5,1.1)[$x$,0][$y$,90]
  \pscustom[fillstyle=solid,fillcolor=blue!40,opacity=0.4,linecolor=red,linestyle=none]{%
    \psline(0,0)(-5,0)
    \psGaussI[sigma=#1]{-5}{5}
    \psline(5,0)(0,0)
  }
  \psGaussI[sigma=#1,linecolor=red,linewidth=1pt]{-5}{5}
  \rput(-3,0.6){$\sigma = #1$}
 \end{pspicture}
}

\begin{document}

\begin{figure}[htbp]
\centering
 \begin{animateinline}[poster=first,controls,palindrome]{10}
  \multiframe{31}{rA=0.5+0.1}{\normalC{\rA}}
 \end{animateinline}
\end{figure}

\end{document}
In the first couple of frames, the curve is all messed up. What is going on here? :o

Thank you in advance!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

PSTricks | Unexpected behaviour of \psGaussI from pst-func

Post by CrazyHorse »

svend_tveskaeg wrote: In the first couple of frames, the curve is all messed up. What is going on here? :o
it is a numerical integration and for functions with a big slope you need more steps:

Code: Select all

[...]
  \psGaussI[sigma=#1,Simpson=10]{-5}{5}
  \psline(5,0)(0,0)
}
\psGaussI[sigma=#1,Simpson=10,linecolor=red,linewidth=1pt]{-5}{5}
[...]
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

PSTricks | Unexpected behaviour of \psGaussI from pst-func

Post by svend_tveskaeg »

Great. Thank you!

Actually,

Code: Select all

Simpson=15
is needed. Otherwise, the slope of the curve is sightly negative at the farmost right end.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply