# Plotting logarithm in Plot3D with bounds {x,0,1}, {y,0,1-x}

I would like to plot entropy on a 2-simplex, i.e., I want to plot a function for x,y,z s.t. x+y+z=1. My strategy is to take bounds {x,0,1}, {y,0,1-x}, and compute z=1-x-y. However, there is some problem with logarithm in this approach. The following yields an empty plot:

Plot3D[x + Log[y], {x, 0, 1}, {y, 0, 1 - x}]


However, for example the following works just fine:

Plot3D[Log[x] + y, {x, 0, 1}, {y, 0, 1 - x}]


What is the issue with putting y in logarithm here?

EDIT: It works fine in version 12.0.0, didn't work in 11.3.0 [for Linux x86 (64-bit) (March 7, 2018)]

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Jul 2, 2019 at 14:56
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is useful for learning how to format your questions and answers. You may also find this meta Q&A helpful Jul 2, 2019 at 14:56
• What version of Mathematica are you using? Jul 2, 2019 at 15:00
• I've tagged the Q version-11.3, unless the community thinks this should be tagged a bug, in which case the version tag should be removed and the bugs header be edited into the question. I wonder if the plot fails in other earlier versions. Jul 2, 2019 at 17:38

I'm not sure why the second example works while the first one doesn't, but a better strategy might be to specify a region to plot over instead of using the range plotting parameters.

R = ImplicitRegion[0 <= y <= 1 - x, {{x, 0, 1}, y}];

Plot3D[x + Log[y], {x, y} \[Element] R]


or in this case simply

Plot3D[x + Log[y], {x, y} \[Element] Simplex[2]]


both of which give

Try RegionFunction

Plot3D[x + Log[y], {x, 0, 1}, {y, 0, 1}, RegionFunction -> Function[{x, y}, 0 <= y <= 1 - x]]


It works for me:

Plot3D[x + Log[y], {x, 0, 1}, {y, 0, 1 - x}]


• Ah, I see, so it might be just a bug? I am using version 11.3.0 for Linux x86 (64-bit) (March 7, 2018). I'll install 12.0.0 and see. Jul 2, 2019 at 16:15
• Confirm, works fine in 12.0.0. Jul 2, 2019 at 16:56