本文整理汇总了Python中scipy.interpolate.PPoly.from_bernstein_basis方法的典型用法代码示例。如果您正苦于以下问题:Python PPoly.from_bernstein_basis方法的具体用法?Python PPoly.from_bernstein_basis怎么用?Python PPoly.from_bernstein_basis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy.interpolate.PPoly
的用法示例。
在下文中一共展示了PPoly.from_bernstein_basis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pp_from_bp
# 需要导入模块: from scipy.interpolate import PPoly [as 别名]
# 或者: from scipy.interpolate.PPoly import from_bernstein_basis [as 别名]
def test_pp_from_bp(self):
x = [0, 1, 3]
c = [[3, 3], [1, 1], [4, 2]]
bp = BPoly(c, x)
pp = PPoly.from_bernstein_basis(bp)
bp1 = BPoly.from_power_basis(pp)
xp = [0.1, 1.4]
assert_allclose(bp(xp), pp(xp))
assert_allclose(bp(xp), bp1(xp))
示例2: test_bp_from_pp_random
# 需要导入模块: from scipy.interpolate import PPoly [as 别名]
# 或者: from scipy.interpolate.PPoly import from_bernstein_basis [as 别名]
def test_bp_from_pp_random(self):
np.random.seed(1234)
m, k = 5, 8 # number of intervals, order
x = np.sort(np.random.random(m))
c = np.random.random((k, m-1))
pp = PPoly(c, x)
bp = BPoly.from_power_basis(pp)
pp1 = PPoly.from_bernstein_basis(bp)
xp = np.linspace(x[0], x[-1], 21)
assert_allclose(pp(xp), bp(xp))
assert_allclose(pp(xp), pp1(xp))
示例3: test_derivative_ppoly
# 需要导入模块: from scipy.interpolate import PPoly [as 别名]
# 或者: from scipy.interpolate.PPoly import from_bernstein_basis [as 别名]
def test_derivative_ppoly(self):
# make sure it's consistent w/ power basis
np.random.seed(1234)
m, k = 5, 8 # number of intervals, order
x = np.sort(np.random.random(m))
c = np.random.random((k, m-1))
bp = BPoly(c, x)
pp = PPoly.from_bernstein_basis(bp)
for d in range(k):
bp = bp.derivative()
pp = pp.derivative()
xp = np.linspace(x[0], x[-1], 21)
assert_allclose(bp(xp), pp(xp))