我在Mathematica中使用RegionPlot3D
来形象化一些不等式。由于不等式在坐标中是均匀的,它们由它们与单位球体的交点唯一确定。这给出了我想绘制的球表面上的一些二维区域。我的问题是如何?
如果有要求,我会非常乐意提供一些Mathematica代码;虽然我认为答案应该独立于我试图绘制的地区的细节。
提前致谢!
更新:如果有人有兴趣,我最近完成了一篇论文,其中我使用了Sasha的答案,以便制作一些情节。这篇论文是Symmetric M-theory backgrounds,上周已经开始了。它包含这样的图:
再次感谢!
答案 0 :(得分:13)
请查看RegionFunction
。您可以在ParametricPlot3D
内逐字使用不等式。
Show[{ParametricPlot3D[{Sin[th] Cos[ph], Sin[th] Sin[ph],
Cos[th]}, {th, 0, Pi}, {ph, 0, 2 Pi},
RegionFunction ->
Function[{x, y, z}, And[x^3 < x y z + z^3, y^2 z < y^3 + x z^2]],
PlotRange -> {-1, 1}, PlotStyle -> Red],
Graphics3D[{Opacity[0.2], Sphere[]}]}]
答案 1 :(得分:12)
这是我能提出的最简单的想法(感谢belisarius的some of the code)。
这是3阶的几个齐次不等式
ineq = {x^3 < x y^2, y^2 z > x z^2};
coords = {x -> r Sin[q] Cos[f], y -> r Sin[q] Sin[f], z -> r Cos[q]}/.r -> 1
region = RegionPlot[ineq /. coords, {q, 0, Pi}, {f, 0, 2 Pi},
Frame -> None, ImagePadding -> 0, PlotRangePadding -> 0, ImageMargins -> 0]
ParametricPlot3D[coords[[All, 2]], {q, 0, Pi}, {f, 0, 2 Pi},
Mesh -> None, TextureCoordinateFunction -> ({#4, 1 - #5} &),
PlotStyle -> Texture[Show[region, ImageSize -> 1000]]]
答案 2 :(得分:5)
西蒙打败了我,但这是一个类似的想法,基于较低级别的图形。我处理Ax> 0形式的线性,齐次不等式。
A = RandomReal[{0, 1}, {8, 3}];
eqs = And @@ Thread[
A.{Sin[phi] Cos[th], Sin[phi] Sin[th], Cos[phi]} >
Table[0, {Length[A]}]];
twoDPic = RegionPlot[eqs,
{phi, 0, Pi}, {th, 0, 2 Pi}];
pts2D = twoDPic[[1, 1]];
spherePt[{phi_, th_}] := {Sin[phi] Cos[th], Sin[phi] Sin[th],
Cos[phi]};
rpSphere = Graphics3D[GraphicsComplex[spherePt /@ pts2D,
twoDPic[[1, 2]]]]
让我们将其与RegionPlot3D
进行比较。
rp3D = RegionPlot3D[And @@ Thread[A.{x, y, z} >
Table[0, {Length[A]}]],
{x, -2, 2}, {y, -2, 2}, {z, -2, 2},
PlotStyle -> Opacity[0.2]];
Show[{rp3D, rpSphere}, PlotRange -> 1.4]
答案 3 :(得分:2)
SphericalPlot3D[0.6, {\[Phi], 0, \[Pi]}, {\[Theta], 0, 2 \[Pi]},
RegionFunction ->
Function[{x, y, z},
PolyhedronData["Cube", "RegionFunction"][x, y, z]], Mesh -> False,
PlotStyle -> {Orange, Opacity[0.9]}]