本文整理汇总了Python中vector.Vector.setcoords方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.setcoords方法的具体用法?Python Vector.setcoords怎么用?Python Vector.setcoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector.Vector
的用法示例。
在下文中一共展示了Vector.setcoords方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSetCoords
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def testSetCoords(self):
v0 = Vector()
v0.setcoords([0, 0])
v1 = Vector()
v1.setcoords([2, 1])
self.assertEqual(v0.vekt, [0, 0])
assert v1.vekt == [2, 1]
示例2: mbm_derivatives
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def mbm_derivatives(self, atom, odl):
lista_sil = [0 for _ in xrange(atom.wymiar)]
for i in range(len(odl)):
lista_sil[i] += -self.a * 2 * self.b * (odl[i] - 1) * (e ** (-self.b * ((odl[i] - 1) ** 2))) \
- self.c * (odl[i] + 1) * e ** (-(odl[i] + 1) ** 2) \
- self.d * 4 * atom.pol.vekt[i] ** 3
sily = Vector()
sily.setcoords(lista_sil)
atom.przysp += sily
示例3: testRownosciWektorow
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def testRownosciWektorow(self):
v0 = Vector()
v1 = Vector()
v1.setcoords([1, 2])
v2 = Vector()
v2.setcoords([1, 2])
self.assertNotEquals(v0, v1)
self.assertEqual(v1, v2)
self.assertEqual(v0, v0)
示例4: miekkie_derivatives
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def miekkie_derivatives(self, atom):
lista_sil = []
for p in atom.pol:
if p > self.l:
lista_sil.append(self.f * p * (self.l - p) / p)
elif p < -self.l:
lista_sil.append(self.f * p * (self.l + p) / abs(p))
else:
lista_sil.append(0.0)
sily = Vector()
sily.setcoords(lista_sil)
atom.przysp += sily
示例5: testOdejmowanieWektorow
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def testOdejmowanieWektorow(self):
v0 = Vector()
v0.setcoords([3, 3])
v1 = Vector()
v1.setcoords([1, 2])
v2 = Vector()
v2.setcoords([2, 1])
self.assertEqual(v2, v0 - v1)
self.assertEqual(v0.vekt, [3, 3])
示例6: testDodawanieWektorow
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def testDodawanieWektorow(self):
v0 = Vector()
v0.setcoords([2, 1])
v1 = Vector()
v1.setcoords([1, 2])
v3 = Vector()
v3.setcoords([3, 3])
self.assertEqual(v3, v1 + v0)
self.assertEqual(v1.vekt, [1, 2])
示例7: testIsInstance
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def testIsInstance(self):
v1 = Vector()
v2 = Vector()
v1.setcoords([0, 0, 0])
v2.setcoords([0.1, 0.1, 0.1])
wynik = Vector()
wynik.setcoords([0.1, 0.1, 0.1])
assert isinstance(v1, Vector)
assert isinstance(v2, Vector)
assert v1 + v2 == wynik
示例8: testMozenieWektorow
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def testMozenieWektorow(self):
skalar = 5
v0 = Vector()
v0.setcoords([1, 1])
v1 = Vector()
v1.setcoords([2, 2])
v2 = Vector()
v2.setcoords([5, 5])
v3 = 4
self.assertEqual(v3, v1 * v0)
self.assertEqual(v2, skalar * v0)
示例9: testLenghtWektorow
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def testLenghtWektorow(self):
v0 = Vector()
v0.setcoords([3, 2])
self.assertAlmostEqual(v0.lenght(), (13) ** 0.5, delta=0.0000001)
示例10: testDlugosciWektorow
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import setcoords [as 别名]
def testDlugosciWektorow(self):
v1 = Vector()
v1.setcoords([1, 1])
self.assertEqual(v1.lenght(), 2.0 ** (1.0 / 2))