Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

5 Answers 5

up vote 2 down vote accepted

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...

share|improve this answer

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

share|improve this answer
    
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

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

share|improve this answer

(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}
share|improve this answer
    
@lohann: Thanks for your answer, but why isn't y=0, when x=0? –  Sisabe Mar 27 '13 at 16:06
    
This looks like a bug in the pow function for numbers between 0 and 1. Probably the same bug as tex.stackexchange.com/q/31775/15925 –  Andrew Swann Mar 27 '13 at 16:45
    
Yeah, looks like a bug... :( –  Iohann Mar 27 '13 at 16:51

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}
share|improve this answer
    
Thanks PSTricks, I don't need to use \ in the expression. –  Who is crazy first Mar 27 '13 at 16:45
    
Could you please tell me why the two solutions above (using TikZ and pstricks) are different? In other words, by using TikZ, why isn't y=0, when x=0? –  Sisabe Mar 27 '13 at 17:15
    
@Sisabe: Because there might be a bug in TikZ (for this case). –  Who is crazy first Mar 27 '13 at 18:09
    
@PSTikZ good observation. I have fixed the bug in TikZ CVS; will become part of the next stable. –  Christian Feuersänger Aug 24 '13 at 11:36
    
@ChristianFeuersänger: OK. Thanks for fixing it. –  Who is crazy first Aug 24 '13 at 15:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.