如何绘制高斯函数图? [英] How to draw graph of Gauss function?

查看:668
本文介绍了如何绘制高斯函数图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

高斯函数具有对于正整数,在x = 1/n处存在无限数量的跳跃间断.

Gauss function has an infinite number of jump discontinuities at x = 1/n, for positive integers.

我想绘制高斯函数图.

I want to draw diagram of Gauss function.

使用Maxima cas,我​​可以通过简单的命令绘制它:

Using Maxima cas I can draw it with simple command :

  f(x):= 1/x - floor(1/x);  plot2d(f(x),[x,0,1]);

,但结果不好(在x = 0附近,它应该像这里)

but the result is not good ( near x=0 it should be like here)

另外千里马声称:

plot2d: expression evaluates to non-numeric value somewhere in plotting range.

plot2d: expression evaluates to non-numeric value somewhere in plotting range.

我可以定义picewise函数(对于正整数,在x = 1/n处跳跃不连续)

I can define picewise function ( jump discontinuities at x = 1/n, for positive integers )

所以我尝试了:

define( g(x), for i:2 thru 20 step 1 do if (x=i) then x else (1/x) - floor(1/x));

但它不起作用.

我还可以使用chebyshew多项式来近似函数(例如:Corless,Robert,Fillion,Nicolas从向后误差分析的观点出发,对数值方法的研究生介绍)

I can also use chebyshew polynomials to aproximate function ( like in : A Graduate Introduction to Numerical Methods From the Viewpoint of Backward Error Analysis by Corless, Robert, Fillion, Nicolas)

如何正确执行?

推荐答案

我列出了带有终点的线段列表.结果是:

I have made a list of segments with ending points. The result is :

完整代码位于此处

在几乎是直线的情况下,尺寸较小,列表较短,

smaller size with shorter lists in case of almost straight lines,

如果(n> 20),则iMax:10,否则iMax:250,

if (n>20) then iMax:10 else iMax : 250,

在GivePart函数中

in the GivePart function

这篇关于如何绘制高斯函数图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