# Graphing/Plotting multivariate profit function with inequalities

I have the following profit function which I would like to 3Dplot in Mathemathica:

Profit = (8c^2-16c*s-10c-4s-3)/(32s+16)


, where c denotes marginal cost.

with the defined ranges:

0 <= c <= 1/2 and 0 < s < (3+2c)/4

c > 1/2 and (-1+2c)/4 < s < (3+2c)/4

Currently, I only know how to 3Dplot a function with real numbers. Fx:

Plot3D[8 c^2 - 16 c s - 10 c - 4 s - (3 s)/32 + 16, {c, 0, 2}, {s, 0,
1}]


I get an error if I do something like this:

Plot3D[((8 c^2 - 16* c* s - 10 c - 4 s - 3)/(32 s + 16)), {c,
0, (1/2)}, {s, 0, ((3 + 2 c)/4)}, {c, (1/2),
inf}, {s, ((-1 + 2 c)/4)}, ((3 + 2 c)/4)} ]

• Does this do it? Plot3D[profit, {c, 0, 2}, {s, 0, 1}, RegionFunction -> Function[Or[ 0 <= #1 <= 1/2 && 0 <= #2 <= (3 + 2 #1)/4, #1 > 1/ 2 && (-1 + 2 #1) < #2 < (3 + 2 #1)/4]]] – march Apr 13 '16 at 15:36
• @march just tried. The output is an empty box. – Saud Apr 13 '16 at 18:33
• Probably because I used profit instead of Profit. Capitalization matters. Also, you should add PlotRange -> All to the list of options. – march Apr 13 '16 at 19:02
• Corrected profit to Profit and added PlotRange -> All at the end: Plot3D[Profit, {c, 0, 2}, {s, 0, 1}, RegionFunction -> Function[Or[ 0 <= #1 <= 1/2 && 0 <= #2 <= (3 + 2 #1)/4, #1 > 1/2 && (-1 + 2 #1) < #2 < (3 + 2 #1)/4]], PlotRange -> All] I still get an empty box. – Saud Apr 14 '16 at 11:10

The proposed snippets are working on 10.0 for Mac OS X x86 (64-bit) (December 4, 2014)

ClearAll["Global*"]

Profit = (8 c^2 - 16 c*s - 10 c - 4 s - 3)/(32 s + 16)


$\frac{8 c^2-16 c s-10 c-4 s-3}{32 s+16}$

Plot3D[Profit, {c, -0.286031, 0.286031}, {s, -0.347656, 0.347656}] Plot3D[8 c^2 - 16 c s - 10 c - 4 s - (3 s)/32 + 16, {c, 0, 2}, {s,  0, 1}] Plot3D[Profit, {c, 0, 2}, {s, 0, 1},
RegionFunction ->
Function[Or[
0 <= #1 <= 1/2 &&
0 <= #2 <= (3 + 2 #1)/4, #1 >
1/2 && (-1 + 2 #1) < #2 < (3 + 2 #1)/4]]] Plot3D[Profit, {c, 0, 2}, {s, 0, 1},
RegionFunction ->
Function[Or[
0 <= #1 <= 1/2 &&
0 <= #2 <= (3 + 2 #1)/4, #1 >
1/2 && (-1 + 2 #1) < #2 < (3 + 2 #1)/4]], PlotRange -> All]
` 