【发布时间】:2017-11-10 06:16:17
【问题描述】:
上一个问题
如何使用代码确定为以下等式的 sigma 循环迭代的最佳方法。
import statistics as stats
import warnings
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy
import scipy.stats
import sympy
from scipy import stats as st
from itertools import islice, count
import itertools
def func_shape_factor(vi, k):
k_list = [] # other name
for vi in np.nditer(vi, flags=['buffered'], op_dtypes=['float64']):
# k initial guess of 1.5, changable
k = 1.5
k = (np.nan_to_num((np.sum((vi) ** (k) * np.log(vi)) / np.sum((vi) ** \
(k)) - ((np.sum(np.log(vi)) / len(vi))))))
k_list.append(k) # append k to the list of ks
return np.array(k) # cast it to an array after the loop.
【问题讨论】:
-
非常感谢您附加到 k 列表的解决方案有效。我现在将尝试更正其余代码,这更像是一个概念问题。
标签: python scipy curve-fitting newtons-method