The “max” function on Tikz being annoying, help?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite












I used Tikz to chart the following function.



enter image description here



This is fine, except that I want the function to equal 0 instead of negative values. So I tried using "max(0,f(x))", where f(x) is my function (specified below):



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot
(x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


But this code does not run. What am I doing wrong?







share|improve this question


















  • 1




    Just for the records: your code does not compile on my machine. Does it run thought on yours? Which TeX installation are you using?
    – marmot
    Aug 10 at 13:59






  • 1




    The same issue arises with min as well. (I tried to see what's going on by comparing min and max in pgflibraryfixedpointarithmetic.code.tex, just to discover that they do not differ, and min doesn't work as well.)
    – marmot
    Aug 10 at 14:50










  • What is also odd is that fp does come with min and max, they are in FPmin and FPmax.
    – marmot
    Aug 10 at 15:12










  • @marmot try without max, I think it will compile. Let me know if otherwise.
    – Raaja
    Aug 10 at 15:32






  • 1




    @Raaja Yes, of course, without max (or min) it compiles. But that's not the issue, I think. Rather, I think pafnuti has discovered an important bug. (However, the fact that some of us can compile and others not seems to suggest that there are different versions of the fp package at work. I added some typeouts to sort of substantiate that.)
    – marmot
    Aug 10 at 15:36














up vote
5
down vote

favorite












I used Tikz to chart the following function.



enter image description here



This is fine, except that I want the function to equal 0 instead of negative values. So I tried using "max(0,f(x))", where f(x) is my function (specified below):



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot
(x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


But this code does not run. What am I doing wrong?







share|improve this question


















  • 1




    Just for the records: your code does not compile on my machine. Does it run thought on yours? Which TeX installation are you using?
    – marmot
    Aug 10 at 13:59






  • 1




    The same issue arises with min as well. (I tried to see what's going on by comparing min and max in pgflibraryfixedpointarithmetic.code.tex, just to discover that they do not differ, and min doesn't work as well.)
    – marmot
    Aug 10 at 14:50










  • What is also odd is that fp does come with min and max, they are in FPmin and FPmax.
    – marmot
    Aug 10 at 15:12










  • @marmot try without max, I think it will compile. Let me know if otherwise.
    – Raaja
    Aug 10 at 15:32






  • 1




    @Raaja Yes, of course, without max (or min) it compiles. But that's not the issue, I think. Rather, I think pafnuti has discovered an important bug. (However, the fact that some of us can compile and others not seems to suggest that there are different versions of the fp package at work. I added some typeouts to sort of substantiate that.)
    – marmot
    Aug 10 at 15:36












up vote
5
down vote

favorite









up vote
5
down vote

favorite











I used Tikz to chart the following function.



enter image description here



This is fine, except that I want the function to equal 0 instead of negative values. So I tried using "max(0,f(x))", where f(x) is my function (specified below):



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot
(x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


But this code does not run. What am I doing wrong?







share|improve this question














I used Tikz to chart the following function.



enter image description here



This is fine, except that I want the function to equal 0 instead of negative values. So I tried using "max(0,f(x))", where f(x) is my function (specified below):



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot
(x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


But this code does not run. What am I doing wrong?









share|improve this question













share|improve this question




share|improve this question








edited Aug 10 at 17:16









Raaja

1,4621522




1,4621522










asked Aug 10 at 8:55









pafnuti

2085




2085







  • 1




    Just for the records: your code does not compile on my machine. Does it run thought on yours? Which TeX installation are you using?
    – marmot
    Aug 10 at 13:59






  • 1




    The same issue arises with min as well. (I tried to see what's going on by comparing min and max in pgflibraryfixedpointarithmetic.code.tex, just to discover that they do not differ, and min doesn't work as well.)
    – marmot
    Aug 10 at 14:50










  • What is also odd is that fp does come with min and max, they are in FPmin and FPmax.
    – marmot
    Aug 10 at 15:12










  • @marmot try without max, I think it will compile. Let me know if otherwise.
    – Raaja
    Aug 10 at 15:32






  • 1




    @Raaja Yes, of course, without max (or min) it compiles. But that's not the issue, I think. Rather, I think pafnuti has discovered an important bug. (However, the fact that some of us can compile and others not seems to suggest that there are different versions of the fp package at work. I added some typeouts to sort of substantiate that.)
    – marmot
    Aug 10 at 15:36












  • 1




    Just for the records: your code does not compile on my machine. Does it run thought on yours? Which TeX installation are you using?
    – marmot
    Aug 10 at 13:59






  • 1




    The same issue arises with min as well. (I tried to see what's going on by comparing min and max in pgflibraryfixedpointarithmetic.code.tex, just to discover that they do not differ, and min doesn't work as well.)
    – marmot
    Aug 10 at 14:50










  • What is also odd is that fp does come with min and max, they are in FPmin and FPmax.
    – marmot
    Aug 10 at 15:12










  • @marmot try without max, I think it will compile. Let me know if otherwise.
    – Raaja
    Aug 10 at 15:32






  • 1




    @Raaja Yes, of course, without max (or min) it compiles. But that's not the issue, I think. Rather, I think pafnuti has discovered an important bug. (However, the fact that some of us can compile and others not seems to suggest that there are different versions of the fp package at work. I added some typeouts to sort of substantiate that.)
    – marmot
    Aug 10 at 15:36







1




1




Just for the records: your code does not compile on my machine. Does it run thought on yours? Which TeX installation are you using?
– marmot
Aug 10 at 13:59




Just for the records: your code does not compile on my machine. Does it run thought on yours? Which TeX installation are you using?
– marmot
Aug 10 at 13:59




1




1




The same issue arises with min as well. (I tried to see what's going on by comparing min and max in pgflibraryfixedpointarithmetic.code.tex, just to discover that they do not differ, and min doesn't work as well.)
– marmot
Aug 10 at 14:50




The same issue arises with min as well. (I tried to see what's going on by comparing min and max in pgflibraryfixedpointarithmetic.code.tex, just to discover that they do not differ, and min doesn't work as well.)
– marmot
Aug 10 at 14:50












What is also odd is that fp does come with min and max, they are in FPmin and FPmax.
– marmot
Aug 10 at 15:12




What is also odd is that fp does come with min and max, they are in FPmin and FPmax.
– marmot
Aug 10 at 15:12












@marmot try without max, I think it will compile. Let me know if otherwise.
– Raaja
Aug 10 at 15:32




@marmot try without max, I think it will compile. Let me know if otherwise.
– Raaja
Aug 10 at 15:32




1




1




@Raaja Yes, of course, without max (or min) it compiles. But that's not the issue, I think. Rather, I think pafnuti has discovered an important bug. (However, the fact that some of us can compile and others not seems to suggest that there are different versions of the fp package at work. I added some typeouts to sort of substantiate that.)
– marmot
Aug 10 at 15:36




@Raaja Yes, of course, without max (or min) it compiles. But that's not the issue, I think. Rather, I think pafnuti has discovered an important bug. (However, the fact that some of us can compile and others not seems to suggest that there are different versions of the fp package at work. I added some typeouts to sort of substantiate that.)
– marmot
Aug 10 at 15:36










2 Answers
2






active

oldest

votes

















up vote
6
down vote



accepted










Removing the fixed point arithmetic should ensure you get what you want. because, when you specify the fixed point constraint, the max(.) assumes its domain to be integers (I think). However, your function returns real-values. Hence, this will cause an internal contradiction and hence you see the errors. If you now remove the constraints, all should go as you desire. Below is the MWE based solution for that.



documentclass[11pt]article
usepackagetikz
usepackagefp
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot (x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


which will give you:



enter image description here






share|improve this answer


















  • 2




    Are you sure that it assumes integers? And even if that's the case, how would that explain that max(0,...) yields something negative?
    – marmot
    Aug 10 at 14:00






  • 1




    @marmot if it's wrong (I sense it from your question), please correct me. What I understood from OP's question is that when OP uses no max they get negative range, but when OP uses max tje code doesn't work. By making that assumption on fixed point it worked. But I have not read that in the manual. Also, in here, I do not know how to see the output data.
    – Raaja
    Aug 10 at 14:33







  • 3




    I have not much experience with that library but I would be really surprised if it assumed integers. And, even if it did, it would not explain the fact that max(0,...) can become negative, would it? In addition, there is is @Bamboo's answer, which is at odds with that assumption.
    – marmot
    Aug 10 at 14:40










  • @marmot I'm in agreement with you. OP tried wo max and gets the negative, but when tried with max it results in error.
    – Raaja
    Aug 10 at 15:30


















up vote
4
down vote













Using an ifthenelse conditional, the result is good with or without fixed point arithmetic. I guess this supports @marmot interrogations regarding the max function.



As proposed by @marmot, I also included a redefinition of the max function as Max(x,y) based on ifthenelse to avoid the repetition of the tested function.



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
tikzsetdeclare function=Max(X,Y)=ifthenelse(X>Y,X,Y);
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,
smooth,
variable=x,blue] plot
(x,Max(((x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))),
0));
endtikzpicture
enddocument


enter image description here






share|improve this answer


















  • 1




    Good idea ! thanks @marmot
    – BambOo
    Aug 10 at 14:46










  • Thanks! I'm wondering if you could the same for min? ;-)
    – marmot
    Aug 10 at 16:13










  • @marmot What do you mean ?
    – BambOo
    Aug 11 at 10:39










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445454%2fthe-max-function-on-tikz-being-annoying-help%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
6
down vote



accepted










Removing the fixed point arithmetic should ensure you get what you want. because, when you specify the fixed point constraint, the max(.) assumes its domain to be integers (I think). However, your function returns real-values. Hence, this will cause an internal contradiction and hence you see the errors. If you now remove the constraints, all should go as you desire. Below is the MWE based solution for that.



documentclass[11pt]article
usepackagetikz
usepackagefp
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot (x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


which will give you:



enter image description here






share|improve this answer


















  • 2




    Are you sure that it assumes integers? And even if that's the case, how would that explain that max(0,...) yields something negative?
    – marmot
    Aug 10 at 14:00






  • 1




    @marmot if it's wrong (I sense it from your question), please correct me. What I understood from OP's question is that when OP uses no max they get negative range, but when OP uses max tje code doesn't work. By making that assumption on fixed point it worked. But I have not read that in the manual. Also, in here, I do not know how to see the output data.
    – Raaja
    Aug 10 at 14:33







  • 3




    I have not much experience with that library but I would be really surprised if it assumed integers. And, even if it did, it would not explain the fact that max(0,...) can become negative, would it? In addition, there is is @Bamboo's answer, which is at odds with that assumption.
    – marmot
    Aug 10 at 14:40










  • @marmot I'm in agreement with you. OP tried wo max and gets the negative, but when tried with max it results in error.
    – Raaja
    Aug 10 at 15:30















up vote
6
down vote



accepted










Removing the fixed point arithmetic should ensure you get what you want. because, when you specify the fixed point constraint, the max(.) assumes its domain to be integers (I think). However, your function returns real-values. Hence, this will cause an internal contradiction and hence you see the errors. If you now remove the constraints, all should go as you desire. Below is the MWE based solution for that.



documentclass[11pt]article
usepackagetikz
usepackagefp
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot (x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


which will give you:



enter image description here






share|improve this answer


















  • 2




    Are you sure that it assumes integers? And even if that's the case, how would that explain that max(0,...) yields something negative?
    – marmot
    Aug 10 at 14:00






  • 1




    @marmot if it's wrong (I sense it from your question), please correct me. What I understood from OP's question is that when OP uses no max they get negative range, but when OP uses max tje code doesn't work. By making that assumption on fixed point it worked. But I have not read that in the manual. Also, in here, I do not know how to see the output data.
    – Raaja
    Aug 10 at 14:33







  • 3




    I have not much experience with that library but I would be really surprised if it assumed integers. And, even if it did, it would not explain the fact that max(0,...) can become negative, would it? In addition, there is is @Bamboo's answer, which is at odds with that assumption.
    – marmot
    Aug 10 at 14:40










  • @marmot I'm in agreement with you. OP tried wo max and gets the negative, but when tried with max it results in error.
    – Raaja
    Aug 10 at 15:30













up vote
6
down vote



accepted







up vote
6
down vote



accepted






Removing the fixed point arithmetic should ensure you get what you want. because, when you specify the fixed point constraint, the max(.) assumes its domain to be integers (I think). However, your function returns real-values. Hence, this will cause an internal contradiction and hence you see the errors. If you now remove the constraints, all should go as you desire. Below is the MWE based solution for that.



documentclass[11pt]article
usepackagetikz
usepackagefp
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot (x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


which will give you:



enter image description here






share|improve this answer














Removing the fixed point arithmetic should ensure you get what you want. because, when you specify the fixed point constraint, the max(.) assumes its domain to be integers (I think). However, your function returns real-values. Hence, this will cause an internal contradiction and hence you see the errors. If you now remove the constraints, all should go as you desire. Below is the MWE based solution for that.



documentclass[11pt]article
usepackagetikz
usepackagefp
begindocument
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
scale=1.3,domain=0.001:4,smooth,variable=x,blue] plot (x,max(0,(x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))));
endtikzpicture
enddocument


which will give you:



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 10 at 9:05

























answered Aug 10 at 8:59









Raaja

1,4621522




1,4621522







  • 2




    Are you sure that it assumes integers? And even if that's the case, how would that explain that max(0,...) yields something negative?
    – marmot
    Aug 10 at 14:00






  • 1




    @marmot if it's wrong (I sense it from your question), please correct me. What I understood from OP's question is that when OP uses no max they get negative range, but when OP uses max tje code doesn't work. By making that assumption on fixed point it worked. But I have not read that in the manual. Also, in here, I do not know how to see the output data.
    – Raaja
    Aug 10 at 14:33







  • 3




    I have not much experience with that library but I would be really surprised if it assumed integers. And, even if it did, it would not explain the fact that max(0,...) can become negative, would it? In addition, there is is @Bamboo's answer, which is at odds with that assumption.
    – marmot
    Aug 10 at 14:40










  • @marmot I'm in agreement with you. OP tried wo max and gets the negative, but when tried with max it results in error.
    – Raaja
    Aug 10 at 15:30













  • 2




    Are you sure that it assumes integers? And even if that's the case, how would that explain that max(0,...) yields something negative?
    – marmot
    Aug 10 at 14:00






  • 1




    @marmot if it's wrong (I sense it from your question), please correct me. What I understood from OP's question is that when OP uses no max they get negative range, but when OP uses max tje code doesn't work. By making that assumption on fixed point it worked. But I have not read that in the manual. Also, in here, I do not know how to see the output data.
    – Raaja
    Aug 10 at 14:33







  • 3




    I have not much experience with that library but I would be really surprised if it assumed integers. And, even if it did, it would not explain the fact that max(0,...) can become negative, would it? In addition, there is is @Bamboo's answer, which is at odds with that assumption.
    – marmot
    Aug 10 at 14:40










  • @marmot I'm in agreement with you. OP tried wo max and gets the negative, but when tried with max it results in error.
    – Raaja
    Aug 10 at 15:30








2




2




Are you sure that it assumes integers? And even if that's the case, how would that explain that max(0,...) yields something negative?
– marmot
Aug 10 at 14:00




Are you sure that it assumes integers? And even if that's the case, how would that explain that max(0,...) yields something negative?
– marmot
Aug 10 at 14:00




1




1




@marmot if it's wrong (I sense it from your question), please correct me. What I understood from OP's question is that when OP uses no max they get negative range, but when OP uses max tje code doesn't work. By making that assumption on fixed point it worked. But I have not read that in the manual. Also, in here, I do not know how to see the output data.
– Raaja
Aug 10 at 14:33





@marmot if it's wrong (I sense it from your question), please correct me. What I understood from OP's question is that when OP uses no max they get negative range, but when OP uses max tje code doesn't work. By making that assumption on fixed point it worked. But I have not read that in the manual. Also, in here, I do not know how to see the output data.
– Raaja
Aug 10 at 14:33





3




3




I have not much experience with that library but I would be really surprised if it assumed integers. And, even if it did, it would not explain the fact that max(0,...) can become negative, would it? In addition, there is is @Bamboo's answer, which is at odds with that assumption.
– marmot
Aug 10 at 14:40




I have not much experience with that library but I would be really surprised if it assumed integers. And, even if it did, it would not explain the fact that max(0,...) can become negative, would it? In addition, there is is @Bamboo's answer, which is at odds with that assumption.
– marmot
Aug 10 at 14:40












@marmot I'm in agreement with you. OP tried wo max and gets the negative, but when tried with max it results in error.
– Raaja
Aug 10 at 15:30





@marmot I'm in agreement with you. OP tried wo max and gets the negative, but when tried with max it results in error.
– Raaja
Aug 10 at 15:30











up vote
4
down vote













Using an ifthenelse conditional, the result is good with or without fixed point arithmetic. I guess this supports @marmot interrogations regarding the max function.



As proposed by @marmot, I also included a redefinition of the max function as Max(x,y) based on ifthenelse to avoid the repetition of the tested function.



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
tikzsetdeclare function=Max(X,Y)=ifthenelse(X>Y,X,Y);
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,
smooth,
variable=x,blue] plot
(x,Max(((x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))),
0));
endtikzpicture
enddocument


enter image description here






share|improve this answer


















  • 1




    Good idea ! thanks @marmot
    – BambOo
    Aug 10 at 14:46










  • Thanks! I'm wondering if you could the same for min? ;-)
    – marmot
    Aug 10 at 16:13










  • @marmot What do you mean ?
    – BambOo
    Aug 11 at 10:39














up vote
4
down vote













Using an ifthenelse conditional, the result is good with or without fixed point arithmetic. I guess this supports @marmot interrogations regarding the max function.



As proposed by @marmot, I also included a redefinition of the max function as Max(x,y) based on ifthenelse to avoid the repetition of the tested function.



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
tikzsetdeclare function=Max(X,Y)=ifthenelse(X>Y,X,Y);
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,
smooth,
variable=x,blue] plot
(x,Max(((x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))),
0));
endtikzpicture
enddocument


