# [pstricks] Ghostscript (or PostScript) errors reproducing pst-func examples

Patrice MEGRET Patrice.MEGRET at umons.ac.be
Fri Aug 18 08:16:56 CEST 2017

Emilio,

If you change the integration limits to -+12 instead of -+14.5, everything works perfectly.

I suspect that you have some rounding effects or 0/0 that make ps error.

By the way, \psplot[plotpoints=1000]{-12}{12}{x RadtoDeg sin x div} will give an error if x=0: if you try \psplot[plotpoints=21]{-10}{10}{x RadtoDeg sin x div} will have x=0 and an error.

Best regards,
Patrice

\documentclass[12pt,a4paper]{book}
\usepackage{mathtools, amssymb}
\usepackage{pstricks}

%\usepackage{pst-math}
\usepackage{pst-func}
\begin{document}

\psset{xunit=0.5}
\begin{pspicture}(-15,-4.5)(15,2)
\psaxes[dx=1cm,Dx=2]{->}(0,0)(-15.1,-4)(15,2)
\psSi[plotpoints=1500,linecolor=red,linewidth=1pt]{-12}{12}
\pssi[plotpoints=1500,linecolor=blue,linewidth=1pt]{-12}{12}
\rput(-5,1.5){\color{red}$Si(x)=\int\limits_{0}^x\frac{\sin(t)}{t}dt$}
\rput(8,-1.5){\color{blue}$si(x)=-\int\limits_{x}^{\infty} \frac{\sin(t)}{t}dt=Si(x)-\frac{\pi}{2}$}
\rput(8,.5){$f(x)= \frac{\sin(t)}{t}$}
\end{pspicture}

\end{document}

-----Message d'origine-----
De : PSTricks [mailto:pstricks-bounces at tug.org] De la part de EMILIO RAMON GARCIA LADONA
Envoyé : vendredi 18 août 2017 00:45
À : pstricks at tug.org
Objet : [pstricks] Ghostscript (or PostScript) errors reproducing pst-func examples

Hi,

I'm preparing a textbook that requires to include many graphics using pst-func package. In particular I'm trying to replicate the example given in chapter 6 of pst-func.doc about "\psSi,\pssi and \psCi"
functions. There appears a problem when the "\psSi" and "\pssi"
functions are included (see code below which is almost exactly to what appears in the doc). The code is compiled under the last texlive distribution and using the TeXworks GUI using the "tex-dvips-ps2pdf.bat" command. The error appears when running ps2pdf throwing a console message (see below) and fails to build a correct pdf. I will appreciate if somebody can explain me why and how can I circumvent it. I need to use many graphics using \psSi imperatively.

Thanks

========== ERROR Message ==================
Error: /undefinedresult in --div--
Operand stack:
-206.282   #INF.0   35
Execution stack:
%interp_exit   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--
--nostringval--   --nostringval--   false   1   %stopped_push   2015
1   3   %oparray_pop   2014   1   3   %oparray_pop   1998   1   3
%oparray_pop   1884   1   3   %oparray_pop   --nostringval--
%errorexec_pop   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--
--nostringval--   --nostringval--   %loop_continue   --nostringval--
Dictionary stack:
--dict:1212/1684(ro)(G)--   --dict:0/20(G)--   --dict:165/200(L)--
--dict:185/300(L)--   --dict:38/200(L)--   --dict:125/200(L)--
--dict:53/100(L)--
Current allocation mode is local
Current file position is 264398
GPL Ghostscript 9.21: Unrecoverable error, exit code 1

========== CODE ==============
\documentclass[12pt,a4paper]{book}
\usepackage{mathtools, amssymb}
\usepackage{pstricks}
\usepackage{pst-math}
\usepackage{pst-func}

\begin{document}

\psset{xunit=0.5}
\begin{pspicture}(-15,-4.5)(15,2)
\psaxes[dx=1cm,Dx=2]{->}(0,0)(-15.1,-4)(15,2)
\psplot[plotpoints=1000]{-14.5}{14.5}{x RadtoDeg sin x div} %\psSi[plotpoints=1500,linecolor=red,linewidth=1pt]{-14.5}{14.5}
%\pssi[plotpoints=1500,linecolor=blue,linewidth=1pt]{-14.5}{14.5}
\rput(-5,1.5){\color{red}$Si(x)=\int\limits_{0}^x\frac{\sin(t)}{t}dt$}
\rput(8,-1.5){\color{blue}$si(x)=-\int\limits_{x}^{\infty} \frac{\sin(t)}{t}dt=Si(x)-\frac{\pi}{2}$}
\rput(8,.5){$f(x)= \frac{\sin(t)}{t}$}
\end{pspicture}

\end{document}

_______________________________________________
PSTricks mailing list
PSTricks at tug.org
http://tug.org/mailman/listinfo/pstricks
archive: http://www.tug.org/pipermail/pstricks/