1

How to draw curve of $y=(6x+2)^{\frac{1}{3}}$ in domain $-1:3$ with tikz?

\begin{tikzpicture}[scale=1,line join=round, font=\footnotesize]
\coordinate[label={[rotate=28,shift={(.3,-.05)}]above:{$A(1,2)$}}] (A) at (1,2);
\coordinate[label={[shift={(.05,.15)}]left:$B$}] (B) at (0,1.5);
\coordinate[label={[shift={(.13,-.05)}]above:$C$}] (C) at (2,0);
\coordinate[label={[shift={(-.15,0)}]below:$O$}] (O) at (0,0);
\coordinate[label={[shift={(0,.05)}]right:$E$}] (E) at (.55,1.1);
\draw[-stealth] (-1,0)--(4,0) node[right]{$X$};
\draw[-stealth] (0,-2)--(0,3) node[above]{$Y$};
\siku{B}{A}{C}
\draw[Periwinkle,domain=-1:3,samples=200,smooth] plot (\x,{.5*\x+1.5});
\draw[Peach] (O)--(A)--($(C)!-.3!(A)$) (B)--(C) ;
\draw[blue,thick,domain=0:3,samples=200,smooth] plot (\x,{(6*\x+2)^(1/3)}) node[right,black] {$y=(6x+2)^{\frac{1}{3}}$}; %here the plot
\end{tikzpicture}
  • What are the definitions of \siku, Periwinkle and Peach? Please provide us with a complete MWE. And the argument of the power becomes negative in the domain you specify, so you need to specify what to do do with these values. – user121799 Apr 22 at 4:13
  • \newcommand{\siku}[4][.2cm]% #1=size (optional), #2-#4 three points: \angle #2#3#4 {\coordinate (tempa) at ($(#3)!#1!(#2)$); \coordinate (tempb) at ($(#3)!#1!(#4)$); \coordinate (tempc) at ($(tempa)!0.5!(tempb)$); \draw[darkgray] (tempa) -- ($(#3)!2!(tempc)$) -- (tempb); } – kalakay Apr 22 at 4:18
  • sign for a right angle – kalakay Apr 22 at 4:19
  • \usepackage[dvipsnames]{xcolor} – kalakay Apr 22 at 4:20
6

The function is not well-defined for x<-1/3. You may plot sign(6x+2)*|6x+2|^{\frac{1}{3}} instead.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=1,line join=round, font=\footnotesize]
\coordinate[label={[rotate=28,shift={(.3,-.05)}]above:{$A(1,2)$}}] (A) at (1,2);
\coordinate[label={[shift={(.05,.15)}]left:$B$}] (B) at (0,1.5);
\coordinate[label={[shift={(.13,-.05)}]above:$C$}] (C) at (2,0);
\coordinate[label={[shift={(-.15,0)}]below:$O$}] (O) at (0,0);
\coordinate[label={[shift={(0,.05)}]right:$E$}] (E) at (.55,1.1);
\draw[-stealth] (-1,0)--(4,0) node[right]{$X$};
\draw[-stealth] (0,-2)--(0,3) node[above]{$Y$};
%\siku{B}{A}{C}
\draw[purple,domain=-1:3,samples=200,smooth] plot (\x,{.5*\x+1.5});
\draw[orange] (O)--(A)--($(C)!-.3!(A)$) (B)--(C) ;
\draw[blue,thick,domain=-1:3,samples=200,smooth] plot (\x,{sign(6*\x+2)*pow(abs(6*\x+2),1/3)}) node[right,black] {$y=(6x+2)^{\frac{1}{3}}$}; %here the plot
\end{tikzpicture}
\end{document}

enter image description here

Or

\documentclass[border=3.14mm]{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\siku}[4][.2cm]% #1=size (optional), #2-#4 three points: \angle #2#3#4 
{\coordinate (tempa) at ($(#3)!#1!(#2)$); 
\coordinate (tempb) at ($(#3)!#1!(#4)$); 
\coordinate (tempc) at ($(tempa)!0.5!(tempb)$); 
\draw[darkgray] (tempa) -- ($(#3)!2!(tempc)$) -- (tempb); }
\begin{document}
\begin{tikzpicture}[scale=1,line join=round, font=\footnotesize]
\coordinate[label={[rotate=28,shift={(.3,-.05)}]above:{$A(1,2)$}}] (A) at (1,2);
\coordinate[label={[shift={(.05,.15)}]left:$B$}] (B) at (0,1.5);
\coordinate[label={[shift={(.13,-.05)}]above:$C$}] (C) at (2,0);
\coordinate[label={[shift={(-.15,0)}]below:$O$}] (O) at (0,0);
\coordinate[label={[shift={(0,.05)}]right:$E$}] (E) at (.55,1.1);
\draw[-stealth] (-1,0)--(4,0) node[right]{$X$};
\draw[-stealth] (0,-2)--(0,3) node[above]{$Y$};
\siku{B}{A}{C}
\draw[Periwinkle,domain=-1:3,samples=200,smooth] plot (\x,{.5*\x+1.5});
\draw[Peach] (O)--(A)--($(C)!-.3!(A)$) (B)--(C) ;
\draw[blue,thick,domain=-1:3,samples=200,smooth] plot (\x,{sign(6*\x+2)*pow(abs(6*\x+2),1/3)}) node[right,black] {$y=(6x+2)^{\frac{1}{3}}$}; %here the plot
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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