本文整理汇总了Python中sympy.galgebra.ga.MV.trigsimp方法的典型用法代码示例。如果您正苦于以下问题:Python MV.trigsimp方法的具体用法?Python MV.trigsimp怎么用?Python MV.trigsimp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.galgebra.ga.MV
的用法示例。
在下文中一共展示了MV.trigsimp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sympy.galgebra.ga import MV [as 别名]
# 或者: from sympy.galgebra.ga.MV import trigsimp [as 别名]
def __init__(self, x, coords, debug=False, I=None):
"""
coords: list of coordinate variables
x: vector fuction of coordinate variables (parametric surface)
"""
self.I = I
self.x = x
self.coords = coords
self.basis = []
self.basis_str = []
self.embedded_basis = []
for u in coords:
tv = x.diff(u)
self.basis.append(tv)
(coefs, bases) = linear_expand(tv.obj)
tc = {}
for (coef, base) in zip(coefs, bases):
str_base = str(base)
tc[str_base] = coef
if str_base not in self.embedded_basis:
self.embedded_basis.append(str_base)
self.basis_str.append(tc)
self.gij = []
for base1 in self.basis:
tmp = []
for base2 in self.basis:
tmp.append(simplify(trigsimp((base1 | base2).scalar())))
self.gij.append(tmp)
for tv in self.basis_str:
for base in self.embedded_basis:
if base not in tv:
tv[base] = 0
self.dim = len(self.basis)
indexes = tuple(range(self.dim))
self.index = [()]
for i in indexes:
self.index.append(tuple(combinations(indexes, i + 1)))
self.index = tuple(self.index)
self.MFbasis = [[MV.ONE], self.basis]
for igrade in self.index[2:]:
grade = []
for iblade in igrade:
blade = MV(1, 'scalar')
for ibasis in iblade:
blade ^= self.basis[ibasis]
blade = blade.trigsimp(deep=True, recursive=True)
grade.append(blade)
self.MFbasis.append(grade)
self.E = self.MFbasis[-1][0]
self.E_sq = trigsimp((self.E * self.E).scalar(), deep=True, recursive=True)
duals = copy.copy(self.MFbasis[-2])
duals.reverse()
sgn = 1
self.rbasis = []
for dual in duals:
recpv = (sgn * dual * self.E).trigsimp(deep=True, recursive=True)
self.rbasis.append(recpv)
sgn = -sgn
self.dbasis = []
for base in self.basis:
dbase = []
for coord in self.coords:
d = base.diff(coord).trigsimp(deep=True, recursive=True)
dbase.append(d)
self.dbasis.append(dbase)
self.surface = {}
(coefs, bases) = linear_expand(self.x.obj)
for (coef, base) in zip(coefs, bases):
self.surface[str(base)] = coef
self.grad = MV()
self.grad.is_grad = True
self.grad.blade_rep = True
self.grad.igrade = 1
self.grad.rcpr_bases_MV = []
for rbase in self.rbasis:
self.grad.rcpr_bases_MV.append(rbase / self.E_sq)
self.grad.rcpr_bases_MV = tuple(self.grad.rcpr_bases_MV)
self.grad.coords = self.coords
self.grad.norm = self.E_sq
self.grad.connection = {}
if debug:
oprint('x', self.x,
'coords', self.coords,
'basis vectors', self.basis,
#.........这里部分代码省略.........