Graphics, Figures & TablesPlot e^x with PSTricks

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Plot e^x with PSTricks

Post by coachbennett1981 »

I am trying to plot this function and have looked at several PStricks modules but have had no luck graphing e^x. I can do ln(x) just fine..

Anyone have suggestions?


Thank you

Nick

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Plot e^x with PSTricks

Post by localghost »

Code: Select all

\documentclass{minimal}
\usepackage{pstricks-add}

\newcommand*{\PSTeuler}{2.7182818}

\begin{document}
  \begin{psgraph}(0,0)(-5,0)(5,8){10cm}{!}   % x-y-axis with same unit
    \psplot[algebraic=true,linecolor=red]{-5}{2}{\PSTeuler^x}
  \end{psgraph}
\end{document}

Best regards
Thorsten
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Plot e^x with PSTricks

Post by coachbennett1981 »

How do you know so much??? Thank you so much!
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Plot e^x with PSTricks

Post by coachbennett1981 »

When I use your code, I get the following error.. I have been told I need to update my PStricks, but I don't know how.. I am simply not that advanced..

Undefined controls sequence
<argument>..psplot \ifPst@algebraic (\PSTeuler^x) \ifx \psk@PlotDerivative...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Plot e^x with PSTricks

Post by localghost »

coachbennett1981 wrote:How do you know so much? […]
Reading the related manuals helps a lot. The rest is practical application (although I switched to pgf/tikZ).
coachbennett1981 wrote:[…] I have been told I need to update my PStricks, but I don't know how. […]
You just need an update [1]. That's it.

[1] MiKTeX 2.8 Manual - Installing Updates
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Plot e^x with PSTricks

Post by coachbennett1981 »

I use TexShop.. So I don't think that will be the same for me.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Plot e^x with PSTricks

Post by localghost »

So you will have to do that manually according to the TeX Directory Structure (TDS) standard. I'm not familiar with the LaTeX system on a Mac. But there should be TeX Live 2009 available for your machine.

It seems that your version doesn't accept the algebraic option. For the present you can try to plot the function using a postfix expression.

Code: Select all

\documentclass{minimal}
\usepackage{pstricks-add}

\begin{document}
  \begin{psgraph}(0,0)(-5,0)(5,8){10cm}{!}   % x-y-axis with same unit
    \psplot[linecolor=red]{-5}{2}{2.7182818 x exp}
  \end{psgraph}
\end{document}
Post Reply