Maxima 的绘图功能 3

本文最初写于 2011-07-03于 sohu 博客,这次博客搬家一起搬到这里来。

版权所有,转载请注明出处。

 

1.3 二维参数方程绘图

如果在函数列表之前加上 parametric,就代表参数方程作图。
nticks 参数控制画图时函数计算取样的数目。如果这个值过小,可能画出的函数曲线不够平滑。

(%i1) wxplot2d([parametric, sin(t), cos(t)/2], [t, - %pi, %pi], [nticks, 10]);

默认的nticks = 10, 只有十个点得到的图形失真很严重。将 nticks 加大到 200 后曲线变的光滑的多。

(%i2) wxplot2d([parametric, sin(t), cos(t)/2], [t, - %pi, %pi], [nticks, 200]);

下面用参数方程绘制出蝴蝶曲线。

(%i3) r: (exp(cos(t))-2*cos(4*t)-sin(t/12)^5)$
wxplot2d([parametric, r*sin(t), r*cos(t), [t, -8*%pi, 8*%pi], [nticks, 2000]])$

同样,参数方程也可以和其他类型的曲线绘制于同一幅图中。下面的例子用到了各种常见选项。

(%i9) wxplot2d([[parametric, 5*sin(t), 6*cos(t)], [discrete,xx,yy]],
[t, 0, %pi], [nticks, 200],[style, [lines, 1, 2], [points, 3, 1, 11]],
 [legend, "parametric", "discrete"],[xlabel, "time"], [ylabel, "position(m)"]);

数据点还可以在一个列表中,下面是一个例子:

(%i10) xy: [[10, .6], [20, .9], [30, 1.1], [40, 1.3], [50, 1.4]]$
wxplot2d([[discrete, xy], 2*%pi*sqrt(l/980)], [l,0,50],
        [style, points, lines], [color, red, blue], [point_type, asterisk],
        [legend, "experiment", "theory"],
        [xlabel, "pendulum's length (cm)"], [ylabel, "period (s)"])$

等高线绘图

contour_plot (x^2 + y^2, [x, -4, 4], [y, -4, 4])$

contour_plot (u^3 + v^2, [u, -4, 4], [v, -4, 4],
             [legend,false], [grid, 500, 500],
             [gnuplot_preamble,"set cntrparam levels 22"])$

wxcontour_plot (x*sin(y)+y*sin(x), [x, -10, 10], [y, -10, 10],
               [legend,false], [grid, 100, 100],
               [gnuplot_preamble,"set pm3d; set cntrparam levels 30"])$


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值