# Plot 3D with conditions and variables dependent on each other

I m trying to do something like this:

Plot3D[x[s1, s2],
{s2, (m3^2 + m^2)^2, (Sqrt[s] -  m^2)^2}, {s1,s1min[s2], s1max[s2]},
RegionFunction -> Function[{x[s1, s2]}, -1 < x < 1]]


but without success.

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) 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! 3) As you receive help, try to give it too, by answering questions in your area of expertise. Mar 27 '15 at 0:08
• The plot limits for s1 and s2 have to be constants, and your syntax for Function is wrong. Try integrating the conditions on s1 into the RegionFunction, something like Function[{s1, s2, x}, -1 < x < 1 && s1min[s2] < s1 < s1max[s2]]. Mar 27 '15 at 0:09
• First of all, thks for the quick answer. So the problem is that s2 varies between numbers and s1 varies a function of s2. So what I wanna do is plot the fucntion x that I already defined before but only if its between -1 and 1...hope you understand what I mean Mar 27 '15 at 0:13

You can use ConditionalExpression using all the conditions that define the region you want to plot as the second argument:

ClearAll[x, m, m3, s1min, s1max]
x[s1_, s2_] := Sin[s1 + s2];
m = Sqrt[Pi/32];
m3 = Sqrt[Pi/64];
s1min[s_] := Sqrt@s;
s1max[s_] := 2 + Sqrt@s;

Plot3D[ConditionalExpression[x[s1, s2],
(m3^2 + m^2)^2 <= s2 <= (Sqrt[s1] - m^2)^2 &&
s1min[s2] <= s1 <= s1max[s2] && -1 < x[s1, s2] < 1],
{s1, 0, Pi}, {s2, 0, Pi}, PlotPoints -> 100, MaxRecursion -> 4] or, use RegionFunction

Plot3D[x[s1, s2], {s1, 0, Pi}, {s2, 0, Pi}, PlotPoints -> 100, MaxRecursion -> 4,
RegionFunction ->
Function[{s1, s2, z}, (m3^2 + m^2)^2 <= s2 <= (Sqrt[s1] - m^2)^2 &&
s1min[s2] <= s1 <= s1max[s2] && -1 < z < 1]]
(* same picture *)