1
$\begingroup$

I have a region with 3 variables: x, s3 and s4. The value of s3 depends on x and the value of s4 depends on both s3 and x. The full region is as follows:

x > 45 && ((Inequality[0, Less, s3, LessEqual, (5/16)*(-55 + x) +
(5/16)*Sqrt[3025 + 330*x + x^2]] && 0 < s4 < (1/4)*(-275 - 4*s3 + 5*x) +
(1/4)*Sqrt[75625 + 2200*s3 + 16*s3^2 + 8250*x + 120*s3*x + 25*x^2]) ||
((5/16)*(-55 + x) + (5/16)*Sqrt[3025 + 330*x + x^2] < s3 < (5/24)*(-55 + 2*x) +
(5/24)*Sqrt[3025 + 440*x + 4*x^2] && (-1100*s3 - 32*s3^2 + 1375*x +
20*s3*x)/(4*s3 - 5*x) < s4 < (1/4)*(-275 - 4*s3 + 5*x) + (1/4)*Sqrt[75625 +
2200*s3 + 16*s3^2 + 8250*x + 120*s3*x + 25*x^2]))

I would like to plot this region in a single 2D graph, with the x-axis representing x and the y-axis representing both s3 and s4. I made a quick mockup of what the result should be like:

Region plot mockup

I have not been able to figure out how to do this. Does someone know the best way to approach this?

$\endgroup$
  • 3
    $\begingroup$ Provide the region as copy/pastable Mathematica code, not as Latex. $\endgroup$ – MarcoB Jul 3 '18 at 18:52
  • $\begingroup$ @MarcoB Sorry, changed it $\endgroup$ – meteoorkip Jul 3 '18 at 20:11
  • $\begingroup$ I am afraid that I do not understand your question. What do you mean for an axis to represent both values? $\endgroup$ – MarcoB Jul 3 '18 at 21:38
  • $\begingroup$ @MarcoB I want to plot the values of both s3 and s4 in a single graph. The issue is that the value of s4 is dependent on s3. I can plot it using a 3D region, but I would like to have a 2D plot showing both the value of s3 and s4. In other words, the y-axis should be used for both values $\endgroup$ – meteoorkip Jul 3 '18 at 22:18
1
$\begingroup$

As you can see from the RegionPlot3D plot, the $x-s3$ slices of the region depend on the value of s4 and the $x-s4$ slices of the region depend on the value of s3. So you can only get a 2D $x-s3$ region conditional on a value for s4 (similarly for $x-s4$ slices). This can be done along the following lines:

ClearAll[x, s3, s4, reg]
reg[x_, y_, z_] :=  x > 45 && ((0 < y <= 5/16 (-55 + x) + 5/16 Sqrt[3025 + 330 x + x^2] &&
    0 < z < 1/4 (-275 - 4 y + 5 x) + 1/4 Sqrt[75625 + 2200 y + 16 y^2 +
      8250 x + 120 y x + 25 x^2]) || 
   (5/16 (-55 + x) + 5/16 Sqrt[3025 + 330 x + x^2] < y < 5/24 (-55 + 2 x) + 
      5/24 Sqrt[3025 + 440 x + 4 x^2] && (-1100 y - 32 y^2 + 
         1375 x + 20 y x)/(4 y - 5 x) < z < 1/4 (-275 - 4 y + 5 x) + 
         1/4 Sqrt[75625 + 2200 y + 16 y^2 + 8250 x + 120 y x + 25 x^2]));

Manipulate[Show[RegionPlot[reg[x, s3, a[[2]]], {x, 45, 500}, {s3, 0, 400}, 
   FrameTicks -> {{All, All}, {Automatic, Automatic}},
   FrameLabel -> {{Style[OverBar[S3], 16], Style[OverBar[S4], 16]}, {Style["x", 16], ""}},
   BoundaryStyle -> Directive[Darker@Green, Thick], 
   PlotStyle -> Directive[Opacity[.5], Green], 
   PlotLegends -> {TraditionalForm[HoldForm@reg[x, s3, Dynamic@a[[2]]]]}],
  RegionPlot[reg[x, a[[1]], s4], {x, 45, 500}, {s4, 0, 400}, 
   BoundaryStyle -> Directive[Darker@Red, Thick], 
   PlotStyle -> Directive[Opacity[.5], Red], 
   PlotLegends -> {TraditionalForm[HoldForm@reg[x, Dynamic@a[[1]], s4]]}]], 
 "\n\n\n", 
 {{a, {200, 300}, ""}, {0, 0}, {400, 400}, 
   Labeled[Slider2D[##, ImageSize -> Large], {OverBar[S3],  OverBar[S4]}, 
     {Top, Left}] &},   
  ControlPlacement -> Left, Alignment -> Center]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.