Mathematica中的精度精度 Accuracy 和precision辨析,

有些时候, accuracy和precision似乎是同义的术语,

accuracy是指测量值的精确程度。换句话说,是指测量值接近真实值的程度。

对于一系列测量值,precision指的是测量质量相同的若干点之间的靠近程度。

这个是工程数据处理要用到的,精度知识。

我还是没有理解,查看了mathemactica的手册:

Precision[x]
gives the effective number of digits of precision in the number x.

Accuracy[x]
gives the effective number of digits to the right of the decimal point in the number x.

In[1]:= Accuracy[123456789.987654321]

Out[1]= 9.

 

In[1]:= Precision[123456789.987654321]

Out[1]= 17.0915

因为mathematica默认的是MachinePrecision,一般是小数点后面的5位小数,

In[1]:= 2.12345678901

Out[1]= 2.12346

所以要自己设置精度,而设置精度的方法有几个函数:

SetAccuracy[expr,a]
yields a version of expr in which all numbers have been set to have accuracy a.

SetPrecision[expr,p]
yields a version of expr in which all numbers have been set to have precision p.

In[2]:= SetAccuracy[2.1234567890, 15]

Out[2]= 2.12345678900000

In[3]:= SetPrecision[2.1234567890, 15]

Out[3]= 2.12345678900000

另外还有犀利的N,不过关于N,

非常简单,

N[expr,n]
attempts to give a result with n-digit precision.

 可以根据你输入的来确定小数点位置,但是感觉没有上面两个好用,

当然,达到一定的数位后要发生溢出(可能术语不对)如:

In[4]:= SetAccuracy[2.1234567890, 25]

Out[4]= 2.1234567890000000112138423

后面的一些不知道是什么问题,待解决。

 


转载于:https://www.cnblogs.com/dragonlive/archive/2012/03/25/2416567.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值