# Getting values of 2 variables and a constant based on a single equation using a 3D graph

This is my function.

g[p_, q_, c_] :=
2^(-p*Log2[p] -
q*Log2[q] - (1 - p)*Log2[1 - p] - (1 - q)*
Log2[1 - q])*(c^(p*q + (1 - p)*(1 - q)))*(1 - c)^(1 -
p*q - (1 - p)*(1 - q))


I have graphed this function taking g as a function of p and q, I am varying c as a constant.

flo=Manipulate[Plot3D[{g[p, q, c]}, {p, 0, 1}, {q, 0, 1}], {c, 0.001, 1}]


How can I get values of p, q and c so that g[p,q,c]<1?

Plot your function for given value c=.5(for example) with the option RegionFunction

 pic = Plot3D[  g[p, q, .5]  , {p, 0, 1}, {q, 0, 1}, RegionFunction -> Function[{p, q, z}, z <= 1]]


With

points=pic[[1, 1]][[1]]
(*{{7.14286*10^-8, 7.14286*10^-8, 0.500001}, {0.0714286, 7.14286*10^-8,0.64673},
{0.142857, 7.14286*10^-8, 0.753498}, {0.214286,7.14286*10^-8, 0.840662},...}*)
points = pic[[1, 1]][[1]];
Graphics3D[{Point[points]}]


you get all the plotted points in pic!

• Which version of mathematica do you use? The second part, that is the part beginning from points isnt working for me. I use 10.3. This is amazing though. I want the numerical values of these points too. What can I do further? – newgirl May 26 at 11:13
• When I do this - points = pic[[1, 1]][[1]] ,I get just a single point. {7.14286*10^-8, 7.14286*10^-8, 0.500001} – newgirl May 26 at 11:24
• Try ??pic to Analyse the graphic. My version is v12 – Ulrich Neumann May 26 at 11:50
• I get a list of numbers. I do think part of it is the values of p, q and c. Is there any way I can get the range for p and q for a given c, such that g is lesser than 1? – newgirl May 26 at 12:01
• Probably points=pic[[1, 1]] gives you the values {p,q} . ListPlot[ points[[All,{1,2}]]] shows the range. – Ulrich Neumann May 26 at 12:07