plot - Maxima 用 3 列绘制离散数据

标签 plot maxima

如何绘制具有 3 列或更多列的离散数据集? MWE如下:

/* Required essentially to create the data set */
eqn1: 4 - x^2 - 4*y^2$
eqn2: y^2 - x^2 + 1$
sol: rk([eqn1,eqn2],[x,y],[-1.25, 0.75],[t,0,4,0.2])$

/* My current workaround to plot (x vs t) and (y vs t) */
n : length(sol)$
/* Select the ith column and create separate lists */
tseries : makelist(sol[i][1], i, 1, n)$ 
xseries:  makelist(sol[i][2], i, 1, n)$ 
yseries:  makelist(sol[i][3], i, 1, n)$ 

plot2d([
    [discrete, tseries, xseries],
    [discrete, tseries, yseries]
], [legend,"x","y"] ,[xlabel,"t"], [ylabel,"x, y"],[style, 
[linespoints,2,2]],
[gnuplot_preamble,"set key box width 2 spacing 1.3 top left"])$

是否有更好的解决方案来绘制而不创建tseriesxseriesyseries列表?

最佳答案

好的,根据您的评论,我明白了目标是什么。您的解决方案可以更简短一些,尽管不是很多。无论如何,map(lambda([txy], [txy[1], txy[2]]), sol)生成 [t, x] 点和 map(lambda([txy], [txy[1], txy[3]]), sol) 的列表生成 [t, y] 点列表。所以sol如上所述,我发现

plot2d ([[discrete, map(lambda([txy], [txy[1], txy[2]]), sol)],
         [discrete, map(lambda([txy], [txy[1], txy[3]]), sol)]]);

具有所需的输出(为了清晰起见,省略了绘图选项)。

关于plot - Maxima 用 3 列绘制离散数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53726184/

相关文章:

Python-使用 slider 更改图形图上的文本

python - matplotlib.mplot3d 立方体表面的 basemap

python - 将 matplotlib 子图排列到子网格中

plot - 在 Maxima 中显示 3D 函数的有组织的自上而下 View

function - Maxima:如何区分矩阵的行和行向量?

python - 如何在 Python 中创建三元等高线图?

r - 根据 R 中另一列中的字符串对维恩图的一列中的所有值进行计数

symbolic-math - 千里马 CAS : how to substitute for the independent variable in derivative forms

maxima - 方程未完全求解

函数符号的 SymPy 泰勒展开式