[OS X TeX] Drawing parametric curves for Beamer

Tim Brophy timbrophy at mac.com
Mon Oct 17 23:01:36 CEST 2016


Hi Everybody,

I am trying to draw the two curves f(x) = x^3 + 4 and its inverse g(x) = (x-4)^{1/3}. I produce the graphs in GeoGebra and use its facility to export to PGF/TikZ to get

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
 
%<<<<<<<WARNING>>>>>>>
% PGF/Tikz doesn't support the following mathematical functions:
% cosh, acosh, sinh, asinh, tanh, atanh,
% x^r with r not integer

% Plotting will be done using GNUPLOT
% GNUPLOT must be installed and you must allow Latex to call external programs by
% Adding the following option to your compiler
% shell-escape    OR    enable-write18 
% Example: pdflatex --shell-escape file.tex 

\begin{document}
\definecolor{qqqqff}{rgb}{0.,0.,1.}
\definecolor{ffqqqq}{rgb}{1.,0.,0.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw[->,color=black] (-7.025,0.) -- (14.53,0.);
\foreach \x in {-6.,-4.,-2.,2.,4.,6.,8.,10.,12.,14.}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0.,-6.625) -- (0.,7.865);
\foreach \y in {-6.,-4.,-2.,2.,4.,6.}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-7.025,-6.625) rectangle (14.53,7.865);
\draw[line width=1.2pt,color=ffqqqq,smooth,samples=100,domain=-3.025000000000002:6.530000000000006] plot(\x,{(\x)^(3.0)+4.0});
\draw [color=ffqqqq](1.345,6.065) node[anchor=north west] {$f(x)=x^3 + 4$};
\draw [color=qqqqff](1.66,-1.045) node[anchor=north west] {$f^{-1}(x) = \sqrt[3]{x-4}$};
\draw[line width=1.2pt,color=qqqqff, smooth,samples=100,domain=-3.07000000000001:6.57500000000001] plot[parametric] function{6.123233995736766E-17*(t+0.0)+t**(3.0)+4.0,t+0.0-6.123233995736766E-17*(t**(3.0)+4.0)-0.0};
\end{tikzpicture}
\end{document}

Unfortunately the WARNING means nothing to me!

I am using the GUI TeXshop on a Mac and know nothing about the Shell.

Is there any way around this.

Thanks in advance,

Tim Brophy
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://www.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex


More information about the macostex-archives mailing list