# psplot and this function

Denis Girou Denis.Girou at idris.fr
Mon Sep 11 23:19:46 CEST 2000

-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

>>>>> "Bastian.Kruse" == KRUSE BASTIAN <W3KRUS01 at stud.uni-passau.de> writes:

Bastian.Kruse> i wanted to plot this function
Bastian.Kruse> \frac{0.08*e^{-x}-(1-0.08)^16*0.08*e^{-x*17)}{1-(1-0.08)*e{-x}}
Bastian.Kruse> Guess I have to use 2.71828 instead of e, cause postscript doesn at t
Bastian.Kruse> know fhis.
Bastian.Kruse> I have trouble with the e^{-x}. The minus makes me sick ? What at s the
Bastian.Kruse> correct input?

PSTricks just use here the PostScript programming language. So, you must refer
here to a PostScript book. The reference one is: "PostScript Reference
Manual", Addison-Wesley. You can found some summaries and syntax descriptions
online. For instance, for the arithmetic operators you need here ("neg" and
"exp"), you can look at:

or:

http://www.cs.indiana.edu/docproject/programming/postscript/operators.html

---
exp
base exponent exp value
This operator returns the value of base raised to the exponent power.
---
neg
value1 neg - value1
This operator returns -value1.
---

Bastian.Kruse> How does postscipt know when the counter ends and the denominator
Bastian.Kruse> starts?

This is a postfix language using the so-called Polish notation (not
"natural" for humans, but easy to handle by an automatic process like
a computer program). Denominator end when the heap is empty.

So what you are looking for is something like that (you must check it...):

\documentclass{article}

\usepackage{pst-plot}

\pagestyle{empty}

\begin{document}

\begin{center}
\begin{displaymath}
f(x)=\frac{0.08*e^{-x}-(1-0.08)^{16}*0.08*e^{-x*17}}{1-(1-0.08)*e^{-x}}
\end{displaymath}

\begin{pspicture}(-1.5,-0.5)(5,5)
\psaxes[Ox=-1,tickstyle=top,axesstyle=frame](-1,0)(5,5)
\psplot{-0.2}{5}{0.08 2.71828 x neg exp mul             % 0.08*e^{-x}
1 0.08 sub 16 exp 0.08 mul             % (1-0.08)^{16}*0.08
2.71828 x neg 17 mul exp               % e^{-x*17)
mul sub
1 1 0.08 sub 2.71828 x neg exp mul sub % 1-(1-0.08)*e^{-x}
div}
\end{pspicture}
\end{center}

\end{document}

D.G.

-----------------------------------------------------------------------------