本文整理汇总了Python中numpy.polynomial.polyutils.mapdomain方法的典型用法代码示例。如果您正苦于以下问题:Python polyutils.mapdomain方法的具体用法?Python polyutils.mapdomain怎么用?Python polyutils.mapdomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.polynomial.polyutils
的用法示例。
在下文中一共展示了polyutils.mapdomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mapdomain
# 需要导入模块: from numpy.polynomial import polyutils [as 别名]
# 或者: from numpy.polynomial.polyutils import mapdomain [as 别名]
def test_mapdomain(self):
# test for real values
dom1 = [0, 4]
dom2 = [1, 3]
tgt = dom2
res = pu.mapdomain(dom1, dom1, dom2)
assert_almost_equal(res, tgt)
# test for complex values
dom1 = [0 - 1j, 2 + 1j]
dom2 = [-2, 2]
tgt = dom2
x = dom1
res = pu.mapdomain(x, dom1, dom2)
assert_almost_equal(res, tgt)
# test for multidimensional arrays
dom1 = [0, 4]
dom2 = [1, 3]
tgt = np.array([dom2, dom2])
x = np.array([dom1, dom1])
res = pu.mapdomain(x, dom1, dom2)
assert_almost_equal(res, tgt)
# test that subtypes are preserved.
class MyNDArray(np.ndarray):
pass
dom1 = [0, 4]
dom2 = [1, 3]
x = np.array([dom1, dom1]).view(MyNDArray)
res = pu.mapdomain(x, dom1, dom2)
assert_(isinstance(res, MyNDArray))
示例2: test_mapdomain
# 需要导入模块: from numpy.polynomial import polyutils [as 别名]
# 或者: from numpy.polynomial.polyutils import mapdomain [as 别名]
def test_mapdomain(self):
# test for real values
dom1 = [0, 4]
dom2 = [1, 3]
tgt = dom2
res = pu. mapdomain(dom1, dom1, dom2)
assert_almost_equal(res, tgt)
# test for complex values
dom1 = [0 - 1j, 2 + 1j]
dom2 = [-2, 2]
tgt = dom2
x = dom1
res = pu.mapdomain(x, dom1, dom2)
assert_almost_equal(res, tgt)
# test for multidimensional arrays
dom1 = [0, 4]
dom2 = [1, 3]
tgt = np.array([dom2, dom2])
x = np.array([dom1, dom1])
res = pu.mapdomain(x, dom1, dom2)
assert_almost_equal(res, tgt)
# test that subtypes are preserved.
dom1 = [0, 4]
dom2 = [1, 3]
x = np.matrix([dom1, dom1])
res = pu.mapdomain(x, dom1, dom2)
assert_(isinstance(res, np.matrix))
示例3: test_mapdomain
# 需要导入模块: from numpy.polynomial import polyutils [as 别名]
# 或者: from numpy.polynomial.polyutils import mapdomain [as 别名]
def test_mapdomain(self) :
# test for real values
dom1 = [0, 4]
dom2 = [1, 3]
tgt = dom2
res = pu. mapdomain(dom1, dom1, dom2)
assert_almost_equal(res, tgt)
# test for complex values
dom1 = [0 - 1j, 2 + 1j]
dom2 = [-2, 2]
tgt = dom2
x = dom1
res = pu.mapdomain(x, dom1, dom2)
assert_almost_equal(res, tgt)
# test for multidimensional arrays
dom1 = [0, 4]
dom2 = [1, 3]
tgt = np.array([dom2, dom2])
x = np.array([dom1, dom1])
res = pu.mapdomain(x, dom1, dom2)
assert_almost_equal(res, tgt)
# test that subtypes are preserved.
dom1 = [0, 4]
dom2 = [1, 3]
x = np.matrix([dom1, dom1])
res = pu.mapdomain(x, dom1, dom2)
assert_(isinstance(res, np.matrix))