111
This commit is contained in:
13
89-2.py
13
89-2.py
@@ -1,9 +1,5 @@
|
||||
import math
|
||||
|
||||
x = [1,2,4,8,16,32,64]
|
||||
y = [4.22,4.02,3.85,3.59,3.44,3.02,2.59]
|
||||
|
||||
|
||||
# 列主元高斯消元法
|
||||
def SovleRowMain(A,b):
|
||||
ks = 0.00000001
|
||||
@@ -63,8 +59,15 @@ def LeastSquares(list_x,list_y,n):
|
||||
for j in range(n+1):
|
||||
tmp.append(x_n[i+j])
|
||||
A.append(tmp)
|
||||
return SovleRowMain(A,b)
|
||||
print("A:", A)
|
||||
print("b:", b)
|
||||
result = SovleRowMain(A, b)
|
||||
print("result:", result)
|
||||
return result
|
||||
|
||||
#把x和y的值改为实际数据#######################
|
||||
x = [1,2,4,8,16,32,64]
|
||||
y = [4.22,4.02,3.85,3.59,3.44,3.02,2.59]
|
||||
if __name__ == "__main__":
|
||||
# 取对数 ln(W) = ln(C)+lamda*ln(t)
|
||||
ln_W = [math.log(i) for i in y]
|
||||
|
||||
Reference in New Issue
Block a user