3

How to write y=(x/6)‎^{3/‎7} in TikZ format to plot its graph in the following code?

‎\documentclass{article}‎
‎‎\usepackage{tikz‎}‎ 
‎\begin{document}‎‎
‎‎\begin{tikzpicture}‎
‎\draw ‎[‎smooth,‎samples=100‎,domain=0:‎‎2‎‎] ‎plot(\x,‎‎‎‎‎‎‎{(\x)‎‎‎‎‎‎‎‎‎‎‎‎‎});‎
‎\end{tikzpicture}‎‎
‎\end{document}
Qrrbrbirlbel
  • 119,821
Sisabe
  • 3,351

5 Answers5

11

This answer is more of a "did you possibly mean a plot together with its axis?"-answer.

If so, you might be interested in pgfplots; a package built on top of tikz. It can sample with higher accuracy and a considerably higher data range, accepts a very similar syntax as tikz, scales the plot to some prescribed width/height, automatically computes ticks, comes with interfaces like xlabel=the x axis, and is highly customable.

Here is your example with pgfplots:

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\begin{document}
\begin{tikzpicture}
\begin{axis}
    \addplot [smooth,samples=100,domain=0:10] {(x/6)^(3/7)};
% same as:
%\addplot [smooth,samples=100,domain=0:10] plot(x,{(x/6)^(3/7)});
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

  • Note that my solution suffers from a bug in TikZ: 0^(3/7) should be 0. I have just fixed it in pgf cvs, will become part of the next stable. The current solution excludes it because it computed 0^x = nan. – Christian Feuersänger Aug 24 '13 at 11:37
7

With tkz-fct or with Tikz + gnuplot the syntaxes are different. gnuplot needs strange notations.

 1) exp(3*log(x/6)/7 log signifies ln
 2) (x/6)**(3./7) ** is used for ^ and 3./7 is used to divide with real numbers

The results are the same in each case.

\documentclass[11pt]{scrartcl} 
\usepackage[utf8]{inputenc}     
\usepackage{tkz-fct}
 \begin{document}  

     \begin{tikzpicture}
      \tkzInit[xmin=0,xmax=10,ymin=0,ymax=2] 
      \tkzGrid 
      \tkzAxeXY 
   %  \tkzFct[color=red,thick,domain=0.001:10,samples=500]{exp(3*log(x/6)/7)}
      \tkzFct[color=red,thick,domain=0:10,samples=200]{(x/6)**(3./7)}
     \end{tikzpicture}  
\end{document} 

with Tikz and gnuplot :

  \draw[color=red,domain=0:10,samples=200]    plot[id=x]   function{(x/6)**(3./7)} ;

enter image description here

Alain Matthes
  • 95,075
6

(I changed domain a bit)

\documentclass[tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \draw [smooth,samples=100,domain=0.01:10] plot(\x,{(\x/6)^(3/7)});
\end{tikzpicture}
\end{document}
Iohann
  • 697
3

With PSTricks.

enter image description here

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\psset{algebraic,unit=0.5cm,labelFontSize=\scriptscriptstyle,labelsep=2pt,plotpoints=100}
\begin{document}
\begin{pspicture}(-1,-1)(11,2)
    \psparametricplot{0}{10}{t|(t/6)^(3/7)}
    \psaxes{->}(0,0)(-1,-1)(11,2)[$x$,0][$y$,90]
\end{pspicture}
\end{document}
3

Try the $\exp(\ln(x))$ form:

\documentclass[tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \draw [smooth,samples=100,domain=0.01:10] plot(\x,{exp(3*ln(\x/6)/7)});
\end{tikzpicture}
\end{document}

Doesn't work in 0, of course...