(wx)Maxima 逐点绘图,编号
(wx)Maxima plot point by point, numbered
我有一个根列表,我想绘制 real/imaginary 部分。如果s=allroots()
、r=realpart()
和i=imagpart()
,都用makelist()
。由于 length(s)
会变得...冗长,有没有办法逐点绘制并编号?实际上,编号部分是我最关心的。我可以简单地使用 points(r,i)
并完成工作,但我想知道它们在某些排序算法之前和之后的出现。并不总是需要绘制 all 个点,我可以绘制到 some 个数,但我必须能够看到它们的顺序已整理。
我试过multiplot_mode但是没用:
multiplot_mode(wxt)$
for i:1 thru length(s) do draw2d(points([r[i]],[i[i]]))$
multiplot_mode(none)$
我得到的只是一个点。现在,如果这可行,使用 draw2d
的 label(["label",posx,posy])
非常方便,但我能否以某种方式在 ""
内的 for
循环中计算 i
?
或者,还有其他方法吗?用八度?还是 Scilab?我在 Linux,顺便说一句。
为了清楚起见,这是我目前所做的:(我不能 post 图片,这里是 link:i.stack.imgur.com/hNYZF.png )
...这是 wxMaxima 代码:
ptest:sortd(pp2); length(ptest);
draw2d(proportional_axes=xy,xrange=[sort(realpart(s))[1]-0.1,sort(realpart(s))[length(s)]+0.1],
yrange=[sort(imagpart(s))[1]-0.1,sort(imagpart(s))[length(s)]+0.1],point_type=0,
label(["1",realpart(ptest[1]),imagpart(ptest[1])]),points([realpart(ptest[1])],[imagpart(ptest[1])]),
label(["2",realpart(ptest[2]),imagpart(ptest[2])]),points([realpart(ptest[2])],[imagpart(ptest[2])]),
label(["3",realpart(ptest[3]),imagpart(ptest[3])]),points([realpart(ptest[3])],[imagpart(ptest[3])]),
label(["4",realpart(ptest[4]),imagpart(ptest[4])]),points([realpart(ptest[4])],[imagpart(ptest[4])]),
label(["5",realpart(ptest[5]),imagpart(ptest[5])]),points([realpart(ptest[5])],[imagpart(ptest[5])]),
label(["6",realpart(ptest[6]),imagpart(ptest[6])]),points([realpart(ptest[6])],[imagpart(ptest[6])]),
label(["7",realpart(ptest[7]),imagpart(ptest[7])]),points([realpart(ptest[7])],[imagpart(ptest[7])]),
label(["8",realpart(ptest[8]),imagpart(ptest[8])]),points([realpart(ptest[8])],[imagpart(ptest[8])]),
label(["9",realpart(ptest[9]),imagpart(ptest[9])]),points([realpart(ptest[9])],[imagpart(ptest[9])]),
label(["10",realpart(ptest[10]),imagpart(ptest[10])]),points([realpart(ptest[10])],[imagpart(ptest[10])]),
label(["11",realpart(ptest[11]),imagpart(ptest[11])]),points([realpart(ptest[11])],[imagpart(ptest[11])]),
label(["12",realpart(ptest[12]),imagpart(ptest[12])]),points([realpart(ptest[12])],[imagpart(ptest[12])]),/*
label(["13",realpart(ptest[13]),imagpart(ptest[13])]),points([realpart(ptest[13])],[imagpart(ptest[13])]),
label(["14",realpart(ptest[14]),imagpart(ptest[14])]),points([realpart(ptest[14])],[imagpart(ptest[14])]),*/
color=red,point_type=circle,point_size=3,points_joined=false,points(realpart(pp2),imagpart(pp2)),points_joined=false,
color=black,key="",line_type=dots,nticks=50,polar(1,t,0,2*%pi) )$
这仅适用于 14 个零。对于更高的订单,这将是非常痛苦的。
我想问题是你想自动构造所有 points([realpart(...), imagpart(...)])
。我的建议是通过 makelist
构造 points
表达式的列表,然后 append
列出任何其他绘图参数,然后 apply
绘图函数到附加列表。类似于:
my_labels_and_points :
apply (append,
makelist ([label ([sconcat (i), realpart (ptest[i]), imagpart (ptest[i])]),
points ([realpart (ptest[i])], [imagpart (ptest[i])])],
i, 1, length (ptest)));
all_plot_args : append ([proptional_axes=..., ...], my_labels_and_points, [color=..., key=..., ...]);
apply (draw2d, all_plot_args);
总体思路是建立绘图参数列表,然后对其应用绘图函数。
我有一个根列表,我想绘制 real/imaginary 部分。如果s=allroots()
、r=realpart()
和i=imagpart()
,都用makelist()
。由于 length(s)
会变得...冗长,有没有办法逐点绘制并编号?实际上,编号部分是我最关心的。我可以简单地使用 points(r,i)
并完成工作,但我想知道它们在某些排序算法之前和之后的出现。并不总是需要绘制 all 个点,我可以绘制到 some 个数,但我必须能够看到它们的顺序已整理。
我试过multiplot_mode但是没用:
multiplot_mode(wxt)$
for i:1 thru length(s) do draw2d(points([r[i]],[i[i]]))$
multiplot_mode(none)$
我得到的只是一个点。现在,如果这可行,使用 draw2d
的 label(["label",posx,posy])
非常方便,但我能否以某种方式在 ""
内的 for
循环中计算 i
?
或者,还有其他方法吗?用八度?还是 Scilab?我在 Linux,顺便说一句。
为了清楚起见,这是我目前所做的:(我不能 post 图片,这里是 link:i.stack.imgur.com/hNYZF.png )
...这是 wxMaxima 代码:
ptest:sortd(pp2); length(ptest); draw2d(proportional_axes=xy,xrange=[sort(realpart(s))[1]-0.1,sort(realpart(s))[length(s)]+0.1], yrange=[sort(imagpart(s))[1]-0.1,sort(imagpart(s))[length(s)]+0.1],point_type=0, label(["1",realpart(ptest[1]),imagpart(ptest[1])]),points([realpart(ptest[1])],[imagpart(ptest[1])]), label(["2",realpart(ptest[2]),imagpart(ptest[2])]),points([realpart(ptest[2])],[imagpart(ptest[2])]), label(["3",realpart(ptest[3]),imagpart(ptest[3])]),points([realpart(ptest[3])],[imagpart(ptest[3])]), label(["4",realpart(ptest[4]),imagpart(ptest[4])]),points([realpart(ptest[4])],[imagpart(ptest[4])]), label(["5",realpart(ptest[5]),imagpart(ptest[5])]),points([realpart(ptest[5])],[imagpart(ptest[5])]), label(["6",realpart(ptest[6]),imagpart(ptest[6])]),points([realpart(ptest[6])],[imagpart(ptest[6])]), label(["7",realpart(ptest[7]),imagpart(ptest[7])]),points([realpart(ptest[7])],[imagpart(ptest[7])]), label(["8",realpart(ptest[8]),imagpart(ptest[8])]),points([realpart(ptest[8])],[imagpart(ptest[8])]), label(["9",realpart(ptest[9]),imagpart(ptest[9])]),points([realpart(ptest[9])],[imagpart(ptest[9])]), label(["10",realpart(ptest[10]),imagpart(ptest[10])]),points([realpart(ptest[10])],[imagpart(ptest[10])]), label(["11",realpart(ptest[11]),imagpart(ptest[11])]),points([realpart(ptest[11])],[imagpart(ptest[11])]), label(["12",realpart(ptest[12]),imagpart(ptest[12])]),points([realpart(ptest[12])],[imagpart(ptest[12])]),/* label(["13",realpart(ptest[13]),imagpart(ptest[13])]),points([realpart(ptest[13])],[imagpart(ptest[13])]), label(["14",realpart(ptest[14]),imagpart(ptest[14])]),points([realpart(ptest[14])],[imagpart(ptest[14])]),*/ color=red,point_type=circle,point_size=3,points_joined=false,points(realpart(pp2),imagpart(pp2)),points_joined=false, color=black,key="",line_type=dots,nticks=50,polar(1,t,0,2*%pi) )$
这仅适用于 14 个零。对于更高的订单,这将是非常痛苦的。
我想问题是你想自动构造所有 points([realpart(...), imagpart(...)])
。我的建议是通过 makelist
构造 points
表达式的列表,然后 append
列出任何其他绘图参数,然后 apply
绘图函数到附加列表。类似于:
my_labels_and_points :
apply (append,
makelist ([label ([sconcat (i), realpart (ptest[i]), imagpart (ptest[i])]),
points ([realpart (ptest[i])], [imagpart (ptest[i])])],
i, 1, length (ptest)));
all_plot_args : append ([proptional_axes=..., ...], my_labels_and_points, [color=..., key=..., ...]);
apply (draw2d, all_plot_args);
总体思路是建立绘图参数列表,然后对其应用绘图函数。