栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python求均值方差标准差_python求均值方差?

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python求均值方差标准差_python求均值方差?

 差商表

import numpy as np
from sympy import *

np.set_printoptions(suppress=True)
def cs(x, f):
    n=len(x)
    res=np.ones([n,n])*np.inf
    for i in range(0, n):
        res[i][0] = f[i]
    for j in range(1, n):
        for i in range(j, n):
            res[i][j] = round((res[i][j - 1] - res[i - 1][j - 1]) / (x[i] - x[i - j]),5)
    return res
if __name__=="__main__":
    x=np.array([0.4,0.55,0.65,0.80,0.90,1.05])
    f=np.array([0.41075,0.57815,0.69675,0.88811,1.02652,1.25382])
    print(cs(x,f))

实现效果:

[[ 0.41075      inf      inf      inf      inf      inf]
 [ 0.57815  1.116        inf      inf      inf      inf]
 [ 0.69675  1.186    0.28         inf      inf      inf]
 [ 0.88811  1.27573  0.35892  0.1973       inf      inf]
 [ 1.02652  1.3841   0.43348  0.21303  0.03146      inf]
 [ 1.25382  1.51533  0.52492  0.2286   0.03114 -0.00049]]

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/786731.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号