How to plot the function the absolute value of x*(x-1)^(1/3) using tikzpicture environment
I am trying to plot f(x)=abs(x*(x-1)^(1/3))
on [0,2]
:
I have to use tikzpicture
environment but I am not able to do it in a nice way.
MWE:
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,abs(x*(x-1)^(1/3)),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=81,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
The same effect is produced if I try with addplot[very thick,red,samples=81,domain=0:2,name path=f] {abs(x*(x-1)^(1/3))};
:
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=81,domain=0:2,name path=f] {abs(x*(x-1)^(1/3))};
end{axis}
end{tikzpicture}
end{center}
Thanks and have a nice 20
19!
tikz-pgf
add a comment |
I am trying to plot f(x)=abs(x*(x-1)^(1/3))
on [0,2]
:
I have to use tikzpicture
environment but I am not able to do it in a nice way.
MWE:
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,abs(x*(x-1)^(1/3)),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=81,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
The same effect is produced if I try with addplot[very thick,red,samples=81,domain=0:2,name path=f] {abs(x*(x-1)^(1/3))};
:
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=81,domain=0:2,name path=f] {abs(x*(x-1)^(1/3))};
end{axis}
end{tikzpicture}
end{center}
Thanks and have a nice 20
19!
tikz-pgf
4
Your document is incomplete
– Christian Hupfer
5 hours ago
add a comment |
I am trying to plot f(x)=abs(x*(x-1)^(1/3))
on [0,2]
:
I have to use tikzpicture
environment but I am not able to do it in a nice way.
MWE:
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,abs(x*(x-1)^(1/3)),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=81,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
The same effect is produced if I try with addplot[very thick,red,samples=81,domain=0:2,name path=f] {abs(x*(x-1)^(1/3))};
:
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=81,domain=0:2,name path=f] {abs(x*(x-1)^(1/3))};
end{axis}
end{tikzpicture}
end{center}
Thanks and have a nice 20
19!
tikz-pgf
I am trying to plot f(x)=abs(x*(x-1)^(1/3))
on [0,2]
:
I have to use tikzpicture
environment but I am not able to do it in a nice way.
MWE:
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,abs(x*(x-1)^(1/3)),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=81,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
The same effect is produced if I try with addplot[very thick,red,samples=81,domain=0:2,name path=f] {abs(x*(x-1)^(1/3))};
:
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=81,domain=0:2,name path=f] {abs(x*(x-1)^(1/3))};
end{axis}
end{tikzpicture}
end{center}
Thanks and have a nice 20
19!
tikz-pgf
tikz-pgf
asked 5 hours ago
manooooh
9071315
9071315
4
Your document is incomplete
– Christian Hupfer
5 hours ago
add a comment |
4
Your document is incomplete
– Christian Hupfer
5 hours ago
4
4
Your document is incomplete
– Christian Hupfer
5 hours ago
Your document is incomplete
– Christian Hupfer
5 hours ago
add a comment |
1 Answer
1
active
oldest
votes
You set the brackets in such a way that the compiler sees (x-1)^(1/3)
. It does not know how to plot the third root of a negative number, and let's it be. I fixed the brackets to obtain
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
usepgfplotslibrary{fillbetween}
begin{document}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,x*abs(x-1)^(1/3),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {abs(x)*abs(x-1)^(1/3)};
end{axis}
end{tikzpicture}
end{center}
end{document}
Happy New Year!
1
Good to know! This time I did not forget the odd samples haha, Happy New Year!!
– manooooh
5 hours ago
1
@manooooh Oh, this was a real question (and not just a trick to have the first question in 2019)? ;-)
– marmot
5 hours ago
1
It is? You know I thought about it while taking a shower but for the time zones I said "There is no way it is the first question of 2019":D
. If so, you are the first best answer of 2019;)
.
– manooooh
5 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468090%2fhow-to-plot-the-function-the-absolute-value-of-xx-11-3-using-tikzpicture-e%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You set the brackets in such a way that the compiler sees (x-1)^(1/3)
. It does not know how to plot the third root of a negative number, and let's it be. I fixed the brackets to obtain
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
usepgfplotslibrary{fillbetween}
begin{document}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,x*abs(x-1)^(1/3),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {abs(x)*abs(x-1)^(1/3)};
end{axis}
end{tikzpicture}
end{center}
end{document}
Happy New Year!
1
Good to know! This time I did not forget the odd samples haha, Happy New Year!!
– manooooh
5 hours ago
1
@manooooh Oh, this was a real question (and not just a trick to have the first question in 2019)? ;-)
– marmot
5 hours ago
1
It is? You know I thought about it while taking a shower but for the time zones I said "There is no way it is the first question of 2019":D
. If so, you are the first best answer of 2019;)
.
– manooooh
5 hours ago
add a comment |
You set the brackets in such a way that the compiler sees (x-1)^(1/3)
. It does not know how to plot the third root of a negative number, and let's it be. I fixed the brackets to obtain
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
usepgfplotslibrary{fillbetween}
begin{document}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,x*abs(x-1)^(1/3),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {abs(x)*abs(x-1)^(1/3)};
end{axis}
end{tikzpicture}
end{center}
end{document}
Happy New Year!
1
Good to know! This time I did not forget the odd samples haha, Happy New Year!!
– manooooh
5 hours ago
1
@manooooh Oh, this was a real question (and not just a trick to have the first question in 2019)? ;-)
– marmot
5 hours ago
1
It is? You know I thought about it while taking a shower but for the time zones I said "There is no way it is the first question of 2019":D
. If so, you are the first best answer of 2019;)
.
– manooooh
5 hours ago
add a comment |
You set the brackets in such a way that the compiler sees (x-1)^(1/3)
. It does not know how to plot the third root of a negative number, and let's it be. I fixed the brackets to obtain
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
usepgfplotslibrary{fillbetween}
begin{document}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,x*abs(x-1)^(1/3),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {abs(x)*abs(x-1)^(1/3)};
end{axis}
end{tikzpicture}
end{center}
end{document}
Happy New Year!
You set the brackets in such a way that the compiler sees (x-1)^(1/3)
. It does not know how to plot the third root of a negative number, and let's it be. I fixed the brackets to obtain
documentclass{article}
usepackage[english]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
usepackage{pgfplots}
pgfplotsset{compat=1.15}
usepgfplotslibrary{fillbetween}
begin{document}
begin{center}
begin{tikzpicture}[declare function={f(x)=ifthenelse(x>=0&&x<=1,x*abs(x-1)^(1/3),x*(x-1)^(1/3));}]
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {f(x)};
end{axis}
end{tikzpicture}
end{center}
begin{center}
begin{tikzpicture}
begin{axis}[
axis on top,
legend pos=outer north east,
axis lines = center,
xticklabel style = {font=tiny},
yticklabel style = {font=tiny},
xlabel = $x$,
ylabel = $y$,
legend style={cells={align=left}},
legend cell align={left},
]
addplot[very thick,red,samples=161,domain=0:2,name path=f] {abs(x)*abs(x-1)^(1/3)};
end{axis}
end{tikzpicture}
end{center}
end{document}
Happy New Year!
edited 5 hours ago
answered 5 hours ago
marmot
87.5k4100188
87.5k4100188
1
Good to know! This time I did not forget the odd samples haha, Happy New Year!!
– manooooh
5 hours ago
1
@manooooh Oh, this was a real question (and not just a trick to have the first question in 2019)? ;-)
– marmot
5 hours ago
1
It is? You know I thought about it while taking a shower but for the time zones I said "There is no way it is the first question of 2019":D
. If so, you are the first best answer of 2019;)
.
– manooooh
5 hours ago
add a comment |
1
Good to know! This time I did not forget the odd samples haha, Happy New Year!!
– manooooh
5 hours ago
1
@manooooh Oh, this was a real question (and not just a trick to have the first question in 2019)? ;-)
– marmot
5 hours ago
1
It is? You know I thought about it while taking a shower but for the time zones I said "There is no way it is the first question of 2019":D
. If so, you are the first best answer of 2019;)
.
– manooooh
5 hours ago
1
1
Good to know! This time I did not forget the odd samples haha, Happy New Year!!
– manooooh
5 hours ago
Good to know! This time I did not forget the odd samples haha, Happy New Year!!
– manooooh
5 hours ago
1
1
@manooooh Oh, this was a real question (and not just a trick to have the first question in 2019)? ;-)
– marmot
5 hours ago
@manooooh Oh, this was a real question (and not just a trick to have the first question in 2019)? ;-)
– marmot
5 hours ago
1
1
It is? You know I thought about it while taking a shower but for the time zones I said "There is no way it is the first question of 2019"
:D
. If so, you are the first best answer of 2019 ;)
.– manooooh
5 hours ago
It is? You know I thought about it while taking a shower but for the time zones I said "There is no way it is the first question of 2019"
:D
. If so, you are the first best answer of 2019 ;)
.– manooooh
5 hours ago
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468090%2fhow-to-plot-the-function-the-absolute-value-of-xx-11-3-using-tikzpicture-e%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Your document is incomplete
– Christian Hupfer
5 hours ago