从 Mathematica 5 升级到 Mathematica 7
我正在尝试升级目前针对 Mathematica 5 编写的一些方程,以使它们在 Mathematica 7 中工作。
F = Graphics[
ContourPlot[
x^2 + (2)*y^2 + (-1)*((1)/(3))*x, {x, -1, 1}, {y, -1, 1},
ContourShading -> False, ContourStyle -> {RGBColor[1, 0, 1]},
Contours -> 20, PlotPoints -> 100]];
G = ParametricPlot[{Cos[u], Sin[u]}, {u, 0, 2*Pi},
PlotStyle -> {RGBColor[0, 174/255, 239/255]}];
H = DeleteCases[F, {x_, y_} /; (x^2 + y^2 > 1), 5];
Show[{H, G}, AspectRatio -> Automatic, Frame -> False, Axes -> True,
AxesOrigin -> {0, 0}, AxesLabel -> {x, y}, Ticks -> None]
它应该如下所示: ,但 id 看起来确实像这样:
并给出以下错误:
Thread::tdlen: Objects of unequal length in
{{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}}+{{},<<21>>,{}}
cannot be combined. >>
如果将鼠标悬停在图像上,您会在工具提示中看到以下内容:
The specified setting for the option GraphicsBoxOptions, PlotRange cannot be used.
Coordinate index X is out of range for the enclosing GraphicsComplex
有很多坐标坐标都具有不同的坐标。
我遇到困难的第二个是:
P1 = {{(5)/10*Cos[u]*Cos[v], (5)/10*Sin[u]*Cos[v], (5)/10*Sin[v]}, {u,
0, 2*Pi}, {v, -Pi/2, Pi/2}};
P2 = {{(5)/10*Cos[u], 0, (5)/10*Sin[u]}, {u, 0, 2*Pi}};
P3 = {{(5)/10*Cos[u], (5)/10*Sin[u], 0}, {u, 0, 2*Pi}};
P4 = {{0, (5)/10*Cos[u], (5)/10*Sin[u]}, {u, 0, 2*Pi}};
U = {P1, P2, P3, P4};
XL = {{-1, 1}, {-1, 1}, {-1, 1}};
XV = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
XS = {"x", "y", "z"};
f[a_, b_, c_] := {a, 1.1*b[[2]]*c};
g[a_, b_] := {(b*# &) /@ a};
T = Text @@@ MapThread[f, {XS, XL, XV}];
A = Line @@@ MapThread[g, {XL, XV}];
F = (ParametricPlot3D[Evaluate[Evaluate @@ #]][[1]] &) /@ U;
OPT = {Boxed -> False, Axes -> False, BoxRatios -> {1, 1, 1}, PlotRange -> XL,
ViewPoint -> {2.4, 1.3, 2},
DisplayFunction ->
Identity};
L = {LightSources -> {{{0.1, 0, 1}, RGBColor[0.68, 0.88, 0.96]}}};
gr1 = (Show[Graphics3D[#], OPT, L] &) /@ {{EdgeForm[], F}, {Dashing[{0.03, 0.03}],
GrayLevel[0.7], A}, {T}};
gr2 = DeleteCases[Graphics[Show[Graphics3D[{A, EdgeForm[], F}], OPT,
RenderAll -> False]], {__, _Polygon}, 3];
Show[{gr1, gr2}, AspectRatio -> Automatic]
这个应该看起来像: ,但看起来确实像:
它给出了这些错误:
ParametricPlot3D::write: Tag Plus in x^2+y^2 is Protected. >>
Graphics3D::optx : Unknown option RenderAll
Graphics3D::optx : Unknown option LightSources
如果我然后删除未知选项,这些错误就会消失,但它看起来仍然错误:
另外,如果将鼠标悬停在 mathematica 中的最后一个图像上,您会收到以下重复的消息工具提示中的时间
Times is not a Graphics3D primitive or directive
I am trying to upgrade some equations that currently are written against Mathematica 5 to get them to work in Mathematica 7.
F = Graphics[
ContourPlot[
x^2 + (2)*y^2 + (-1)*((1)/(3))*x, {x, -1, 1}, {y, -1, 1},
ContourShading -> False, ContourStyle -> {RGBColor[1, 0, 1]},
Contours -> 20, PlotPoints -> 100]];
G = ParametricPlot[{Cos[u], Sin[u]}, {u, 0, 2*Pi},
PlotStyle -> {RGBColor[0, 174/255, 239/255]}];
H = DeleteCases[F, {x_, y_} /; (x^2 + y^2 > 1), 5];
Show[{H, G}, AspectRatio -> Automatic, Frame -> False, Axes -> True,
AxesOrigin -> {0, 0}, AxesLabel -> {x, y}, Ticks -> None]
It should look like this:
, but id does look like this:
and it gives the following error:
Thread::tdlen: Objects of unequal length in
{{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}}+{{},<<21>>,{}}
cannot be combined. >>
and if you hover over the image you get the following in a tooltip:
The specified setting for the option GraphicsBoxOptions, PlotRange cannot be used.
Coordinate index X is out of range for the enclosing GraphicsComplex
there are a lot of those Coordinate ones all with different coordinates.
And the second one I'm having difficulty with is:
P1 = {{(5)/10*Cos[u]*Cos[v], (5)/10*Sin[u]*Cos[v], (5)/10*Sin[v]}, {u,
0, 2*Pi}, {v, -Pi/2, Pi/2}};
P2 = {{(5)/10*Cos[u], 0, (5)/10*Sin[u]}, {u, 0, 2*Pi}};
P3 = {{(5)/10*Cos[u], (5)/10*Sin[u], 0}, {u, 0, 2*Pi}};
P4 = {{0, (5)/10*Cos[u], (5)/10*Sin[u]}, {u, 0, 2*Pi}};
U = {P1, P2, P3, P4};
XL = {{-1, 1}, {-1, 1}, {-1, 1}};
XV = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
XS = {"x", "y", "z"};
f[a_, b_, c_] := {a, 1.1*b[[2]]*c};
g[a_, b_] := {(b*# &) /@ a};
T = Text @@@ MapThread[f, {XS, XL, XV}];
A = Line @@@ MapThread[g, {XL, XV}];
F = (ParametricPlot3D[Evaluate[Evaluate @@ #]][[1]] &) /@ U;
OPT = {Boxed -> False, Axes -> False, BoxRatios -> {1, 1, 1}, PlotRange -> XL,
ViewPoint -> {2.4, 1.3, 2},
DisplayFunction ->
Identity};
L = {LightSources -> {{{0.1, 0, 1}, RGBColor[0.68, 0.88, 0.96]}}};
gr1 = (Show[Graphics3D[#], OPT, L] &) /@ {{EdgeForm[], F}, {Dashing[{0.03, 0.03}],
GrayLevel[0.7], A}, {T}};
gr2 = DeleteCases[Graphics[Show[Graphics3D[{A, EdgeForm[], F}], OPT,
RenderAll -> False]], {__, _Polygon}, 3];
Show[{gr1, gr2}, AspectRatio -> Automatic]
This one should look like: , but does look like:
which and it gives these errors:
ParametricPlot3D::write: Tag Plus in x^2+y^2 is Protected. >>
Graphics3D::optx : Unknown option RenderAll
Graphics3D::optx : Unknown option LightSources
If I then remove the Unknown options, those errors disappear but it still looks wrong:
Also, if you hover over the last image in mathematica you get the following message repeated several times in a tooltip
Times is not a Graphics3D primitive or directive
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
第二个,大圆部分隐藏,轴部分虚线:
Second one, great circles partly hidden, axes partly dashed:
从图片中很难看出您想要第二张图的内容。请尝试一下,告诉我什么是正确的,什么是不足的。
这是另一个可能更接近原始版本的版本。这样你就失去了 v7 旋转图形的能力。
It is a little hard to tell from the picture what you want for the second graphic. Please try this and tell me what is right and what is lacking.
Here is another take that may be closer to the original. You lose the v7 ability to rotate the graphic with this.
第一个:
[编辑]
第二个,使用
A
和T
的给定值:First one:
[Edit]
Second one, using the given values for
A
andT
: