(self, x, coords, debug=False, I=None)
coords: list of coordinate variables
        x: vector fuction of coordinate variables (parametric surface)
coords: list of coordinate variables
        x: vector fuction of coordinate variables (parametric surface)
coords : list of coordinate variables x : vector fuction of coordinate variables ( parametric surface )
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,
                   'index', self.index,
                   'basis blades', self.MFbasis,
                   'E', self.E,
                   'E**2', self.E_sq,
                   '*basis', duals,
                   'rbasis', self.rbasis,
                   'basis derivatives', self.dbasis,
                   'surface', self.surface,
                   'basis strings', self.basis_str,
                   'embedding basis', self.embedded_basis,
                   'metric tensor', self.gij)
def __init__ ( self , x , coords , debug = False , I = None ) : 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 , 'index' , self . index , 'basis blades' , self . MFbasis , 'E' , self . E , 'E**2' , self . E_sq , '*basis' , duals , 'rbasis' , self . rbasis , 'basis derivatives' , self . dbasis , 'surface' , self . surface , 'basis strings' , self . basis_str , 'embedding basis' , self . embedded_basis , 'metric tensor' , self . gij )