enter image description here






share|improve this answer


















  • 1




    Good idea ! thanks @marmot
    – BambOo
    Aug 10 at 14:46










  • Thanks! I'm wondering if you could the same for min? ;-)
    – marmot
    Aug 10 at 16:13










  • @marmot What do you mean ?
    – BambOo
    Aug 11 at 10:39












up vote
4
down vote










up vote
4
down vote









Using an ifthenelse conditional, the result is good with or without fixed point arithmetic. I guess this supports @marmot interrogations regarding the max function.



As proposed by @marmot, I also included a redefinition of the max function as Max(x,y) based on ifthenelse to avoid the repetition of the tested function.



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
tikzsetdeclare function=Max(X,Y)=ifthenelse(X>Y,X,Y);
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,
smooth,
variable=x,blue] plot
(x,Max(((x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))),
0));
endtikzpicture
enddocument


enter image description here






share|improve this answer














Using an ifthenelse conditional, the result is good with or without fixed point arithmetic. I guess this supports @marmot interrogations regarding the max function.



As proposed by @marmot, I also included a redefinition of the max function as Max(x,y) based on ifthenelse to avoid the repetition of the tested function.



documentclass[11pt]article
usepackagetikz
usepackagefp
usetikzlibraryfixedpointarithmetic
begindocument
tikzsetdeclare function=Max(X,Y)=ifthenelse(X>Y,X,Y);
begintikzpicture
draw (0,0) rectangle (4,4);
draw[
samples=100,
fixed point arithmetic,
scale=1.3,domain=0.001:4,
smooth,
variable=x,blue] plot
(x,Max(((x*(0.005*x)^0.5-0.005)/((0.33*x+(0.005*x)^0.5))),
0));
endtikzpicture
enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 10 at 14:53

























answered Aug 10 at 14:16









BambOo

2,365323




2,365323







  • 1




    Good idea ! thanks @marmot
    – BambOo
    Aug 10 at 14:46










  • Thanks! I'm wondering if you could the same for min? ;-)
    – marmot
    Aug 10 at 16:13










  • @marmot What do you mean ?
    – BambOo
    Aug 11 at 10:39












  • 1




    Good idea ! thanks @marmot
    – BambOo
    Aug 10 at 14:46










  • Thanks! I'm wondering if you could the same for min? ;-)
    – marmot
    Aug 10 at 16:13










  • @marmot What do you mean ?
    – BambOo
    Aug 11 at 10:39







1




1




Good idea ! thanks @marmot
– BambOo
Aug 10 at 14:46




Good idea ! thanks @marmot
– BambOo
Aug 10 at 14:46












Thanks! I'm wondering if you could the same for min? ;-)
– marmot
Aug 10 at 16:13




Thanks! I'm wondering if you could the same for min? ;-)
– marmot
Aug 10 at 16:13












@marmot What do you mean ?
– BambOo
Aug 11 at 10:39




@marmot What do you mean ?
– BambOo
Aug 11 at 10:39

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445454%2fthe-max-function-on-tikz-being-annoying-help%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

One-line joke