From f267d632b28352a439e04cccbd49f0494f856d5e Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sat, 30 Nov 2019 11:48:54 +0000 Subject: [PATCH 01/62] Fix indentation and alignment issues found by flake8 --- galgebra/ga.py | 26 +++++++++++++------------- galgebra/lt.py | 12 ++++++------ galgebra/metric.py | 4 ++-- galgebra/mv.py | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 665d8618..81372584 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -556,8 +556,8 @@ def mv(self, root=None, *args, **kwargs): mvtype_lst = args[0].split(' ') if len(root_lst) != len(mvtype_lst): raise ValueError('In Ga.mv() for multiple multivectors and ' + - 'multivector types incompatible args ' + - str(root_lst) + ' and ' + str(mvtype_lst)) + 'multivector types incompatible args ' + + str(root_lst) + ' and ' + str(mvtype_lst)) mv_lst = [] for (root, mv_type) in zip(root_lst, mvtype_lst): @@ -656,10 +656,10 @@ def sm(self, *args, **kwargs): def parametric(self, coords): if not isinstance(coords, list): raise TypeError('In Ga.parametric coords = ' + str(coords) + - ' is not a list.') + ' is not a list.') if len(coords) != self.n: raise ValueError('In Ga.parametric number of parametric functions' + - ' not equal to number of coordinates.') + ' not equal to number of coordinates.') self.par_coords = {} @@ -816,16 +816,16 @@ def _build_bases(self): if self.debug: printer.oprint('indexes', self.indexes, 'list(indexes)', self.indexes_lst, - 'blades', self.blades, 'list(blades)', self.blades_lst, - 'blades_to_indexes_dict', self.blades_to_indexes_dict, - 'indexes_to_blades_dict', self.indexes_to_blades_dict, - 'blades_to_grades_dict', self.blades_to_grades_dict, - 'blade_super_scripts', self.blade_super_scripts) + 'blades', self.blades, 'list(blades)', self.blades_lst, + 'blades_to_indexes_dict', self.blades_to_indexes_dict, + 'indexes_to_blades_dict', self.indexes_to_blades_dict, + 'blades_to_grades_dict', self.blades_to_grades_dict, + 'blade_super_scripts', self.blade_super_scripts) if not self.is_ortho: printer.oprint('bases', self.bases, 'list(bases)', self.bases_lst, - 'bases_to_indexes_dict', self.bases_to_indexes_dict, - 'indexes_to_bases_dict', self.indexes_to_bases_dict, - 'bases_to_grades_dict', self.bases_to_grades_dict) + 'bases_to_indexes_dict', self.bases_to_indexes_dict, + 'indexes_to_bases_dict', self.indexes_to_bases_dict, + 'bases_to_grades_dict', self.bases_to_grades_dict) # create the Mv wrappers self.mv_blades_lst = [ @@ -2022,7 +2022,7 @@ def __init__(self, *args, **kwargs): if len(u) != n_base: raise ValueError('In submanifold dimension of base manifold' + - ' not equal to dimension of mapping.') + ' not equal to dimension of mapping.') dxdu = [] for x_i in u: tmp = [] diff --git a/galgebra/lt.py b/galgebra/lt.py index 6850f087..068b8117 100644 --- a/galgebra/lt.py +++ b/galgebra/lt.py @@ -43,7 +43,7 @@ def Symbolic_Matrix(root,coords=None,mode='g',f=False,sub=True): if not f: mat[row,col] = Symbol(element,real=True) else: - mat[row,col] = Function(element)(*coords) + mat[row,col] = Function(element)(*coords) elif mode == 's': # Symmetric symbolic matrix for row in n_range: @@ -57,7 +57,7 @@ def Symbolic_Matrix(root,coords=None,mode='g',f=False,sub=True): if not f: mat[row,col] = Symbol(element,real=True) else: - mat[row,col] = Function(element)(*coords) + mat[row,col] = Function(element)(*coords) elif mode == 'a': # Asymmetric symbolic matrix for row in n_range: @@ -75,7 +75,7 @@ def Symbolic_Matrix(root,coords=None,mode='g',f=False,sub=True): if not f: mat[row,col] = sign * Symbol(element,real=True) else: - mat[row,col] = sign * Function(element)(*coords) + mat[row,col] = sign * Function(element)(*coords) else: raise ValueError('In Symbolic_Matrix mode = ' + str(mode)) else: @@ -219,8 +219,8 @@ def __init__(self, *args, **kwargs): raise ValueError('In Spinor input for Lt, S*S.rev() not a scalar!\n') elif utils.isstr(mat_rep): # String input - Amat = Symbolic_Matrix(mat_rep, coords=self.Ga.coords,mode=self.mode,f=self.fct_flg) - self.__init__(Amat, ga=self.Ga) + Amat = Symbolic_Matrix(mat_rep, coords=self.Ga.coords,mode=self.mode,f=self.fct_flg) + self.__init__(Amat, ga=self.Ga) else: # Linear multivector function input # F is a multivector function to be tested for linearity @@ -239,7 +239,7 @@ def __init__(self, *args, **kwargs): def __call__(self, v, obj=False): if isinstance(v, mv.Mv) and self.Ga.name != v.Ga.name: - raise ValueError('In Lt call Lt and argument refer to different vector spaces') + raise ValueError('In Lt call Lt and argument refer to different vector spaces') if self.spinor: if not isinstance(v, mv.Mv): diff --git a/galgebra/metric.py b/galgebra/metric.py index 4c9b38cc..ade9c7fd 100644 --- a/galgebra/metric.py +++ b/galgebra/metric.py @@ -419,8 +419,8 @@ def _build_derivatives_of_basis(self): # Derivatives of basis vectors from Chri # \frac{\partial e_{j}}{\partial x^{i}} = \Gamma_{ijk} e^{k} de = [[ sum([Gamma_ijk * e__k for (Gamma_ijk, e__k) in zip(dG[i][j], self.r_symbols)]) - for j in n_range] - for i in n_range] + for j in n_range + ] for i in n_range] if self.debug: printer.oprint('D_{i}e^{j}', de) diff --git a/galgebra/mv.py b/galgebra/mv.py index 39c56d62..7b43e3d6 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1029,8 +1029,8 @@ def rev(self): def diff(self, coord): Dself = Mv(ga=self.Ga) if self.Ga.coords is None: - Dself.obj = diff(self.obj, coord) - return Dself + Dself.obj = diff(self.obj, coord) + return Dself elif coord not in self.Ga.coords: if self.Ga.par_coords is None: Dself.obj = diff(self.obj, coord) From f9907816496e61a03439be0059a93798e85dc2f3 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 2 Dec 2019 09:47:09 +0000 Subject: [PATCH 02/62] Lookup `kwargs['f']` just once --- galgebra/mv.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 081af205..690d0922 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -180,16 +180,17 @@ def add_superscript(root, s): grade = __grade if utils.isstr(__name_or_coeffs): name = __name_or_coeffs - if isinstance(kwargs['f'], bool) and not kwargs['f']: #Is a constant mulitvector function + f = kwargs['f'] + if isinstance(f, bool) and not f: #Is a constant mulitvector function return sum([Symbol(add_superscript(name, super_script), real=True) * base for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) else: - if isinstance(kwargs['f'], bool): #Is a multivector function of all coordinates + if isinstance(f, bool): #Is a multivector function of all coordinates return sum([Function(add_superscript(name, super_script), real=True)(*ga.coords) * base for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) - else: #Is a multivector function of tuple kwargs['f'] variables - return sum([Function(add_superscript(name, super_script), real=True)(*kwargs['f']) * base + else: #Is a multivector function of tuple f variables + return sum([Function(add_superscript(name, super_script), real=True)(*f) * base for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) elif isinstance(__name_or_coeffs, (list, tuple)): coeffs = __name_or_coeffs From 0de7425615bc916d9ebc0ade46d10787b17a212c Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 2 Dec 2019 09:49:47 +0000 Subject: [PATCH 03/62] Check `isinstance(f, bool)` just once --- galgebra/mv.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 690d0922..83a718ae 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -181,17 +181,16 @@ def add_superscript(root, s): if utils.isstr(__name_or_coeffs): name = __name_or_coeffs f = kwargs['f'] - if isinstance(f, bool) and not f: #Is a constant mulitvector function - return sum([Symbol(add_superscript(name, super_script), real=True) * base - for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) - - else: - if isinstance(f, bool): #Is a multivector function of all coordinates + if isinstance(f, bool): + if f: # Is a multivector function of all coordinates return sum([Function(add_superscript(name, super_script), real=True)(*ga.coords) * base - for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) - else: #Is a multivector function of tuple f variables - return sum([Function(add_superscript(name, super_script), real=True)(*f) * base - for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) + for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) + else: # Is a constant multivector function + return sum([Symbol(add_superscript(name, super_script), real=True) * base + for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) + else: # Is a multivector function of tuple f variables + return sum([Function(add_superscript(name, super_script), real=True)(*f) * base + for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) elif isinstance(__name_or_coeffs, (list, tuple)): coeffs = __name_or_coeffs if len(coeffs) <= len(ga.blades[grade]): From e1f77bd5a852972a3cffb92b4832f6171d5113f7 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 4 Dec 2019 15:45:57 +0000 Subject: [PATCH 04/62] Be stricter about kwargs to Mv.__init__ (#97) Also add much better documentation for construction --- galgebra/deprecated.py | 7 ++-- galgebra/mv.py | 82 ++++++++++++++++++++++++++++++++++++------ galgebra/utils.py | 42 ++++++++++++++++++++++ test/test_mv.py | 7 ++++ 4 files changed, 126 insertions(+), 12 deletions(-) diff --git a/galgebra/deprecated.py b/galgebra/deprecated.py index 5f42e7db..e1b230ca 100644 --- a/galgebra/deprecated.py +++ b/galgebra/deprecated.py @@ -38,8 +38,11 @@ def setup(basis, metric=None, coords=None, rframe=False, debug=False, curv=(None return list(MV.GA.mv()) - def __init__(self, base, mvtype, fct=False, blade_rep=True): - Mv.__init__(self, base, mvtype, f=fct, ga=MV.GA) + def __init__(self, base, mvtype, fct=None, blade_rep=True): + kwargs = {} + if fct is not None: + kwargs['f'] = fct # only forward this argument if we received it + Mv.__init__(self, base, mvtype, ga=MV.GA, **kwargs) def Fmt(self, fmt=1, title=None): print(Mv.Fmt(self, fmt=fmt, title=title)) diff --git a/galgebra/mv.py b/galgebra/mv.py index dcc419d6..c078a122 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -19,6 +19,7 @@ from . import metric from . import utils from .printer import ZERO_STR +from .utils import _KwargParser ONE = S(1) ZERO = S(0) @@ -61,10 +62,6 @@ class Mv(object): fmt = 1 latex_flg = False restore = False - init_slots = {'f': (False, 'True if function of coordinates'), - 'ga': (None, 'Geometric algebra to be used with multivectors'), - 'coords': (None, 'Coordinates to be used with multivector function'), - 'recp': (None, 'Normalization for reciprocal vector')} dual_mode_lst = ['+I','I+','+Iinv','Iinv+','-I','I-','-Iinv','Iinv-'] @staticmethod @@ -178,9 +175,11 @@ def add_superscript(root, s): return root return '{}__{}'.format(root, s) grade = __grade + kw = _KwargParser('_make_grade', kwargs) if utils.isstr(__name_or_coeffs): name = __name_or_coeffs - f = kwargs['f'] + f = kw.pop('f', False) + kw.reject_remaining() if isinstance(f, bool): if f: # Is a multivector function of all coordinates return sum([Function(add_superscript(name, super_script), real=True)(*ga.coords) * base @@ -193,6 +192,7 @@ def add_superscript(root, s): for (super_script, base) in zip(ga.blade_super_scripts[grade], ga.blades[grade])]) elif isinstance(__name_or_coeffs, (list, tuple)): coeffs = __name_or_coeffs + kw.reject_remaining() if len(coeffs) <= len(ga.blades[grade]): return sum([coef * base for (coef, base) in zip(coeffs, ga.blades[grade][:len(coeffs)])]) @@ -259,14 +259,74 @@ def _make_odd(ga, __name_or_coeffs, **kwargs): _make_even = _make_spinor def __init__(self, *args, **kwargs): + """ + __init__(self, *args, ga, recp=None, **kwargs) + + Note this constructor is overloaded, based on the type and number of + positional arguments: + + .. class:: Mv(*, ga, recp=None) + + Create a zero multivector + .. class:: Mv(expr, /, *, ga, recp=None) + + Create a multivector from an existing vector or sympy expression + .. class:: Mv(coeffs, grade, /, ga, recp=None) + + Create a multivector constant with a given grade + .. class:: Mv(name, category, /, *cat_args, ga, recp=None, f=False) + + Create a multivector constant with a given category + .. class:: Mv(name, grade, /, ga, recp=None, f=False) - if 'ga' not in kwargs: - raise ValueError("Geometric algebra key inplut 'ga' required") + Create a multivector variable or function of a given grade + .. class:: Mv(coeffs, category, /, *cat_args, ga, recp=None) - kwargs = metric.test_init_slots(Mv.init_slots, **kwargs) + Create a multivector variable or function of a given category - self.Ga = kwargs.pop('ga') - self.recp = kwargs.pop('recp') # Normalization for reciprocal vectors + + ``*`` and ``/`` in the signatures above are python + 3.8 syntax, and respectively indicate the boundaries between + positional-only, normal, and keyword-only arguments. + + Parameters + ---------- + ga : ~galgebra.ga.Ga + Geometric algebra to be used with multivectors + recp : object, optional + Normalization for reciprocal vector. Unused. + name : str + Name of this multivector, if it is a variable or function + coeffs : sequence + Sequence of coefficients for the given category. + This is only meaningful + category : str + One of: + + * ``"grade"`` - this takes an additional argument, the grade to + create, in ``cat_args`` + * ``"scalar"`` + * ``"vector"`` + * ``"bivector"`` / ``"grade2"`` + * ``"pseudo"`` + * ``"mv"`` + * ``"even"`` / ``"spinor"`` + * ``"odd"`` + + f : bool, tuple + True if function of coordinates, or a tuple of those coordinates. + Only valid if a name is passed + + coords : + This argument is always accepted but ignored. + + It is incorrectly described internally as the coordinates to be + used with multivector functions. + """ + kw = _KwargParser('__init__', kwargs) + self.Ga = kw.pop('ga') + self.recp = kw.pop('recp', None) # not used + kw.pop('coords', None) # ignored self.char_Mv = False self.i_grade = None # if pure grade mv, grade value @@ -280,6 +340,7 @@ def __init__(self, *args, **kwargs): if len(args) == 0: # default constructor 0 self.obj = S(0) self.i_grade = 0 + kw.reject_remaining() elif len(args) == 1 and not utils.isstr(args[0]): # copy constructor x = args[0] if isinstance(x, Mv): @@ -293,6 +354,7 @@ def __init__(self, *args, **kwargs): self.obj = S(x) self.is_blade_rep = True self.characterise_Mv() + kw.reject_remaining() else: if utils.isstr(args[1]): make_args = list(args) diff --git a/galgebra/utils.py b/galgebra/utils.py index 24e0cd82..e7e7cfa8 100644 --- a/galgebra/utils.py +++ b/galgebra/utils.py @@ -32,3 +32,45 @@ def flatten(x): def isstr(s): return isinstance(s, string_types) + + +class _KwargParser: + """ + Helper function to emulate Python 3 keyword-only arguments. + + Use as:: + + def func(x1, **kwargs): + kw = KwargParser('func', kwargs) + a = kw.pop('a') + b = kw.pop('b', 2) + kw.reject_remaining() + ... + + To emulate the Python 3 syntax:: + + def func(x1, *, a, b=2): + ... + """ + def __init__(self, func_name, kwargs): + self._func_name = func_name + self._kwargs = kwargs + + def pop(self, arg_name, *default): + try: + return self._kwargs.pop(arg_name, *default) + except KeyError: + pass + raise TypeError( + '{}() missing required keyword-only argument {!r}' + .format(self._func_name, arg_name) + ) + + def reject_remaining(self): + if self._kwargs: + # match the error message to what Python 3 produces + bad_arg = next(iter(self._kwargs)) + raise TypeError( + '{}() got an unexpected keyword argument {!r}' + .format(self._func_name, bad_arg) + ) diff --git a/test/test_mv.py b/test/test_mv.py index 94e250f5..8996e039 100644 --- a/test/test_mv.py +++ b/test/test_mv.py @@ -108,8 +108,15 @@ def check(x, expected_grades): check(ga.mv('A', 'odd'), [1, 3]) check(ga.mv('A', 'mv'), [0, 1, 2, 3]) + # value construction + check(ga.mv([1, 2, 3], 'vector'), [1]) + # illegal arguments with self.assertRaises(TypeError): ga.mv('A', 'vector', "too many arguments") with self.assertRaises(TypeError): ga.mv('A', 'grade') # too few arguments + with self.assertRaises(TypeError): + ga.mv('A', 'grade', not_an_argument=True) # invalid kwarg + with self.assertRaises(TypeError): + ga.mv([1, 2, 3], 'vector', f=True) # can't pass f with coefficients From 786af26f4dd9e95d2a951045b96841bcd479e511 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 5 Dec 2019 03:07:14 +0000 Subject: [PATCH 05/62] Merge duplicate grade selection code (#135) Merges the duplicate grade lookup rules between `dot_product_basis_blades` and `non_orthogonal_dot_product_basis_blades`. This also fixes some return values to be zero instead of 0, not that that matters too much. --- galgebra/ga.py | 62 +++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 8fa6d827..90888781 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -1066,6 +1066,26 @@ def wedge_product_basis_blades(self, blade12): # blade12 = blade1*blade2 #****** Dot (|) product, reft (<) and right (>) contractions ******# + def _dot_product_grade(self, grade1, grade2, mode): + """ + Get the grade to select from the geometric product, for a given + dot product + """ + if mode == '|': + return abs(grade1 - grade2) + elif mode == '<': + grade = grade2 - grade1 + if grade < 0: + return None + return grade + elif mode == '>': + grade = grade1 - grade2 + if grade < 0: + return None + return grade + else: + raise ValueError('mode={!r} not allowed'.format(mode)) + def dot_product_basis_blades(self, blade12, mode): # dot (|), left (<), and right (>) products # dot product for orthogonal basis @@ -1073,19 +1093,11 @@ def dot_product_basis_blades(self, blade12, mode): index1 = self.blades_to_indexes_dict[blade1] index2 = self.blades_to_indexes_dict[blade2] index = list(index1 + index2) - grade1 = len(index1) - grade2 = len(index2) - if mode == '|': - grade = abs(grade1 - grade2) - elif mode == '<': - grade = grade2 - grade1 - if grade < 0: - return 0 - elif mode == '>': - grade = grade1 - grade2 - if grade < 0: - return 0 + grade = self._dot_product_grade(len(index1), len(index2), mode=mode) + if grade is None: + return zero + n = len(index) sgn = 1 result = 1 @@ -1138,27 +1150,11 @@ def non_orthogonal_dot_product_basis_blades(self, blade12, mode): # blade12 = ( # grades of input blades grade1 = self.blades_to_grades_dict[blade1] grade2 = self.blades_to_grades_dict[blade2] - if mode == '|': - grade_dot = abs(grade2 - grade1) - if grade_dot in grade_dict: - return grade_dict[grade_dot] - else: - return zero - elif mode == '<': - grade_contract = grade2 - grade1 - if grade_contract in grade_dict: - return grade_dict[grade_contract] - else: - return zero - elif mode == '>': - grade_contract = grade1 - grade2 - if grade_contract in grade_dict: - return grade_dict[grade_contract] - else: - return zero - else: - raise ValueError('"' + str(mode) + '" not allowed ' - 'dot mode in non_orthogonal_dot_basis') + + grade = self._dot_product_grade(grade1, grade2, mode=mode) + if grade is None: + return zero + return grade_dict.get(grade, zero) ############# Non-Orthogonal Tables and Dictionaries ############### From 1ea8eeacf3a25dffb3df551820b5ca4c5fbebccf Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Fri, 6 Dec 2019 13:34:30 +0000 Subject: [PATCH 06/62] Eliminate special cases from update_and_substitute (#138) The tables now contain scalars, so this should work for all cases Note that as a result of this, some multiplications now end up slightly more expanded --- examples/ipython/Terminal.ipynb | 4 ++-- galgebra/ga.py | 11 +---------- test/test_test.py | 4 ++-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/examples/ipython/Terminal.ipynb b/examples/ipython/Terminal.ipynb index 832a855e..4b727c96 100644 --- a/examples/ipython/Terminal.ipynb +++ b/examples/ipython/Terminal.ipynb @@ -131,11 +131,11 @@ "[(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m), (\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m), 1]])\n", "(X^Y)**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2\n", "B = \u001b[0;34mX\u001b[0m^\u001b[0;34mY\u001b[0m - (\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mX\u001b[0m^\u001b[0;34me\u001b[0m + (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mY\u001b[0m^\u001b[0;34me\u001b[0m\n", - "B**2 = 3*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m) + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mY\u001b[0m^\u001b[0;34me\u001b[0m - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*((\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m) + \u001b[0;34mY\u001b[0m^\u001b[0;34me\u001b[0m) - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mX\u001b[0m^\u001b[0;34me\u001b[0m + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*((\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m) + \u001b[0;34mX\u001b[0m^\u001b[0;34me\u001b[0m) + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*\u001b[0;34mX\u001b[0m^\u001b[0;34mY\u001b[0m - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m) + \u001b[0;34mX\u001b[0m^\u001b[0;34mY\u001b[0m)\n", + "B**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)\n", "#L = X^Y^e is a non-euclidian line\n", "B = L*e = \u001b[0;34mX\u001b[0m^\u001b[0;34mY\u001b[0m - (\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mX\u001b[0m^\u001b[0;34me\u001b[0m + (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mY\u001b[0m^\u001b[0;34me\u001b[0m\n", "B*e*B.rev() = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(-(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m) + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))*\u001b[0;34me\u001b[0m\n", - "B**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m) - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))\n", + "B**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)\n", "L**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)\n", "s = sinh(alpha/2) and c = cosh(alpha/2)\n", "exp(alpha*B/(2*|B|)) = c\n", diff --git a/galgebra/ga.py b/galgebra/ga.py index 90888781..47a8b9cf 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -101,16 +101,7 @@ def update_and_substitute(expr1, expr2, mul_dict): expr = S(0) for (coef1, base1) in zip(coefs1, bases1): for (coef2, base2) in zip(coefs2, bases2): - #Special cases where base1 and/or base2 is scalar - if base1 == 1 and base2 == 1: - expr += coef1 * coef2 - elif base1 == 1: - expr += coef1 * coef2 * base2 - elif base2 == 1: - expr += coef1 * coef2 * base1 - else: - key = (base1, base2) - expr += coef1 * coef2 * mul_dict[key] + expr += coef1 * coef2 * mul_dict[base1, base2] return expr diff --git a/test/test_test.py b/test/test_test.py index cf61749c..546cef03 100644 --- a/test/test_test.py +++ b/test/test_test.py @@ -198,13 +198,13 @@ def test_noneuclidian_distance_calculation(self): B = (L*e).expand().blade_rep() # D&L 10.152 assert str(B) == 'X^Y - (Y.e)*X^e + (X.e)*Y^e' Bsq = B*B - assert str(Bsq) == '(X.Y)*((X.Y) - 2*(X.e)*(Y.e))' + assert str(Bsq) == '(X.Y)**2 - 2*(X.Y)*(X.e)*(Y.e)' Bsq = Bsq.scalar() assert str(B) == 'X^Y - (Y.e)*X^e + (X.e)*Y^e' BeBr = B*e*B.rev() assert str(BeBr) == '(X.Y)*(-(X.Y) + 2*(X.e)*(Y.e))*e' - assert str(B*B) == '(X.Y)*((X.Y) - 2*(X.e)*(Y.e))' + assert str(B*B) == '(X.Y)**2 - 2*(X.Y)*(X.e)*(Y.e)' assert str(L*L) == '(X.Y)**2 - 2*(X.Y)*(X.e)*(Y.e)' # D&L 10.153 (s,c,Binv,M,S,C,alpha) = symbols('s c (1/B) M S C alpha') From 159cc2a9cf29acb8bcca9cc9d1eda754d3e06834 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Fri, 6 Dec 2019 15:22:12 +0000 Subject: [PATCH 07/62] Fold the exclusions of scalars from the hestenes dot product into the table (#134) This means that `ga.dot_table_dict[S(1), S(1)] == S(0)`, whereas previously it was incorrectly 1. --- galgebra/ga.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 47a8b9cf..408b6796 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -12,7 +12,7 @@ from sympy import ( diff, Rational, Symbol, S, Mul, Add, expand, simplify, eye, trigsimp, - symbols, sqrt, numbers, Function + symbols, sqrt, Function ) from . import printer @@ -93,9 +93,6 @@ def update_and_substitute(expr1, expr2, mul_dict): product of ``bases1[i]*bases2[j]`` as a linear combination of scalars and bases of the geometric algebra. """ - if (isinstance(expr1, numbers.Number) or expr1.is_commutative) \ - or (isinstance(expr2, numbers.Number) or expr2.is_commutative): - return expr1 * expr2 (coefs1, bases1) = metric.linear_expand(expr1) (coefs2, bases2) = metric.linear_expand(expr2) expr = S(0) @@ -1063,6 +1060,8 @@ def _dot_product_grade(self, grade1, grade2, mode): dot product """ if mode == '|': + if grade1 == 0 or grade2 == 0: + return None return abs(grade1 - grade2) elif mode == '<': grade = grade2 - grade1 @@ -1288,8 +1287,6 @@ def _dot(self, A, B, mode): return 0 if mode == '|': # Hestenes dot product - A = self.remove_scalar_part(A) - B = self.remove_scalar_part(B) return update_and_substitute(A, B, self.dot_table_dict) elif mode == '<' or mode == '>': r""" From 1e7de693d6452d764dbb8aade4a7cc278e677ad5 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sat, 7 Dec 2019 22:20:59 +0000 Subject: [PATCH 08/62] Remove special-cases for scalars in contractions (#99) It's possible this will be marginally slower, but it makes everything much easier to read. --- galgebra/ga.py | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 408b6796..522bdd70 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -1288,35 +1288,10 @@ def _dot(self, A, B, mode): if mode == '|': # Hestenes dot product return update_and_substitute(A, B, self.dot_table_dict) - elif mode == '<' or mode == '>': - r""" - Let :math:`A = a + A'` and :math:`B = b + B'` where :math:`a` and - :math:`b` are the scalar parts of :math:`A` and :math:`B`, and - :math:`A'` and :math:`B'` are the remaining parts of :math:`A` and - :math:`B`. Then we have: - - .. math:: - - (a+A') \rfloor (b+B') &= a(b+B') + A' \rfloor B' \\ - (a+A') \lfloor (b+B') &= b(a+A') + A' \lfloor B' - - We use these relations to reduce :math:`A \rfloor B` (``AB``). - """ - (a, Ap) = self.split_multivector(A) # Ap = A' - (b, Bp) = self.split_multivector(B) # Bp = B' - if mode == '<': # Left contraction - if Ap != 0 and Bp != 0: # Neither nc part of A or B is zero - prod = update_and_substitute(Ap, Bp, self.left_contract_table_dict) - return prod + a * B - else: # Ap or Bp is zero - return a * B - elif mode == '>': # Right contraction - if Ap != 0 and Bp != 0: # Neither nc part of A or B is zero - prod = update_and_substitute(Ap, Bp, self.right_contract_table_dict) - return prod + b * A - else: # Ap or Bp is zero - return b * A + elif mode == '<': # Left contraction + return update_and_substitute(A, B, self.left_contract_table_dict) + elif mode == '>': # Right contraction + return update_and_substitute(A, B, self.right_contract_table_dict) else: raise ValueError('"' + str(mode) + '" not a legal mode in dot') From 8e21d5bd9ee9b086b33431c01f13ded62d7b6946 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sun, 8 Dec 2019 00:11:02 +0000 Subject: [PATCH 09/62] Remove assignments to mv.obj (#141) * Remove assignments to mv.obj It is much easier to reason about multivector objects if they are are not mutated unexpectedly. This changes the following functions to not mutate their arguments. Any code relying solely on the return value will be unaffected: * `Metric.applymv` * `Mv.diff` * `Mv.simplify` * `Mv.expand` * `Mv.collect` This also changes `Mv.Mv_str` and `Mv.Mv_latex_str` to not mutate their multivectors when they are printed - this is super surprising behavior * Remove `Mv.first_line` This was a bad workaround to pass variables to a closure in the printer * Fix typo in earlier commit --- examples/Terminal/rotations.py | 4 +- galgebra/metric.py | 3 +- galgebra/mv.py | 67 ++++++++++++++++------------------ 3 files changed, 34 insertions(+), 40 deletions(-) diff --git a/examples/Terminal/rotations.py b/examples/Terminal/rotations.py index c732e2be..e4536515 100644 --- a/examples/Terminal/rotations.py +++ b/examples/Terminal/rotations.py @@ -53,8 +53,8 @@ def main(): R_th = cos(th/2)+I*e_phi*sin(th/2) R_th_rev = R_th.rev() - print(R_th) - print(R_th_rev) + print(R_th.trigsimp()) + print(R_th_rev.trigsimp()) e_r = (R_th*R_phi*ex*R_phi_rev*R_th_rev).trigsimp() diff --git a/galgebra/metric.py b/galgebra/metric.py index ade9c7fd..f8b5bfde 100644 --- a/galgebra/metric.py +++ b/galgebra/metric.py @@ -206,8 +206,7 @@ def apply(expr): @staticmethod def applymv(mv): - mv.obj = Simp.apply(mv.obj) - return mv + return Mv(Simp.apply(mv.obj), ga=mv.Ga) class Metric(object): diff --git a/galgebra/mv.py b/galgebra/mv.py index c078a122..cce2a3d7 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -609,9 +609,12 @@ def Mv_str(self): global print_replace_old, print_replace_new if self.i_grade == 0: return str(self.obj) - self.obj = expand(self.obj) - self.characterise_Mv() - self.obj = metric.Simp.apply(self.obj) + + # note: this just replaces `self` for the rest of this function + obj = expand(self.obj) + obj = metric.Simp.apply(obj) + self = Mv(obj, ga=self.Ga) + if self.is_blade_rep or self.Ga.is_ortho: base_keys = self.Ga._all_blades_lst grade_keys = self.Ga.blades_to_grades_dict @@ -678,11 +681,13 @@ def Mv_latex_str(self): if self.obj == 0: return ZERO_STR - self.first_line = True + # todo: use the nonlocal keyword here instead once we drop python 2 + class first_line: + value = True def append_plus(c_str): - if self.first_line: - self.first_line = False + if first_line.value: + first_line.value = False return c_str else: c_str = c_str.strip() @@ -692,9 +697,10 @@ def append_plus(c_str): return ' + ' + c_str # str representation of multivector - self.obj = expand(self.obj) - self.characterise_Mv() - self.obj = metric.Simp.apply(self.obj) + # note: this just replaces `self` for the rest of this function + obj = expand(self.obj) + obj = metric.Simp.apply(obj) + self = Mv(obj, ga=self.Ga) if self.obj == S(0): return ZERO_STR @@ -761,7 +767,7 @@ def append_plus(c_str): elif printer.GaLatexPrinter.fmt == 2: # One grade per line if grade != old_grade: old_grade = grade - if not self.first_line: + if not first_line.value: lines.append(s) s = append_plus(cb_str) else: @@ -918,14 +924,13 @@ def collect(self,deep=False): obj_dict[base] += coef else: obj_dict[base] = coef - obj = 0 + obj = S(0) for base in list(obj_dict.keys()): if deep: obj += collect(obj_dict[base])*base else: obj += obj_dict[base]*base - self.obj = obj - return(self) + return Mv(obj, ga=self.Ga) def is_scalar(self): @@ -1087,27 +1092,23 @@ def rev(self): def diff(self, coord): Dself = Mv(ga=self.Ga) if self.Ga.coords is None: - Dself.obj = diff(self.obj, coord) - return Dself + obj = diff(self.obj, coord) elif coord not in self.Ga.coords: if self.Ga.par_coords is None: - Dself.obj = diff(self.obj, coord) + obj = diff(self.obj, coord) elif coord not in self.Ga.par_coords: - Dself.obj = diff(self.obj, coord) + obj = diff(self.obj, coord) else: - Dself.obj = diff(self.obj, coord) + obj = diff(self.obj, coord) for x_coord in self.Ga.coords: f = self.Ga.par_coords[x_coord] if f != S(0): tmp1 = self.Ga.pDiff(self.obj, x_coord) tmp2 = diff(f, coord) - Dself.obj += tmp1 * tmp2 - Dself.characterise_Mv() - return Dself + obj += tmp1 * tmp2 else: - Dself.obj = self.Ga.pDiff(self.obj, coord) - Dself.characterise_Mv() - return Dself + obj = self.Ga.pDiff(self.obj, coord) + return Mv(obj, ga=self.Ga) def pdiff(self, var): return Mv(self.Ga.pDiff(self.obj, var), ga=self.Ga) @@ -1349,8 +1350,7 @@ def simplify(self, modes=simplify): else: for (coef, base) in zip(coefs, bases): obj += modes(coef) * base - self.obj = obj - return self + return Mv(obj, ga=self.Ga) def subs(self, d): # For each scalar coef of the multivector apply substitution argument d @@ -1358,20 +1358,17 @@ def subs(self, d): obj = S(0) for (coef, base) in zip(coefs, bases): obj += coef.subs(d) * base - #self.obj = obj - #return self - return self.Ga.mv(obj) + return Mv(obj, ga=self.Ga) def expand(self): coefs,bases = metric.linear_expand(self.obj) new_coefs = [] for coef in coefs: new_coefs.append(expand(coef)) - obj = 0 + obj = S(0) for coef,base in zip(new_coefs,bases): obj += coef * base - self.obj = obj - return self + return Mv(obj, ga=self.Ga) def list(self): (coefs, bases) = metric.linear_expand(self.obj) @@ -2490,11 +2487,9 @@ def basic(ga): def Nga(x, prec=5): if isinstance(x, Mv): - Px = Mv(x, ga=x.Ga) - Px.obj = Nsympy(x.obj, prec) - return(Px) + return Mv(Nsympy(x.obj, prec), ga=x.Ga) else: - return(Nsympy(x, prec)) + return Nsympy(x, prec) def printeigen(M): # Print eigenvalues, multiplicities, eigenvectors of M. From 7a27cddd1371047c88554414cc162418e60dd165 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sun, 8 Dec 2019 00:42:05 +0000 Subject: [PATCH 10/62] Eliminate `_dot`, which is now easy to inline into `Mul` (#142) --- galgebra/ga.py | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 522bdd70..a2362c07 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -1266,8 +1266,14 @@ def Mul(self, A, B, mode='*'): # Unifies all products into one function return self.mul(A, B) elif mode == '^': return self.wedge(A, B) + elif mode == '|': + return self.hestenes_dot(A, B) + elif mode == '<': + return self.left_contract(A, B) + elif mode == '>': + return self.right_contract(A, B) else: - return self._dot(A, B, mode=mode) + raise ValueError('Unknown multiplication operator {!r}', mode) def mul(self, A, B): # geometric (*) product of blade representations if A == 0 or B == 0: @@ -1281,31 +1287,17 @@ def wedge(self, A, B): return 0 return update_and_substitute(A, B, self.wedge_table_dict) - - def _dot(self, A, B, mode): - if A == 0 or B == 0: - return 0 - - if mode == '|': # Hestenes dot product - return update_and_substitute(A, B, self.dot_table_dict) - elif mode == '<': # Left contraction - return update_and_substitute(A, B, self.left_contract_table_dict) - elif mode == '>': # Right contraction - return update_and_substitute(A, B, self.right_contract_table_dict) - else: - raise ValueError('"' + str(mode) + '" not a legal mode in dot') - def hestenes_dot(self, A, B): r""" compute the hestenes dot product, :math:`A \bullet B` """ - return self._dot(A, B, mode='|') + return update_and_substitute(A, B, self.dot_table_dict) def left_contract(self, A, B): r""" compute the left contraction, :math:`A \rfloor B` """ - return self._dot(A, B, mode='<') + return update_and_substitute(A, B, self.left_contract_table_dict) def right_contract(self, A, B): r""" compute the right contraction, :math:`A \lfloor B` """ - return self._dot(A, B, mode='>') + return update_and_substitute(A, B, self.right_contract_table_dict) def dot(self, A, B): r""" @@ -1313,7 +1305,11 @@ def dot(self, A, B): The :attr:`dot_mode` attribute determines which of these is used. """ - return self._dot(A, B, mode=self.dot_mode) + # forbid something silly like setting dot_mode to the wedge or geometric + # product + if self.dot_mode in '^*': + raise ValueError('"' + str(self.dot_mode) + '" not a legal mode in dot') + return self.Mul(A, B, mode=self.dot_mode) ######################## Helper Functions ########################## From ac9cf581ede3135d66005fc8815095f700d75346 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sun, 8 Dec 2019 01:17:14 +0000 Subject: [PATCH 11/62] Eliminate special-cases for multiplication by zero (#143) This is already handled just fine as part of the substitution process, and doesn't seem like a particularly worthwhile case to optimize. If we do care care about optimizing it, the optimization would be more effective inside `update_and_substitute` anyway. --- galgebra/ga.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index a2362c07..9d2b4426 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -1276,15 +1276,11 @@ def Mul(self, A, B, mode='*'): # Unifies all products into one function raise ValueError('Unknown multiplication operator {!r}', mode) def mul(self, A, B): # geometric (*) product of blade representations - if A == 0 or B == 0: - return 0 return update_and_substitute(A, B, self.mul_table_dict) def wedge(self, A, B): # wedge assumes A and B are in blade rep # wedge product is same for both orthogonal and non-orthogonal for A and B in blade rep - if A == 0 or B == 0: - return 0 return update_and_substitute(A, B, self.wedge_table_dict) def hestenes_dot(self, A, B): From 7995365bde093c1cec9b3f8523d346e67a46a28c Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sun, 8 Dec 2019 01:17:43 +0000 Subject: [PATCH 12/62] Remove unused variable found by LGTM (#144) Introduced in gh-141, which removed all uses of this variable but forgot to remove it. --- galgebra/mv.py | 1 - 1 file changed, 1 deletion(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index cce2a3d7..560ba519 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1090,7 +1090,6 @@ def rev(self): __invert__ = rev # allow `~x` to call x.rev() def diff(self, coord): - Dself = Mv(ga=self.Ga) if self.Ga.coords is None: obj = diff(self.obj, coord) elif coord not in self.Ga.coords: From 9e8ff623336813f30d2106e43f97c915f8220235 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 11 Dec 2019 09:12:50 +0100 Subject: [PATCH 13/62] Update release notes from some previous PRs (#146) --- doc/changelog.rst | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 79acfc25..a1b2888b 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -2,6 +2,10 @@ Changelog ========= +- :bug:`134` :attr:`~galgebra.ga.Ga.dot_table_dict` now contains correct values (zero) for scalar keys +- :bug:`90` :attr:`~galgebra.ga.Ga.blades`, :attr:`~galgebra.ga.Ga.bases`, and :attr:`~galgebra.ga.Ga.indices` + now reference the scalar ``S(0)`` as the single grade-0 object. Previously they listed no grade 0 objects. +- :bug:`80` (also :issue:`57`, :issue:`58`, :issue:`97`) The :class:`galgebra.mv.Mv` constructor no longer silently accepts illegal arguments, and produces better error messages - :feature:`78` :meth:`~galgebra.ga.Ga.grads` now raises a better error when it fails, and is faster. - :support:`72` Other internal cleanup - :feature:`66` (also :issue:`67`, :issue:`71`) Remove unused code in the public API: @@ -16,10 +20,20 @@ Changelog - :bug:`61` Make contraction and Hestenes dot products thread-safe. Previously these relied on the :attr:`~galgebra.ga.Ga.dot_mode` setting not being changed mid-operation. The :meth:`~galgebra.ga.Ga.dot` method still respects this setting, but is no longer used internally. -- :bug:`60` Make :meth:`~galgebra.mv.Mv.blade_rep` and :meth:`~galgebra.mv.Mv.base_rep` not mutate the object they are called on. - Any code relying on this behavior will need to change from ``x.base_rep()`` to ``x = x.base_rep()``. +- :bug:`60` (also :issue:`141`) Make the following operations on :class:`galgebra.mv.Mv` non-mutating: + + * :meth:`~galgebra.mv.Mv.blade_rep` + * :meth:`~galgebra.mv.Mv.base_rep` + * :meth:`~galgebra.mv.Mv.diff` + * :meth:`~galgebra.mv.Mv.simplify` + * :meth:`~galgebra.mv.Mv.expand` + * :meth:`~galgebra.mv.Mv.collect` + * ``print(mv)`` + + Any code relying on this behavior will need to change from ``x.method()`` to ``x = x.method()``. + Note that the latter syntax was always supported even before this change. + - :support:`59` (also :issue:`65`) Make internal helper functions private. -- :support:`57` (also :issue:`58`) Clean up the ``Mv(name, 'category')`` constructors to produce better error messages. - :support:`55` Rename ``*kargs`` to ``*args`` internally, to match convention. This has no effect on callers, but makes the docs and source easier to read. - :feature:`50` (also :issue:`51`, :issue:`56`) Improve documentation formatting: From 84ee81e49119fe1f46e4dc7262f5296d3aaec45c Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 11 Dec 2019 09:26:38 +0100 Subject: [PATCH 14/62] Use the three-argument `reduce` to avoid special-cases (#145) --- galgebra/ga.py | 7 +------ galgebra/mv.py | 10 ++-------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 9d2b4426..45d87194 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -1754,12 +1754,7 @@ def pDiff(self, A, coord): c, nc = term.args_cnc(split_1=False) x = self.blade_derivation(nc[0], coord) if x != zero: - if len(c) == 1: - dA += c[0] * x - elif len(c) == 0: - dA += x - else: - dA += reduce(operator.mul, c, one) * x + dA += reduce(operator.mul, c, x) return dA diff --git a/galgebra/mv.py b/galgebra/mv.py index 560ba519..6950ca9f 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -629,10 +629,7 @@ def Mv_str(self): grade0 = S(0) for arg in args: c, nc = arg.args_cnc() - if len(c) > 0: - c = reduce(operator.mul, c) - else: - c = S(1) + c = reduce(operator.mul, c, S(1)) if len(nc) > 0: base = nc[0] if base in base_keys: @@ -719,10 +716,7 @@ def append_plus(c_str): grade0 = S(0) for arg in args: c, nc = arg.args_cnc(split_1=False) - if len(c) > 0: - c = reduce(operator.mul, c) - else: - c = S(1) + c = reduce(operator.mul, c, S(1)) if len(nc) > 0: base = nc[0] if base in base_keys: From 8daa9d44fbebfcbee9265f547c549474c0f5d207 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 14:10:11 +0000 Subject: [PATCH 15/62] Unify test requirements into a single file --- .circleci/config.yml | 7 +------ .travis.yml | 6 +----- test_requirements.txt | 7 +++++++ 3 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 test_requirements.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index cd66e704..e8d77991 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,13 +7,8 @@ defaults: &defaults - run: name: Install command: | - sudo pip install pytest - sudo pip install sympy==1.3 + sudo pip install -r test_requirements.txt sudo pip install -e . - sudo pip install pytest-cov - if [[ "$CIRCLE_JOB" == "python-2.7" ]]; then sudo pip install ipython==5.8.0 ; fi - sudo pip install nbval - sudo pip install pytest-xdist - run: name: Test command: | diff --git a/.travis.yml b/.travis.yml index 380547b2..98be1335 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +11,8 @@ matrix: before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then lsb_release -a ; fi install: -- pip install sympy==1.3 +- pip install -r test_requirements.txt - pip install -e . -- pip install pytest-cov -- if [[ "$TRAVIS_PYTHON_VERSION" == 2.7 ]]; then pip install ipython==5.8.0 ; fi -- pip install nbval -- pip install pytest-xdist script: - pytest -n 2 --dist loadscope --cov=galgebra --nbval examples/ipython/ test --current-env --sanitize-with test/.nbval_sanitize.cfg after_success: diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 00000000..c15324dd --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,7 @@ +# requirements for CI +sympy == 1.3 +pytest-cov +ipython == 5.8.0; python_version == "2.7" +nbval +pytest-xdist +pytest From f307c2554b4f070daa3201efbc89bf4f6e8e070c Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 14:11:25 +0000 Subject: [PATCH 16/62] Pin the version of coverage for nbval compatibility --- test_requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test_requirements.txt b/test_requirements.txt index c15324dd..fe67f42c 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -5,3 +5,6 @@ ipython == 5.8.0; python_version == "2.7" nbval pytest-xdist pytest + +# pinned until https://github.com/computationalmodelling/nbval/issues/129 is fixed +coverage < 5 From 5743cf24e3bb811c5be0a55c496b2300754d5c09 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 14:24:43 +0000 Subject: [PATCH 17/62] Pin pytest too, to avoid using the old version pre-installed on travis --- test_requirements.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test_requirements.txt b/test_requirements.txt index fe67f42c..ef34e601 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -4,7 +4,9 @@ pytest-cov ipython == 5.8.0; python_version == "2.7" nbval pytest-xdist -pytest + +# needed by pytest-xdist +pytest >= 4.4.0 # pinned until https://github.com/computationalmodelling/nbval/issues/129 is fixed coverage < 5 From 513f601d44fd440b1c907de14156986557ee7ae9 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 14:25:00 +0000 Subject: [PATCH 18/62] Fail CI if versions are incompatible --- .circleci/config.yml | 1 + .travis.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e8d77991..169c762a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,7 @@ defaults: &defaults command: | sudo pip install -r test_requirements.txt sudo pip install -e . + sudo pip check - run: name: Test command: | diff --git a/.travis.yml b/.travis.yml index 98be1335..c8f6145c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ before_install: install: - pip install -r test_requirements.txt - pip install -e . +- pip check script: - pytest -n 2 --dist loadscope --cov=galgebra --nbval examples/ipython/ test --current-env --sanitize-with test/.nbval_sanitize.cfg after_success: From a797cf4c10f632d6e9febc7d219598f0a91dcde6 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 23:45:33 +0000 Subject: [PATCH 19/62] Remove yet more special-casing of the hestenes dot product (#154) This also changes some sympy zeros to multivector zeros, which means that `(A | scalar) ^ (B | scalar)` is not a TypeError --- examples/ipython/inner_product.ipynb | 16 ++++++++-------- galgebra/mv.py | 5 +---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/examples/ipython/inner_product.ipynb b/examples/ipython/inner_product.ipynb index ca90b981..2cc96498 100644 --- a/examples/ipython/inner_product.ipynb +++ b/examples/ipython/inner_product.ipynb @@ -81,10 +81,10 @@ { "data": { "text/latex": [ - "$$0$$" + "\\begin{equation*} 0 \\end{equation*}" ], "text/plain": [ - "0" + " 0 " ] }, "execution_count": 6, @@ -104,10 +104,10 @@ { "data": { "text/latex": [ - "$$0$$" + "\\begin{equation*} 0 \\end{equation*}" ], "text/plain": [ - "0" + " 0 " ] }, "execution_count": 7, @@ -127,10 +127,10 @@ { "data": { "text/latex": [ - "$$0$$" + "\\begin{equation*} 0 \\end{equation*}" ], "text/plain": [ - "0" + " 0 " ] }, "execution_count": 8, @@ -150,10 +150,10 @@ { "data": { "text/latex": [ - "$$0$$" + "\\begin{equation*} 0 \\end{equation*}" ], "text/plain": [ - "0" + " 0 " ] }, "execution_count": 9, diff --git a/galgebra/mv.py b/galgebra/mv.py index 6950ca9f..df320ad5 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -816,11 +816,8 @@ def __or__(self, A): # dot (|) product return A.Mul(self, A, op='|') self = self.blade_rep() - if self.is_scalar() or A.is_scalar(): - return S(0) A = A.blade_rep() - self_dot_A = Mv(self.Ga.hestenes_dot(self.obj, A.obj), ga=self.Ga) - return self_dot_A + return Mv(self.Ga.hestenes_dot(self.obj, A.obj), ga=self.Ga) def __ror__(self, A): # dot (|) product if not isinstance(A, Mv): From 99dbe15bc269615b319216f9417c8672b7c81d25 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 23:48:48 +0000 Subject: [PATCH 20/62] Return appropriate zeros on an empty sum (#156) By default `sum([])` returns the `int` 0, but for sympy we ought to return `S(0)` or `Mv(0)`, so that other operations continue to work. --- galgebra/mv.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index df320ad5..4c712c3d 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1608,7 +1608,7 @@ def __call__(self, arg): terms += new_terms return Sdop(terms, ga=self.Ga) else: - return sum([x[0] * x[1](arg) for x in self.terms]) + return sum([x[0] * x[1](arg) for x in self.terms], S(0)) def __neg__(self): @@ -1704,7 +1704,7 @@ def __mul__(self, sdopr): product = Sdop(terms, ga=sdopr.Ga) # returns Sdop return Sdop.consolidate_coefs(product) else: # sdopr is a scalar or a multivector - return sum([x[0] * x[1](sdopr) for x in sdopl.terms]) # returns scalar + return sum([x[0] * x[1](sdopr) for x in sdopl.terms], S(0)) # returns scalar def __rmul__(self,sdop): terms = [(sdop * x[0], x[1]) for x in self.terms] @@ -2168,6 +2168,7 @@ def Mul(dopl, dopr, op='*'): # General multiplication of Dop's if isinstance(dopl, Dop) and isinstance(dopr, Dop): if dopl.Ga != dopr.Ga: raise ValueError('In Dop.Mul Dop arguments are not from same geometric algebra') + ga = dopl.Ga if dopl.cmpflg != dopr.cmpflg: raise ValueError('In Dop.Mul Dop arguments do not have same cmplfg') if not dopl.cmpflg: # dopl and dopr operate on right argument @@ -2176,33 +2177,35 @@ def Mul(dopl, dopr, op='*'): # General multiplication of Dop's Ddopl = pdiff(dopr.terms) # list of terms Ddopl = [(Mv.Mul(coef, x[0], op=op), x[1]) for x in Ddopl] terms += Ddopl - product = Dop(terms, ga=dopl.Ga) + product = Dop(terms, ga=ga) else: # dopl and dopr operate on left argument terms = [] for (coef, pdiff) in dopr.terms: Ddopr = pdiff(dopl.terms) # list of terms Ddopr = [(Mv.Mul(x[0], coef, op=op), x[1]) for x in Ddopr] terms += Ddopr - product = Dop(terms, ga=dopr.Ga, cmpflg=True) + product = Dop(terms, ga=ga, cmpflg=True) else: if not isinstance(dopl, Dop): # dopl is a scalar or Mv and dopr is Dop if isinstance(dopl, Mv) and dopl.Ga != dopr.Ga: raise ValueError('In Dop.Mul Dop arguments are not from same geometric algebra') else: dopl = dopr.Ga.mv(dopl) + ga = dopl.Ga if not dopr.cmpflg: # dopr operates on right argument terms = [(Mv.Mul(dopl, x[0], op=op), x[1]) for x in dopr.terms] - return Dop(terms, ga=dopr.Ga) # returns Dop + return Dop(terms, ga=ga) # returns Dop else: - product = sum([Mv.Mul(x[1](dopl), x[0], op=op) for x in dopr.terms]) # returns multivector + product = sum([Mv.Mul(x[1](dopl), x[0], op=op) for x in dopr.terms], Mv(0, ga=ga)) # returns multivector else: # dopr is a scalar or a multivector if isinstance(dopr, Mv) and dopl.Ga != dopr.Ga: raise ValueError('In Dop.Mul Dop arguments are not from same geometric algebra') + ga = dopl.Ga if not dopl.cmpflg: # dopl operates on right argument - return sum([Mv.Mul(x[0], x[1](dopr), op=op) for x in dopl.terms]) # returns multivector + return sum([Mv.Mul(x[0], x[1](dopr), op=op) for x in dopl.terms], Mv(0, ga=ga)) # returns multivector else: terms = [(Mv.Mul(x[0], dopr, op=op), x[1]) for x in dopl.terms] product = Dop(terms, ga=dopl.Ga, cmpflg=True) # returns Dop complement From 24bc6eb20d0b7205b9e0957b6e2a3f465342360f Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 23:50:18 +0000 Subject: [PATCH 21/62] Delete a generated tex file (#155) This file and all others in the folder are already gitignored --- examples/LaTeX/groups.tex | 141 -------------------------------------- 1 file changed, 141 deletions(-) delete mode 100644 examples/LaTeX/groups.tex diff --git a/examples/LaTeX/groups.tex b/examples/LaTeX/groups.tex deleted file mode 100644 index 88156dbd..00000000 --- a/examples/LaTeX/groups.tex +++ /dev/null @@ -1,141 +0,0 @@ - -\documentclass[10pt,fleqn]{report} -\usepackage[vcentering]{geometry} -\geometry{papersize={8.5in,11in},total={7.5in,10in}} - -\pagestyle{empty} -\usepackage[latin1]{inputenc} -\usepackage{amsmath} -\usepackage{amsfonts} -\usepackage{amssymb} -\usepackage{amsbsy} -\usepackage{tensor} -\usepackage{listings} -\usepackage{color} -\usepackage{xcolor} -\usepackage{bm} -\usepackage{breqn} -\definecolor{gray}{rgb}{0.95,0.95,0.95} -\setlength{\parindent}{0pt} -\DeclareMathOperator{\Tr}{Tr} -\DeclareMathOperator{\Adj}{Adj} -\newcommand{\bfrac}[2]{\displaystyle\frac{#1}{#2}} -\newcommand{\lp}{\left (} -\newcommand{\rp}{\right )} -\newcommand{\paren}[1]{\lp {#1} \rp} -\newcommand{\half}{\frac{1}{2}} -\newcommand{\llt}{\left <} -\newcommand{\rgt}{\right >} -\newcommand{\abs}[1]{\left |{#1}\right | } -\newcommand{\pdiff}[2]{\bfrac{\partial {#1}}{\partial {#2}}} -\newcommand{\lbrc}{\left \{} -\newcommand{\rbrc}{\right \}} -\newcommand{\W}{\wedge} -\newcommand{\prm}[1]{{#1}'} -\newcommand{\ddt}[1]{\bfrac{d{#1}}{dt}} -\newcommand{\R}{\dagger} -\newcommand{\deriv}[3]{\bfrac{d^{#3}#1}{d{#2}^{#3}}} -\newcommand{\grade}[1]{\left < {#1} \right >} -\newcommand{\f}[2]{{#1}\lp{#2}\rp} -\newcommand{\eval}[2]{\left . {#1} \right |_{#2}} -\newcommand{\Nabla}{\boldsymbol{\nabla}} -\newcommand{\eb}{\boldsymbol{e}} -\usepackage{float} -\floatstyle{plain} % optionally change the style of the new float -\newfloat{Code}{H}{myc} -\lstloadlanguages{Python} - -\begin{document} -\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\color{gray},frame=single] -def Product_of_Rotors(): - Print_Function() - (na,nb,nm,alpha,th,th_a,th_b) = symbols('n_a n_b n_m alpha theta theta_a theta_b',\ - real = True) - g = [[na, 0, alpha],[0, nm, 0],[alpha, 0, nb]] #metric tensor - """ - Values of metric tensor components - [na,nm,nb] = [+1/-1,+1/-1,+1/-1] alpha = ea|eb - """ - (g3d, ea, em, eb) = Ga.build('e_a e_m e_b', g=g) - print('g =',g3d.g) - print(r'%n_{a} = \bm{e}_{a}^{2}\;\;n_{b} = \bm{e}_{b}^{2}\;\;n_{m} = \bm{e}_{m}^{2}'+\ - r'\;\;\alpha = \bm{e}_{a}\cdot\bm{e}_{b}') - (ca,cb,sa,sb) = symbols('c_a c_b s_a s_b',real=True) - Ra = ca + sa*ea*em # Rotor for ea^em plane - Rb = cb + sb*em*eb # Rotor for em^eb plane - print(r'%\mbox{Rotor in }\bm{e}_{a}\bm{e}_{m}\mbox{ plane } R_{a} =',Ra) - print(r'%\mbox{Rotor in }\bm{e}_{m}\bm{e}_{b}\mbox{ plane } R_{b} =',Rb) - Rab = Ra*Rb # Compound Rotor - """ - Show that compound rotor is scalar plus bivector - """ - print(r'%R_{a}R_{b} = S+\bm{B} =', Rab) - Rab2 = Rab.get_grade(2) - print(r'%\bm{B} =',Rab2) - Rab2sq = Rab2*Rab2 # Square of compound rotor bivector part - Ssq = (Rab.scalar())**2 # Square of compound rotor scalar part - Bsq = Rab2sq.scalar() - print(r'%S^{2} =',Ssq) - print(r'%\bm{B}^{2} =',Bsq) - Dsq = (Ssq-Bsq).expand().simplify() - print('%S^{2}-B^{2} =', Dsq) - Dsq = Dsq.subs(nm**2,S(1)) # (e_m)**4 = 1 - print('%S^{2}-B^{2} =', Dsq) - Cases = [S(-1),S(1)] # -1/+1 squares for each basis vector - print(r'#Consider all combinations of $\bm{e}_{a}^{2}$, $\bm{e}_{b}^{2}$'+\ - r' and $\bm{e}_{m}^2$:') - for Na in Cases: - for Nb in Cases: - for Nm in Cases: - Ba_sq = -Na*Nm - Bb_sq = -Nb*Nm - if Ba_sq < 0: - Ca_th = cos(th_a) - Sa_th = sin(th_a) - else: - Ca_th = cosh(th_a) - Sa_th = sinh(th_a) - if Bb_sq < 0: - Cb_th = cos(th_b) - Sb_th = sin(th_b) - else: - Cb_th = cosh(th_b) - Sb_th = sinh(th_b) - print(r'%\left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] =',\ - [Na,Nb,Nm]) - Dsq_tmp = Dsq.subs({ca:Ca_th,sa:Sa_th,cb:Cb_th,sb:Sb_th,na:Na,nb:Nb,nm:Nm}) - print(r'%S^{2}-\bm{B}^{2} =',Dsq_tmp,' =',trigsimp(Dsq_tmp)) - print(r'#Thus we have shown that $R_{a}R_{b} = S+\bm{D} = e^{\bm{C}}$ where $\bm{C}$'+\ - r' is a bivector blade.') - return -\end{lstlisting} -Code Output: -\begin{equation*} g = \left [ \begin{array}{ccc} n_{a} & 0 & \alpha \\ 0 & n_{m} & 0 \\ \alpha & 0 & n_{b} \end{array}\right ] \end{equation*} -\begin{equation*} n_{a} = \bm{e}_{a}^{2}\;\;n_{b} = \bm{e}_{b}^{2}\;\;n_{m} = \bm{e}_{m}^{2}\;\;\alpha = \bm{e}_{a}\cdot\bm{e}_{b} \end{equation*} -\begin{equation*} \mbox{Rotor in }\bm{e}_{a}\bm{e}_{m}\mbox{ plane } R_{a} = c_{a} + s_{a} \boldsymbol{e}_{a}\wedge \boldsymbol{e}_{m} \end{equation*} -\begin{equation*} \mbox{Rotor in }\bm{e}_{m}\bm{e}_{b}\mbox{ plane } R_{b} = c_{b} + s_{b} \boldsymbol{e}_{m}\wedge \boldsymbol{e}_{b} \end{equation*} -\begin{equation*} R_{a}R_{b} = S+\bm{B} = \left ( \alpha n_{m} s_{a} s_{b} + c_{a} c_{b}\right ) + c_{b} s_{a} \boldsymbol{e}_{a}\wedge \boldsymbol{e}_{m} + n_{m} s_{a} s_{b} \boldsymbol{e}_{a}\wedge \boldsymbol{e}_{b} + c_{a} s_{b} \boldsymbol{e}_{m}\wedge \boldsymbol{e}_{b} \end{equation*} -\begin{equation*} \bm{B} = c_{b} s_{a} \boldsymbol{e}_{a}\wedge \boldsymbol{e}_{m} + n_{m} s_{a} s_{b} \boldsymbol{e}_{a}\wedge \boldsymbol{e}_{b} + c_{a} s_{b} \boldsymbol{e}_{m}\wedge \boldsymbol{e}_{b} \end{equation*} -\begin{equation*} S^{2} = \left(\alpha n_{m} s_{a} s_{b} + c_{a} c_{b}\right)^{2} \end{equation*} -\begin{equation*} \bm{B}^{2} = \alpha ^{2} {\left ( n_{m} \right )}^{2} {\left ( s_{a} \right )}^{2} {\left ( s_{b} \right )}^{2} + 2 \alpha c_{a} c_{b} n_{m} s_{a} s_{b} - {\left ( c_{a} \right )}^{2} n_{b} n_{m} {\left ( s_{b} \right )}^{2} - {\left ( c_{b} \right )}^{2} n_{a} n_{m} {\left ( s_{a} \right )}^{2} - n_{a} n_{b} {\left ( n_{m} \right )}^{2} {\left ( s_{a} \right )}^{2} {\left ( s_{b} \right )}^{2} \end{equation*} -\begin{equation*} S^{2}-B^{2} = {\left ( c_{a} \right )}^{2} {\left ( c_{b} \right )}^{2} + {\left ( c_{a} \right )}^{2} n_{b} n_{m} {\left ( s_{b} \right )}^{2} + {\left ( c_{b} \right )}^{2} n_{a} n_{m} {\left ( s_{a} \right )}^{2} + n_{a} n_{b} {\left ( n_{m} \right )}^{2} {\left ( s_{a} \right )}^{2} {\left ( s_{b} \right )}^{2} \end{equation*} -\begin{equation*} S^{2}-B^{2} = {\left ( c_{a} \right )}^{2} {\left ( c_{b} \right )}^{2} + {\left ( c_{a} \right )}^{2} n_{b} n_{m} {\left ( s_{b} \right )}^{2} + {\left ( c_{b} \right )}^{2} n_{a} n_{m} {\left ( s_{a} \right )}^{2} + n_{a} n_{b} {\left ( s_{a} \right )}^{2} {\left ( s_{b} \right )}^{2} \end{equation*} -Consider all combinations of $\bm{e}_{a}^{2}$, $\bm{e}_{b}^{2}$ and $\bm{e}_{m}^2$: -\begin{equation*} \left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] = [-1, -1, -1] \end{equation*} -\begin{equation*} S^{2}-\bm{B}^{2} = {\sin{\left (\theta _{a} \right )}}^{2} {\sin{\left (\theta _{b} \right )}}^{2} + {\sin{\left (\theta _{a} \right )}}^{2} {\cos{\left (\theta _{b} \right )}}^{2} + {\sin{\left (\theta _{b} \right )}}^{2} {\cos{\left (\theta _{a} \right )}}^{2} + {\cos{\left (\theta _{a} \right )}}^{2} {\cos{\left (\theta _{b} \right )}}^{2} = 1 \end{equation*} -\begin{equation*} \left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] = [-1, -1, 1] \end{equation*} -\begin{equation*} S^{2}-\bm{B}^{2} = {\sinh{\left (\theta _{a} \right )}}^{2} {\sinh{\left (\theta _{b} \right )}}^{2} - {\sinh{\left (\theta _{a} \right )}}^{2} {\cosh{\left (\theta _{b} \right )}}^{2} - {\sinh{\left (\theta _{b} \right )}}^{2} {\cosh{\left (\theta _{a} \right )}}^{2} + {\cosh{\left (\theta _{a} \right )}}^{2} {\cosh{\left (\theta _{b} \right )}}^{2} = 1 \end{equation*} -\begin{equation*} \left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] = [-1, 1, -1] \end{equation*} -\begin{equation*} S^{2}-\bm{B}^{2} = - {\sin{\left (\theta _{a} \right )}}^{2} {\sinh{\left (\theta _{b} \right )}}^{2} + {\sin{\left (\theta _{a} \right )}}^{2} {\cosh{\left (\theta _{b} \right )}}^{2} - {\cos{\left (\theta _{a} \right )}}^{2} {\sinh{\left (\theta _{b} \right )}}^{2} + {\cos{\left (\theta _{a} \right )}}^{2} {\cosh{\left (\theta _{b} \right )}}^{2} = 1 \end{equation*} -\begin{equation*} \left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] = [-1, 1, 1] \end{equation*} -\begin{equation*} S^{2}-\bm{B}^{2} = - {\sin{\left (\theta _{b} \right )}}^{2} {\sinh{\left (\theta _{a} \right )}}^{2} + {\sin{\left (\theta _{b} \right )}}^{2} {\cosh{\left (\theta _{a} \right )}}^{2} - {\cos{\left (\theta _{b} \right )}}^{2} {\sinh{\left (\theta _{a} \right )}}^{2} + {\cos{\left (\theta _{b} \right )}}^{2} {\cosh{\left (\theta _{a} \right )}}^{2} = 1 \end{equation*} -\begin{equation*} \left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] = [1, -1, -1] \end{equation*} -\begin{equation*} S^{2}-\bm{B}^{2} = - {\sin{\left (\theta _{b} \right )}}^{2} {\sinh{\left (\theta _{a} \right )}}^{2} + {\sin{\left (\theta _{b} \right )}}^{2} {\cosh{\left (\theta _{a} \right )}}^{2} - {\cos{\left (\theta _{b} \right )}}^{2} {\sinh{\left (\theta _{a} \right )}}^{2} + {\cos{\left (\theta _{b} \right )}}^{2} {\cosh{\left (\theta _{a} \right )}}^{2} = 1 \end{equation*} -\begin{equation*} \left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] = [1, -1, 1] \end{equation*} -\begin{equation*} S^{2}-\bm{B}^{2} = - {\sin{\left (\theta _{a} \right )}}^{2} {\sinh{\left (\theta _{b} \right )}}^{2} + {\sin{\left (\theta _{a} \right )}}^{2} {\cosh{\left (\theta _{b} \right )}}^{2} - {\cos{\left (\theta _{a} \right )}}^{2} {\sinh{\left (\theta _{b} \right )}}^{2} + {\cos{\left (\theta _{a} \right )}}^{2} {\cosh{\left (\theta _{b} \right )}}^{2} = 1 \end{equation*} -\begin{equation*} \left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] = [1, 1, -1] \end{equation*} -\begin{equation*} S^{2}-\bm{B}^{2} = {\sinh{\left (\theta _{a} \right )}}^{2} {\sinh{\left (\theta _{b} \right )}}^{2} - {\sinh{\left (\theta _{a} \right )}}^{2} {\cosh{\left (\theta _{b} \right )}}^{2} - {\sinh{\left (\theta _{b} \right )}}^{2} {\cosh{\left (\theta _{a} \right )}}^{2} + {\cosh{\left (\theta _{a} \right )}}^{2} {\cosh{\left (\theta _{b} \right )}}^{2} = 1 \end{equation*} -\begin{equation*} \left [ \bm{e}_{a}^{2},\bm{e}_{b}^{2},\bm{e}_{m}^2\right ] = [1, 1, 1] \end{equation*} -\begin{equation*} S^{2}-\bm{B}^{2} = {\sin{\left (\theta _{a} \right )}}^{2} {\sin{\left (\theta _{b} \right )}}^{2} + {\sin{\left (\theta _{a} \right )}}^{2} {\cos{\left (\theta _{b} \right )}}^{2} + {\sin{\left (\theta _{b} \right )}}^{2} {\cos{\left (\theta _{a} \right )}}^{2} + {\cos{\left (\theta _{a} \right )}}^{2} {\cos{\left (\theta _{b} \right )}}^{2} = 1 \end{equation*} -Thus we have shown that $R_{a}R_{b} = S+\bm{D} = e^{\bm{C}}$ where $\bm{C}$ is a bivector blade. -\end{document} From 4740ea2395cb0eaa1e5316ad6be6bde029a25fe6 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 23:52:27 +0000 Subject: [PATCH 22/62] Don't use `cat` in tests, which does not work on windows (#153) This also combines the execution and output into a single cell, which might make the diff a little easier to manage --- examples/LaTeX/simple_check_latex.py | 2 +- examples/ipython/LaTeX.ipynb | 4939 +++++++++++++------------- 2 files changed, 2388 insertions(+), 2553 deletions(-) diff --git a/examples/LaTeX/simple_check_latex.py b/examples/LaTeX/simple_check_latex.py index 866ee775..50946077 100644 --- a/examples/LaTeX/simple_check_latex.py +++ b/examples/LaTeX/simple_check_latex.py @@ -58,7 +58,7 @@ def main(): basic_multivector_operations_2D() # xpdf('simple_test_latex.tex') - xpdf('simple_test_latex.tex', pdfprog=None) + xpdf('simple_check_latex.tex', pdfprog=None) return if __name__ == "__main__": diff --git a/examples/ipython/LaTeX.ipynb b/examples/ipython/LaTeX.ipynb index 2bc8dfe4..9d00d1c7 100644 --- a/examples/ipython/LaTeX.ipynb +++ b/examples/ipython/LaTeX.ipynb @@ -6,2769 +6,2604 @@ "metadata": {}, "outputs": [], "source": [ - "%cd -q ../LaTeX" + "import subprocess\n", + "import sys\n", + "import os\n", + "from IPython.display import display_pretty\n", + "\n", + "os.chdir('../LaTeX')\n", + "\n", + "def check(name):\n", + " subprocess.check_call([sys.executable, name + '.py'])\n", + " with open(name + '.tex', 'r') as f:\n", + " # can't use display.Latex here, it would result in CSS comparisons in the output.\n", + " \n", + " # using `display` forces this to be a separate output to any stdout from above.\n", + " display_pretty(f.read(), raw=True)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, - "outputs": [], - "source": [ - "!python 4Derr.py" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} g_{ii} = \\left [ \\begin{array}{cccc} 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 1 \\\\ 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} x_1\\rfloor x_1== 1 \\end{equation*}\r\n", - "\\begin{equation*} x_1\\rfloor x_2== 0 \\end{equation*}\r\n", - "\\begin{equation*} x_2\\rfloor x_1== 0 \\end{equation*}\r\n", - "\\begin{equation*} x_2\\rfloor x_2== 1 \\end{equation*}\r\n", - "$-\\infty < v < \\infty$\r\n", - "\\begin{equation*} (-v (x_1\\W x_2)/2) \\cdot exp()== \\cos{\\left (\\frac{\\left|{v}\\right|}{2} \\right )} - \\frac{v \\sin{\\left (\\frac{\\left|{v}\\right|}{2} \\right )}}{2 \\left|{v}\\right|} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} - \\frac{v \\sin{\\left (\\frac{\\left|{v}\\right|}{2} \\right )}}{2 \\left|{v}\\right|} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{4} + \\frac{v \\sin{\\left (\\frac{\\left|{v}\\right|}{2} \\right )}}{2 \\left|{v}\\right|} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} - \\frac{v \\sin{\\left (\\frac{\\left|{v}\\right|}{2} \\right )}}{2 \\left|{v}\\right|} \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\end{equation*}\r\n", - "$0\\le v < \\infty$\r\n", - "\\begin{equation*} (-v (x_1\\W x_2)/2) \\cdot exp()== \\cos{\\left (\\frac{v}{2} \\right )} - \\frac{\\sin{\\left (\\frac{v}{2} \\right )}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} - \\frac{\\sin{\\left (\\frac{v}{2} \\right )}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{4} + \\frac{\\sin{\\left (\\frac{v}{2} \\right )}}{2} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} - \\frac{\\sin{\\left (\\frac{v}{2} \\right )}}{2} \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} g_{ii} = \\left [ \\begin{array}{cccc} 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 1 \\\\ 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} x_1\\rfloor x_1== 1 \\end{equation*}\n", + "\\begin{equation*} x_1\\rfloor x_2== 0 \\end{equation*}\n", + "\\begin{equation*} x_2\\rfloor x_1== 0 \\end{equation*}\n", + "\\begin{equation*} x_2\\rfloor x_2== 1 \\end{equation*}\n", + "$-\\infty < v < \\infty$\n", + "\\begin{equation*} (-v (x_1\\W x_2)/2) \\cdot exp()== \\cos{\\left (\\frac{\\left|{v}\\right|}{2} \\right )} - \\frac{v \\sin{\\left (\\frac{\\left|{v}\\right|}{2} \\right )}}{2 \\left|{v}\\right|} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} - \\frac{v \\sin{\\left (\\frac{\\left|{v}\\right|}{2} \\right )}}{2 \\left|{v}\\right|} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{4} + \\frac{v \\sin{\\left (\\frac{\\left|{v}\\right|}{2} \\right )}}{2 \\left|{v}\\right|} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} - \\frac{v \\sin{\\left (\\frac{\\left|{v}\\right|}{2} \\right )}}{2 \\left|{v}\\right|} \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\end{equation*}\n", + "$0\\le v < \\infty$\n", + "\\begin{equation*} (-v (x_1\\W x_2)/2) \\cdot exp()== \\cos{\\left (\\frac{v}{2} \\right )} - \\frac{\\sin{\\left (\\frac{v}{2} \\right )}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} - \\frac{\\sin{\\left (\\frac{v}{2} \\right )}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{4} + \\frac{\\sin{\\left (\\frac{v}{2} \\right )}}{2} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} - \\frac{\\sin{\\left (\\frac{v}{2} \\right )}}{2} \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat 4Derr.tex" + "check('4Derr')" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, - "outputs": [], - "source": [ - "!python curvi_linear_latex.py" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} A = A^{r} \\boldsymbol{e}_{r} + A^{\\theta } \\boldsymbol{e}_{\\theta } + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} B = B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{r} f \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } A^{\\phi } + \\partial_{r} A^{r} + \\partial_{\\theta } A^{\\theta } + \\frac{2 A^{r} }{r} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\times A = -I (\\boldsymbol{\\nabla} \\W A) = \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right) \\left|{\\sin{\\left (\\theta \\right )}}\\right| \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta \\right )}}^{2} \\partial_{r} A^{\\phi } - 2 r A^{\\phi } {\\sin{\\left (\\theta \\right )}}^{2} + \\partial_{\\phi } A^{r} }{r^{2} \\left|{\\sin{\\left (\\theta \\right )}}\\right|} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta } + 2 r A^{\\theta } - \\partial_{\\theta } A^{r} }{r^{2} \\left|{\\sin{\\left (\\theta \\right )}}\\right|} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\nabla^{2}f = \\frac{r^{2} \\partial^{2}_{r} f + 2 r \\partial_{r} f + \\partial^{2}_{\\theta } f + \\frac{\\partial_{\\theta } f }{\\tan{\\left (\\theta \\right )}} + \\frac{\\partial^{2}_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi } + 4 r B^{\\theta \\phi } - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "Derivatives in Paraboloidal Coordinates\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} A = A^{u} \\boldsymbol{e}_{u} + A^{v} \\boldsymbol{e}_{v} + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} B = B^{uv} \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} + B^{u\\phi } \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{\\phi } + B^{v\\phi } \\boldsymbol{e}_{v}\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\frac{\\partial_{u} f }{\\sqrt{u^{2} + v^{2}}} \\boldsymbol{e}_{u} + \\frac{\\partial_{v} f }{\\sqrt{u^{2} + v^{2}}} \\boldsymbol{e}_{v} + \\frac{\\partial_{\\phi } f }{u v} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{u A^{u} }{\\left(u^{2} + v^{2}\\right)^{\\frac{3}{2}}} + \\frac{v A^{v} }{\\left(u^{2} + v^{2}\\right)^{\\frac{3}{2}}} + \\frac{\\partial_{u} A^{u} }{\\sqrt{u^{2} + v^{2}}} + \\frac{\\partial_{v} A^{v} }{\\sqrt{u^{2} + v^{2}}} + \\frac{A^{v} }{v \\sqrt{u^{2} + v^{2}}} + \\frac{A^{u} }{u \\sqrt{u^{2} + v^{2}}} + \\frac{\\partial_{\\phi } A^{\\phi } }{u v} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\left ( \\frac{u B^{v\\phi } }{\\left(u^{2} + v^{2}\\right)^{\\frac{3}{2}}} - \\frac{v B^{u\\phi } }{\\left(u^{2} + v^{2}\\right)^{\\frac{3}{2}}} - \\frac{\\partial_{v} B^{u\\phi } }{\\sqrt{u^{2} + v^{2}}} + \\frac{\\partial_{u} B^{v\\phi } }{\\sqrt{u^{2} + v^{2}}} - \\frac{B^{u\\phi } }{v \\sqrt{u^{2} + v^{2}}} + \\frac{B^{v\\phi } }{u \\sqrt{u^{2} + v^{2}}} + \\frac{\\partial_{\\phi } B^{uv} }{u v}\\right ) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v}\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - " \\begin{align*} A = & A^{\\xi } \\boldsymbol{e}_{\\xi } \\\\ & + A^{\\eta } \\boldsymbol{e}_{\\eta } \\\\ & + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - " \\begin{align*} B = & B^{\\xi \\eta } \\boldsymbol{e}_{\\xi }\\wedge \\boldsymbol{e}_{\\eta } \\\\ & + B^{\\xi \\phi } \\boldsymbol{e}_{\\xi }\\wedge \\boldsymbol{e}_{\\phi } \\\\ & + B^{\\eta \\phi } \\boldsymbol{e}_{\\eta }\\wedge \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - " \\begin{align*} \\boldsymbol{\\nabla} f = & \\frac{\\partial_{\\xi } f }{\\sqrt{{\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}} \\left|{a}\\right|} \\boldsymbol{e}_{\\xi } \\\\ & + \\frac{\\partial_{\\eta } f }{\\sqrt{{\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}} \\left|{a}\\right|} \\boldsymbol{e}_{\\eta } \\\\ & + \\frac{\\partial_{\\phi } f }{a \\sin{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )}} \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{a \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{3} \\partial_{\\phi } A^{\\phi } + \\frac{\\left(A^{\\eta } \\sin{\\left (2 \\eta \\right )} + A^{\\xi } \\sinh{\\left (2 \\xi \\right )}\\right) \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{\\frac{3}{2}} \\sin{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )} \\left|{a}\\right|}{2} + \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{\\frac{5}{2}} \\left(\\partial_{\\eta } A^{\\eta } + \\partial_{\\xi } A^{\\xi } \\right) \\sin{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )} \\left|{a}\\right| + \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{\\frac{5}{2}} A^{\\eta } \\cos{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )} \\left|{a}\\right| + \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{\\frac{5}{2}} A^{\\xi } \\sin{\\left (\\eta \\right )} \\cosh{\\left (\\xi \\right )} \\left|{a}\\right|}{a^{2} \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{3} \\sin{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )}} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} A = A^{r} \\boldsymbol{e}_{r} + A^{\\theta } \\boldsymbol{e}_{\\theta } + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} B = B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{r} f \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } A^{\\phi } + \\partial_{r} A^{r} + \\partial_{\\theta } A^{\\theta } + \\frac{2 A^{r} }{r} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\times A = -I (\\boldsymbol{\\nabla} \\W A) = \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right) \\left|{\\sin{\\left (\\theta \\right )}}\\right| \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta \\right )}}^{2} \\partial_{r} A^{\\phi } - 2 r A^{\\phi } {\\sin{\\left (\\theta \\right )}}^{2} + \\partial_{\\phi } A^{r} }{r^{2} \\left|{\\sin{\\left (\\theta \\right )}}\\right|} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta } + 2 r A^{\\theta } - \\partial_{\\theta } A^{r} }{r^{2} \\left|{\\sin{\\left (\\theta \\right )}}\\right|} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\nabla^{2}f = \\frac{r^{2} \\partial^{2}_{r} f + 2 r \\partial_{r} f + \\partial^{2}_{\\theta } f + \\frac{\\partial_{\\theta } f }{\\tan{\\left (\\theta \\right )}} + \\frac{\\partial^{2}_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi } + 4 r B^{\\theta \\phi } - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "Derivatives in Paraboloidal Coordinates\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} A = A^{u} \\boldsymbol{e}_{u} + A^{v} \\boldsymbol{e}_{v} + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} B = B^{uv} \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} + B^{u\\phi } \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{\\phi } + B^{v\\phi } \\boldsymbol{e}_{v}\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\frac{\\partial_{u} f }{\\sqrt{u^{2} + v^{2}}} \\boldsymbol{e}_{u} + \\frac{\\partial_{v} f }{\\sqrt{u^{2} + v^{2}}} \\boldsymbol{e}_{v} + \\frac{\\partial_{\\phi } f }{u v} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{u A^{u} }{\\left(u^{2} + v^{2}\\right)^{\\frac{3}{2}}} + \\frac{v A^{v} }{\\left(u^{2} + v^{2}\\right)^{\\frac{3}{2}}} + \\frac{\\partial_{u} A^{u} }{\\sqrt{u^{2} + v^{2}}} + \\frac{\\partial_{v} A^{v} }{\\sqrt{u^{2} + v^{2}}} + \\frac{A^{v} }{v \\sqrt{u^{2} + v^{2}}} + \\frac{A^{u} }{u \\sqrt{u^{2} + v^{2}}} + \\frac{\\partial_{\\phi } A^{\\phi } }{u v} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\left ( \\frac{u B^{v\\phi } }{\\left(u^{2} + v^{2}\\right)^{\\frac{3}{2}}} - \\frac{v B^{u\\phi } }{\\left(u^{2} + v^{2}\\right)^{\\frac{3}{2}}} - \\frac{\\partial_{v} B^{u\\phi } }{\\sqrt{u^{2} + v^{2}}} + \\frac{\\partial_{u} B^{v\\phi } }{\\sqrt{u^{2} + v^{2}}} - \\frac{B^{u\\phi } }{v \\sqrt{u^{2} + v^{2}}} + \\frac{B^{v\\phi } }{u \\sqrt{u^{2} + v^{2}}} + \\frac{\\partial_{\\phi } B^{uv} }{u v}\\right ) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v}\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} f = f \\end{equation*}\n", + " \\begin{align*} A = & A^{\\xi } \\boldsymbol{e}_{\\xi } \\\\ & + A^{\\eta } \\boldsymbol{e}_{\\eta } \\\\ & + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{align*} \n", + " \\begin{align*} B = & B^{\\xi \\eta } \\boldsymbol{e}_{\\xi }\\wedge \\boldsymbol{e}_{\\eta } \\\\ & + B^{\\xi \\phi } \\boldsymbol{e}_{\\xi }\\wedge \\boldsymbol{e}_{\\phi } \\\\ & + B^{\\eta \\phi } \\boldsymbol{e}_{\\eta }\\wedge \\boldsymbol{e}_{\\phi } \\end{align*} \n", + " \\begin{align*} \\boldsymbol{\\nabla} f = & \\frac{\\partial_{\\xi } f }{\\sqrt{{\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}} \\left|{a}\\right|} \\boldsymbol{e}_{\\xi } \\\\ & + \\frac{\\partial_{\\eta } f }{\\sqrt{{\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}} \\left|{a}\\right|} \\boldsymbol{e}_{\\eta } \\\\ & + \\frac{\\partial_{\\phi } f }{a \\sin{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )}} \\boldsymbol{e}_{\\phi } \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{a \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{3} \\partial_{\\phi } A^{\\phi } + \\frac{\\left(A^{\\eta } \\sin{\\left (2 \\eta \\right )} + A^{\\xi } \\sinh{\\left (2 \\xi \\right )}\\right) \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{\\frac{3}{2}} \\sin{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )} \\left|{a}\\right|}{2} + \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{\\frac{5}{2}} \\left(\\partial_{\\eta } A^{\\eta } + \\partial_{\\xi } A^{\\xi } \\right) \\sin{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )} \\left|{a}\\right| + \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{\\frac{5}{2}} A^{\\eta } \\cos{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )} \\left|{a}\\right| + \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{\\frac{5}{2}} A^{\\xi } \\sin{\\left (\\eta \\right )} \\cosh{\\left (\\xi \\right )} \\left|{a}\\right|}{a^{2} \\left({\\sin{\\left (\\eta \\right )}}^{2} + {\\sinh{\\left (\\xi \\right )}}^{2}\\right)^{3} \\sin{\\left (\\eta \\right )} \\sinh{\\left (\\xi \\right )}} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat curvi_linear_latex.tex" + "check('curvi_linear_latex')" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": {}, - "outputs": [], - "source": [ - "!python dchk.py" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\left [ \\begin{array}{ccc} \\left ( e_{a}\\cdot e_{a}\\right ) & 0 & \\left ( e_{a}\\cdot e_{b}\\right ) \\\\ 0 & \\left ( e_{ab}\\cdot e_{ab}\\right ) & 0 \\\\ \\left ( e_{a}\\cdot e_{b}\\right ) & 0 & \\left ( e_{b}\\cdot e_{b}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} v^{a} \\boldsymbol{e}_{a} + v^{ab} \\boldsymbol{e}_{ab} + v^{b} \\boldsymbol{e}_{b} \\end{equation*}\r\n", - "\\begin{equation*} B^{aab} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{ab} + B^{ab} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{b} + B^{abb} \\boldsymbol{e}_{ab}\\wedge \\boldsymbol{e}_{b} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\left [ \\begin{array}{ccc} \\left ( e_{a}\\cdot e_{a}\\right ) & 0 & \\left ( e_{a}\\cdot e_{b}\\right ) \\\\ 0 & \\left ( e_{ab}\\cdot e_{ab}\\right ) & 0 \\\\ \\left ( e_{a}\\cdot e_{b}\\right ) & 0 & \\left ( e_{b}\\cdot e_{b}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} v^{a} \\boldsymbol{e}_{a} + v^{ab} \\boldsymbol{e}_{ab} + v^{b} \\boldsymbol{e}_{b} \\end{equation*}\n", + "\\begin{equation*} B^{aab} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{ab} + B^{ab} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{b} + B^{abb} \\boldsymbol{e}_{ab}\\wedge \\boldsymbol{e}_{b} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat dchk.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [], - "source": [ - "!python diffeq_sys.py" + "check('dchk')" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def main():\r\n", - " Print_Function()\r\n", - " (a, b, c) = abc = symbols('a,b,c',real=True)\r\n", - " (o3d, ea, eb, ec) = Ga.build('e_a e_b e_c', g=[1, 1, 1], coords=abc)\r\n", - " grad = o3d.grad\r\n", - " x = symbols('x',real=True)\r\n", - " A = o3d.lt([[x*a*c**2,x**2*a*b*c,x**2*a**3*b**5],\\\r\n", - " [x**3*a**2*b*c,x**4*a*b**2*c**5,5*x**4*a*b**2*c],\\\r\n", - " [x**4*a*b**2*c**4,4*x**4*a*b**2*c**2,4*x**4*a**5*b**2*c]])\r\n", - " print('A =',A)\r\n", - " v = a*ea+b*eb+c*ec\r\n", - " print('v =',v)\r\n", - " f = v|A(v)\r\n", - " print(r'%f = v\\cdot \\f{A}{v} =',f)\r\n", - " (grad * f).Fmt(3,r'%\\nabla f')\r\n", - " Av = A(v)\r\n", - " print(r'%\\f{A}{v} =', Av)\r\n", - " (grad * Av).Fmt(3,r'%\\nabla \\f{A}{v}')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{a}\\right ) =& a c^{2} x \\boldsymbol{e}_{a} + a b c x^{2} \\boldsymbol{e}_{b} + a^{3} b^{5} x^{2} \\boldsymbol{e}_{c} \\\\ L \\left ( \\boldsymbol{e}_{b}\\right ) =& a^{2} b c x^{3} \\boldsymbol{e}_{a} + a b^{2} c^{5} x^{4} \\boldsymbol{e}_{b} + 5 a b^{2} c x^{4} \\boldsymbol{e}_{c} \\\\ L \\left ( \\boldsymbol{e}_{c}\\right ) =& a b^{2} c^{4} x^{4} \\boldsymbol{e}_{a} + 4 a b^{2} c^{2} x^{4} \\boldsymbol{e}_{b} + 4 a^{5} b^{2} c x^{4} \\boldsymbol{e}_{c} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} v = a \\boldsymbol{e}_{a} + b \\boldsymbol{e}_{b} + c \\boldsymbol{e}_{c} \\end{equation*}\r\n", - "\\begin{equation*} f = v\\cdot \\f{A}{v} = a c x \\left(4 a^{4} b^{2} c^{2} x^{3} + a^{3} b^{5} x + a^{2} b^{2} x^{2} + a^{2} c + a b^{2} c^{4} x^{3} + a b^{2} x + b^{4} c^{4} x^{3} + 4 b^{3} c^{2} x^{3} + 5 b^{3} c x^{3}\\right) \\end{equation*}\r\n", - " \\begin{align*} \\f{A}{v} = & a c x \\left(a b^{2} x^{2} + a c + b^{2} c^{4} x^{3}\\right) \\boldsymbol{e}_{a} \\\\ & + a b c x^{2} \\left(a + b^{2} c^{4} x^{2} + 4 b c^{2} x^{2}\\right) \\boldsymbol{e}_{b} \\\\ & + a b^{2} x^{2} \\left(4 a^{4} c^{2} x^{2} + a^{3} b^{3} + 5 b c x^{2}\\right) \\boldsymbol{e}_{c} \\end{align*} \r\n", - "\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def main():\n", + " Print_Function()\n", + " (a, b, c) = abc = symbols('a,b,c',real=True)\n", + " (o3d, ea, eb, ec) = Ga.build('e_a e_b e_c', g=[1, 1, 1], coords=abc)\n", + " grad = o3d.grad\n", + " x = symbols('x',real=True)\n", + " A = o3d.lt([[x*a*c**2,x**2*a*b*c,x**2*a**3*b**5],\\\n", + " [x**3*a**2*b*c,x**4*a*b**2*c**5,5*x**4*a*b**2*c],\\\n", + " [x**4*a*b**2*c**4,4*x**4*a*b**2*c**2,4*x**4*a**5*b**2*c]])\n", + " print('A =',A)\n", + " v = a*ea+b*eb+c*ec\n", + " print('v =',v)\n", + " f = v|A(v)\n", + " print(r'%f = v\\cdot \\f{A}{v} =',f)\n", + " (grad * f).Fmt(3,r'%\\nabla f')\n", + " Av = A(v)\n", + " print(r'%\\f{A}{v} =', Av)\n", + " (grad * Av).Fmt(3,r'%\\nabla \\f{A}{v}')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{a}\\right ) =& a c^{2} x \\boldsymbol{e}_{a} + a b c x^{2} \\boldsymbol{e}_{b} + a^{3} b^{5} x^{2} \\boldsymbol{e}_{c} \\\\ L \\left ( \\boldsymbol{e}_{b}\\right ) =& a^{2} b c x^{3} \\boldsymbol{e}_{a} + a b^{2} c^{5} x^{4} \\boldsymbol{e}_{b} + 5 a b^{2} c x^{4} \\boldsymbol{e}_{c} \\\\ L \\left ( \\boldsymbol{e}_{c}\\right ) =& a b^{2} c^{4} x^{4} \\boldsymbol{e}_{a} + 4 a b^{2} c^{2} x^{4} \\boldsymbol{e}_{b} + 4 a^{5} b^{2} c x^{4} \\boldsymbol{e}_{c} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} v = a \\boldsymbol{e}_{a} + b \\boldsymbol{e}_{b} + c \\boldsymbol{e}_{c} \\end{equation*}\n", + "\\begin{equation*} f = v\\cdot \\f{A}{v} = a c x \\left(4 a^{4} b^{2} c^{2} x^{3} + a^{3} b^{5} x + a^{2} b^{2} x^{2} + a^{2} c + a b^{2} c^{4} x^{3} + a b^{2} x + b^{4} c^{4} x^{3} + 4 b^{3} c^{2} x^{3} + 5 b^{3} c x^{3}\\right) \\end{equation*}\n", + " \\begin{align*} \\f{A}{v} = & a c x \\left(a b^{2} x^{2} + a c + b^{2} c^{4} x^{3}\\right) \\boldsymbol{e}_{a} \\\\ & + a b c x^{2} \\left(a + b^{2} c^{4} x^{2} + 4 b c^{2} x^{2}\\right) \\boldsymbol{e}_{b} \\\\ & + a b^{2} x^{2} \\left(4 a^{4} c^{2} x^{2} + a^{3} b^{3} + 5 b c x^{2}\\right) \\boldsymbol{e}_{c} \\end{align*} \n", + "\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat diffeq_sys.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [], - "source": [ - "!python dirac_derive.py" + "check('diffeq_sys')" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\psi + \\psi ^{01} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{1} + \\psi ^{02} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{2} + \\psi ^{03} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{3} + \\psi ^{12} \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{2} + \\psi ^{13} \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{3} + \\psi ^{23} \\boldsymbol{\\gamma }_{2}\\wedge \\boldsymbol{\\gamma }_{3} + \\psi ^{0123} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{2}\\wedge \\boldsymbol{\\gamma }_{3} \\end{equation*}\r\n", - "\\begin{equation*} B^{01} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{1} + B^{02} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{2} + B^{03} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{3} + B^{12} \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{2} + B^{13} \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{3} + B^{23} \\boldsymbol{\\gamma }_{2}\\wedge \\boldsymbol{\\gamma }_{3} \\end{equation*}\r\n", - "\\begin{equation*} \\left ( - 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{02} \\psi ^{12} + 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{12} \\psi ^{02} - 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{03} \\psi ^{13} + 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{13} \\psi ^{03}\\right ) \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{1} + \\left ( 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{01} \\psi ^{12} - 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{12} \\psi ^{01} - 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{03} \\psi ^{23} + 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{23} \\psi ^{03}\\right ) \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{2} + \\left ( 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{01} \\psi ^{13} - 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{13} \\psi ^{01} + 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{02} \\psi ^{23} - 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{23} \\psi ^{02}\\right ) \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{3} + \\left ( - 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{01} \\psi ^{02} + 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{02} \\psi ^{01} - 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{13} \\psi ^{23} + 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{23} \\psi ^{13}\\right ) \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{2} + \\left ( - 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{01} \\psi ^{03} + 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{03} \\psi ^{01} + 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{12} \\psi ^{23} - 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{23} \\psi ^{12}\\right ) \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{3} + \\left ( - 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{02} \\psi ^{03} + 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{03} \\psi ^{02} - 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{12} \\psi ^{13} + 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{13} \\psi ^{12}\\right ) \\boldsymbol{\\gamma }_{2}\\wedge \\boldsymbol{\\gamma }_{3} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\psi + \\psi ^{01} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{1} + \\psi ^{02} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{2} + \\psi ^{03} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{3} + \\psi ^{12} \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{2} + \\psi ^{13} \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{3} + \\psi ^{23} \\boldsymbol{\\gamma }_{2}\\wedge \\boldsymbol{\\gamma }_{3} + \\psi ^{0123} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{2}\\wedge \\boldsymbol{\\gamma }_{3} \\end{equation*}\n", + "\\begin{equation*} B^{01} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{1} + B^{02} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{2} + B^{03} \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{3} + B^{12} \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{2} + B^{13} \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{3} + B^{23} \\boldsymbol{\\gamma }_{2}\\wedge \\boldsymbol{\\gamma }_{3} \\end{equation*}\n", + "\\begin{equation*} \\left ( - 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{02} \\psi ^{12} + 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{12} \\psi ^{02} - 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{03} \\psi ^{13} + 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{13} \\psi ^{03}\\right ) \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{1} + \\left ( 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{01} \\psi ^{12} - 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{12} \\psi ^{01} - 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{03} \\psi ^{23} + 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{23} \\psi ^{03}\\right ) \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{2} + \\left ( 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{01} \\psi ^{13} - 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{13} \\psi ^{01} + 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{02} \\psi ^{23} - 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{23} \\psi ^{02}\\right ) \\boldsymbol{\\gamma }_{0}\\wedge \\boldsymbol{\\gamma }_{3} + \\left ( - 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{01} \\psi ^{02} + 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{02} \\psi ^{01} - 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{13} \\psi ^{23} + 2 \\left ( \\gamma _{3}\\cdot \\gamma _{3}\\right ) B^{23} \\psi ^{13}\\right ) \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{2} + \\left ( - 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{01} \\psi ^{03} + 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{03} \\psi ^{01} + 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{12} \\psi ^{23} - 2 \\left ( \\gamma _{2}\\cdot \\gamma _{2}\\right ) B^{23} \\psi ^{12}\\right ) \\boldsymbol{\\gamma }_{1}\\wedge \\boldsymbol{\\gamma }_{3} + \\left ( - 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{02} \\psi ^{03} + 2 \\left ( \\gamma _{0}\\cdot \\gamma _{0}\\right ) B^{03} \\psi ^{02} - 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{12} \\psi ^{13} + 2 \\left ( \\gamma _{1}\\cdot \\gamma _{1}\\right ) B^{13} \\psi ^{12}\\right ) \\boldsymbol{\\gamma }_{2}\\wedge \\boldsymbol{\\gamma }_{3} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat dirac_derive.tex" + "check('dirac_derive')" ] }, { "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], - "source": [ - "!python Dop.py" - ] - }, - { - "cell_type": "code", - "execution_count": 13, + "execution_count": 7, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={6in,7in},total={5in,6in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\nabla = \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z} \\end{equation*}\r\n", - "\\begin{equation*} \\nabla^{2} = \\nabla \\cdot \\nabla = \\frac{\\partial^{2}}{\\partial x^{2}} + \\frac{\\partial^{2}}{\\partial y^{2}} + \\frac{\\partial^{2}}{\\partial z^{2}} \\end{equation*}\r\n", - "\\begin{equation*} \\lp\\nabla^{2}\\rp f = \\partial^{2}_{y} f + \\partial^{2}_{z} f \\end{equation*}\r\n", - "\\begin{equation*} \\nabla\\cdot\\lp\\nabla f\\rp = \\partial^{2}_{x} f + \\partial^{2}_{y} f + \\partial^{2}_{z} f \\end{equation*}\r\n", - "\\begin{equation*} \\nabla^{2} = \\nabla\\cdot\\nabla = \\frac{2}{r} \\frac{\\partial}{\\partial r} + \\frac{1}{r^{2} \\tan{\\left (\\theta \\right )}} \\frac{\\partial}{\\partial \\theta } + \\frac{\\partial^{2}}{\\partial r^{2}} + r^{-2} \\frac{\\partial^{2}}{\\partial \\theta ^{2}} + \\frac{1}{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\frac{\\partial^{2}}{\\partial \\phi ^{2}} \\end{equation*}\r\n", - "\\begin{equation*} \\lp\\nabla^{2}\\rp f = \\frac{r^{2} \\partial^{2}_{r} f + 2 r \\partial_{r} f + \\partial^{2}_{\\theta } f + \\frac{\\partial_{\\theta } f }{\\tan{\\left (\\theta \\right )}} + \\frac{\\partial^{2}_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\end{equation*}\r\n", - "\\begin{equation*} \\nabla\\cdot\\lp\\nabla f\\rp = \\frac{r^{2} \\partial^{2}_{r} f + 2 r \\partial_{r} f + \\partial^{2}_{\\theta } f + \\frac{\\partial_{\\theta } f }{\\tan{\\left (\\theta \\right )}} + \\frac{\\partial^{2}_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\end{equation*}\r\n", - "\\begin{equation*} \\begin{array}{c} \\left [ \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z}, \\right. \\\\ \\left. \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z}\\right ] \\\\ \\end{array} \\end{equation*}\r\n", - "\\begin{equation*} F \\end{equation*}\r\n", - "\\begin{equation*} F^{r} \\boldsymbol{e}_{r} + F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} F \\end{equation*}\r\n", - "\\begin{equation*} F^{r} \\boldsymbol{e}_{r} + F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} F \\end{equation*}\r\n", - "\\begin{equation*} \\begin{array}{c} \\left ( F^{r} \\boldsymbol{e}_{r} + F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi }, \\right. \\\\ \\left. F^{r} \\boldsymbol{e}_{r} + F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi }\\right ) \\\\ \\end{array} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={6in,7in},total={5in,6in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\nabla = \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z} \\end{equation*}\n", + "\\begin{equation*} \\nabla^{2} = \\nabla \\cdot \\nabla = \\frac{\\partial^{2}}{\\partial x^{2}} + \\frac{\\partial^{2}}{\\partial y^{2}} + \\frac{\\partial^{2}}{\\partial z^{2}} \\end{equation*}\n", + "\\begin{equation*} \\lp\\nabla^{2}\\rp f = \\partial^{2}_{y} f + \\partial^{2}_{z} f \\end{equation*}\n", + "\\begin{equation*} \\nabla\\cdot\\lp\\nabla f\\rp = \\partial^{2}_{x} f + \\partial^{2}_{y} f + \\partial^{2}_{z} f \\end{equation*}\n", + "\\begin{equation*} \\nabla^{2} = \\nabla\\cdot\\nabla = \\frac{2}{r} \\frac{\\partial}{\\partial r} + \\frac{1}{r^{2} \\tan{\\left (\\theta \\right )}} \\frac{\\partial}{\\partial \\theta } + \\frac{\\partial^{2}}{\\partial r^{2}} + r^{-2} \\frac{\\partial^{2}}{\\partial \\theta ^{2}} + \\frac{1}{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\frac{\\partial^{2}}{\\partial \\phi ^{2}} \\end{equation*}\n", + "\\begin{equation*} \\lp\\nabla^{2}\\rp f = \\frac{r^{2} \\partial^{2}_{r} f + 2 r \\partial_{r} f + \\partial^{2}_{\\theta } f + \\frac{\\partial_{\\theta } f }{\\tan{\\left (\\theta \\right )}} + \\frac{\\partial^{2}_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\end{equation*}\n", + "\\begin{equation*} \\nabla\\cdot\\lp\\nabla f\\rp = \\frac{r^{2} \\partial^{2}_{r} f + 2 r \\partial_{r} f + \\partial^{2}_{\\theta } f + \\frac{\\partial_{\\theta } f }{\\tan{\\left (\\theta \\right )}} + \\frac{\\partial^{2}_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\end{equation*}\n", + "\\begin{equation*} \\begin{array}{c} \\left [ \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z}, \\right. \\\\ \\left. \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z}\\right ] \\\\ \\end{array} \\end{equation*}\n", + "\\begin{equation*} F \\end{equation*}\n", + "\\begin{equation*} F^{r} \\boldsymbol{e}_{r} + F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} F \\end{equation*}\n", + "\\begin{equation*} F^{r} \\boldsymbol{e}_{r} + F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} F \\end{equation*}\n", + "\\begin{equation*} \\begin{array}{c} \\left ( F^{r} \\boldsymbol{e}_{r} + F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi }, \\right. \\\\ \\left. F^{r} \\boldsymbol{e}_{r} + F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi }\\right ) \\\\ \\end{array} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat Dop.tex" + "check('Dop')" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 8, "metadata": {}, - "outputs": [], - "source": [ - "!python em_waves_latex.py" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\text{Pseudo Scalar\\;\\;}I = \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "\\begin{equation*} I_{xyz} = \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - " \\begin{align*} \\text{Electromagnetic Field Bi-Vector\\;\\;} F = & - E^{x} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{z} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + B^{y} e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{x} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - "Geom Derivative of Electomagnetic Field Bi-Vector\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} F = 0 = & - i \\left(E^{x} k_{x} + E^{y} k_{y} + E^{z} k_{z}\\right) e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{t} \\\\ & + i \\left(B^{y} k_{z} - B^{z} k_{y} - E^{x} \\omega \\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{x} \\\\ & + i \\left(- B^{x} k_{z} + B^{z} k_{x} - E^{y} \\omega \\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{y} \\\\ & + i \\left(B^{x} k_{y} - B^{y} k_{x} - E^{z} \\omega \\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{z} \\\\ & + i \\left(- B^{z} \\omega - E^{x} k_{y} + E^{y} k_{x}\\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + i \\left(B^{y} \\omega - E^{x} k_{z} + E^{z} k_{x}\\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + i \\left(- B^{x} \\omega - E^{y} k_{z} + E^{z} k_{y}\\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - i \\left(B^{x} k_{x} + B^{y} k_{y} + B^{z} k_{z}\\right) e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} \\lp\\bm{\\nabla}F\\rp /\\lp i e^{iK\\cdot X}\\rp = 0 = & \\left ( - E^{x} k_{x} - E^{y} k_{y} - E^{z} k_{z}\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( B^{y} k_{z} - B^{z} k_{y} - E^{x} \\omega \\right ) \\boldsymbol{\\gamma }_{x} \\\\ & + \\left ( - B^{x} k_{z} + B^{z} k_{x} - E^{y} \\omega \\right ) \\boldsymbol{\\gamma }_{y} \\\\ & + \\left ( B^{x} k_{y} - B^{y} k_{x} - E^{z} \\omega \\right ) \\boldsymbol{\\gamma }_{z} \\\\ & + \\left ( - B^{z} \\omega - E^{x} k_{y} + E^{y} k_{x}\\right ) \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\left ( B^{y} \\omega - E^{x} k_{z} + E^{z} k_{x}\\right ) \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\left ( - B^{x} \\omega - E^{y} k_{z} + E^{z} k_{y}\\right ) \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\left ( - B^{x} k_{x} - B^{y} k_{y} - B^{z} k_{z}\\right ) \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - "\\begin{equation*} \\mbox{set } e_{E}\\cdot e_{k} = e_{B}\\cdot e_{k} = 0\\mbox{ and } e_{E}\\cdot e_{E} = e_{B}\\cdot e_{B} = e_{k}\\cdot e_{k} = -e_{t}\\cdot e_{t} = 1 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cccc} -1 & \\left ( e_{E}\\cdot e_{B}\\right ) & 0 & 0 \\\\ \\left ( e_{E}\\cdot e_{B}\\right ) & -1 & 0 & 0 \\\\ 0 & 0 & -1 & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} K\\cdot X = \\omega t - k x_{k} \\end{equation*}\r\n", - " \\begin{align*} F = & - \\frac{B e^{i \\left(\\omega t - k x_{k}\\right)}}{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{k} \\\\ & + E e^{i \\left(\\omega t - k x_{k}\\right)} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{t} \\\\ & - \\frac{\\left ( e_{E}\\cdot e_{B}\\right ) B e^{i \\left(\\omega t - k x_{k}\\right)}}{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} \\boldsymbol{e}_{B}\\wedge \\boldsymbol{e}_{k} \\end{align*} \r\n", - " \\begin{align*} \\lp\\bm{\\nabla}F\\rp/\\lp ie^{iK\\cdot X} \\rp = 0 = & \\left ( - \\frac{B k}{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} - E \\omega \\right ) \\boldsymbol{e}_{E} \\\\ & - \\frac{\\left ( e_{E}\\cdot e_{B}\\right ) B k}{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} \\boldsymbol{e}_{B} \\\\ & + \\left ( - \\frac{B \\omega }{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} - E k\\right ) \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{k}\\wedge \\boldsymbol{t} \\\\ & - \\frac{\\left ( e_{E}\\cdot e_{B}\\right ) B \\omega }{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} \\boldsymbol{e}_{B}\\wedge \\boldsymbol{e}_{k}\\wedge \\boldsymbol{t} \\end{align*} \r\n", - "\\begin{equation*} \\mbox{Previous equation requires that: }e_{E}\\cdot e_{B} = 0\\mbox{ if }B\\ne 0\\mbox{ and }k\\ne 0 \\end{equation*}\r\n", - " \\begin{align*} \\lp\\bm{\\nabla}F\\rp/\\lp ie^{iK\\cdot X} \\rp = 0 = & \\left ( - B k - E \\omega \\right ) \\boldsymbol{e}_{E} \\\\ & + \\left ( - B \\omega - E k\\right ) \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{k}\\wedge \\boldsymbol{t} \\end{align*} \r\n", - "\\begin{equation*} 0 = - B k - E \\omega \\end{equation*}\r\n", - "\\begin{equation*} 0 = - B \\omega - E k \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{eq3 = eq1-eq2: }0 = - \\frac{E \\omega }{k} + \\frac{E k}{\\omega } \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{eq3 = (eq1-eq2)/E: }0 = - \\frac{\\omega }{k} + \\frac{k}{\\omega } \\end{equation*}\r\n", - "\\begin{equation*} k = \\left [ \\begin{array}{c} - \\omega \\\\ \\omega \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} B = \\left [ \\begin{array}{c} - E \\\\ E \\end{array}\\right ] \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\text{Pseudo Scalar\\;\\;}I = \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "\\begin{equation*} I_{xyz} = \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + " \\begin{align*} \\text{Electromagnetic Field Bi-Vector\\;\\;} F = & - E^{x} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{z} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + B^{y} e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{x} e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + "Geom Derivative of Electomagnetic Field Bi-Vector\n", + " \\begin{align*} \\boldsymbol{\\nabla} F = 0 = & - i \\left(E^{x} k_{x} + E^{y} k_{y} + E^{z} k_{z}\\right) e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{t} \\\\ & + i \\left(B^{y} k_{z} - B^{z} k_{y} - E^{x} \\omega \\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{x} \\\\ & + i \\left(- B^{x} k_{z} + B^{z} k_{x} - E^{y} \\omega \\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{y} \\\\ & + i \\left(B^{x} k_{y} - B^{y} k_{x} - E^{z} \\omega \\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{z} \\\\ & + i \\left(- B^{z} \\omega - E^{x} k_{y} + E^{y} k_{x}\\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + i \\left(B^{y} \\omega - E^{x} k_{z} + E^{z} k_{x}\\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + i \\left(- B^{x} \\omega - E^{y} k_{z} + E^{z} k_{y}\\right) e^{i \\left(\\omega t - k_{x} x - k_{y} y - k_{z} z\\right)} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - i \\left(B^{x} k_{x} + B^{y} k_{y} + B^{z} k_{z}\\right) e^{- i \\left(- \\omega t + k_{x} x + k_{y} y + k_{z} z\\right)} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} \\lp\\bm{\\nabla}F\\rp /\\lp i e^{iK\\cdot X}\\rp = 0 = & \\left ( - E^{x} k_{x} - E^{y} k_{y} - E^{z} k_{z}\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( B^{y} k_{z} - B^{z} k_{y} - E^{x} \\omega \\right ) \\boldsymbol{\\gamma }_{x} \\\\ & + \\left ( - B^{x} k_{z} + B^{z} k_{x} - E^{y} \\omega \\right ) \\boldsymbol{\\gamma }_{y} \\\\ & + \\left ( B^{x} k_{y} - B^{y} k_{x} - E^{z} \\omega \\right ) \\boldsymbol{\\gamma }_{z} \\\\ & + \\left ( - B^{z} \\omega - E^{x} k_{y} + E^{y} k_{x}\\right ) \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\left ( B^{y} \\omega - E^{x} k_{z} + E^{z} k_{x}\\right ) \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\left ( - B^{x} \\omega - E^{y} k_{z} + E^{z} k_{y}\\right ) \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\left ( - B^{x} k_{x} - B^{y} k_{y} - B^{z} k_{z}\\right ) \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + "\\begin{equation*} \\mbox{set } e_{E}\\cdot e_{k} = e_{B}\\cdot e_{k} = 0\\mbox{ and } e_{E}\\cdot e_{E} = e_{B}\\cdot e_{B} = e_{k}\\cdot e_{k} = -e_{t}\\cdot e_{t} = 1 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cccc} -1 & \\left ( e_{E}\\cdot e_{B}\\right ) & 0 & 0 \\\\ \\left ( e_{E}\\cdot e_{B}\\right ) & -1 & 0 & 0 \\\\ 0 & 0 & -1 & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} K\\cdot X = \\omega t - k x_{k} \\end{equation*}\n", + " \\begin{align*} F = & - \\frac{B e^{i \\left(\\omega t - k x_{k}\\right)}}{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{k} \\\\ & + E e^{i \\left(\\omega t - k x_{k}\\right)} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{t} \\\\ & - \\frac{\\left ( e_{E}\\cdot e_{B}\\right ) B e^{i \\left(\\omega t - k x_{k}\\right)}}{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} \\boldsymbol{e}_{B}\\wedge \\boldsymbol{e}_{k} \\end{align*} \n", + " \\begin{align*} \\lp\\bm{\\nabla}F\\rp/\\lp ie^{iK\\cdot X} \\rp = 0 = & \\left ( - \\frac{B k}{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} - E \\omega \\right ) \\boldsymbol{e}_{E} \\\\ & - \\frac{\\left ( e_{E}\\cdot e_{B}\\right ) B k}{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} \\boldsymbol{e}_{B} \\\\ & + \\left ( - \\frac{B \\omega }{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} - E k\\right ) \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{k}\\wedge \\boldsymbol{t} \\\\ & - \\frac{\\left ( e_{E}\\cdot e_{B}\\right ) B \\omega }{\\sqrt{- \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} + 1}} \\boldsymbol{e}_{B}\\wedge \\boldsymbol{e}_{k}\\wedge \\boldsymbol{t} \\end{align*} \n", + "\\begin{equation*} \\mbox{Previous equation requires that: }e_{E}\\cdot e_{B} = 0\\mbox{ if }B\\ne 0\\mbox{ and }k\\ne 0 \\end{equation*}\n", + " \\begin{align*} \\lp\\bm{\\nabla}F\\rp/\\lp ie^{iK\\cdot X} \\rp = 0 = & \\left ( - B k - E \\omega \\right ) \\boldsymbol{e}_{E} \\\\ & + \\left ( - B \\omega - E k\\right ) \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{k}\\wedge \\boldsymbol{t} \\end{align*} \n", + "\\begin{equation*} 0 = - B k - E \\omega \\end{equation*}\n", + "\\begin{equation*} 0 = - B \\omega - E k \\end{equation*}\n", + "\\begin{equation*} \\mbox{eq3 = eq1-eq2: }0 = - \\frac{E \\omega }{k} + \\frac{E k}{\\omega } \\end{equation*}\n", + "\\begin{equation*} \\mbox{eq3 = (eq1-eq2)/E: }0 = - \\frac{\\omega }{k} + \\frac{k}{\\omega } \\end{equation*}\n", + "\\begin{equation*} k = \\left [ \\begin{array}{c} - \\omega \\\\ \\omega \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} B = \\left [ \\begin{array}{c} - E \\\\ E \\end{array}\\right ] \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat em_waves_latex.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [], - "source": [ - "!python FmtChk.py" + "check('em_waves_latex')" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 9, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={6in,7in},total={5in,6in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\begin{array}{c} \\left [ f , \\right. \\\\ F^{x} \\boldsymbol{e}_{x} + F^{y} \\boldsymbol{e}_{y} + F^{z} \\boldsymbol{e}_{z}, \\\\ \\left. B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}\\right ] \\\\ \\end{array} \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\begin{array}{ccc} f , & F^{x} \\boldsymbol{e}_{x} + F^{y} \\boldsymbol{e}_{y} + F^{z} \\boldsymbol{e}_{z}, & B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}\\\\ \\end{array} \\right ] \\end{equation*}\r\n", - " \\begin{align*} & F^{x} \\boldsymbol{e}_{x} \\\\ & + F^{y} \\boldsymbol{e}_{y} \\\\ & + F^{z} \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} & B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\nabla^{2} = \\nabla\\cdot\\nabla = \\frac{\\partial^{2}}{\\partial x^{2}} + \\frac{\\partial^{2}}{\\partial y^{2}} + \\frac{\\partial^{2}}{\\partial z^{2}} \\end{equation*}\r\n", - "\\begin{equation*} \\frac{\\partial^{2}}{\\partial x^{2}} + \\frac{\\partial^{2}}{\\partial y^{2}} + \\frac{\\partial^{2}}{\\partial z^{2}} + \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={6in,7in},total={5in,6in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\begin{array}{c} \\left [ f , \\right. \\\\ F^{x} \\boldsymbol{e}_{x} + F^{y} \\boldsymbol{e}_{y} + F^{z} \\boldsymbol{e}_{z}, \\\\ \\left. B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}\\right ] \\\\ \\end{array} \\end{equation*}\n", + "\\begin{equation*} \\left [ \\begin{array}{ccc} f , & F^{x} \\boldsymbol{e}_{x} + F^{y} \\boldsymbol{e}_{y} + F^{z} \\boldsymbol{e}_{z}, & B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z}\\\\ \\end{array} \\right ] \\end{equation*}\n", + " \\begin{align*} & F^{x} \\boldsymbol{e}_{x} \\\\ & + F^{y} \\boldsymbol{e}_{y} \\\\ & + F^{z} \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} & B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\nabla^{2} = \\nabla\\cdot\\nabla = \\frac{\\partial^{2}}{\\partial x^{2}} + \\frac{\\partial^{2}}{\\partial y^{2}} + \\frac{\\partial^{2}}{\\partial z^{2}} \\end{equation*}\n", + "\\begin{equation*} \\frac{\\partial^{2}}{\\partial x^{2}} + \\frac{\\partial^{2}}{\\partial y^{2}} + \\frac{\\partial^{2}}{\\partial z^{2}} + \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat FmtChk.tex" + "check('FmtChk')" ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 10, "metadata": {}, - "outputs": [], - "source": [ - "!python groups.py" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={8.5in,11in},total={7.5in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def Product_of_Rotors():\r\n", - " Print_Function()\r\n", - " (na,nb,nm,alpha,th,th_a,th_b) = symbols('n_a n_b n_m alpha theta theta_a theta_b',\\\r\n", - " real = True)\r\n", - " g = [[na, 0, alpha],[0, nm, 0],[alpha, 0, nb]] #metric tensor\r\n", - " \"\"\"\r\n", - " Values of metric tensor components\r\n", - " [na,nm,nb] = [+1/-1,+1/-1,+1/-1] alpha = ea|eb\r\n", - " \"\"\"\r\n", - " (g3d, ea, em, eb) = Ga.build('e_a e_m e_b', g=g)\r\n", - " print('g =',g3d.g)\r\n", - " print(r'%n_{a} = \\bm{e}_{a}^{2}\\;\\;n_{b} = \\bm{e}_{b}^{2}\\;\\;n_{m} = \\bm{e}_{m}^{2}'+\\\r\n", - " r'\\;\\;\\alpha = \\bm{e}_{a}\\cdot\\bm{e}_{b}')\r\n", - " (ca,cb,sa,sb) = symbols('c_a c_b s_a s_b',real=True)\r\n", - " Ra = ca + sa*ea*em # Rotor for ea^em plane\r\n", - " Rb = cb + sb*em*eb # Rotor for em^eb plane\r\n", - " print(r'%\\mbox{Rotor in }\\bm{e}_{a}\\bm{e}_{m}\\mbox{ plane } R_{a} =',Ra)\r\n", - " print(r'%\\mbox{Rotor in }\\bm{e}_{m}\\bm{e}_{b}\\mbox{ plane } R_{b} =',Rb)\r\n", - " Rab = Ra*Rb # Compound Rotor\r\n", - " \"\"\"\r\n", - " Show that compound rotor is scalar plus bivector\r\n", - " \"\"\"\r\n", - " print(r'%R_{a}R_{b} = S+\\bm{B} =', Rab)\r\n", - " Rab2 = Rab.get_grade(2)\r\n", - " print(r'%\\bm{B} =',Rab2)\r\n", - " Rab2sq = Rab2*Rab2 # Square of compound rotor bivector part\r\n", - " Ssq = (Rab.scalar())**2 # Square of compound rotor scalar part\r\n", - " Bsq = Rab2sq.scalar()\r\n", - " print(r'%S^{2} =',Ssq)\r\n", - " print(r'%\\bm{B}^{2} =',Bsq)\r\n", - " Dsq = (Ssq-Bsq).expand().simplify()\r\n", - " print('%S^{2}-B^{2} =', Dsq)\r\n", - " Dsq = Dsq.subs(nm**2,S(1)) # (e_m)**4 = 1\r\n", - " print('%S^{2}-B^{2} =', Dsq)\r\n", - " Cases = [S(-1),S(1)] # -1/+1 squares for each basis vector\r\n", - " print(r'#Consider all combinations of $\\bm{e}_{a}^{2}$, $\\bm{e}_{b}^{2}$'+\\\r\n", - " r' and $\\bm{e}_{m}^2$:')\r\n", - " for Na in Cases:\r\n", - " for Nb in Cases:\r\n", - " for Nm in Cases:\r\n", - " Ba_sq = -Na*Nm\r\n", - " Bb_sq = -Nb*Nm\r\n", - " if Ba_sq < 0:\r\n", - " Ca_th = cos(th_a)\r\n", - " Sa_th = sin(th_a)\r\n", - " else:\r\n", - " Ca_th = cosh(th_a)\r\n", - " Sa_th = sinh(th_a)\r\n", - " if Bb_sq < 0:\r\n", - " Cb_th = cos(th_b)\r\n", - " Sb_th = sin(th_b)\r\n", - " else:\r\n", - " Cb_th = cosh(th_b)\r\n", - " Sb_th = sinh(th_b)\r\n", - " print(r'%\\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] =',\\\r\n", - " [Na,Nb,Nm])\r\n", - " Dsq_tmp = Dsq.subs({ca:Ca_th,sa:Sa_th,cb:Cb_th,sb:Sb_th,na:Na,nb:Nb,nm:Nm})\r\n", - " print(r'%S^{2}-\\bm{B}^{2} =',Dsq_tmp,' =',trigsimp(Dsq_tmp))\r\n", - " print(r'#Thus we have shown that $R_{a}R_{b} = S+\\bm{D} = e^{\\bm{C}}$ where $\\bm{C}$'+\\\r\n", - " r' is a bivector blade.')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{ccc} n_{a} & 0 & \\alpha \\\\ 0 & n_{m} & 0 \\\\ \\alpha & 0 & n_{b} \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} n_{a} = \\bm{e}_{a}^{2}\\;\\;n_{b} = \\bm{e}_{b}^{2}\\;\\;n_{m} = \\bm{e}_{m}^{2}\\;\\;\\alpha = \\bm{e}_{a}\\cdot\\bm{e}_{b} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Rotor in }\\bm{e}_{a}\\bm{e}_{m}\\mbox{ plane } R_{a} = c_{a} + s_{a} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{m} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Rotor in }\\bm{e}_{m}\\bm{e}_{b}\\mbox{ plane } R_{b} = c_{b} + s_{b} \\boldsymbol{e}_{m}\\wedge \\boldsymbol{e}_{b} \\end{equation*}\r\n", - "\\begin{equation*} R_{a}R_{b} = S+\\bm{B} = \\left ( \\alpha n_{m} s_{a} s_{b} + c_{a} c_{b}\\right ) + c_{b} s_{a} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{m} + n_{m} s_{a} s_{b} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{b} + c_{a} s_{b} \\boldsymbol{e}_{m}\\wedge \\boldsymbol{e}_{b} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{B} = c_{b} s_{a} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{m} + n_{m} s_{a} s_{b} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{b} + c_{a} s_{b} \\boldsymbol{e}_{m}\\wedge \\boldsymbol{e}_{b} \\end{equation*}\r\n", - "\\begin{equation*} S^{2} = \\left(\\alpha n_{m} s_{a} s_{b} + c_{a} c_{b}\\right)^{2} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{B}^{2} = \\alpha ^{2} {\\left ( n_{m} \\right )}^{2} {\\left ( s_{a} \\right )}^{2} {\\left ( s_{b} \\right )}^{2} + 2 \\alpha c_{a} c_{b} n_{m} s_{a} s_{b} - {\\left ( c_{a} \\right )}^{2} n_{b} n_{m} {\\left ( s_{b} \\right )}^{2} - {\\left ( c_{b} \\right )}^{2} n_{a} n_{m} {\\left ( s_{a} \\right )}^{2} - n_{a} n_{b} {\\left ( n_{m} \\right )}^{2} {\\left ( s_{a} \\right )}^{2} {\\left ( s_{b} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-B^{2} = {\\left ( c_{a} \\right )}^{2} {\\left ( c_{b} \\right )}^{2} + {\\left ( c_{a} \\right )}^{2} n_{b} n_{m} {\\left ( s_{b} \\right )}^{2} + {\\left ( c_{b} \\right )}^{2} n_{a} n_{m} {\\left ( s_{a} \\right )}^{2} + n_{a} n_{b} {\\left ( n_{m} \\right )}^{2} {\\left ( s_{a} \\right )}^{2} {\\left ( s_{b} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-B^{2} = {\\left ( c_{a} \\right )}^{2} {\\left ( c_{b} \\right )}^{2} + {\\left ( c_{a} \\right )}^{2} n_{b} n_{m} {\\left ( s_{b} \\right )}^{2} + {\\left ( c_{b} \\right )}^{2} n_{a} n_{m} {\\left ( s_{a} \\right )}^{2} + n_{a} n_{b} {\\left ( s_{a} \\right )}^{2} {\\left ( s_{b} \\right )}^{2} \\end{equation*}\r\n", - "Consider all combinations of $\\bm{e}_{a}^{2}$, $\\bm{e}_{b}^{2}$ and $\\bm{e}_{m}^2$:\r\n", - "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [-1, -1, -1] \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-\\bm{B}^{2} = {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\sin{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\cos{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\cos{\\left (\\theta _{a} \\right )}}^{2} + {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\cos{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [-1, -1, 1] \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-\\bm{B}^{2} = {\\sinh{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} - {\\sinh{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} - {\\sinh{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} + {\\cosh{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [-1, 1, -1] \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-\\bm{B}^{2} = - {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} - {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} + {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [-1, 1, 1] \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-\\bm{B}^{2} = - {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\sinh{\\left (\\theta _{a} \\right )}}^{2} + {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} - {\\cos{\\left (\\theta _{b} \\right )}}^{2} {\\sinh{\\left (\\theta _{a} \\right )}}^{2} + {\\cos{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [1, -1, -1] \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-\\bm{B}^{2} = - {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\sinh{\\left (\\theta _{a} \\right )}}^{2} + {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} - {\\cos{\\left (\\theta _{b} \\right )}}^{2} {\\sinh{\\left (\\theta _{a} \\right )}}^{2} + {\\cos{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [1, -1, 1] \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-\\bm{B}^{2} = - {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} - {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} + {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [1, 1, -1] \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-\\bm{B}^{2} = {\\sinh{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} - {\\sinh{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} - {\\sinh{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} + {\\cosh{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [1, 1, 1] \\end{equation*}\r\n", - "\\begin{equation*} S^{2}-\\bm{B}^{2} = {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\sin{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\cos{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\cos{\\left (\\theta _{a} \\right )}}^{2} + {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\cos{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\r\n", - "Thus we have shown that $R_{a}R_{b} = S+\\bm{D} = e^{\\bm{C}}$ where $\\bm{C}$ is a bivector blade.\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={8.5in,11in},total={7.5in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def Product_of_Rotors():\n", + " Print_Function()\n", + " (na,nb,nm,alpha,th,th_a,th_b) = symbols('n_a n_b n_m alpha theta theta_a theta_b',\\\n", + " real = True)\n", + " g = [[na, 0, alpha],[0, nm, 0],[alpha, 0, nb]] #metric tensor\n", + " \"\"\"\n", + " Values of metric tensor components\n", + " [na,nm,nb] = [+1/-1,+1/-1,+1/-1] alpha = ea|eb\n", + " \"\"\"\n", + " (g3d, ea, em, eb) = Ga.build('e_a e_m e_b', g=g)\n", + " print('g =',g3d.g)\n", + " print(r'%n_{a} = \\bm{e}_{a}^{2}\\;\\;n_{b} = \\bm{e}_{b}^{2}\\;\\;n_{m} = \\bm{e}_{m}^{2}'+\\\n", + " r'\\;\\;\\alpha = \\bm{e}_{a}\\cdot\\bm{e}_{b}')\n", + " (ca,cb,sa,sb) = symbols('c_a c_b s_a s_b',real=True)\n", + " Ra = ca + sa*ea*em # Rotor for ea^em plane\n", + " Rb = cb + sb*em*eb # Rotor for em^eb plane\n", + " print(r'%\\mbox{Rotor in }\\bm{e}_{a}\\bm{e}_{m}\\mbox{ plane } R_{a} =',Ra)\n", + " print(r'%\\mbox{Rotor in }\\bm{e}_{m}\\bm{e}_{b}\\mbox{ plane } R_{b} =',Rb)\n", + " Rab = Ra*Rb # Compound Rotor\n", + " \"\"\"\n", + " Show that compound rotor is scalar plus bivector\n", + " \"\"\"\n", + " print(r'%R_{a}R_{b} = S+\\bm{B} =', Rab)\n", + " Rab2 = Rab.get_grade(2)\n", + " print(r'%\\bm{B} =',Rab2)\n", + " Rab2sq = Rab2*Rab2 # Square of compound rotor bivector part\n", + " Ssq = (Rab.scalar())**2 # Square of compound rotor scalar part\n", + " Bsq = Rab2sq.scalar()\n", + " print(r'%S^{2} =',Ssq)\n", + " print(r'%\\bm{B}^{2} =',Bsq)\n", + " Dsq = (Ssq-Bsq).expand().simplify()\n", + " print('%S^{2}-B^{2} =', Dsq)\n", + " Dsq = Dsq.subs(nm**2,S(1)) # (e_m)**4 = 1\n", + " print('%S^{2}-B^{2} =', Dsq)\n", + " Cases = [S(-1),S(1)] # -1/+1 squares for each basis vector\n", + " print(r'#Consider all combinations of $\\bm{e}_{a}^{2}$, $\\bm{e}_{b}^{2}$'+\\\n", + " r' and $\\bm{e}_{m}^2$:')\n", + " for Na in Cases:\n", + " for Nb in Cases:\n", + " for Nm in Cases:\n", + " Ba_sq = -Na*Nm\n", + " Bb_sq = -Nb*Nm\n", + " if Ba_sq < 0:\n", + " Ca_th = cos(th_a)\n", + " Sa_th = sin(th_a)\n", + " else:\n", + " Ca_th = cosh(th_a)\n", + " Sa_th = sinh(th_a)\n", + " if Bb_sq < 0:\n", + " Cb_th = cos(th_b)\n", + " Sb_th = sin(th_b)\n", + " else:\n", + " Cb_th = cosh(th_b)\n", + " Sb_th = sinh(th_b)\n", + " print(r'%\\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] =',\\\n", + " [Na,Nb,Nm])\n", + " Dsq_tmp = Dsq.subs({ca:Ca_th,sa:Sa_th,cb:Cb_th,sb:Sb_th,na:Na,nb:Nb,nm:Nm})\n", + " print(r'%S^{2}-\\bm{B}^{2} =',Dsq_tmp,' =',trigsimp(Dsq_tmp))\n", + " print(r'#Thus we have shown that $R_{a}R_{b} = S+\\bm{D} = e^{\\bm{C}}$ where $\\bm{C}$'+\\\n", + " r' is a bivector blade.')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g = \\left [ \\begin{array}{ccc} n_{a} & 0 & \\alpha \\\\ 0 & n_{m} & 0 \\\\ \\alpha & 0 & n_{b} \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} n_{a} = \\bm{e}_{a}^{2}\\;\\;n_{b} = \\bm{e}_{b}^{2}\\;\\;n_{m} = \\bm{e}_{m}^{2}\\;\\;\\alpha = \\bm{e}_{a}\\cdot\\bm{e}_{b} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Rotor in }\\bm{e}_{a}\\bm{e}_{m}\\mbox{ plane } R_{a} = c_{a} + s_{a} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{m} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Rotor in }\\bm{e}_{m}\\bm{e}_{b}\\mbox{ plane } R_{b} = c_{b} + s_{b} \\boldsymbol{e}_{m}\\wedge \\boldsymbol{e}_{b} \\end{equation*}\n", + "\\begin{equation*} R_{a}R_{b} = S+\\bm{B} = \\left ( \\alpha n_{m} s_{a} s_{b} + c_{a} c_{b}\\right ) + c_{b} s_{a} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{m} + n_{m} s_{a} s_{b} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{b} + c_{a} s_{b} \\boldsymbol{e}_{m}\\wedge \\boldsymbol{e}_{b} \\end{equation*}\n", + "\\begin{equation*} \\bm{B} = c_{b} s_{a} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{m} + n_{m} s_{a} s_{b} \\boldsymbol{e}_{a}\\wedge \\boldsymbol{e}_{b} + c_{a} s_{b} \\boldsymbol{e}_{m}\\wedge \\boldsymbol{e}_{b} \\end{equation*}\n", + "\\begin{equation*} S^{2} = \\left(\\alpha n_{m} s_{a} s_{b} + c_{a} c_{b}\\right)^{2} \\end{equation*}\n", + "\\begin{equation*} \\bm{B}^{2} = \\alpha ^{2} {\\left ( n_{m} \\right )}^{2} {\\left ( s_{a} \\right )}^{2} {\\left ( s_{b} \\right )}^{2} + 2 \\alpha c_{a} c_{b} n_{m} s_{a} s_{b} - {\\left ( c_{a} \\right )}^{2} n_{b} n_{m} {\\left ( s_{b} \\right )}^{2} - {\\left ( c_{b} \\right )}^{2} n_{a} n_{m} {\\left ( s_{a} \\right )}^{2} - n_{a} n_{b} {\\left ( n_{m} \\right )}^{2} {\\left ( s_{a} \\right )}^{2} {\\left ( s_{b} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} S^{2}-B^{2} = {\\left ( c_{a} \\right )}^{2} {\\left ( c_{b} \\right )}^{2} + {\\left ( c_{a} \\right )}^{2} n_{b} n_{m} {\\left ( s_{b} \\right )}^{2} + {\\left ( c_{b} \\right )}^{2} n_{a} n_{m} {\\left ( s_{a} \\right )}^{2} + n_{a} n_{b} {\\left ( n_{m} \\right )}^{2} {\\left ( s_{a} \\right )}^{2} {\\left ( s_{b} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} S^{2}-B^{2} = {\\left ( c_{a} \\right )}^{2} {\\left ( c_{b} \\right )}^{2} + {\\left ( c_{a} \\right )}^{2} n_{b} n_{m} {\\left ( s_{b} \\right )}^{2} + {\\left ( c_{b} \\right )}^{2} n_{a} n_{m} {\\left ( s_{a} \\right )}^{2} + n_{a} n_{b} {\\left ( s_{a} \\right )}^{2} {\\left ( s_{b} \\right )}^{2} \\end{equation*}\n", + "Consider all combinations of $\\bm{e}_{a}^{2}$, $\\bm{e}_{b}^{2}$ and $\\bm{e}_{m}^2$:\n", + "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [-1, -1, -1] \\end{equation*}\n", + "\\begin{equation*} S^{2}-\\bm{B}^{2} = {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\sin{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\cos{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\cos{\\left (\\theta _{a} \\right )}}^{2} + {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\cos{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [-1, -1, 1] \\end{equation*}\n", + "\\begin{equation*} S^{2}-\\bm{B}^{2} = {\\sinh{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} - {\\sinh{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} - {\\sinh{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} + {\\cosh{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [-1, 1, -1] \\end{equation*}\n", + "\\begin{equation*} S^{2}-\\bm{B}^{2} = - {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} - {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} + {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [-1, 1, 1] \\end{equation*}\n", + "\\begin{equation*} S^{2}-\\bm{B}^{2} = - {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\sinh{\\left (\\theta _{a} \\right )}}^{2} + {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} - {\\cos{\\left (\\theta _{b} \\right )}}^{2} {\\sinh{\\left (\\theta _{a} \\right )}}^{2} + {\\cos{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [1, -1, -1] \\end{equation*}\n", + "\\begin{equation*} S^{2}-\\bm{B}^{2} = - {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\sinh{\\left (\\theta _{a} \\right )}}^{2} + {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} - {\\cos{\\left (\\theta _{b} \\right )}}^{2} {\\sinh{\\left (\\theta _{a} \\right )}}^{2} + {\\cos{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [1, -1, 1] \\end{equation*}\n", + "\\begin{equation*} S^{2}-\\bm{B}^{2} = - {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} - {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} + {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [1, 1, -1] \\end{equation*}\n", + "\\begin{equation*} S^{2}-\\bm{B}^{2} = {\\sinh{\\left (\\theta _{a} \\right )}}^{2} {\\sinh{\\left (\\theta _{b} \\right )}}^{2} - {\\sinh{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} - {\\sinh{\\left (\\theta _{b} \\right )}}^{2} {\\cosh{\\left (\\theta _{a} \\right )}}^{2} + {\\cosh{\\left (\\theta _{a} \\right )}}^{2} {\\cosh{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} \\left [ \\bm{e}_{a}^{2},\\bm{e}_{b}^{2},\\bm{e}_{m}^2\\right ] = [1, 1, 1] \\end{equation*}\n", + "\\begin{equation*} S^{2}-\\bm{B}^{2} = {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\sin{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{a} \\right )}}^{2} {\\cos{\\left (\\theta _{b} \\right )}}^{2} + {\\sin{\\left (\\theta _{b} \\right )}}^{2} {\\cos{\\left (\\theta _{a} \\right )}}^{2} + {\\cos{\\left (\\theta _{a} \\right )}}^{2} {\\cos{\\left (\\theta _{b} \\right )}}^{2} = 1 \\end{equation*}\n", + "Thus we have shown that $R_{a}R_{b} = S+\\bm{D} = e^{\\bm{C}}$ where $\\bm{C}$ is a bivector blade.\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat groups.tex" + "check('groups')" ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 11, "metadata": {}, - "outputs": [], - "source": [ - "!python latex_check.py" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def basic_multivector_operations_3D():\r\n", - " Print_Function()\r\n", - " g3d = Ga('e*x|y|z')\r\n", - " (ex,ey,ez) = g3d.mv()\r\n", - " A = g3d.mv('A','mv')\r\n", - " print(A.Fmt(1,'A'))\r\n", - " print(A.Fmt(2,'A'))\r\n", - " print(A.Fmt(3,'A'))\r\n", - " print(A.even().Fmt(1,'%A_{+}'))\r\n", - " print(A.odd().Fmt(1,'%A_{-}'))\r\n", - " X = g3d.mv('X','vector')\r\n", - " Y = g3d.mv('Y','vector')\r\n", - " print('g_{ij} = ',g3d.g)\r\n", - " print(X.Fmt(1,'X'))\r\n", - " print(Y.Fmt(1,'Y'))\r\n", - " print((X*Y).Fmt(2,'X*Y'))\r\n", - " print((X^Y).Fmt(2,'X^Y'))\r\n", - " print((X|Y).Fmt(2,'X|Y'))\r\n", - " print(cross(X,Y).Fmt(1,r'X\\times Y'))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} A = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} A_{+} = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} A_{-} = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{x}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{z}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) & \\left ( e_{z}\\cdot e_{z}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} X Y = & \\left ( \\left ( e_{x}\\cdot e_{x}\\right ) X^{x} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{y} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{z}\\right ) \\\\ & + \\left ( X^{x} Y^{y} - X^{y} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( X^{x} Y^{z} - X^{z} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( X^{y} Y^{z} - X^{z} Y^{y}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} X\\W Y = \\left ( X^{x} Y^{y} - X^{y} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( X^{x} Y^{z} - X^{z} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( X^{y} Y^{z} - X^{z} Y^{y}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} X\\cdot Y = \\left ( e_{x}\\cdot e_{x}\\right ) X^{x} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{y} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{z} \\end{equation*}\r\n", - "\\begin{equation*} X\\times Y = \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{x} Y^{y} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{x} Y^{z} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{x} - \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{x} - \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{y} Y^{z} - \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{y} - \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} X^{z} Y^{y}}{\\sqrt{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} \\left ( e_{z}\\cdot e_{z}\\right ) + 2 \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} \\left ( e_{y}\\cdot e_{y}\\right ) }} \\boldsymbol{e}_{x} + \\frac{- \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{x} - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{y} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) X^{y} Y^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} X^{x} Y^{z} - \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} X^{z} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} - \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y}}{\\sqrt{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} \\left ( e_{z}\\cdot e_{z}\\right ) + 2 \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} \\left ( e_{y}\\cdot e_{y}\\right ) }} \\boldsymbol{e}_{y} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{x} Y^{y} - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{x} Y^{z} - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} X^{y} Y^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} - \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{z} Y^{y}}{\\sqrt{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} \\left ( e_{z}\\cdot e_{z}\\right ) + 2 \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} \\left ( e_{y}\\cdot e_{y}\\right ) }} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def basic_multivector_operations_2D():\r\n", - " Print_Function()\r\n", - " g2d = Ga('e*x|y')\r\n", - " (ex,ey) = g2d.mv()\r\n", - " print('g_{ij} =',g2d.g)\r\n", - " X = g2d.mv('X','vector')\r\n", - " A = g2d.mv('A','spinor')\r\n", - " print(X.Fmt(1,'X'))\r\n", - " print(A.Fmt(1,'A'))\r\n", - " print((X|A).Fmt(2,'X|A'))\r\n", - " print((XX).Fmt(2,'A>X'))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} X\\cdot A = - A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} + A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} X\\rfloor A = - A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} + A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A\\lfloor X = A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} - A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def basic_multivector_operations_2D_orthogonal():\r\n", - " Print_Function()\r\n", - " o2d = Ga('e*x|y',g=[1,1])\r\n", - " (ex,ey) = o2d.mv()\r\n", - " print('g_{ii} =',o2d.g)\r\n", - " X = o2d.mv('X','vector')\r\n", - " A = o2d.mv('A','spinor')\r\n", - " print(X.Fmt(1,'X'))\r\n", - " print(A.Fmt(1,'A'))\r\n", - " print((X*A).Fmt(2,'X*A'))\r\n", - " print((X|A).Fmt(2,'X|A'))\r\n", - " print((XA).Fmt(2,'X>A'))\r\n", - " print((A*X).Fmt(2,'A*X'))\r\n", - " print((A|X).Fmt(2,'A|X'))\r\n", - " print((AX).Fmt(2,'A>X'))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ii} = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} X A = \\left ( A X^{x} - A^{xy} X^{y}\\right ) \\boldsymbol{e}_{x} + \\left ( A X^{y} + A^{xy} X^{x}\\right ) \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} X\\cdot A = - A^{xy} X^{y} \\boldsymbol{e}_{x} + A^{xy} X^{x} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} X\\rfloor A = - A^{xy} X^{y} \\boldsymbol{e}_{x} + A^{xy} X^{x} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} X\\lfloor A = A X^{x} \\boldsymbol{e}_{x} + A X^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A X = \\left ( A X^{x} + A^{xy} X^{y}\\right ) \\boldsymbol{e}_{x} + \\left ( A X^{y} - A^{xy} X^{x}\\right ) \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A\\cdot X = A^{xy} X^{y} \\boldsymbol{e}_{x} - A^{xy} X^{x} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A\\rfloor X = A X^{x} \\boldsymbol{e}_{x} + A X^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A\\lfloor X = A^{xy} X^{y} \\boldsymbol{e}_{x} - A^{xy} X^{x} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def check_generalized_BAC_CAB_formulas():\r\n", - " Print_Function()\r\n", - " g4d = Ga('a b c d e')\r\n", - " (a,b,c,d,e) = g4d.mv()\r\n", - " print('g_{ij} =',g4d.g)\r\n", - " print('\\\\bm{a|(b*c)} =',a|(b*c))\r\n", - " print('\\\\bm{a|(b^c)} =',a|(b^c))\r\n", - " print('\\\\bm{a|(b^c^d)} =',a|(b^c^d))\r\n", - " print('\\\\bm{a|(b^c)+c|(a^b)+b|(c^a)} =',(a|(b^c))+(c|(a^b))+(b|(c^a)))\r\n", - " print('\\\\bm{a*(b^c)-b*(a^c)+c*(a^b)} =',a*(b^c)-b*(a^c)+c*(a^b))\r\n", - " print('\\\\bm{a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c)} =',a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c))\r\n", - " print('\\\\bm{(a^b)|(c^d)} =',(a^b)|(c^d))\r\n", - " print('\\\\bm{((a^b)|c)|d} =',((a^b)|c)|d)\r\n", - " print('\\\\bm{(a^b)\\\\times (c^d)} =',Ga.com(a^b,c^d))\r\n", - " print('\\\\bm{(a^b^c)(d^e)} =',((a^b^c)*(d^e)).Fmt(2))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} \\left ( a\\cdot a\\right ) & \\left ( a\\cdot b\\right ) & \\left ( a\\cdot c\\right ) & \\left ( a\\cdot d\\right ) & \\left ( a\\cdot e\\right ) \\\\ \\left ( a\\cdot b\\right ) & \\left ( b\\cdot b\\right ) & \\left ( b\\cdot c\\right ) & \\left ( b\\cdot d\\right ) & \\left ( b\\cdot e\\right ) \\\\ \\left ( a\\cdot c\\right ) & \\left ( b\\cdot c\\right ) & \\left ( c\\cdot c\\right ) & \\left ( c\\cdot d\\right ) & \\left ( c\\cdot e\\right ) \\\\ \\left ( a\\cdot d\\right ) & \\left ( b\\cdot d\\right ) & \\left ( c\\cdot d\\right ) & \\left ( d\\cdot d\\right ) & \\left ( d\\cdot e\\right ) \\\\ \\left ( a\\cdot e\\right ) & \\left ( b\\cdot e\\right ) & \\left ( c\\cdot e\\right ) & \\left ( d\\cdot e\\right ) & \\left ( e\\cdot e\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a\\cdot (b c)} = - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a\\cdot (b\\W c)} = - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a\\cdot (b\\W c\\W d)} = \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} + \\left ( a\\cdot b\\right ) \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} = 0 \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\r\n", - "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\r\n", - "\\begin{equation*} \\bm{(a\\W b)\\times (c\\W d)} = - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c} + \\left ( b\\cdot c\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{d} + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{equation*}\r\n", - " \\begin{align*} \\bm{(a\\W b\\W c)(d\\W e)} = & \\left ( - \\left ( b\\cdot d\\right ) \\left ( c\\cdot e\\right ) + \\left ( b\\cdot e\\right ) \\left ( c\\cdot d\\right ) \\right ) \\boldsymbol{a} + \\left ( \\left ( a\\cdot d\\right ) \\left ( c\\cdot e\\right ) - \\left ( a\\cdot e\\right ) \\left ( c\\cdot d\\right ) \\right ) \\boldsymbol{b} + \\left ( - \\left ( a\\cdot d\\right ) \\left ( b\\cdot e\\right ) + \\left ( a\\cdot e\\right ) \\left ( b\\cdot d\\right ) \\right ) \\boldsymbol{c} \\\\ & - \\left ( c\\cdot e\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{d} + \\left ( c\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{e} + \\left ( b\\cdot e\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{e} - \\left ( a\\cdot e\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{e} \\\\ & + \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d}\\wedge \\boldsymbol{e} \\end{align*} \r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def rounding_numerical_components():\r\n", - " Print_Function()\r\n", - " o3d = Ga('e_x e_y e_z',g=[1,1,1])\r\n", - " (ex,ey,ez) = o3d.mv()\r\n", - " X = 1.2*ex+2.34*ey+0.555*ez\r\n", - " Y = 0.333*ex+4*ey+5.3*ez\r\n", - " print('X =',X)\r\n", - " print('Nga(X,2) =',Nga(X,2))\r\n", - " print('X*Y =',X*Y)\r\n", - " print('Nga(X*Y,2) =',Nga(X*Y,2))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} X = 1 \\cdot 2 \\boldsymbol{e}_{x} + 2 \\cdot 34 \\boldsymbol{e}_{y} + 0 \\cdot 555 \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} Nga(X,2) = 1 \\cdot 2 \\boldsymbol{e}_{x} + 2 \\cdot 3 \\boldsymbol{e}_{y} + 0 \\cdot 55 \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} X Y = & 12 \\cdot 7011 \\\\ & + 4 \\cdot 02078 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6 \\cdot 175185 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10 \\cdot 182 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} Nga(X Y,2) = & 13 \\cdot 0 \\\\ & + 4 \\cdot 0 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6 \\cdot 2 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10 \\cdot 0 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def derivatives_in_rectangular_coordinates():\r\n", - " Print_Function()\r\n", - " X = (x,y,z) = symbols('x y z')\r\n", - " o3d = Ga('e_x e_y e_z',g=[1,1,1],coords=X)\r\n", - " (ex,ey,ez) = o3d.mv()\r\n", - " grad = o3d.grad\r\n", - " f = o3d.mv('f','scalar',f=True)\r\n", - " A = o3d.mv('A','vector',f=True)\r\n", - " B = o3d.mv('B','bivector',f=True)\r\n", - " C = o3d.mv('C','mv')\r\n", - " print('f =',f)\r\n", - " print('A =',A)\r\n", - " print('B =',B)\r\n", - " print('C =',C)\r\n", - " print('grad*f =',grad*f)\r\n", - " print('grad|A =',grad|A)\r\n", - " print('grad*A =',grad*A)\r\n", - " print('-I*(grad^A) =',-o3d.I()*(grad^A))\r\n", - " print('grad*B =',grad*B)\r\n", - " print('grad^B =',grad^B)\r\n", - " print('grad|B =',grad|B)\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} A = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} B = B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} C = & C \\\\ & + C^{x} \\boldsymbol{e}_{x} + C^{y} \\boldsymbol{e}_{y} + C^{z} \\boldsymbol{e}_{z} \\\\ & + C^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + C^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + C^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + C^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{x} f \\boldsymbol{e}_{x} + \\partial_{y} f \\boldsymbol{e}_{y} + \\partial_{z} f \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} A = & \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{z} A^{x} - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} B = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\\\ & + \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot B = \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def derivatives_in_spherical_coordinates():\r\n", - " Print_Function()\r\n", - " X = (r,th,phi) = symbols('r theta phi')\r\n", - " s3d = Ga('e_r e_theta e_phi',g=[1,r**2,r**2*sin(th)**2],coords=X,norm=True)\r\n", - " (er,eth,ephi) = s3d.mv()\r\n", - " grad = s3d.grad\r\n", - " f = s3d.mv('f','scalar',f=True)\r\n", - " A = s3d.mv('A','vector',f=True)\r\n", - " B = s3d.mv('B','bivector',f=True)\r\n", - " print('f =',f)\r\n", - " print('A =',A)\r\n", - " print('B =',B)\r\n", - " print('grad*f =',grad*f)\r\n", - " print('grad|A =',grad|A)\r\n", - " print('-I*(grad^A) =',(-s3d.E()*(grad^A)).simplify())\r\n", - " print('grad^B =',grad^B)\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} A = A^{r} \\boldsymbol{e}_{r} + A^{\\theta } \\boldsymbol{e}_{\\theta } + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} B = B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{r} f \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r \\sin{\\left (\\theta \\right )}} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{r \\partial_{r} A^{r} + 2 A^{r} + \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\theta } + \\frac{\\partial_{\\phi } A^{\\phi } }{\\sin{\\left (\\theta \\right )}}}{r} \\end{equation*}\r\n", - "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\frac{A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{r} + \\frac{- r \\partial_{r} A^{\\phi } - A^{\\phi } + \\frac{\\partial_{\\phi } A^{r} }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{\\theta } + \\frac{r \\partial_{r} A^{\\theta } + A^{\\theta } - \\partial_{\\theta } A^{r} }{r} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r \\partial_{r} B^{\\theta \\phi } - \\frac{B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} + 2 B^{\\theta \\phi } - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def noneuclidian_distance_calculation():\r\n", - " Print_Function()\r\n", - " from sympy import solve,sqrt\r\n", - " Fmt(1)\r\n", - " g = '0 # #,# 0 #,# # 1'\r\n", - " nel = Ga('X Y e',g=g)\r\n", - " (X,Y,e) = nel.mv()\r\n", - " print('g_{ij} =',nel.g)\r\n", - " print('%(X\\\\W Y)^{2} =',(X^Y)*(X^Y))\r\n", - " L = X^Y^e\r\n", - " B = L*e # D&L 10.152\r\n", - " Bsq = (B*B).scalar()\r\n", - " print('#%L = X\\\\W Y\\\\W e \\\\text{ is a non-euclidian line}')\r\n", - " print('B = L*e =',B)\r\n", - " BeBr =B*e*B.rev()\r\n", - " print('%BeB^{\\\\dagger} =',BeBr)\r\n", - " print('%B^{2} =',B*B)\r\n", - " print('%L^{2} =',L*L) # D&L 10.153\r\n", - " (s,c,Binv,M,S,C,alpha) = symbols('s c (1/B) M S C alpha')\r\n", - " XdotY = nel.g[0,1]\r\n", - " Xdote = nel.g[0,2]\r\n", - " Ydote = nel.g[1,2]\r\n", - " Bhat = Binv*B # D&L 10.154\r\n", - " R = c+s*Bhat # Rotor R = exp(alpha*Bhat/2)\r\n", - " print('#%s = \\\\f{\\\\sinh}{\\\\alpha/2} \\\\text{ and } c = \\\\f{\\\\cosh}{\\\\alpha/2}')\r\n", - " print('%e^{\\\\alpha B/{2\\\\abs{B}}} =',R)\r\n", - " Z = R*X*R.rev() # D&L 10.155\r\n", - " Z.obj = expand(Z.obj)\r\n", - " Z.obj = Z.obj.collect([Binv,s,c,XdotY])\r\n", - " Z.Fmt(3,'%RXR^{\\\\dagger}')\r\n", - " W = Z|Y # Extract scalar part of multivector\r\n", - " # From this point forward all calculations are with sympy scalars\r\n", - " #print '#Objective is to determine value of C = cosh(alpha) such that W = 0'\r\n", - " W = W.scalar()\r\n", - " print('%W = Z\\\\cdot Y =',W)\r\n", - " W = expand(W)\r\n", - " W = simplify(W)\r\n", - " W = W.collect([s*Binv])\r\n", - " M = 1/Bsq\r\n", - " W = W.subs(Binv**2,M)\r\n", - " W = simplify(W)\r\n", - " Bmag = sqrt(XdotY**2-2*XdotY*Xdote*Ydote)\r\n", - " W = W.collect([Binv*c*s,XdotY])\r\n", - " #Double angle substitutions\r\n", - " W = W.subs(2*XdotY**2-4*XdotY*Xdote*Ydote,2/(Binv**2))\r\n", - " W = W.subs(2*c*s,S)\r\n", - " W = W.subs(c**2,(C+1)/2)\r\n", - " W = W.subs(s**2,(C-1)/2)\r\n", - " W = simplify(W)\r\n", - " W = W.subs(1/Binv,Bmag)\r\n", - " W = expand(W)\r\n", - " print('#%S = \\\\f{\\\\sinh}{\\\\alpha} \\\\text{ and } C = \\\\f{\\\\cosh}{\\\\alpha}')\r\n", - " print('W =',W)\r\n", - " Wd = collect(W,[C,S],exact=True,evaluate=False)\r\n", - " Wd_1 = Wd[one]\r\n", - " Wd_C = Wd[C]\r\n", - " Wd_S = Wd[S]\r\n", - " print('%\\\\text{Scalar Coefficient} =',Wd_1)\r\n", - " print('%\\\\text{Cosh Coefficient} =',Wd_C)\r\n", - " print('%\\\\text{Sinh Coefficient} =',Wd_S)\r\n", - " print('%\\\\abs{B} =',Bmag)\r\n", - " Wd_1 = Wd_1.subs(Bmag,1/Binv)\r\n", - " Wd_C = Wd_C.subs(Bmag,1/Binv)\r\n", - " Wd_S = Wd_S.subs(Bmag,1/Binv)\r\n", - " lhs = Wd_1+Wd_C*C\r\n", - " rhs = -Wd_S*S\r\n", - " lhs = lhs**2\r\n", - " rhs = rhs**2\r\n", - " W = expand(lhs-rhs)\r\n", - " W = expand(W.subs(1/Binv**2,Bmag**2))\r\n", - " W = expand(W.subs(S**2,C**2-1))\r\n", - " W = W.collect([C,C**2],evaluate=False)\r\n", - " a = simplify(W[C**2])\r\n", - " b = simplify(W[C])\r\n", - " c = simplify(W[one])\r\n", - " print('#%\\\\text{Require } aC^{2}+bC+c = 0')\r\n", - " print('a =',a)\r\n", - " print('b =',b)\r\n", - " print('c =',c)\r\n", - " x = Symbol('x')\r\n", - " C = solve(a*x**2+b*x+c,x)[0]\r\n", - " print('%b^{2}-4ac =',simplify(b**2-4*a*c))\r\n", - " print('%\\\\f{\\\\cosh}{\\\\alpha} = C = -b/(2a) =',expand(simplify(expand(C))))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 0 & \\left ( X\\cdot Y\\right ) & \\left ( X\\cdot e\\right ) \\\\ \\left ( X\\cdot Y\\right ) & 0 & \\left ( Y\\cdot e\\right ) \\\\ \\left ( X\\cdot e\\right ) & \\left ( Y\\cdot e\\right ) & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} (X\\W Y)^{2} = \\left ( X\\cdot Y\\right ) ^{2} \\end{equation*}\r\n", - "\\begin{equation*} L = X\\W Y\\W e \\text{ is a non-euclidian line} \\end{equation*}\r\n", - "\\begin{equation*} B = L e = \\boldsymbol{X}\\wedge \\boldsymbol{Y} - \\left ( Y\\cdot e\\right ) \\boldsymbol{X}\\wedge \\boldsymbol{e} + \\left ( X\\cdot e\\right ) \\boldsymbol{Y}\\wedge \\boldsymbol{e} \\end{equation*}\r\n", - "\\begin{equation*} BeB^{\\dagger} = \\left ( X\\cdot Y\\right ) \\left(- \\left ( X\\cdot Y\\right ) + 2 \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\right) \\boldsymbol{e} \\end{equation*}\r\n", - "\\begin{equation*} B^{2} = \\left ( X\\cdot Y\\right ) \\left(\\left ( X\\cdot Y\\right ) - 2 \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\right) \\end{equation*}\r\n", - "\\begin{equation*} L^{2} = \\left ( X\\cdot Y\\right ) \\left(\\left ( X\\cdot Y\\right ) - 2 \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\right) \\end{equation*}\r\n", - "\\begin{equation*} s = \\f{\\sinh}{\\alpha/2} \\text{ and } c = \\f{\\cosh}{\\alpha/2} \\end{equation*}\r\n", - "\\begin{equation*} e^{\\alpha B/{2\\abs{B}}} = c + (1/B) s \\boldsymbol{X}\\wedge \\boldsymbol{Y} - (1/B) \\left ( Y\\cdot e\\right ) s \\boldsymbol{X}\\wedge \\boldsymbol{e} + (1/B) \\left ( X\\cdot e\\right ) s \\boldsymbol{Y}\\wedge \\boldsymbol{e} \\end{equation*}\r\n", - "\\begin{equation*} W = Z\\cdot Y = (1/B)^{2} \\left ( X\\cdot Y\\right ) ^{3} s^{2} - 4 (1/B)^{2} \\left ( X\\cdot Y\\right ) ^{2} \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) s^{2} + 4 (1/B)^{2} \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) ^{2} \\left ( Y\\cdot e\\right ) ^{2} s^{2} + 2 (1/B) \\left ( X\\cdot Y\\right ) ^{2} c s - 4 (1/B) \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) c s + \\left ( X\\cdot Y\\right ) c^{2} \\end{equation*}\r\n", - "\\begin{equation*} S = \\f{\\sinh}{\\alpha} \\text{ and } C = \\f{\\cosh}{\\alpha} \\end{equation*}\r\n", - "\\begin{equation*} W = (1/B) \\left ( X\\cdot Y\\right ) C \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } - (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) C \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + S \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\r\n", - "\\begin{equation*} \\text{Scalar Coefficient} = (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\r\n", - "\\begin{equation*} \\text{Cosh Coefficient} = (1/B) \\left ( X\\cdot Y\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } - (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\r\n", - "\\begin{equation*} \\text{Sinh Coefficient} = \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\r\n", - "\\begin{equation*} \\abs{B} = \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\r\n", - "\\begin{equation*} \\text{Require } aC^{2}+bC+c = 0 \\end{equation*}\r\n", - "\\begin{equation*} a = \\left ( X\\cdot e\\right ) ^{2} \\left ( Y\\cdot e\\right ) ^{2} \\end{equation*}\r\n", - "\\begin{equation*} b = 2 \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\left(\\left ( X\\cdot Y\\right ) - \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\right) \\end{equation*}\r\n", - "\\begin{equation*} c = \\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) + \\left ( X\\cdot e\\right ) ^{2} \\left ( Y\\cdot e\\right ) ^{2} \\end{equation*}\r\n", - "\\begin{equation*} b^{2}-4ac = 0 \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\cosh}{\\alpha} = C = -b/(2a) = - \\frac{\\left ( X\\cdot Y\\right ) }{\\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + 1 \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def conformal_representations_of_circles_lines_spheres_and_planes():\r\n", - " Print_Function()\r\n", - " global n,nbar\r\n", - " Fmt(1)\r\n", - " g = '1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 2,0 0 0 2 0'\r\n", - " c3d = Ga('e_1 e_2 e_3 n \\\\bar{n}',g=g)\r\n", - " (e1,e2,e3,n,nbar) = c3d.mv()\r\n", - " print('g_{ij} =',c3d.g)\r\n", - " e = n+nbar\r\n", - " #conformal representation of points\r\n", - " A = make_vector(e1, ga=c3d) # point a = (1,0,0) A = F(a)\r\n", - " B = make_vector(e2, ga=c3d) # point b = (0,1,0) B = F(b)\r\n", - " C = make_vector(-e1, ga=c3d) # point c = (-1,0,0) C = F(c)\r\n", - " D = make_vector(e3, ga=c3d) # point d = (0,0,1) D = F(d)\r\n", - " X = make_vector('x',3, ga=c3d)\r\n", - " print('F(a) =',A)\r\n", - " print('F(b) =',B)\r\n", - " print('F(c) =',C)\r\n", - " print('F(d) =',D)\r\n", - " print('F(x) =',X)\r\n", - " print('#a = e1, b = e2, c = -e1, and d = e3')\r\n", - " print('#A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.')\r\n", - " print('#Circle through a, b, and c')\r\n", - " print('Circle: A^B^C^X = 0 =',(A^B^C^X))\r\n", - " print('#Line through a and b')\r\n", - " print('Line : A^B^n^X = 0 =',(A^B^n^X))\r\n", - " print('#Sphere through a, b, c, and d')\r\n", - " print('Sphere: A^B^C^D^X = 0 =',(((A^B)^C)^D)^X)\r\n", - " print('#Plane through a, b, and d')\r\n", - " print('Plane : A^B^n^D^X = 0 =',(A^B^n^D^X))\r\n", - " L = (A^B^e)^X\r\n", - " L.Fmt(3,'Hyperbolic\\\\;\\\\; Circle: (A^B^e)^X = 0')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} 1 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 2 \\\\ 0 & 0 & 0 & 2 & 0 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} F(a) = \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\begin{equation*} F(b) = \\boldsymbol{e}_{2} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\begin{equation*} F(c) = - \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\begin{equation*} F(d) = \\boldsymbol{e}_{3} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\begin{equation*} F(x) = x_{1} \\boldsymbol{e}_{1} + x_{2} \\boldsymbol{e}_{2} + x_{3} \\boldsymbol{e}_{3} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2}\\right ) \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "a = e1, b = e2, c = -e1, and d = e3\r\n", - "A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.\r\n", - "Circle through a, b, and c\r\n", - "\\begin{equation*} Circle: A\\W B\\W C\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{\\bar{n}} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "Line through a and b\r\n", - "\\begin{equation*} Line : A\\W B\\W n\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + \\left ( \\frac{x_{1}}{2} + \\frac{x_{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} + \\frac{x_{3}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} - \\frac{x_{3}}{2} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "Sphere through a, b, c, and d\r\n", - "\\begin{equation*} Sphere: A\\W B\\W C\\W D\\W X = 0 = \\left ( - \\frac{{\\left ( x_{1} \\right )}^{2}}{2} - \\frac{{\\left ( x_{2} \\right )}^{2}}{2} - \\frac{{\\left ( x_{3} \\right )}^{2}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "Plane through a, b, and d\r\n", - "\\begin{equation*} Plane : A\\W B\\W n\\W D\\W X = 0 = \\left ( - \\frac{x_{1}}{2} - \\frac{x_{2}}{2} - \\frac{x_{3}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def properties_of_geometric_objects():\r\n", - " Print_Function()\r\n", - " global n, nbar\r\n", - " Fmt(1)\r\n", - " g = '# # # 0 0,'+ \\\r\n", - " '# # # 0 0,'+ \\\r\n", - " '# # # 0 0,'+ \\\r\n", - " '0 0 0 0 2,'+ \\\r\n", - " '0 0 0 2 0'\r\n", - " c3d = Ga('p1 p2 p3 n \\\\bar{n}',g=g)\r\n", - " (p1,p2,p3,n,nbar) = c3d.mv()\r\n", - " print('g_{ij} =',c3d.g)\r\n", - " P1 = F(p1)\r\n", - " P2 = F(p2)\r\n", - " P3 = F(p3)\r\n", - " print('\\\\text{Extracting direction of line from }L = P1\\\\W P2\\\\W n')\r\n", - " L = P1^P2^n\r\n", - " delta = (L|n)|nbar\r\n", - " print('(L|n)|\\\\bar{n} =',delta)\r\n", - " print('\\\\text{Extracting plane of circle from }C = P1\\\\W P2\\\\W P3')\r\n", - " C = P1^P2^P3\r\n", - " delta = ((C^n)|n)|nbar\r\n", - " print('((C^n)|n)|\\\\bar{n}=',delta)\r\n", - " print('(p2-p1)^(p3-p1)=',(p2-p1)^(p3-p1))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} \\left ( p_{1}\\cdot p_{1}\\right ) & \\left ( p_{1}\\cdot p_{2}\\right ) & \\left ( p_{1}\\cdot p_{3}\\right ) & 0 & 0 \\\\ \\left ( p_{1}\\cdot p_{2}\\right ) & \\left ( p_{2}\\cdot p_{2}\\right ) & \\left ( p_{2}\\cdot p_{3}\\right ) & 0 & 0 \\\\ \\left ( p_{1}\\cdot p_{3}\\right ) & \\left ( p_{2}\\cdot p_{3}\\right ) & \\left ( p_{3}\\cdot p_{3}\\right ) & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 2 \\\\ 0 & 0 & 0 & 2 & 0 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\text{Extracting direction of line from }L = P1\\W P2\\W n \\end{equation*}\r\n", - "\\begin{equation*} (L\\cdot n)\\cdot \\bar{n} = 2 \\boldsymbol{p}_{1} -2 \\boldsymbol{p}_{2} \\end{equation*}\r\n", - "\\begin{equation*} \\text{Extracting plane of circle from }C = P1\\W P2\\W P3 \\end{equation*}\r\n", - "\\begin{equation*} ((C\\W n)\\cdot n)\\cdot \\bar{n}= 2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} -2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} + 2 \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{equation*}\r\n", - "\\begin{equation*} (p2-p1)\\W (p3-p1)= \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} - \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} + \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def extracting_vectors_from_conformal_2_blade():\r\n", - " Print_Function()\r\n", - " Fmt(1)\r\n", - " print(r'B = P1\\W P2')\r\n", - " g = '0 -1 #,'+ \\\r\n", - " '-1 0 #,'+ \\\r\n", - " '# # #'\r\n", - " c2b = Ga('P1 P2 a',g=g)\r\n", - " (P1,P2,a) = c2b.mv()\r\n", - " print('g_{ij} =',c2b.g)\r\n", - " B = P1^P2\r\n", - " Bsq = B*B\r\n", - " print('%B^{2} =',Bsq)\r\n", - " ap = a-(a^B)*B\r\n", - " print(\"a' = a-(a^B)*B =\",ap)\r\n", - " Ap = ap+ap*B\r\n", - " Am = ap-ap*B\r\n", - " print(\"A+ = a'+a'*B =\",Ap)\r\n", - " print(\"A- = a'-a'*B =\",Am)\r\n", - " print('%(A+)^{2} =',Ap*Ap)\r\n", - " print('%(A-)^{2} =',Am*Am)\r\n", - " aB = a|B\r\n", - " print('a|B =',aB)\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} B = P1\\W P2 \\end{equation*}\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 0 & -1 & \\left ( P_{1}\\cdot a\\right ) \\\\ -1 & 0 & \\left ( P_{2}\\cdot a\\right ) \\\\ \\left ( P_{1}\\cdot a\\right ) & \\left ( P_{2}\\cdot a\\right ) & \\left ( a\\cdot a\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} B^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} a' = a-(a\\W B) B = - \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} - \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{equation*}\r\n", - "\\begin{equation*} A+ = a'+a' B = - 2 \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} \\end{equation*}\r\n", - "\\begin{equation*} A- = a'-a' B = - 2 \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{equation*}\r\n", - "\\begin{equation*} (A+)^{2} = 0 \\end{equation*}\r\n", - "\\begin{equation*} (A-)^{2} = 0 \\end{equation*}\r\n", - "\\begin{equation*} a\\cdot B = - \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} + \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def reciprocal_frame_test():\r\n", - " Print_Function()\r\n", - " Fmt(1)\r\n", - " g = '1 # #,'+ \\\r\n", - " '# 1 #,'+ \\\r\n", - " '# # 1'\r\n", - " ng3d = Ga('e1 e2 e3',g=g)\r\n", - " (e1,e2,e3) = ng3d.mv()\r\n", - " print('g_{ij} =',ng3d.g)\r\n", - " E = e1^e2^e3\r\n", - " Esq = (E*E).scalar()\r\n", - " print('E =',E)\r\n", - " print('%E^{2} =',Esq)\r\n", - " Esq_inv = 1/Esq\r\n", - " E1 = (e2^e3)*E\r\n", - " E2 = (-1)*(e1^e3)*E\r\n", - " E3 = (e1^e2)*E\r\n", - " print('E1 = (e2^e3)*E =',E1)\r\n", - " print('E2 =-(e1^e3)*E =',E2)\r\n", - " print('E3 = (e1^e2)*E =',E3)\r\n", - " w = (E1|e2)\r\n", - " w = w.expand()\r\n", - " print('E1|e2 =',w)\r\n", - " w = (E1|e3)\r\n", - " w = w.expand()\r\n", - " print('E1|e3 =',w)\r\n", - " w = (E2|e1)\r\n", - " w = w.expand()\r\n", - " print('E2|e1 =',w)\r\n", - " w = (E2|e3)\r\n", - " w = w.expand()\r\n", - " print('E2|e3 =',w)\r\n", - " w = (E3|e1)\r\n", - " w = w.expand()\r\n", - " print('E3|e1 =',w)\r\n", - " w = (E3|e2)\r\n", - " w = w.expand()\r\n", - " print('E3|e2 =',w)\r\n", - " w = (E1|e1)\r\n", - " w = (w.expand()).scalar()\r\n", - " Esq = expand(Esq)\r\n", - " print('%(E1\\\\cdot e1)/E^{2} =',simplify(w/Esq))\r\n", - " w = (E2|e2)\r\n", - " w = (w.expand()).scalar()\r\n", - " print('%(E2\\\\cdot e2)/E^{2} =',simplify(w/Esq))\r\n", - " w = (E3|e3)\r\n", - " w = (w.expand()).scalar()\r\n", - " print('%(E3\\\\cdot e3)/E^{2} =',simplify(w/Esq))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 1 & \\left ( e_{1}\\cdot e_{2}\\right ) & \\left ( e_{1}\\cdot e_{3}\\right ) \\\\ \\left ( e_{1}\\cdot e_{2}\\right ) & 1 & \\left ( e_{2}\\cdot e_{3}\\right ) \\\\ \\left ( e_{1}\\cdot e_{3}\\right ) & \\left ( e_{2}\\cdot e_{3}\\right ) & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} E = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} E^{2} = \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 2 \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} + \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1 \\end{equation*}\r\n", - "\\begin{equation*} E1 = (e2\\W e3) E = \\left ( \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} E2 =-(e1\\W e3) E = \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} + \\left ( \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} E3 = (e1\\W e2) E = \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} E1\\cdot e2 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E1\\cdot e3 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E2\\cdot e1 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E2\\cdot e3 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E3\\cdot e1 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E3\\cdot e2 = 0 \\end{equation*}\r\n", - "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def signature_test():\r\n", - " Print_Function()\r\n", - " e3d = Ga('e1 e2 e3',g=[1,1,1])\r\n", - " print('g =', e3d.g)\r\n", - " print(r'%Signature = (3,0)\\: I =', e3d.I(),'\\: I^{2} =', e3d.I()*e3d.I())\r\n", - " e3d = Ga('e1 e2 e3',g=[2,2,2])\r\n", - " print('g =', e3d.g)\r\n", - " print(r'%Signature = (3,0)\\: I =', e3d.I(),'|; I^{2} =', e3d.I()*e3d.I())\r\n", - " sp4d = Ga('e1 e2 e3 e4',g=[1,-1,-1,-1])\r\n", - " print('g =', sp4d.g)\r\n", - " print(r'%Signature = (1,3)\\: I =', sp4d.I(),'\\: I^{2} =', sp4d.I()*sp4d.I())\r\n", - " sp4d = Ga('e1 e2 e3 e4',g=[2,-2,-2,-2])\r\n", - " print('g =', sp4d.g)\r\n", - " print(r'%Signature = (1,3)\\: I =', sp4d.I(),'\\: I^{2} =', sp4d.I()*sp4d.I())\r\n", - " e4d = Ga('e1 e2 e3 e4',g=[1,1,1,1])\r\n", - " print('g =', e4d.g)\r\n", - " print(r'%Signature = (4,0)\\: I =', e4d.I(),'\\: I^{2} =', e4d.I()*e4d.I())\r\n", - " cf3d = Ga('e1 e2 e3 e4 e5',g=[1,1,1,1,-1])\r\n", - " print('g =', cf3d.g)\r\n", - " print(r'%Signature = (4,1)\\: I =', cf3d.I(),'\\: I^{2} =', cf3d.I()*cf3d.I())\r\n", - " cf3d = Ga('e1 e2 e3 e4 e5',g=[2,2,2,2,-2])\r\n", - " print('g =', cf3d.g)\r\n", - " print(r'%Signature = (4,1)\\: I =', cf3d.I(),'\\: I^{2} =', cf3d.I()*cf3d.I())\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} Signature = (3,0)\\: I = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\: I^{2} = -1 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 2 & 0 & 0 \\\\ 0 & 2 & 0 \\\\ 0 & 0 & 2 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} Signature = (3,0)\\: I = \\frac{\\sqrt{2}}{4} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} |; I^{2} = -1 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0 \\\\ 0 & -1 & 0 & 0 \\\\ 0 & 0 & -1 & 0 \\\\ 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} Signature = (1,3)\\: I = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\: I^{2} = -1 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 2 & 0 & 0 & 0 \\\\ 0 & -2 & 0 & 0 \\\\ 0 & 0 & -2 & 0 \\\\ 0 & 0 & 0 & -2 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} Signature = (1,3)\\: I = \\frac{1}{4} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\: I^{2} = -1 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} Signature = (4,0)\\: I = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\: I^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{ccccc} 1 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 \\\\ 0 & 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} Signature = (4,1)\\: I = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4}\\wedge \\boldsymbol{e}_{5} \\: I^{2} = -1 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{ccccc} 2 & 0 & 0 & 0 & 0 \\\\ 0 & 2 & 0 & 0 & 0 \\\\ 0 & 0 & 2 & 0 & 0 \\\\ 0 & 0 & 0 & 2 & 0 \\\\ 0 & 0 & 0 & 0 & -2 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} Signature = (4,1)\\: I = \\frac{\\sqrt{2}}{8} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4}\\wedge \\boldsymbol{e}_{5} \\: I^{2} = -1 \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def Fmt_test():\r\n", - " Print_Function()\r\n", - " e3d = Ga('e1 e2 e3',g=[1,1,1])\r\n", - " v = e3d.mv('v','vector')\r\n", - " B = e3d.mv('B','bivector')\r\n", - " M = e3d.mv('M','mv')\r\n", - " Fmt(2)\r\n", - " print('#Global $Fmt = 2$')\r\n", - " print('v =',v)\r\n", - " print('B =',B)\r\n", - " print('M =',M)\r\n", - " print('#Using $.Fmt()$ Function')\r\n", - " print('v.Fmt(3) =',v.Fmt(3))\r\n", - " print('B.Fmt(3) =',B.Fmt(3))\r\n", - " print('M.Fmt(2) =',M.Fmt(2))\r\n", - " print('M.Fmt(1) =',M.Fmt(1))\r\n", - " print('#Global $Fmt = 1$')\r\n", - " Fmt(1)\r\n", - " print('v =',v)\r\n", - " print('B =',B)\r\n", - " print('M =',M)\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "Global $Fmt = 2$\r\n", - "\\begin{equation*} v = v^{1} \\boldsymbol{e}_{1} + v^{2} \\boldsymbol{e}_{2} + v^{3} \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} B = B^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + B^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + B^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\r\n", - " \\begin{align*} M = & M \\\\ & + M^{1} \\boldsymbol{e}_{1} + M^{2} \\boldsymbol{e}_{2} + M^{3} \\boldsymbol{e}_{3} \\\\ & + M^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + M^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + M^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\\\ & + M^{123} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{align*} \r\n", - "Using $.Fmt()$ Function\r\n", - " \\begin{align*} v \\cdot Fmt(3) = & v^{1} \\boldsymbol{e}_{1} \\\\ & + v^{2} \\boldsymbol{e}_{2} \\\\ & + v^{3} \\boldsymbol{e}_{3} \\end{align*} \r\n", - " \\begin{align*} B \\cdot Fmt(3) = & B^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} \\\\ & + B^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} \\\\ & + B^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{align*} \r\n", - " \\begin{align*} M \\cdot Fmt(2) = & M \\\\ & + M^{1} \\boldsymbol{e}_{1} + M^{2} \\boldsymbol{e}_{2} + M^{3} \\boldsymbol{e}_{3} \\\\ & + M^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + M^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + M^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\\\ & + M^{123} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{align*} \r\n", - "\\begin{equation*} M \\cdot Fmt(1) = M + M^{1} \\boldsymbol{e}_{1} + M^{2} \\boldsymbol{e}_{2} + M^{3} \\boldsymbol{e}_{3} + M^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + M^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + M^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} + M^{123} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "Global $Fmt = 1$\r\n", - "\\begin{equation*} v = v^{1} \\boldsymbol{e}_{1} + v^{2} \\boldsymbol{e}_{2} + v^{3} \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} B = B^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + B^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + B^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} M = M + M^{1} \\boldsymbol{e}_{1} + M^{2} \\boldsymbol{e}_{2} + M^{3} \\boldsymbol{e}_{3} + M^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + M^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + M^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} + M^{123} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def basic_multivector_operations_3D():\n", + " Print_Function()\n", + " g3d = Ga('e*x|y|z')\n", + " (ex,ey,ez) = g3d.mv()\n", + " A = g3d.mv('A','mv')\n", + " print(A.Fmt(1,'A'))\n", + " print(A.Fmt(2,'A'))\n", + " print(A.Fmt(3,'A'))\n", + " print(A.even().Fmt(1,'%A_{+}'))\n", + " print(A.odd().Fmt(1,'%A_{-}'))\n", + " X = g3d.mv('X','vector')\n", + " Y = g3d.mv('Y','vector')\n", + " print('g_{ij} = ',g3d.g)\n", + " print(X.Fmt(1,'X'))\n", + " print(Y.Fmt(1,'Y'))\n", + " print((X*Y).Fmt(2,'X*Y'))\n", + " print((X^Y).Fmt(2,'X^Y'))\n", + " print((X|Y).Fmt(2,'X|Y'))\n", + " print(cross(X,Y).Fmt(1,r'X\\times Y'))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} A = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} A_{+} = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} A_{-} = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{x}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{z}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) & \\left ( e_{z}\\cdot e_{z}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} X Y = & \\left ( \\left ( e_{x}\\cdot e_{x}\\right ) X^{x} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{y} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{z}\\right ) \\\\ & + \\left ( X^{x} Y^{y} - X^{y} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( X^{x} Y^{z} - X^{z} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( X^{y} Y^{z} - X^{z} Y^{y}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} X\\W Y = \\left ( X^{x} Y^{y} - X^{y} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( X^{x} Y^{z} - X^{z} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( X^{y} Y^{z} - X^{z} Y^{y}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} X\\cdot Y = \\left ( e_{x}\\cdot e_{x}\\right ) X^{x} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{y} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{z} \\end{equation*}\n", + "\\begin{equation*} X\\times Y = \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{x} Y^{y} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{x} Y^{z} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{x} - \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{x} - \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{y} Y^{z} - \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{y} - \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} X^{z} Y^{y}}{\\sqrt{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} \\left ( e_{z}\\cdot e_{z}\\right ) + 2 \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} \\left ( e_{y}\\cdot e_{y}\\right ) }} \\boldsymbol{e}_{x} + \\frac{- \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{x} - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{y} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) X^{y} Y^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} X^{x} Y^{z} - \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} X^{z} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} - \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y}}{\\sqrt{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} \\left ( e_{z}\\cdot e_{z}\\right ) + 2 \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} \\left ( e_{y}\\cdot e_{y}\\right ) }} \\boldsymbol{e}_{y} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{x} Y^{y} - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{x} Y^{z} - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} X^{y} Y^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} - \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} - \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) X^{z} Y^{y}}{\\sqrt{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) \\left ( e_{z}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) ^{2} - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2} \\left ( e_{z}\\cdot e_{z}\\right ) + 2 \\left ( e_{x}\\cdot e_{y}\\right ) \\left ( e_{x}\\cdot e_{z}\\right ) \\left ( e_{y}\\cdot e_{z}\\right ) - \\left ( e_{x}\\cdot e_{z}\\right ) ^{2} \\left ( e_{y}\\cdot e_{y}\\right ) }} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def basic_multivector_operations_2D():\n", + " Print_Function()\n", + " g2d = Ga('e*x|y')\n", + " (ex,ey) = g2d.mv()\n", + " print('g_{ij} =',g2d.g)\n", + " X = g2d.mv('X','vector')\n", + " A = g2d.mv('A','spinor')\n", + " print(X.Fmt(1,'X'))\n", + " print(A.Fmt(1,'A'))\n", + " print((X|A).Fmt(2,'X|A'))\n", + " print((XX).Fmt(2,'A>X'))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} X\\cdot A = - A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} + A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} X\\rfloor A = - A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} + A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A\\lfloor X = A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} - A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def basic_multivector_operations_2D_orthogonal():\n", + " Print_Function()\n", + " o2d = Ga('e*x|y',g=[1,1])\n", + " (ex,ey) = o2d.mv()\n", + " print('g_{ii} =',o2d.g)\n", + " X = o2d.mv('X','vector')\n", + " A = o2d.mv('A','spinor')\n", + " print(X.Fmt(1,'X'))\n", + " print(A.Fmt(1,'A'))\n", + " print((X*A).Fmt(2,'X*A'))\n", + " print((X|A).Fmt(2,'X|A'))\n", + " print((XA).Fmt(2,'X>A'))\n", + " print((A*X).Fmt(2,'A*X'))\n", + " print((A|X).Fmt(2,'A|X'))\n", + " print((AX).Fmt(2,'A>X'))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ii} = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} X A = \\left ( A X^{x} - A^{xy} X^{y}\\right ) \\boldsymbol{e}_{x} + \\left ( A X^{y} + A^{xy} X^{x}\\right ) \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} X\\cdot A = - A^{xy} X^{y} \\boldsymbol{e}_{x} + A^{xy} X^{x} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} X\\rfloor A = - A^{xy} X^{y} \\boldsymbol{e}_{x} + A^{xy} X^{x} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} X\\lfloor A = A X^{x} \\boldsymbol{e}_{x} + A X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A X = \\left ( A X^{x} + A^{xy} X^{y}\\right ) \\boldsymbol{e}_{x} + \\left ( A X^{y} - A^{xy} X^{x}\\right ) \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A\\cdot X = A^{xy} X^{y} \\boldsymbol{e}_{x} - A^{xy} X^{x} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A\\rfloor X = A X^{x} \\boldsymbol{e}_{x} + A X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A\\lfloor X = A^{xy} X^{y} \\boldsymbol{e}_{x} - A^{xy} X^{x} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def check_generalized_BAC_CAB_formulas():\n", + " Print_Function()\n", + " g4d = Ga('a b c d e')\n", + " (a,b,c,d,e) = g4d.mv()\n", + " print('g_{ij} =',g4d.g)\n", + " print('\\\\bm{a|(b*c)} =',a|(b*c))\n", + " print('\\\\bm{a|(b^c)} =',a|(b^c))\n", + " print('\\\\bm{a|(b^c^d)} =',a|(b^c^d))\n", + " print('\\\\bm{a|(b^c)+c|(a^b)+b|(c^a)} =',(a|(b^c))+(c|(a^b))+(b|(c^a)))\n", + " print('\\\\bm{a*(b^c)-b*(a^c)+c*(a^b)} =',a*(b^c)-b*(a^c)+c*(a^b))\n", + " print('\\\\bm{a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c)} =',a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c))\n", + " print('\\\\bm{(a^b)|(c^d)} =',(a^b)|(c^d))\n", + " print('\\\\bm{((a^b)|c)|d} =',((a^b)|c)|d)\n", + " print('\\\\bm{(a^b)\\\\times (c^d)} =',Ga.com(a^b,c^d))\n", + " print('\\\\bm{(a^b^c)(d^e)} =',((a^b^c)*(d^e)).Fmt(2))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} \\left ( a\\cdot a\\right ) & \\left ( a\\cdot b\\right ) & \\left ( a\\cdot c\\right ) & \\left ( a\\cdot d\\right ) & \\left ( a\\cdot e\\right ) \\\\ \\left ( a\\cdot b\\right ) & \\left ( b\\cdot b\\right ) & \\left ( b\\cdot c\\right ) & \\left ( b\\cdot d\\right ) & \\left ( b\\cdot e\\right ) \\\\ \\left ( a\\cdot c\\right ) & \\left ( b\\cdot c\\right ) & \\left ( c\\cdot c\\right ) & \\left ( c\\cdot d\\right ) & \\left ( c\\cdot e\\right ) \\\\ \\left ( a\\cdot d\\right ) & \\left ( b\\cdot d\\right ) & \\left ( c\\cdot d\\right ) & \\left ( d\\cdot d\\right ) & \\left ( d\\cdot e\\right ) \\\\ \\left ( a\\cdot e\\right ) & \\left ( b\\cdot e\\right ) & \\left ( c\\cdot e\\right ) & \\left ( d\\cdot e\\right ) & \\left ( e\\cdot e\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\bm{a\\cdot (b c)} = - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}\n", + "\\begin{equation*} \\bm{a\\cdot (b\\W c)} = - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}\n", + "\\begin{equation*} \\bm{a\\cdot (b\\W c\\W d)} = \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} + \\left ( a\\cdot b\\right ) \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n", + "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} = 0 \\end{equation*}\n", + "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\n", + "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n", + "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\n", + "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\n", + "\\begin{equation*} \\bm{(a\\W b)\\times (c\\W d)} = - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c} + \\left ( b\\cdot c\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{d} + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{equation*}\n", + " \\begin{align*} \\bm{(a\\W b\\W c)(d\\W e)} = & \\left ( - \\left ( b\\cdot d\\right ) \\left ( c\\cdot e\\right ) + \\left ( b\\cdot e\\right ) \\left ( c\\cdot d\\right ) \\right ) \\boldsymbol{a} + \\left ( \\left ( a\\cdot d\\right ) \\left ( c\\cdot e\\right ) - \\left ( a\\cdot e\\right ) \\left ( c\\cdot d\\right ) \\right ) \\boldsymbol{b} + \\left ( - \\left ( a\\cdot d\\right ) \\left ( b\\cdot e\\right ) + \\left ( a\\cdot e\\right ) \\left ( b\\cdot d\\right ) \\right ) \\boldsymbol{c} \\\\ & - \\left ( c\\cdot e\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{d} + \\left ( c\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{e} + \\left ( b\\cdot e\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{e} - \\left ( a\\cdot e\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{e} \\\\ & + \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d}\\wedge \\boldsymbol{e} \\end{align*} \n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def rounding_numerical_components():\n", + " Print_Function()\n", + " o3d = Ga('e_x e_y e_z',g=[1,1,1])\n", + " (ex,ey,ez) = o3d.mv()\n", + " X = 1.2*ex+2.34*ey+0.555*ez\n", + " Y = 0.333*ex+4*ey+5.3*ez\n", + " print('X =',X)\n", + " print('Nga(X,2) =',Nga(X,2))\n", + " print('X*Y =',X*Y)\n", + " print('Nga(X*Y,2) =',Nga(X*Y,2))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} X = 1 \\cdot 2 \\boldsymbol{e}_{x} + 2 \\cdot 34 \\boldsymbol{e}_{y} + 0 \\cdot 555 \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} Nga(X,2) = 1 \\cdot 2 \\boldsymbol{e}_{x} + 2 \\cdot 3 \\boldsymbol{e}_{y} + 0 \\cdot 55 \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} X Y = & 12 \\cdot 7011 \\\\ & + 4 \\cdot 02078 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6 \\cdot 175185 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10 \\cdot 182 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} Nga(X Y,2) = & 13 \\cdot 0 \\\\ & + 4 \\cdot 0 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6 \\cdot 2 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10 \\cdot 0 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def derivatives_in_rectangular_coordinates():\n", + " Print_Function()\n", + " X = (x,y,z) = symbols('x y z')\n", + " o3d = Ga('e_x e_y e_z',g=[1,1,1],coords=X)\n", + " (ex,ey,ez) = o3d.mv()\n", + " grad = o3d.grad\n", + " f = o3d.mv('f','scalar',f=True)\n", + " A = o3d.mv('A','vector',f=True)\n", + " B = o3d.mv('B','bivector',f=True)\n", + " C = o3d.mv('C','mv')\n", + " print('f =',f)\n", + " print('A =',A)\n", + " print('B =',B)\n", + " print('C =',C)\n", + " print('grad*f =',grad*f)\n", + " print('grad|A =',grad|A)\n", + " print('grad*A =',grad*A)\n", + " print('-I*(grad^A) =',-o3d.I()*(grad^A))\n", + " print('grad*B =',grad*B)\n", + " print('grad^B =',grad^B)\n", + " print('grad|B =',grad|B)\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} A = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} B = B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} C = & C \\\\ & + C^{x} \\boldsymbol{e}_{x} + C^{y} \\boldsymbol{e}_{y} + C^{z} \\boldsymbol{e}_{z} \\\\ & + C^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + C^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + C^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + C^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{x} f \\boldsymbol{e}_{x} + \\partial_{y} f \\boldsymbol{e}_{y} + \\partial_{z} f \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\n", + " \\begin{align*} \\boldsymbol{\\nabla} A = & \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{z} A^{x} - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} \\boldsymbol{\\nabla} B = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\\\ & + \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot B = \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def derivatives_in_spherical_coordinates():\n", + " Print_Function()\n", + " X = (r,th,phi) = symbols('r theta phi')\n", + " s3d = Ga('e_r e_theta e_phi',g=[1,r**2,r**2*sin(th)**2],coords=X,norm=True)\n", + " (er,eth,ephi) = s3d.mv()\n", + " grad = s3d.grad\n", + " f = s3d.mv('f','scalar',f=True)\n", + " A = s3d.mv('A','vector',f=True)\n", + " B = s3d.mv('B','bivector',f=True)\n", + " print('f =',f)\n", + " print('A =',A)\n", + " print('B =',B)\n", + " print('grad*f =',grad*f)\n", + " print('grad|A =',grad|A)\n", + " print('-I*(grad^A) =',(-s3d.E()*(grad^A)).simplify())\n", + " print('grad^B =',grad^B)\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} A = A^{r} \\boldsymbol{e}_{r} + A^{\\theta } \\boldsymbol{e}_{\\theta } + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} B = B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{r} f \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r \\sin{\\left (\\theta \\right )}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{r \\partial_{r} A^{r} + 2 A^{r} + \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\theta } + \\frac{\\partial_{\\phi } A^{\\phi } }{\\sin{\\left (\\theta \\right )}}}{r} \\end{equation*}\n", + "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\frac{A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{r} + \\frac{- r \\partial_{r} A^{\\phi } - A^{\\phi } + \\frac{\\partial_{\\phi } A^{r} }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{\\theta } + \\frac{r \\partial_{r} A^{\\theta } + A^{\\theta } - \\partial_{\\theta } A^{r} }{r} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r \\partial_{r} B^{\\theta \\phi } - \\frac{B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} + 2 B^{\\theta \\phi } - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def noneuclidian_distance_calculation():\n", + " Print_Function()\n", + " from sympy import solve,sqrt\n", + " Fmt(1)\n", + " g = '0 # #,# 0 #,# # 1'\n", + " nel = Ga('X Y e',g=g)\n", + " (X,Y,e) = nel.mv()\n", + " print('g_{ij} =',nel.g)\n", + " print('%(X\\\\W Y)^{2} =',(X^Y)*(X^Y))\n", + " L = X^Y^e\n", + " B = L*e # D&L 10.152\n", + " Bsq = (B*B).scalar()\n", + " print('#%L = X\\\\W Y\\\\W e \\\\text{ is a non-euclidian line}')\n", + " print('B = L*e =',B)\n", + " BeBr =B*e*B.rev()\n", + " print('%BeB^{\\\\dagger} =',BeBr)\n", + " print('%B^{2} =',B*B)\n", + " print('%L^{2} =',L*L) # D&L 10.153\n", + " (s,c,Binv,M,S,C,alpha) = symbols('s c (1/B) M S C alpha')\n", + " XdotY = nel.g[0,1]\n", + " Xdote = nel.g[0,2]\n", + " Ydote = nel.g[1,2]\n", + " Bhat = Binv*B # D&L 10.154\n", + " R = c+s*Bhat # Rotor R = exp(alpha*Bhat/2)\n", + " print('#%s = \\\\f{\\\\sinh}{\\\\alpha/2} \\\\text{ and } c = \\\\f{\\\\cosh}{\\\\alpha/2}')\n", + " print('%e^{\\\\alpha B/{2\\\\abs{B}}} =',R)\n", + " Z = R*X*R.rev() # D&L 10.155\n", + " Z.obj = expand(Z.obj)\n", + " Z.obj = Z.obj.collect([Binv,s,c,XdotY])\n", + " Z.Fmt(3,'%RXR^{\\\\dagger}')\n", + " W = Z|Y # Extract scalar part of multivector\n", + " # From this point forward all calculations are with sympy scalars\n", + " #print '#Objective is to determine value of C = cosh(alpha) such that W = 0'\n", + " W = W.scalar()\n", + " print('%W = Z\\\\cdot Y =',W)\n", + " W = expand(W)\n", + " W = simplify(W)\n", + " W = W.collect([s*Binv])\n", + " M = 1/Bsq\n", + " W = W.subs(Binv**2,M)\n", + " W = simplify(W)\n", + " Bmag = sqrt(XdotY**2-2*XdotY*Xdote*Ydote)\n", + " W = W.collect([Binv*c*s,XdotY])\n", + " #Double angle substitutions\n", + " W = W.subs(2*XdotY**2-4*XdotY*Xdote*Ydote,2/(Binv**2))\n", + " W = W.subs(2*c*s,S)\n", + " W = W.subs(c**2,(C+1)/2)\n", + " W = W.subs(s**2,(C-1)/2)\n", + " W = simplify(W)\n", + " W = W.subs(1/Binv,Bmag)\n", + " W = expand(W)\n", + " print('#%S = \\\\f{\\\\sinh}{\\\\alpha} \\\\text{ and } C = \\\\f{\\\\cosh}{\\\\alpha}')\n", + " print('W =',W)\n", + " Wd = collect(W,[C,S],exact=True,evaluate=False)\n", + " Wd_1 = Wd[one]\n", + " Wd_C = Wd[C]\n", + " Wd_S = Wd[S]\n", + " print('%\\\\text{Scalar Coefficient} =',Wd_1)\n", + " print('%\\\\text{Cosh Coefficient} =',Wd_C)\n", + " print('%\\\\text{Sinh Coefficient} =',Wd_S)\n", + " print('%\\\\abs{B} =',Bmag)\n", + " Wd_1 = Wd_1.subs(Bmag,1/Binv)\n", + " Wd_C = Wd_C.subs(Bmag,1/Binv)\n", + " Wd_S = Wd_S.subs(Bmag,1/Binv)\n", + " lhs = Wd_1+Wd_C*C\n", + " rhs = -Wd_S*S\n", + " lhs = lhs**2\n", + " rhs = rhs**2\n", + " W = expand(lhs-rhs)\n", + " W = expand(W.subs(1/Binv**2,Bmag**2))\n", + " W = expand(W.subs(S**2,C**2-1))\n", + " W = W.collect([C,C**2],evaluate=False)\n", + " a = simplify(W[C**2])\n", + " b = simplify(W[C])\n", + " c = simplify(W[one])\n", + " print('#%\\\\text{Require } aC^{2}+bC+c = 0')\n", + " print('a =',a)\n", + " print('b =',b)\n", + " print('c =',c)\n", + " x = Symbol('x')\n", + " C = solve(a*x**2+b*x+c,x)[0]\n", + " print('%b^{2}-4ac =',simplify(b**2-4*a*c))\n", + " print('%\\\\f{\\\\cosh}{\\\\alpha} = C = -b/(2a) =',expand(simplify(expand(C))))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 0 & \\left ( X\\cdot Y\\right ) & \\left ( X\\cdot e\\right ) \\\\ \\left ( X\\cdot Y\\right ) & 0 & \\left ( Y\\cdot e\\right ) \\\\ \\left ( X\\cdot e\\right ) & \\left ( Y\\cdot e\\right ) & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} (X\\W Y)^{2} = \\left ( X\\cdot Y\\right ) ^{2} \\end{equation*}\n", + "\\begin{equation*} L = X\\W Y\\W e \\text{ is a non-euclidian line} \\end{equation*}\n", + "\\begin{equation*} B = L e = \\boldsymbol{X}\\wedge \\boldsymbol{Y} - \\left ( Y\\cdot e\\right ) \\boldsymbol{X}\\wedge \\boldsymbol{e} + \\left ( X\\cdot e\\right ) \\boldsymbol{Y}\\wedge \\boldsymbol{e} \\end{equation*}\n", + "\\begin{equation*} BeB^{\\dagger} = \\left ( X\\cdot Y\\right ) \\left(- \\left ( X\\cdot Y\\right ) + 2 \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\right) \\boldsymbol{e} \\end{equation*}\n", + "\\begin{equation*} B^{2} = \\left ( X\\cdot Y\\right ) \\left(\\left ( X\\cdot Y\\right ) - 2 \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\right) \\end{equation*}\n", + "\\begin{equation*} L^{2} = \\left ( X\\cdot Y\\right ) \\left(\\left ( X\\cdot Y\\right ) - 2 \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\right) \\end{equation*}\n", + "\\begin{equation*} s = \\f{\\sinh}{\\alpha/2} \\text{ and } c = \\f{\\cosh}{\\alpha/2} \\end{equation*}\n", + "\\begin{equation*} e^{\\alpha B/{2\\abs{B}}} = c + (1/B) s \\boldsymbol{X}\\wedge \\boldsymbol{Y} - (1/B) \\left ( Y\\cdot e\\right ) s \\boldsymbol{X}\\wedge \\boldsymbol{e} + (1/B) \\left ( X\\cdot e\\right ) s \\boldsymbol{Y}\\wedge \\boldsymbol{e} \\end{equation*}\n", + "\\begin{equation*} W = Z\\cdot Y = (1/B)^{2} \\left ( X\\cdot Y\\right ) ^{3} s^{2} - 4 (1/B)^{2} \\left ( X\\cdot Y\\right ) ^{2} \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) s^{2} + 4 (1/B)^{2} \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) ^{2} \\left ( Y\\cdot e\\right ) ^{2} s^{2} + 2 (1/B) \\left ( X\\cdot Y\\right ) ^{2} c s - 4 (1/B) \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) c s + \\left ( X\\cdot Y\\right ) c^{2} \\end{equation*}\n", + "\\begin{equation*} S = \\f{\\sinh}{\\alpha} \\text{ and } C = \\f{\\cosh}{\\alpha} \\end{equation*}\n", + "\\begin{equation*} W = (1/B) \\left ( X\\cdot Y\\right ) C \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } - (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) C \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + S \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", + "\\begin{equation*} \\text{Scalar Coefficient} = (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", + "\\begin{equation*} \\text{Cosh Coefficient} = (1/B) \\left ( X\\cdot Y\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } - (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", + "\\begin{equation*} \\text{Sinh Coefficient} = \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", + "\\begin{equation*} \\abs{B} = \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", + "\\begin{equation*} \\text{Require } aC^{2}+bC+c = 0 \\end{equation*}\n", + "\\begin{equation*} a = \\left ( X\\cdot e\\right ) ^{2} \\left ( Y\\cdot e\\right ) ^{2} \\end{equation*}\n", + "\\begin{equation*} b = 2 \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\left(\\left ( X\\cdot Y\\right ) - \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\right) \\end{equation*}\n", + "\\begin{equation*} c = \\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) + \\left ( X\\cdot e\\right ) ^{2} \\left ( Y\\cdot e\\right ) ^{2} \\end{equation*}\n", + "\\begin{equation*} b^{2}-4ac = 0 \\end{equation*}\n", + "\\begin{equation*} \\f{\\cosh}{\\alpha} = C = -b/(2a) = - \\frac{\\left ( X\\cdot Y\\right ) }{\\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + 1 \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def conformal_representations_of_circles_lines_spheres_and_planes():\n", + " Print_Function()\n", + " global n,nbar\n", + " Fmt(1)\n", + " g = '1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 2,0 0 0 2 0'\n", + " c3d = Ga('e_1 e_2 e_3 n \\\\bar{n}',g=g)\n", + " (e1,e2,e3,n,nbar) = c3d.mv()\n", + " print('g_{ij} =',c3d.g)\n", + " e = n+nbar\n", + " #conformal representation of points\n", + " A = make_vector(e1, ga=c3d) # point a = (1,0,0) A = F(a)\n", + " B = make_vector(e2, ga=c3d) # point b = (0,1,0) B = F(b)\n", + " C = make_vector(-e1, ga=c3d) # point c = (-1,0,0) C = F(c)\n", + " D = make_vector(e3, ga=c3d) # point d = (0,0,1) D = F(d)\n", + " X = make_vector('x',3, ga=c3d)\n", + " print('F(a) =',A)\n", + " print('F(b) =',B)\n", + " print('F(c) =',C)\n", + " print('F(d) =',D)\n", + " print('F(x) =',X)\n", + " print('#a = e1, b = e2, c = -e1, and d = e3')\n", + " print('#A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.')\n", + " print('#Circle through a, b, and c')\n", + " print('Circle: A^B^C^X = 0 =',(A^B^C^X))\n", + " print('#Line through a and b')\n", + " print('Line : A^B^n^X = 0 =',(A^B^n^X))\n", + " print('#Sphere through a, b, c, and d')\n", + " print('Sphere: A^B^C^D^X = 0 =',(((A^B)^C)^D)^X)\n", + " print('#Plane through a, b, and d')\n", + " print('Plane : A^B^n^D^X = 0 =',(A^B^n^D^X))\n", + " L = (A^B^e)^X\n", + " L.Fmt(3,'Hyperbolic\\\\;\\\\; Circle: (A^B^e)^X = 0')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} 1 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 2 \\\\ 0 & 0 & 0 & 2 & 0 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} F(a) = \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\begin{equation*} F(b) = \\boldsymbol{e}_{2} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\begin{equation*} F(c) = - \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\begin{equation*} F(d) = \\boldsymbol{e}_{3} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\begin{equation*} F(x) = x_{1} \\boldsymbol{e}_{1} + x_{2} \\boldsymbol{e}_{2} + x_{3} \\boldsymbol{e}_{3} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2}\\right ) \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "a = e1, b = e2, c = -e1, and d = e3\n", + "A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.\n", + "Circle through a, b, and c\n", + "\\begin{equation*} Circle: A\\W B\\W C\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{\\bar{n}} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "Line through a and b\n", + "\\begin{equation*} Line : A\\W B\\W n\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + \\left ( \\frac{x_{1}}{2} + \\frac{x_{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} + \\frac{x_{3}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} - \\frac{x_{3}}{2} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "Sphere through a, b, c, and d\n", + "\\begin{equation*} Sphere: A\\W B\\W C\\W D\\W X = 0 = \\left ( - \\frac{{\\left ( x_{1} \\right )}^{2}}{2} - \\frac{{\\left ( x_{2} \\right )}^{2}}{2} - \\frac{{\\left ( x_{3} \\right )}^{2}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "Plane through a, b, and d\n", + "\\begin{equation*} Plane : A\\W B\\W n\\W D\\W X = 0 = \\left ( - \\frac{x_{1}}{2} - \\frac{x_{2}}{2} - \\frac{x_{3}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def properties_of_geometric_objects():\n", + " Print_Function()\n", + " global n, nbar\n", + " Fmt(1)\n", + " g = '# # # 0 0,'+ \\\n", + " '# # # 0 0,'+ \\\n", + " '# # # 0 0,'+ \\\n", + " '0 0 0 0 2,'+ \\\n", + " '0 0 0 2 0'\n", + " c3d = Ga('p1 p2 p3 n \\\\bar{n}',g=g)\n", + " (p1,p2,p3,n,nbar) = c3d.mv()\n", + " print('g_{ij} =',c3d.g)\n", + " P1 = F(p1)\n", + " P2 = F(p2)\n", + " P3 = F(p3)\n", + " print('\\\\text{Extracting direction of line from }L = P1\\\\W P2\\\\W n')\n", + " L = P1^P2^n\n", + " delta = (L|n)|nbar\n", + " print('(L|n)|\\\\bar{n} =',delta)\n", + " print('\\\\text{Extracting plane of circle from }C = P1\\\\W P2\\\\W P3')\n", + " C = P1^P2^P3\n", + " delta = ((C^n)|n)|nbar\n", + " print('((C^n)|n)|\\\\bar{n}=',delta)\n", + " print('(p2-p1)^(p3-p1)=',(p2-p1)^(p3-p1))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} \\left ( p_{1}\\cdot p_{1}\\right ) & \\left ( p_{1}\\cdot p_{2}\\right ) & \\left ( p_{1}\\cdot p_{3}\\right ) & 0 & 0 \\\\ \\left ( p_{1}\\cdot p_{2}\\right ) & \\left ( p_{2}\\cdot p_{2}\\right ) & \\left ( p_{2}\\cdot p_{3}\\right ) & 0 & 0 \\\\ \\left ( p_{1}\\cdot p_{3}\\right ) & \\left ( p_{2}\\cdot p_{3}\\right ) & \\left ( p_{3}\\cdot p_{3}\\right ) & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 2 \\\\ 0 & 0 & 0 & 2 & 0 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\text{Extracting direction of line from }L = P1\\W P2\\W n \\end{equation*}\n", + "\\begin{equation*} (L\\cdot n)\\cdot \\bar{n} = 2 \\boldsymbol{p}_{1} -2 \\boldsymbol{p}_{2} \\end{equation*}\n", + "\\begin{equation*} \\text{Extracting plane of circle from }C = P1\\W P2\\W P3 \\end{equation*}\n", + "\\begin{equation*} ((C\\W n)\\cdot n)\\cdot \\bar{n}= 2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} -2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} + 2 \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{equation*}\n", + "\\begin{equation*} (p2-p1)\\W (p3-p1)= \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} - \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} + \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def extracting_vectors_from_conformal_2_blade():\n", + " Print_Function()\n", + " Fmt(1)\n", + " print(r'B = P1\\W P2')\n", + " g = '0 -1 #,'+ \\\n", + " '-1 0 #,'+ \\\n", + " '# # #'\n", + " c2b = Ga('P1 P2 a',g=g)\n", + " (P1,P2,a) = c2b.mv()\n", + " print('g_{ij} =',c2b.g)\n", + " B = P1^P2\n", + " Bsq = B*B\n", + " print('%B^{2} =',Bsq)\n", + " ap = a-(a^B)*B\n", + " print(\"a' = a-(a^B)*B =\",ap)\n", + " Ap = ap+ap*B\n", + " Am = ap-ap*B\n", + " print(\"A+ = a'+a'*B =\",Ap)\n", + " print(\"A- = a'-a'*B =\",Am)\n", + " print('%(A+)^{2} =',Ap*Ap)\n", + " print('%(A-)^{2} =',Am*Am)\n", + " aB = a|B\n", + " print('a|B =',aB)\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} B = P1\\W P2 \\end{equation*}\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 0 & -1 & \\left ( P_{1}\\cdot a\\right ) \\\\ -1 & 0 & \\left ( P_{2}\\cdot a\\right ) \\\\ \\left ( P_{1}\\cdot a\\right ) & \\left ( P_{2}\\cdot a\\right ) & \\left ( a\\cdot a\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} B^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} a' = a-(a\\W B) B = - \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} - \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{equation*}\n", + "\\begin{equation*} A+ = a'+a' B = - 2 \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} \\end{equation*}\n", + "\\begin{equation*} A- = a'-a' B = - 2 \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{equation*}\n", + "\\begin{equation*} (A+)^{2} = 0 \\end{equation*}\n", + "\\begin{equation*} (A-)^{2} = 0 \\end{equation*}\n", + "\\begin{equation*} a\\cdot B = - \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} + \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def reciprocal_frame_test():\n", + " Print_Function()\n", + " Fmt(1)\n", + " g = '1 # #,'+ \\\n", + " '# 1 #,'+ \\\n", + " '# # 1'\n", + " ng3d = Ga('e1 e2 e3',g=g)\n", + " (e1,e2,e3) = ng3d.mv()\n", + " print('g_{ij} =',ng3d.g)\n", + " E = e1^e2^e3\n", + " Esq = (E*E).scalar()\n", + " print('E =',E)\n", + " print('%E^{2} =',Esq)\n", + " Esq_inv = 1/Esq\n", + " E1 = (e2^e3)*E\n", + " E2 = (-1)*(e1^e3)*E\n", + " E3 = (e1^e2)*E\n", + " print('E1 = (e2^e3)*E =',E1)\n", + " print('E2 =-(e1^e3)*E =',E2)\n", + " print('E3 = (e1^e2)*E =',E3)\n", + " w = (E1|e2)\n", + " w = w.expand()\n", + " print('E1|e2 =',w)\n", + " w = (E1|e3)\n", + " w = w.expand()\n", + " print('E1|e3 =',w)\n", + " w = (E2|e1)\n", + " w = w.expand()\n", + " print('E2|e1 =',w)\n", + " w = (E2|e3)\n", + " w = w.expand()\n", + " print('E2|e3 =',w)\n", + " w = (E3|e1)\n", + " w = w.expand()\n", + " print('E3|e1 =',w)\n", + " w = (E3|e2)\n", + " w = w.expand()\n", + " print('E3|e2 =',w)\n", + " w = (E1|e1)\n", + " w = (w.expand()).scalar()\n", + " Esq = expand(Esq)\n", + " print('%(E1\\\\cdot e1)/E^{2} =',simplify(w/Esq))\n", + " w = (E2|e2)\n", + " w = (w.expand()).scalar()\n", + " print('%(E2\\\\cdot e2)/E^{2} =',simplify(w/Esq))\n", + " w = (E3|e3)\n", + " w = (w.expand()).scalar()\n", + " print('%(E3\\\\cdot e3)/E^{2} =',simplify(w/Esq))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 1 & \\left ( e_{1}\\cdot e_{2}\\right ) & \\left ( e_{1}\\cdot e_{3}\\right ) \\\\ \\left ( e_{1}\\cdot e_{2}\\right ) & 1 & \\left ( e_{2}\\cdot e_{3}\\right ) \\\\ \\left ( e_{1}\\cdot e_{3}\\right ) & \\left ( e_{2}\\cdot e_{3}\\right ) & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} E = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} E^{2} = \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 2 \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} + \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1 \\end{equation*}\n", + "\\begin{equation*} E1 = (e2\\W e3) E = \\left ( \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} E2 =-(e1\\W e3) E = \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} + \\left ( \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} E3 = (e1\\W e2) E = \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} E1\\cdot e2 = 0 \\end{equation*}\n", + "\\begin{equation*} E1\\cdot e3 = 0 \\end{equation*}\n", + "\\begin{equation*} E2\\cdot e1 = 0 \\end{equation*}\n", + "\\begin{equation*} E2\\cdot e3 = 0 \\end{equation*}\n", + "\\begin{equation*} E3\\cdot e1 = 0 \\end{equation*}\n", + "\\begin{equation*} E3\\cdot e2 = 0 \\end{equation*}\n", + "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def signature_test():\n", + " Print_Function()\n", + " e3d = Ga('e1 e2 e3',g=[1,1,1])\n", + " print('g =', e3d.g)\n", + " print(r'%Signature = (3,0)\\: I =', e3d.I(),'\\: I^{2} =', e3d.I()*e3d.I())\n", + " e3d = Ga('e1 e2 e3',g=[2,2,2])\n", + " print('g =', e3d.g)\n", + " print(r'%Signature = (3,0)\\: I =', e3d.I(),'|; I^{2} =', e3d.I()*e3d.I())\n", + " sp4d = Ga('e1 e2 e3 e4',g=[1,-1,-1,-1])\n", + " print('g =', sp4d.g)\n", + " print(r'%Signature = (1,3)\\: I =', sp4d.I(),'\\: I^{2} =', sp4d.I()*sp4d.I())\n", + " sp4d = Ga('e1 e2 e3 e4',g=[2,-2,-2,-2])\n", + " print('g =', sp4d.g)\n", + " print(r'%Signature = (1,3)\\: I =', sp4d.I(),'\\: I^{2} =', sp4d.I()*sp4d.I())\n", + " e4d = Ga('e1 e2 e3 e4',g=[1,1,1,1])\n", + " print('g =', e4d.g)\n", + " print(r'%Signature = (4,0)\\: I =', e4d.I(),'\\: I^{2} =', e4d.I()*e4d.I())\n", + " cf3d = Ga('e1 e2 e3 e4 e5',g=[1,1,1,1,-1])\n", + " print('g =', cf3d.g)\n", + " print(r'%Signature = (4,1)\\: I =', cf3d.I(),'\\: I^{2} =', cf3d.I()*cf3d.I())\n", + " cf3d = Ga('e1 e2 e3 e4 e5',g=[2,2,2,2,-2])\n", + " print('g =', cf3d.g)\n", + " print(r'%Signature = (4,1)\\: I =', cf3d.I(),'\\: I^{2} =', cf3d.I()*cf3d.I())\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} Signature = (3,0)\\: I = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\: I^{2} = -1 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 2 & 0 & 0 \\\\ 0 & 2 & 0 \\\\ 0 & 0 & 2 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} Signature = (3,0)\\: I = \\frac{\\sqrt{2}}{4} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} |; I^{2} = -1 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0 \\\\ 0 & -1 & 0 & 0 \\\\ 0 & 0 & -1 & 0 \\\\ 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} Signature = (1,3)\\: I = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\: I^{2} = -1 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 2 & 0 & 0 & 0 \\\\ 0 & -2 & 0 & 0 \\\\ 0 & 0 & -2 & 0 \\\\ 0 & 0 & 0 & -2 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} Signature = (1,3)\\: I = \\frac{1}{4} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\: I^{2} = -1 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 \\\\ 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} Signature = (4,0)\\: I = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4} \\: I^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{ccccc} 1 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 \\\\ 0 & 0 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} Signature = (4,1)\\: I = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4}\\wedge \\boldsymbol{e}_{5} \\: I^{2} = -1 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{ccccc} 2 & 0 & 0 & 0 & 0 \\\\ 0 & 2 & 0 & 0 & 0 \\\\ 0 & 0 & 2 & 0 & 0 \\\\ 0 & 0 & 0 & 2 & 0 \\\\ 0 & 0 & 0 & 0 & -2 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} Signature = (4,1)\\: I = \\frac{\\sqrt{2}}{8} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{e}_{4}\\wedge \\boldsymbol{e}_{5} \\: I^{2} = -1 \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def Fmt_test():\n", + " Print_Function()\n", + " e3d = Ga('e1 e2 e3',g=[1,1,1])\n", + " v = e3d.mv('v','vector')\n", + " B = e3d.mv('B','bivector')\n", + " M = e3d.mv('M','mv')\n", + " Fmt(2)\n", + " print('#Global $Fmt = 2$')\n", + " print('v =',v)\n", + " print('B =',B)\n", + " print('M =',M)\n", + " print('#Using $.Fmt()$ Function')\n", + " print('v.Fmt(3) =',v.Fmt(3))\n", + " print('B.Fmt(3) =',B.Fmt(3))\n", + " print('M.Fmt(2) =',M.Fmt(2))\n", + " print('M.Fmt(1) =',M.Fmt(1))\n", + " print('#Global $Fmt = 1$')\n", + " Fmt(1)\n", + " print('v =',v)\n", + " print('B =',B)\n", + " print('M =',M)\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "Global $Fmt = 2$\n", + "\\begin{equation*} v = v^{1} \\boldsymbol{e}_{1} + v^{2} \\boldsymbol{e}_{2} + v^{3} \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} B = B^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + B^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + B^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n", + " \\begin{align*} M = & M \\\\ & + M^{1} \\boldsymbol{e}_{1} + M^{2} \\boldsymbol{e}_{2} + M^{3} \\boldsymbol{e}_{3} \\\\ & + M^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + M^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + M^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\\\ & + M^{123} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{align*} \n", + "Using $.Fmt()$ Function\n", + " \\begin{align*} v \\cdot Fmt(3) = & v^{1} \\boldsymbol{e}_{1} \\\\ & + v^{2} \\boldsymbol{e}_{2} \\\\ & + v^{3} \\boldsymbol{e}_{3} \\end{align*} \n", + " \\begin{align*} B \\cdot Fmt(3) = & B^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} \\\\ & + B^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} \\\\ & + B^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{align*} \n", + " \\begin{align*} M \\cdot Fmt(2) = & M \\\\ & + M^{1} \\boldsymbol{e}_{1} + M^{2} \\boldsymbol{e}_{2} + M^{3} \\boldsymbol{e}_{3} \\\\ & + M^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + M^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + M^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\\\ & + M^{123} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{align*} \n", + "\\begin{equation*} M \\cdot Fmt(1) = M + M^{1} \\boldsymbol{e}_{1} + M^{2} \\boldsymbol{e}_{2} + M^{3} \\boldsymbol{e}_{3} + M^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + M^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + M^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} + M^{123} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n", + "Global $Fmt = 1$\n", + "\\begin{equation*} v = v^{1} \\boldsymbol{e}_{1} + v^{2} \\boldsymbol{e}_{2} + v^{3} \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} B = B^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + B^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + B^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} M = M + M^{1} \\boldsymbol{e}_{1} + M^{2} \\boldsymbol{e}_{2} + M^{3} \\boldsymbol{e}_{3} + M^{12} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2} + M^{13} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3} + M^{23} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} + M^{123} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat latex_check.tex" + "check('latex_check')" ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 12, "metadata": {}, - "outputs": [], - "source": [ - "!python lin_tran_check.py" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "3d orthogonal ($A$ is vector function)\r\n", - "\\begin{equation*} A = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} A^{2} = {A^{x} }^{2} + {A^{y} }^{2} + {A^{z} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} A = \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v\\cdot (\\boldsymbol{\\nabla} A) = \\left ( v^{y} \\partial_{y} A^{x} - v^{y} \\partial_{x} A^{y} + v^{z} \\partial_{z} A^{x} - v^{z} \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( - v^{x} \\partial_{y} A^{x} + v^{x} \\partial_{x} A^{y} + v^{z} \\partial_{z} A^{y} - v^{z} \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - v^{x} \\partial_{z} A^{x} + v^{x} \\partial_{x} A^{z} - v^{y} \\partial_{z} A^{y} + v^{y} \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "2d general ($A$ is vector function)\r\n", - "\\begin{equation*} A = A^{u} \\boldsymbol{e}_{u} + A^{v} \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} A^{2} = \\left ( e_{u}\\cdot e_{u}\\right ) {A^{u} }^{2} + 2 \\left ( e_{u}\\cdot e_{v}\\right ) A^{u} A^{v} + \\left ( e_{v}\\cdot e_{v}\\right ) {A^{v} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{u} A^{u} + \\partial_{v} A^{v} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} A = \\left ( \\partial_{u} A^{u} + \\partial_{v} A^{v} \\right ) + \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) \\partial_{v} A^{u} + \\left ( e_{u}\\cdot e_{v}\\right ) \\partial_{u} A^{u} - \\left ( e_{u}\\cdot e_{v}\\right ) \\partial_{v} A^{v} + \\left ( e_{v}\\cdot e_{v}\\right ) \\partial_{u} A^{v} }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "3d orthogonal ($A,\\;B$ are linear transformations)\r\n", - "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& A_{xx} \\boldsymbol{e}_{x} + A_{yx} \\boldsymbol{e}_{y} + A_{zx} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& A_{xy} \\boldsymbol{e}_{x} + A_{yy} \\boldsymbol{e}_{y} + A_{zy} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& A_{xz} \\boldsymbol{e}_{x} + A_{yz} \\boldsymbol{e}_{y} + A_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} \\f{mat}{A} = \\left [ \\begin{array}{ccc} A_{xx} & A_{xy} & A_{xz} \\\\ A_{yx} & A_{yy} & A_{yz} \\\\ A_{zx} & A_{zy} & A_{zz} \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\det}{A} = A_{xz} \\left(A_{yx} A_{zy} - A_{yy} A_{zx}\\right) - A_{yz} \\left(A_{xx} A_{zy} - A_{xy} A_{zx}\\right) + A_{zz} \\left(A_{xx} A_{yy} - A_{xy} A_{yx}\\right) \\end{equation*}\r\n", - "\\begin{equation*} \\overline{A} = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& A_{xx} \\boldsymbol{e}_{x} + A_{xy} \\boldsymbol{e}_{y} + A_{xz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& A_{yx} \\boldsymbol{e}_{x} + A_{yy} \\boldsymbol{e}_{y} + A_{yz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& A_{zx} \\boldsymbol{e}_{x} + A_{zy} \\boldsymbol{e}_{y} + A_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\Tr}{A} = A_{xx} + A_{yy} + A_{zz} \\end{equation*}\r\n", - "\\begin{equation*} \\f{A}{e_x\\W e_y} = \\left ( A_{xx} A_{yy} - A_{xy} A_{yx}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( A_{xx} A_{zy} - A_{xy} A_{zx}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( A_{yx} A_{zy} - A_{yy} A_{zx}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\f{A}{e_x}\\W \\f{A}{e_y} = \\left ( A_{xx} A_{yy} - A_{xy} A_{yx}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( A_{xx} A_{zy} - A_{xy} A_{zx}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( A_{yx} A_{zy} - A_{yy} A_{zx}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} g^{-1} = \\left[\\begin{matrix}1 & 0 & 0\\\\0 & 1 & 0\\\\0 & 0 & 1\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} A + B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& \\left ( A_{xx} + B_{xx}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} + B_{yx}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} + B_{zx}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& \\left ( A_{xy} + B_{xy}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yy} + B_{yy}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zy} + B_{zy}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& \\left ( A_{xz} + B_{xz}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yz} + B_{yz}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zz} + B_{zz}\\right ) \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} AB = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& \\left ( A_{xx} B_{xx} + A_{xy} B_{yx} + A_{xz} B_{zx}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} B_{xx} + A_{yy} B_{yx} + A_{yz} B_{zx}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} B_{xx} + A_{zy} B_{yx} + A_{zz} B_{zx}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& \\left ( A_{xx} B_{xy} + A_{xy} B_{yy} + A_{xz} B_{zy}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} B_{xy} + A_{yy} B_{yy} + A_{yz} B_{zy}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} B_{xy} + A_{zy} B_{yy} + A_{zz} B_{zy}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& \\left ( A_{xx} B_{xz} + A_{xy} B_{yz} + A_{xz} B_{zz}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} B_{xz} + A_{yy} B_{yz} + A_{yz} B_{zz}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} B_{xz} + A_{zy} B_{yz} + A_{zz} B_{zz}\\right ) \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} A - B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& \\left ( A_{xx} - B_{xx}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} - B_{yx}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} - B_{zx}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& \\left ( A_{xy} - B_{xy}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yy} - B_{yy}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zy} - B_{zy}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& \\left ( A_{xz} - B_{xz}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yz} - B_{yz}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zz} - B_{zz}\\right ) \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} General Symmetric Linear Transformation \\end{equation*}\r\n", - "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& A_{xx} \\boldsymbol{e}_{x} + A_{xy} \\boldsymbol{e}_{y} + A_{xz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& A_{xy} \\boldsymbol{e}_{x} + A_{yy} \\boldsymbol{e}_{y} + A_{yz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& A_{xz} \\boldsymbol{e}_{x} + A_{yz} \\boldsymbol{e}_{y} + A_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} General Antisymmetric Linear Transformation \\end{equation*}\r\n", - "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& - A_{xy} \\boldsymbol{e}_{y} - A_{xz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& A_{xy} \\boldsymbol{e}_{x} - A_{yz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& A_{xz} \\boldsymbol{e}_{x} + A_{yz} \\boldsymbol{e}_{y} \\end{array} \\right \\} \\end{equation*}\r\n", - "2d general ($A,\\;B$ are linear transformations)\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cc} \\left ( e_{u}\\cdot e_{u}\\right ) & \\left ( e_{u}\\cdot e_{v}\\right ) \\\\ \\left ( e_{u}\\cdot e_{v}\\right ) & \\left ( e_{v}\\cdot e_{v}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} g^{-1} = \\left[\\begin{matrix}\\frac{\\left ( e_{v}\\cdot e_{v}\\right ) }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} & - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\\\- \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} & \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} gg^{-1} = \\left[\\begin{matrix}1 & 0\\\\0 & 1\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} \\f{mat}{A} = \\left [ \\begin{array}{cc} A_{uu} & A_{uv} \\\\ A_{vu} & A_{vv} \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\det}{A} = \\frac{- \\left(\\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{uv}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) A_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\right) \\left(- \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) A_{vv}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} + \\frac{\\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\right) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} + \\left(\\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{vv}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\right) \\left(- \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) A_{uv}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} + \\frac{\\left ( e_{v}\\cdot e_{v}\\right ) A_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\right) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v}}{\\sqrt{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}} \\end{equation*}\r\n", - "\\begin{equation*} \\overline{A} = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{u} + \\frac{A_{uv} \\left ( e_{u}\\cdot e_{u}\\right ) ^{3} - \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vv} + A_{vu} \\left ( e_{v}\\cdot e_{v}\\right ) ^{3}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} \\f{mat}{\\overline{A}} = \\left[\\begin{matrix}- \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left(\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}\\right) + \\left ( e_{u}\\cdot e_{v}\\right ) \\left(\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vv} - A_{vu} \\left ( e_{v}\\cdot e_{v}\\right ) ^{3}\\right)}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} & \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vv} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vv} + A_{vu} \\left ( e_{u}\\cdot e_{v}\\right ) ^{4} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uv} + 2 \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} \\left ( e_{v}\\cdot e_{v}\\right ) ^{3} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} \\left ( e_{v}\\cdot e_{v}\\right ) ^{3} + A_{vu} \\left ( e_{v}\\cdot e_{v}\\right ) ^{4}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}}\\\\\\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left(A_{uv} \\left ( e_{u}\\cdot e_{u}\\right ) ^{3} - \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}\\right) + \\left ( e_{u}\\cdot e_{v}\\right ) \\left(\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}\\right)}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} & \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) \\left(A_{uv} \\left ( e_{u}\\cdot e_{u}\\right ) ^{3} - \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}\\right) + \\left ( e_{v}\\cdot e_{v}\\right ) \\left(\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}\\right)}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}}\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\Tr}{A} = - \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} - \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uv}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vu}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} + \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\end{equation*}\r\n", - "\\begin{equation*} \\f{A}{e_u\\W e_v} = \\frac{A_{uu} A_{vv} - A_{uv} A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} \\f{A}{e_u}\\W \\f{A}{e_v} = \\frac{A_{uu} A_{vv} - A_{uv} A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) B_{uv} + \\left ( e_{v}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) B_{vv} + \\left ( e_{v}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) B_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} A + B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{uv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{v}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{vv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{v}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) B_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} AB = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} B_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} B_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} B_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} B_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} B_{uu} + \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} B_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} B_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} B_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv} B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} B_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} B_{uu} + \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu} B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} A_{uv} B_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} B_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} B_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} B_{vu} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} B_{uv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} B_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} B_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} A_{vv} B_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{vu} B_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} B_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} B_{vu} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} B_{uv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} B_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv} B_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} A - B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{v}\\right ) B_{uv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} - \\left ( e_{v}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) B_{vv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} - \\left ( e_{v}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) B_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} a\\cdot \\f{\\overline{A}}{b}-b\\cdot \\f{\\underline{A}}{a} = 0 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0 \\\\ 0 & -1 & 0 & 0 \\\\ 0 & 0 & -1 & 0 \\\\ 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\underline{T} = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{t}\\right ) =& T_{tt} \\boldsymbol{e}_{t} + T_{xt} \\boldsymbol{e}_{x} + T_{yt} \\boldsymbol{e}_{y} + T_{zt} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{x}\\right ) =& - T_{tx} \\boldsymbol{e}_{t} - T_{xx} \\boldsymbol{e}_{x} - T_{yx} \\boldsymbol{e}_{y} - T_{zx} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& - T_{ty} \\boldsymbol{e}_{t} - T_{xy} \\boldsymbol{e}_{x} - T_{yy} \\boldsymbol{e}_{y} - T_{zy} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& - T_{tz} \\boldsymbol{e}_{t} - T_{xz} \\boldsymbol{e}_{x} - T_{yz} \\boldsymbol{e}_{y} - T_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} \\overline{T} = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{t}\\right ) =& T_{tt} \\boldsymbol{e}_{t} + T_{tx} \\boldsymbol{e}_{x} + T_{ty} \\boldsymbol{e}_{y} + T_{tz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{x}\\right ) =& - T_{xt} \\boldsymbol{e}_{t} - T_{xx} \\boldsymbol{e}_{x} - T_{xy} \\boldsymbol{e}_{y} - T_{xz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& - T_{yt} \\boldsymbol{e}_{t} - T_{yx} \\boldsymbol{e}_{x} - T_{yy} \\boldsymbol{e}_{y} - T_{yz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& - T_{zt} \\boldsymbol{e}_{t} - T_{zx} \\boldsymbol{e}_{x} - T_{zy} \\boldsymbol{e}_{y} - T_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\det}{\\underline{T}} = T_{tz} \\left(T_{xt} T_{yx} T_{zy} - T_{xt} T_{yy} T_{zx} - T_{xx} T_{yt} T_{zy} + T_{xx} T_{yy} T_{zt} + T_{xy} T_{yt} T_{zx} - T_{xy} T_{yx} T_{zt}\\right) - T_{xz} \\left(T_{tt} T_{yx} T_{zy} - T_{tt} T_{yy} T_{zx} - T_{tx} T_{yt} T_{zy} + T_{tx} T_{yy} T_{zt} + T_{ty} T_{yt} T_{zx} - T_{ty} T_{yx} T_{zt}\\right) + T_{yz} \\left(T_{tt} T_{xx} T_{zy} - T_{tt} T_{xy} T_{zx} - T_{tx} T_{xt} T_{zy} + T_{tx} T_{xy} T_{zt} + T_{ty} T_{xt} T_{zx} - T_{ty} T_{xx} T_{zt}\\right) - T_{zz} \\left(T_{tt} T_{xx} T_{yy} - T_{tt} T_{xy} T_{yx} - T_{tx} T_{xt} T_{yy} + T_{tx} T_{xy} T_{yt} + T_{ty} T_{xt} T_{yx} - T_{ty} T_{xx} T_{yt}\\right) \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\mbox{tr}}{\\underline{T}} = T_{tt} - T_{xx} - T_{yy} - T_{zz} \\end{equation*}\r\n", - "\\begin{equation*} a\\cdot \\f{\\overline{T}}{b}-b\\cdot \\f{\\underline{T}}{a} = 0 \\end{equation*}\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{u} f \\boldsymbol{e}_{u} + \\frac{\\partial_{v} f }{\\sin{\\left (u \\right )}} \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} F = F^{u} \\boldsymbol{e}_{u} + F^{v} \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} F = \\left ( \\frac{F^{u} }{\\tan{\\left (u \\right )}} + \\partial_{u} F^{u} + \\frac{\\partial_{v} F^{v} }{\\sin{\\left (u \\right )}}\\right ) + \\left ( \\frac{F^{v} }{\\tan{\\left (u \\right )}} + \\partial_{u} F^{v} - \\frac{\\partial_{v} F^{u} }{\\sin{\\left (u \\right )}}\\right ) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{\\theta } f \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{\\sin{\\left (\\theta \\right )}} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} F = F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} F = \\left ( \\frac{F^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } F^{\\theta } + \\frac{\\partial_{\\phi } F^{\\phi } }{\\sin{\\left (\\theta \\right )}}\\right ) + \\left ( \\frac{F^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } F^{\\phi } - \\frac{\\partial_{\\phi } F^{\\theta } }{\\sin{\\left (\\theta \\right )}}\\right ) \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "3d orthogonal ($A$ is vector function)\n", + "\\begin{equation*} A = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} A^{2} = {A^{x} }^{2} + {A^{y} }^{2} + {A^{z} }^{2} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} A = \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v\\cdot (\\boldsymbol{\\nabla} A) = \\left ( v^{y} \\partial_{y} A^{x} - v^{y} \\partial_{x} A^{y} + v^{z} \\partial_{z} A^{x} - v^{z} \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( - v^{x} \\partial_{y} A^{x} + v^{x} \\partial_{x} A^{y} + v^{z} \\partial_{z} A^{y} - v^{z} \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - v^{x} \\partial_{z} A^{x} + v^{x} \\partial_{x} A^{z} - v^{y} \\partial_{z} A^{y} + v^{y} \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "2d general ($A$ is vector function)\n", + "\\begin{equation*} A = A^{u} \\boldsymbol{e}_{u} + A^{v} \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} A^{2} = \\left ( e_{u}\\cdot e_{u}\\right ) {A^{u} }^{2} + 2 \\left ( e_{u}\\cdot e_{v}\\right ) A^{u} A^{v} + \\left ( e_{v}\\cdot e_{v}\\right ) {A^{v} }^{2} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{u} A^{u} + \\partial_{v} A^{v} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} A = \\left ( \\partial_{u} A^{u} + \\partial_{v} A^{v} \\right ) + \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) \\partial_{v} A^{u} + \\left ( e_{u}\\cdot e_{v}\\right ) \\partial_{u} A^{u} - \\left ( e_{u}\\cdot e_{v}\\right ) \\partial_{v} A^{v} + \\left ( e_{v}\\cdot e_{v}\\right ) \\partial_{u} A^{v} }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\n", + "3d orthogonal ($A,\\;B$ are linear transformations)\n", + "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& A_{xx} \\boldsymbol{e}_{x} + A_{yx} \\boldsymbol{e}_{y} + A_{zx} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& A_{xy} \\boldsymbol{e}_{x} + A_{yy} \\boldsymbol{e}_{y} + A_{zy} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& A_{xz} \\boldsymbol{e}_{x} + A_{yz} \\boldsymbol{e}_{y} + A_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} \\f{mat}{A} = \\left [ \\begin{array}{ccc} A_{xx} & A_{xy} & A_{xz} \\\\ A_{yx} & A_{yy} & A_{yz} \\\\ A_{zx} & A_{zy} & A_{zz} \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\f{\\det}{A} = A_{xz} \\left(A_{yx} A_{zy} - A_{yy} A_{zx}\\right) - A_{yz} \\left(A_{xx} A_{zy} - A_{xy} A_{zx}\\right) + A_{zz} \\left(A_{xx} A_{yy} - A_{xy} A_{yx}\\right) \\end{equation*}\n", + "\\begin{equation*} \\overline{A} = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& A_{xx} \\boldsymbol{e}_{x} + A_{xy} \\boldsymbol{e}_{y} + A_{xz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& A_{yx} \\boldsymbol{e}_{x} + A_{yy} \\boldsymbol{e}_{y} + A_{yz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& A_{zx} \\boldsymbol{e}_{x} + A_{zy} \\boldsymbol{e}_{y} + A_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} \\f{\\Tr}{A} = A_{xx} + A_{yy} + A_{zz} \\end{equation*}\n", + "\\begin{equation*} \\f{A}{e_x\\W e_y} = \\left ( A_{xx} A_{yy} - A_{xy} A_{yx}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( A_{xx} A_{zy} - A_{xy} A_{zx}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( A_{yx} A_{zy} - A_{yy} A_{zx}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\f{A}{e_x}\\W \\f{A}{e_y} = \\left ( A_{xx} A_{yy} - A_{xy} A_{yx}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( A_{xx} A_{zy} - A_{xy} A_{zx}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( A_{yx} A_{zy} - A_{yy} A_{zx}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} g^{-1} = \\left[\\begin{matrix}1 & 0 & 0\\\\0 & 1 & 0\\\\0 & 0 & 1\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} A + B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& \\left ( A_{xx} + B_{xx}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} + B_{yx}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} + B_{zx}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& \\left ( A_{xy} + B_{xy}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yy} + B_{yy}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zy} + B_{zy}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& \\left ( A_{xz} + B_{xz}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yz} + B_{yz}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zz} + B_{zz}\\right ) \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} AB = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& \\left ( A_{xx} B_{xx} + A_{xy} B_{yx} + A_{xz} B_{zx}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} B_{xx} + A_{yy} B_{yx} + A_{yz} B_{zx}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} B_{xx} + A_{zy} B_{yx} + A_{zz} B_{zx}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& \\left ( A_{xx} B_{xy} + A_{xy} B_{yy} + A_{xz} B_{zy}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} B_{xy} + A_{yy} B_{yy} + A_{yz} B_{zy}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} B_{xy} + A_{zy} B_{yy} + A_{zz} B_{zy}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& \\left ( A_{xx} B_{xz} + A_{xy} B_{yz} + A_{xz} B_{zz}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} B_{xz} + A_{yy} B_{yz} + A_{yz} B_{zz}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} B_{xz} + A_{zy} B_{yz} + A_{zz} B_{zz}\\right ) \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} A - B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& \\left ( A_{xx} - B_{xx}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yx} - B_{yx}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zx} - B_{zx}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& \\left ( A_{xy} - B_{xy}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yy} - B_{yy}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zy} - B_{zy}\\right ) \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& \\left ( A_{xz} - B_{xz}\\right ) \\boldsymbol{e}_{x} + \\left ( A_{yz} - B_{yz}\\right ) \\boldsymbol{e}_{y} + \\left ( A_{zz} - B_{zz}\\right ) \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} General Symmetric Linear Transformation \\end{equation*}\n", + "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& A_{xx} \\boldsymbol{e}_{x} + A_{xy} \\boldsymbol{e}_{y} + A_{xz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& A_{xy} \\boldsymbol{e}_{x} + A_{yy} \\boldsymbol{e}_{y} + A_{yz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& A_{xz} \\boldsymbol{e}_{x} + A_{yz} \\boldsymbol{e}_{y} + A_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} General Antisymmetric Linear Transformation \\end{equation*}\n", + "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{x}\\right ) =& - A_{xy} \\boldsymbol{e}_{y} - A_{xz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& A_{xy} \\boldsymbol{e}_{x} - A_{yz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& A_{xz} \\boldsymbol{e}_{x} + A_{yz} \\boldsymbol{e}_{y} \\end{array} \\right \\} \\end{equation*}\n", + "2d general ($A,\\;B$ are linear transformations)\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cc} \\left ( e_{u}\\cdot e_{u}\\right ) & \\left ( e_{u}\\cdot e_{v}\\right ) \\\\ \\left ( e_{u}\\cdot e_{v}\\right ) & \\left ( e_{v}\\cdot e_{v}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} g^{-1} = \\left[\\begin{matrix}\\frac{\\left ( e_{v}\\cdot e_{v}\\right ) }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} & - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\\\- \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} & \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) }{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} gg^{-1} = \\left[\\begin{matrix}1 & 0\\\\0 & 1\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} A = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} \\f{mat}{A} = \\left [ \\begin{array}{cc} A_{uu} & A_{uv} \\\\ A_{vu} & A_{vv} \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\f{\\det}{A} = \\frac{- \\left(\\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{uv}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) A_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\right) \\left(- \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) A_{vv}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} + \\frac{\\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\right) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} + \\left(\\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{vv}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\right) \\left(- \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) A_{uv}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} + \\frac{\\left ( e_{v}\\cdot e_{v}\\right ) A_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}\\right) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v}}{\\sqrt{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}}} \\end{equation*}\n", + "\\begin{equation*} \\overline{A} = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{u} + \\frac{A_{uv} \\left ( e_{u}\\cdot e_{u}\\right ) ^{3} - \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vv} + A_{vu} \\left ( e_{v}\\cdot e_{v}\\right ) ^{3}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} \\f{mat}{\\overline{A}} = \\left[\\begin{matrix}- \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left(\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}\\right) + \\left ( e_{u}\\cdot e_{v}\\right ) \\left(\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vv} - A_{vu} \\left ( e_{v}\\cdot e_{v}\\right ) ^{3}\\right)}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} & \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vv} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vv} + A_{vu} \\left ( e_{u}\\cdot e_{v}\\right ) ^{4} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uv} + 2 \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} \\left ( e_{v}\\cdot e_{v}\\right ) ^{3} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} \\left ( e_{v}\\cdot e_{v}\\right ) ^{3} + A_{vu} \\left ( e_{v}\\cdot e_{v}\\right ) ^{4}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}}\\\\\\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left(A_{uv} \\left ( e_{u}\\cdot e_{u}\\right ) ^{3} - \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}\\right) + \\left ( e_{u}\\cdot e_{v}\\right ) \\left(\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}\\right)}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} & \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) \\left(A_{uv} \\left ( e_{u}\\cdot e_{u}\\right ) ^{3} - \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}\\right) + \\left ( e_{v}\\cdot e_{v}\\right ) \\left(\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu}\\right)}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}}\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\f{\\Tr}{A} = - \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} - \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{uv}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} - \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) ^{3} A_{vu}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} + \\frac{\\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu}}{- \\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} + 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\end{equation*}\n", + "\\begin{equation*} \\f{A}{e_u\\W e_v} = \\frac{A_{uu} A_{vv} - A_{uv} A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} \\f{A}{e_u}\\W \\f{A}{e_v} = \\frac{A_{uu} A_{vv} - A_{uv} A_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) B_{uv} + \\left ( e_{v}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) B_{vv} + \\left ( e_{v}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) B_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} A + B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{uv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{v}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{vv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{v}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{u}\\right ) B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) B_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} AB = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} B_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} B_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} B_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} B_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uv} B_{uu} + \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{uu} B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} B_{vv} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} B_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} B_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv} B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} B_{vu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vv} B_{uu} + \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} A_{vu} B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} A_{uv} B_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} B_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} B_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} B_{vu} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} B_{uv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uu} B_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{uv} B_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} A_{vv} B_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{vu} B_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} B_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} B_{vu} + \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} B_{uv} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vu} B_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} A_{vv} B_{uu} - \\left ( e_{u}\\cdot e_{v}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) ^{2} - 2 \\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{u}\\cdot e_{v}\\right ) ^{2} \\left ( e_{v}\\cdot e_{v}\\right ) + \\left ( e_{u}\\cdot e_{v}\\right ) ^{4}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} A - B = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{u}\\right ) =& \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{uv} + \\left ( e_{u}\\cdot e_{v}\\right ) B_{uv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{uu} - \\left ( e_{v}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{- \\left ( e_{u}\\cdot e_{v}\\right ) A_{vv} + \\left ( e_{u}\\cdot e_{v}\\right ) B_{vv} + \\left ( e_{v}\\cdot e_{v}\\right ) A_{vu} - \\left ( e_{v}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\\\ L \\left ( \\boldsymbol{e}_{v}\\right ) =& \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{uv} - \\left ( e_{u}\\cdot e_{u}\\right ) B_{uv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{uu} + \\left ( e_{u}\\cdot e_{v}\\right ) B_{uu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{u} + \\frac{\\left ( e_{u}\\cdot e_{u}\\right ) A_{vv} - \\left ( e_{u}\\cdot e_{u}\\right ) B_{vv} - \\left ( e_{u}\\cdot e_{v}\\right ) A_{vu} + \\left ( e_{u}\\cdot e_{v}\\right ) B_{vu}}{\\left ( e_{u}\\cdot e_{u}\\right ) \\left ( e_{v}\\cdot e_{v}\\right ) - \\left ( e_{u}\\cdot e_{v}\\right ) ^{2}} \\boldsymbol{e}_{v} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} a\\cdot \\f{\\overline{A}}{b}-b\\cdot \\f{\\underline{A}}{a} = 0 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0 \\\\ 0 & -1 & 0 & 0 \\\\ 0 & 0 & -1 & 0 \\\\ 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\underline{T} = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{t}\\right ) =& T_{tt} \\boldsymbol{e}_{t} + T_{xt} \\boldsymbol{e}_{x} + T_{yt} \\boldsymbol{e}_{y} + T_{zt} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{x}\\right ) =& - T_{tx} \\boldsymbol{e}_{t} - T_{xx} \\boldsymbol{e}_{x} - T_{yx} \\boldsymbol{e}_{y} - T_{zx} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& - T_{ty} \\boldsymbol{e}_{t} - T_{xy} \\boldsymbol{e}_{x} - T_{yy} \\boldsymbol{e}_{y} - T_{zy} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& - T_{tz} \\boldsymbol{e}_{t} - T_{xz} \\boldsymbol{e}_{x} - T_{yz} \\boldsymbol{e}_{y} - T_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} \\overline{T} = \\left \\{ \\begin{array}{ll} L \\left ( \\boldsymbol{e}_{t}\\right ) =& T_{tt} \\boldsymbol{e}_{t} + T_{tx} \\boldsymbol{e}_{x} + T_{ty} \\boldsymbol{e}_{y} + T_{tz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{x}\\right ) =& - T_{xt} \\boldsymbol{e}_{t} - T_{xx} \\boldsymbol{e}_{x} - T_{xy} \\boldsymbol{e}_{y} - T_{xz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{y}\\right ) =& - T_{yt} \\boldsymbol{e}_{t} - T_{yx} \\boldsymbol{e}_{x} - T_{yy} \\boldsymbol{e}_{y} - T_{yz} \\boldsymbol{e}_{z} \\\\ L \\left ( \\boldsymbol{e}_{z}\\right ) =& - T_{zt} \\boldsymbol{e}_{t} - T_{zx} \\boldsymbol{e}_{x} - T_{zy} \\boldsymbol{e}_{y} - T_{zz} \\boldsymbol{e}_{z} \\end{array} \\right \\} \\end{equation*}\n", + "\\begin{equation*} \\f{\\det}{\\underline{T}} = T_{tz} \\left(T_{xt} T_{yx} T_{zy} - T_{xt} T_{yy} T_{zx} - T_{xx} T_{yt} T_{zy} + T_{xx} T_{yy} T_{zt} + T_{xy} T_{yt} T_{zx} - T_{xy} T_{yx} T_{zt}\\right) - T_{xz} \\left(T_{tt} T_{yx} T_{zy} - T_{tt} T_{yy} T_{zx} - T_{tx} T_{yt} T_{zy} + T_{tx} T_{yy} T_{zt} + T_{ty} T_{yt} T_{zx} - T_{ty} T_{yx} T_{zt}\\right) + T_{yz} \\left(T_{tt} T_{xx} T_{zy} - T_{tt} T_{xy} T_{zx} - T_{tx} T_{xt} T_{zy} + T_{tx} T_{xy} T_{zt} + T_{ty} T_{xt} T_{zx} - T_{ty} T_{xx} T_{zt}\\right) - T_{zz} \\left(T_{tt} T_{xx} T_{yy} - T_{tt} T_{xy} T_{yx} - T_{tx} T_{xt} T_{yy} + T_{tx} T_{xy} T_{yt} + T_{ty} T_{xt} T_{yx} - T_{ty} T_{xx} T_{yt}\\right) \\end{equation*}\n", + "\\begin{equation*} \\f{\\mbox{tr}}{\\underline{T}} = T_{tt} - T_{xx} - T_{yy} - T_{zz} \\end{equation*}\n", + "\\begin{equation*} a\\cdot \\f{\\overline{T}}{b}-b\\cdot \\f{\\underline{T}}{a} = 0 \\end{equation*}\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{u} f \\boldsymbol{e}_{u} + \\frac{\\partial_{v} f }{\\sin{\\left (u \\right )}} \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} F = F^{u} \\boldsymbol{e}_{u} + F^{v} \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} F = \\left ( \\frac{F^{u} }{\\tan{\\left (u \\right )}} + \\partial_{u} F^{u} + \\frac{\\partial_{v} F^{v} }{\\sin{\\left (u \\right )}}\\right ) + \\left ( \\frac{F^{v} }{\\tan{\\left (u \\right )}} + \\partial_{u} F^{v} - \\frac{\\partial_{v} F^{u} }{\\sin{\\left (u \\right )}}\\right ) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{\\theta } f \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{\\sin{\\left (\\theta \\right )}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} F = F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} F = \\left ( \\frac{F^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } F^{\\theta } + \\frac{\\partial_{\\phi } F^{\\phi } }{\\sin{\\left (\\theta \\right )}}\\right ) + \\left ( \\frac{F^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } F^{\\phi } - \\frac{\\partial_{\\phi } F^{\\theta } }{\\sin{\\left (\\theta \\right )}}\\right ) \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat lin_tran_check.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [], - "source": [ - "!python linear_EM_waves.py" + "check('lin_tran_check')" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 13, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & \\left ( e_{E}\\cdot e_{B}\\right ) & \\left ( e_{E}\\cdot e_{k}\\right ) & 0 \\\\ \\left ( e_{E}\\cdot e_{B}\\right ) & 1 & \\left ( e_{B}\\cdot e_{k}\\right ) & 0 \\\\ \\left ( e_{E}\\cdot e_{k}\\right ) & \\left ( e_{B}\\cdot e_{k}\\right ) & 1 & 0 \\\\ 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = x_{E} \\boldsymbol{e}_{E} + x_{B} \\boldsymbol{e}_{B} + x_{k} \\boldsymbol{e}_{k} + t \\boldsymbol{e}_{t} \\end{equation*}\r\n", - "\\begin{equation*} K = k \\boldsymbol{e}_{k} + \\omega \\boldsymbol{e}_{t} \\end{equation*}\r\n", - "\\begin{equation*} K\\cdot X = \\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k} \\end{equation*}\r\n", - "\\begin{equation*} F = \\frac{\\left ( e_{B}\\cdot e_{k}\\right ) B e^{i \\left(\\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k}\\right)}}{\\sqrt{- \\left ( e_{B}\\cdot e_{k}\\right ) ^{2} + 2 \\left ( e_{B}\\cdot e_{k}\\right ) \\left ( e_{E}\\cdot e_{B}\\right ) \\left ( e_{E}\\cdot e_{k}\\right ) - \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} - \\left ( e_{E}\\cdot e_{k}\\right ) ^{2} + 1}} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{B} - \\frac{B e^{i \\left(\\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k}\\right)}}{\\sqrt{- \\left ( e_{B}\\cdot e_{k}\\right ) ^{2} + 2 \\left ( e_{B}\\cdot e_{k}\\right ) \\left ( e_{E}\\cdot e_{B}\\right ) \\left ( e_{E}\\cdot e_{k}\\right ) - \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} - \\left ( e_{E}\\cdot e_{k}\\right ) ^{2} + 1}} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{k} + E e^{i \\left(\\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k}\\right)} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{t} + \\frac{\\left ( e_{E}\\cdot e_{B}\\right ) B e^{i \\left(\\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k}\\right)}}{\\sqrt{- \\left ( e_{B}\\cdot e_{k}\\right ) ^{2} + 2 \\left ( e_{B}\\cdot e_{k}\\right ) \\left ( e_{E}\\cdot e_{B}\\right ) \\left ( e_{E}\\cdot e_{k}\\right ) - \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} - \\left ( e_{E}\\cdot e_{k}\\right ) ^{2} + 1}} \\boldsymbol{e}_{B}\\wedge \\boldsymbol{e}_{k} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Substituting }e_{E}\\cdot e_{B} = e_{E}\\cdot e_{k} = e_{B}\\cdot e_{k} = 0 \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & \\left ( e_{E}\\cdot e_{B}\\right ) & \\left ( e_{E}\\cdot e_{k}\\right ) & 0 \\\\ \\left ( e_{E}\\cdot e_{B}\\right ) & 1 & \\left ( e_{B}\\cdot e_{k}\\right ) & 0 \\\\ \\left ( e_{E}\\cdot e_{k}\\right ) & \\left ( e_{B}\\cdot e_{k}\\right ) & 1 & 0 \\\\ 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\r\n", - " \\begin{align*} X = & x_{E} \\boldsymbol{e}_{E} \\\\ & + x_{B} \\boldsymbol{e}_{B} \\\\ & + x_{k} \\boldsymbol{e}_{k} \\\\ & + t \\boldsymbol{e}_{t} \\end{align*} \r\n", - " \\begin{align*} K = & k \\boldsymbol{e}_{k} \\\\ & + \\omega \\boldsymbol{e}_{t} \\end{align*} \r\n", - "\\begin{equation*} K\\cdot X = \\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Substituting }e_{E}\\cdot e_{B} = e_{E}\\cdot e_{k} = e_{B}\\cdot e_{k} = 0 \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & \\left ( e_{E}\\cdot e_{B}\\right ) & \\left ( e_{E}\\cdot e_{k}\\right ) & 0 \\\\ \\left ( e_{E}\\cdot e_{B}\\right ) & 1 & \\left ( e_{B}\\cdot e_{k}\\right ) & 0 \\\\ \\left ( e_{E}\\cdot e_{k}\\right ) & \\left ( e_{B}\\cdot e_{k}\\right ) & 1 & 0 \\\\ 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = x_{E} \\boldsymbol{e}_{E} + x_{B} \\boldsymbol{e}_{B} + x_{k} \\boldsymbol{e}_{k} + t \\boldsymbol{e}_{t} \\end{equation*}\n", + "\\begin{equation*} K = k \\boldsymbol{e}_{k} + \\omega \\boldsymbol{e}_{t} \\end{equation*}\n", + "\\begin{equation*} K\\cdot X = \\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k} \\end{equation*}\n", + "\\begin{equation*} F = \\frac{\\left ( e_{B}\\cdot e_{k}\\right ) B e^{i \\left(\\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k}\\right)}}{\\sqrt{- \\left ( e_{B}\\cdot e_{k}\\right ) ^{2} + 2 \\left ( e_{B}\\cdot e_{k}\\right ) \\left ( e_{E}\\cdot e_{B}\\right ) \\left ( e_{E}\\cdot e_{k}\\right ) - \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} - \\left ( e_{E}\\cdot e_{k}\\right ) ^{2} + 1}} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{B} - \\frac{B e^{i \\left(\\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k}\\right)}}{\\sqrt{- \\left ( e_{B}\\cdot e_{k}\\right ) ^{2} + 2 \\left ( e_{B}\\cdot e_{k}\\right ) \\left ( e_{E}\\cdot e_{B}\\right ) \\left ( e_{E}\\cdot e_{k}\\right ) - \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} - \\left ( e_{E}\\cdot e_{k}\\right ) ^{2} + 1}} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{k} + E e^{i \\left(\\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k}\\right)} \\boldsymbol{e}_{E}\\wedge \\boldsymbol{e}_{t} + \\frac{\\left ( e_{E}\\cdot e_{B}\\right ) B e^{i \\left(\\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k}\\right)}}{\\sqrt{- \\left ( e_{B}\\cdot e_{k}\\right ) ^{2} + 2 \\left ( e_{B}\\cdot e_{k}\\right ) \\left ( e_{E}\\cdot e_{B}\\right ) \\left ( e_{E}\\cdot e_{k}\\right ) - \\left ( e_{E}\\cdot e_{B}\\right ) ^{2} - \\left ( e_{E}\\cdot e_{k}\\right ) ^{2} + 1}} \\boldsymbol{e}_{B}\\wedge \\boldsymbol{e}_{k} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Substituting }e_{E}\\cdot e_{B} = e_{E}\\cdot e_{k} = e_{B}\\cdot e_{k} = 0 \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cccc} 1 & \\left ( e_{E}\\cdot e_{B}\\right ) & \\left ( e_{E}\\cdot e_{k}\\right ) & 0 \\\\ \\left ( e_{E}\\cdot e_{B}\\right ) & 1 & \\left ( e_{B}\\cdot e_{k}\\right ) & 0 \\\\ \\left ( e_{E}\\cdot e_{k}\\right ) & \\left ( e_{B}\\cdot e_{k}\\right ) & 1 & 0 \\\\ 0 & 0 & 0 & -1 \\end{array}\\right ] \\end{equation*}\n", + " \\begin{align*} X = & x_{E} \\boldsymbol{e}_{E} \\\\ & + x_{B} \\boldsymbol{e}_{B} \\\\ & + x_{k} \\boldsymbol{e}_{k} \\\\ & + t \\boldsymbol{e}_{t} \\end{align*} \n", + " \\begin{align*} K = & k \\boldsymbol{e}_{k} \\\\ & + \\omega \\boldsymbol{e}_{t} \\end{align*} \n", + "\\begin{equation*} K\\cdot X = \\left ( e_{B}\\cdot e_{k}\\right ) k x_{B} + \\left ( e_{E}\\cdot e_{k}\\right ) k x_{E} - \\omega t + k x_{k} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Substituting }e_{E}\\cdot e_{B} = e_{E}\\cdot e_{k} = e_{B}\\cdot e_{k} = 0 \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat linear_EM_waves.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [], - "source": [ - "!python manifold.py" + "check('linear_EM_waves')" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 14, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} (u,v)\\rightarrow (r,\\theta,\\phi) = [1, u, v] \\end{equation*}\r\n", - "Unit Sphere Manifold:\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & {\\sin{\\left (u \\right )}}^{2} \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} a = a^{u} \\boldsymbol{e}_{u} + a^{v} \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} f = f^{u} \\boldsymbol{e}_{u} + f^{v} \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} \\nabla = \\boldsymbol{e}_{u} \\frac{\\partial}{\\partial u} + \\boldsymbol{e}_{v} \\frac{1}{{\\sin{\\left (u \\right )}}^{2}} \\frac{\\partial}{\\partial v} \\end{equation*}\r\n", - "\\begin{equation*} a\\cdot\\nabla = a^{u} \\frac{\\partial}{\\partial u} + a^{v} \\frac{\\partial}{\\partial v} \\end{equation*}\r\n", - "\\begin{equation*} \\paren{a\\cdot\\nabla}\\bm{e}_u = \\frac{a^{v}}{\\tan{\\left (u \\right )}} \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} \\paren{a\\cdot\\nabla}\\bm{e}_v = - \\frac{a^{v} \\sin{\\left (2 u \\right )}}{2} \\boldsymbol{e}_{u} + \\frac{a^{u}}{\\tan{\\left (u \\right )}} \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} \\paren{a\\cdot\\nabla}f = \\left ( a^{u} \\partial_{u} f^{u} - \\frac{a^{v} f^{v} \\sin{\\left (2 u \\right )}}{2} + a^{v} \\partial_{v} f^{u} \\right ) \\boldsymbol{e}_{u} + \\left ( \\frac{a^{u} f^{v} }{\\tan{\\left (u \\right )}} + a^{u} \\partial_{u} f^{v} + \\frac{a^{v} f^{u} }{\\tan{\\left (u \\right )}} + a^{v} \\partial_{v} f^{v} \\right ) \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "\\begin{equation*} \\nabla f = \\left ( \\frac{f^{u} }{\\tan{\\left (u \\right )}} + \\partial_{u} f^{u} + \\partial_{v} f^{v} \\right ) + \\left ( \\frac{2 f^{v} }{\\tan{\\left (u \\right )}} + \\partial_{u} f^{v} - \\frac{\\partial_{v} f^{u} }{{\\sin{\\left (u \\right )}}^{2}}\\right ) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\r\n", - "1-D Manifold On Unit Sphere:\r\n", - "\\begin{equation*} \\nabla = \\boldsymbol{e}_{s} \\frac{1}{{\\sin{\\left (u^{s} \\right )}}^{2} \\left(\\partial_{s} v^{s} \\right)^{2} + \\left(\\partial_{s} u^{s} \\right)^{2}} \\frac{\\partial}{\\partial s} \\end{equation*}\r\n", - "\\begin{equation*} \\nabla g = \\frac{\\partial_{s} g }{{\\sin{\\left (u^{s} \\right )}}^{2} \\left(\\partial_{s} v^{s} \\right)^{2} + \\left(\\partial_{s} u^{s} \\right)^{2}} \\boldsymbol{e}_{s} \\end{equation*}\r\n", - "\\begin{equation*} \\nabla \\cdot \\bm{h} = \\frac{\\left({\\sin{\\left (u^{s} \\right )}}^{2} \\left(\\partial_{s} v^{s} \\right)^{2} + \\left(\\partial_{s} u^{s} \\right)^{2}\\right) \\partial_{s} h^{s} + \\left({\\sin{\\left (u^{s} \\right )}}^{2} \\partial_{s} v^{s} \\partial^{2}_{s} v^{s} + \\partial_{s} u^{s} \\partial^{2}_{s} u^{s} \\right) h^{s} + \\frac{h^{s} \\sin{\\left (2 u^{s} \\right )} \\partial_{s} u^{s} \\left(\\partial_{s} v^{s} \\right)^{2}}{2}}{{\\sin{\\left (u^{s} \\right )}}^{2} \\left(\\partial_{s} v^{s} \\right)^{2} + \\left(\\partial_{s} u^{s} \\right)^{2}} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} (u,v)\\rightarrow (r,\\theta,\\phi) = [1, u, v] \\end{equation*}\n", + "Unit Sphere Manifold:\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & {\\sin{\\left (u \\right )}}^{2} \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} a = a^{u} \\boldsymbol{e}_{u} + a^{v} \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} f = f^{u} \\boldsymbol{e}_{u} + f^{v} \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} \\nabla = \\boldsymbol{e}_{u} \\frac{\\partial}{\\partial u} + \\boldsymbol{e}_{v} \\frac{1}{{\\sin{\\left (u \\right )}}^{2}} \\frac{\\partial}{\\partial v} \\end{equation*}\n", + "\\begin{equation*} a\\cdot\\nabla = a^{u} \\frac{\\partial}{\\partial u} + a^{v} \\frac{\\partial}{\\partial v} \\end{equation*}\n", + "\\begin{equation*} \\paren{a\\cdot\\nabla}\\bm{e}_u = \\frac{a^{v}}{\\tan{\\left (u \\right )}} \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} \\paren{a\\cdot\\nabla}\\bm{e}_v = - \\frac{a^{v} \\sin{\\left (2 u \\right )}}{2} \\boldsymbol{e}_{u} + \\frac{a^{u}}{\\tan{\\left (u \\right )}} \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} \\paren{a\\cdot\\nabla}f = \\left ( a^{u} \\partial_{u} f^{u} - \\frac{a^{v} f^{v} \\sin{\\left (2 u \\right )}}{2} + a^{v} \\partial_{v} f^{u} \\right ) \\boldsymbol{e}_{u} + \\left ( \\frac{a^{u} f^{v} }{\\tan{\\left (u \\right )}} + a^{u} \\partial_{u} f^{v} + \\frac{a^{v} f^{u} }{\\tan{\\left (u \\right )}} + a^{v} \\partial_{v} f^{v} \\right ) \\boldsymbol{e}_{v} \\end{equation*}\n", + "\\begin{equation*} \\nabla f = \\left ( \\frac{f^{u} }{\\tan{\\left (u \\right )}} + \\partial_{u} f^{u} + \\partial_{v} f^{v} \\right ) + \\left ( \\frac{2 f^{v} }{\\tan{\\left (u \\right )}} + \\partial_{u} f^{v} - \\frac{\\partial_{v} f^{u} }{{\\sin{\\left (u \\right )}}^{2}}\\right ) \\boldsymbol{e}_{u}\\wedge \\boldsymbol{e}_{v} \\end{equation*}\n", + "1-D Manifold On Unit Sphere:\n", + "\\begin{equation*} \\nabla = \\boldsymbol{e}_{s} \\frac{1}{{\\sin{\\left (u^{s} \\right )}}^{2} \\left(\\partial_{s} v^{s} \\right)^{2} + \\left(\\partial_{s} u^{s} \\right)^{2}} \\frac{\\partial}{\\partial s} \\end{equation*}\n", + "\\begin{equation*} \\nabla g = \\frac{\\partial_{s} g }{{\\sin{\\left (u^{s} \\right )}}^{2} \\left(\\partial_{s} v^{s} \\right)^{2} + \\left(\\partial_{s} u^{s} \\right)^{2}} \\boldsymbol{e}_{s} \\end{equation*}\n", + "\\begin{equation*} \\nabla \\cdot \\bm{h} = \\frac{\\left({\\sin{\\left (u^{s} \\right )}}^{2} \\left(\\partial_{s} v^{s} \\right)^{2} + \\left(\\partial_{s} u^{s} \\right)^{2}\\right) \\partial_{s} h^{s} + \\left({\\sin{\\left (u^{s} \\right )}}^{2} \\partial_{s} v^{s} \\partial^{2}_{s} v^{s} + \\partial_{s} u^{s} \\partial^{2}_{s} u^{s} \\right) h^{s} + \\frac{h^{s} \\sin{\\left (2 u^{s} \\right )} \\partial_{s} u^{s} \\left(\\partial_{s} v^{s} \\right)^{2}}{2}}{{\\sin{\\left (u^{s} \\right )}}^{2} \\left(\\partial_{s} v^{s} \\right)^{2} + \\left(\\partial_{s} u^{s} \\right)^{2}} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat manifold.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [], - "source": [ - "!python matrix_latex.py" + "check('manifold')" ] }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 15, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\left [ \\begin{array}{cc} 1 & 2 \\\\ 3 & 4 \\end{array}\\right ] \\left [ \\begin{array}{c} 5 \\\\ 6 \\end{array}\\right ] = \\left [ \\begin{array}{c} 17 \\\\ 39 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\begin{array}{cc} x^{3} & y^{3} \\end{array}\\right ] \\left [ \\begin{array}{cc} x^{2} & 2 x y \\\\ 2 x y & y^{2} \\end{array}\\right ] = \\left [ \\begin{array}{cc} x^{5} + 2 x y^{4} & 2 x^{4} y + y^{5} \\end{array}\\right ] \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\left [ \\begin{array}{cc} 1 & 2 \\\\ 3 & 4 \\end{array}\\right ] \\left [ \\begin{array}{c} 5 \\\\ 6 \\end{array}\\right ] = \\left [ \\begin{array}{c} 17 \\\\ 39 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\left [ \\begin{array}{cc} x^{3} & y^{3} \\end{array}\\right ] \\left [ \\begin{array}{cc} x^{2} & 2 x y \\\\ 2 x y & y^{2} \\end{array}\\right ] = \\left [ \\begin{array}{cc} x^{5} + 2 x y^{4} & 2 x^{4} y + y^{5} \\end{array}\\right ] \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat matrix_latex.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": {}, - "outputs": [], - "source": [ - "!python new_bug_grad_exp.py" + "check('matrix_latex')" ] }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 16, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "Results with all scalar variables declared as real\r\n", - "\\begin{equation*} X = t \\boldsymbol{\\gamma }_{t} + x \\boldsymbol{\\gamma }_{x} + y \\boldsymbol{\\gamma }_{y} + z \\boldsymbol{\\gamma }_{z} + w \\boldsymbol{\\gamma }_{w} \\end{equation*}\r\n", - "\\begin{equation*} K = k^{t} \\boldsymbol{\\gamma }_{t} + k^{x} \\boldsymbol{\\gamma }_{x} + k^{y} \\boldsymbol{\\gamma }_{y} + k^{z} \\boldsymbol{\\gamma }_{z} + k^{w} \\boldsymbol{\\gamma }_{w} \\end{equation*}\r\n", - "\\begin{equation*} K\\cdot X = k^{t} t - k^{w} w - k^{x} x - k^{y} y - k^{z} z \\end{equation*}\r\n", - "\\begin{equation*} I^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} I_{xyzw} = I\\gamma_{x}\\gamma_{y}\\gamma_{z}\\gamma_{w} = \\boldsymbol{\\gamma }_{t} \\end{equation*}\r\n", - "\\begin{equation*} \\lp I\\gamma_{x}\\gamma_{y}\\gamma_{z}\\gamma_{w}\\rp^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} e^{I_{xyzw}K\\cdot X} = \\cosh{\\left (- k^{t} t + k^{w} w + k^{x} x + k^{y} y + k^{z} z \\right )} - \\sinh{\\left (- k^{t} t + k^{w} w + k^{x} x + k^{y} y + k^{z} z \\right )} \\boldsymbol{\\gamma }_{t} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "Results with all scalar variables declared as real\n", + "\\begin{equation*} X = t \\boldsymbol{\\gamma }_{t} + x \\boldsymbol{\\gamma }_{x} + y \\boldsymbol{\\gamma }_{y} + z \\boldsymbol{\\gamma }_{z} + w \\boldsymbol{\\gamma }_{w} \\end{equation*}\n", + "\\begin{equation*} K = k^{t} \\boldsymbol{\\gamma }_{t} + k^{x} \\boldsymbol{\\gamma }_{x} + k^{y} \\boldsymbol{\\gamma }_{y} + k^{z} \\boldsymbol{\\gamma }_{z} + k^{w} \\boldsymbol{\\gamma }_{w} \\end{equation*}\n", + "\\begin{equation*} K\\cdot X = k^{t} t - k^{w} w - k^{x} x - k^{y} y - k^{z} z \\end{equation*}\n", + "\\begin{equation*} I^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} I_{xyzw} = I\\gamma_{x}\\gamma_{y}\\gamma_{z}\\gamma_{w} = \\boldsymbol{\\gamma }_{t} \\end{equation*}\n", + "\\begin{equation*} \\lp I\\gamma_{x}\\gamma_{y}\\gamma_{z}\\gamma_{w}\\rp^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} e^{I_{xyzw}K\\cdot X} = \\cosh{\\left (- k^{t} t + k^{w} w + k^{x} x + k^{y} y + k^{z} z \\right )} - \\sinh{\\left (- k^{t} t + k^{w} w + k^{x} x + k^{y} y + k^{z} z \\right )} \\boldsymbol{\\gamma }_{t} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat new_bug_grad_exp.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": {}, - "outputs": [], - "source": [ - "!python physics_check_latex.py" + "check('new_bug_grad_exp')" ] }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 17, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def General_Lorentz_Tranformation():\r\n", - " Print_Function()\r\n", - " (alpha,beta,gamma) = symbols('alpha beta gamma')\r\n", - " (x,y,z,t) = symbols(\"x y z t\",real=True)\r\n", - " (st4d,g0,g1,g2,g3) = Ga.build('gamma*t|x|y|z',g=[1,-1,-1,-1])\r\n", - " B = (x*g1+y*g2+z*g3)^(t*g0)\r\n", - " print(B)\r\n", - " print(B.exp(hint='+'))\r\n", - " print(B.exp(hint='-'))\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} - t x \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - t y \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - t z \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\cosh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )} - \\frac{t x \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - \\frac{t y \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - \\frac{t z \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\cosh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )} - \\frac{t x \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - \\frac{t y \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - \\frac{t z \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def General_Lorentz_Tranformation():\n", + " Print_Function()\n", + " (alpha,beta,gamma) = symbols('alpha beta gamma')\n", + " (x,y,z,t) = symbols(\"x y z t\",real=True)\n", + " (st4d,g0,g1,g2,g3) = Ga.build('gamma*t|x|y|z',g=[1,-1,-1,-1])\n", + " B = (x*g1+y*g2+z*g3)^(t*g0)\n", + " print(B)\n", + " print(B.exp(hint='+'))\n", + " print(B.exp(hint='-'))\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} - t x \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - t y \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - t z \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "\\begin{equation*} \\cosh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )} - \\frac{t x \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - \\frac{t y \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - \\frac{t z \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "\\begin{equation*} \\cosh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )} - \\frac{t x \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - \\frac{t y \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - \\frac{t z \\sinh{\\left (\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right| \\right )}}{\\sqrt{x^{2} + y^{2} + z^{2}} \\left|{t}\\right|} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat physics_check_latex.tex" + "check('physics_check_latex')" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 18, "metadata": {}, - "outputs": [], - "source": [ - "!python print_check_latex.py" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\bm{A} = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} \\bm{A} = & A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} \\bm{B} = & B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} \\boldsymbol{\\nabla} f = & \\partial_{x} f \\boldsymbol{e}_{x} \\\\ & + \\partial_{y} f \\boldsymbol{e}_{y} \\\\ & + \\partial_{z} f \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot \\bm{A} = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} \\bm{A} = & \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} -I (\\boldsymbol{\\nabla} \\W \\bm{A}) = & \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{z} A^{x} - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} \\boldsymbol{\\nabla} \\bm{B} = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\\\ & + \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W \\bm{B} = \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} \\cdot \\bm{B} = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cccc} \\left ( a\\cdot a\\right ) & \\left ( a\\cdot b\\right ) & \\left ( a\\cdot c\\right ) & \\left ( a\\cdot d\\right ) \\\\ \\left ( a\\cdot b\\right ) & \\left ( b\\cdot b\\right ) & \\left ( b\\cdot c\\right ) & \\left ( b\\cdot d\\right ) \\\\ \\left ( a\\cdot c\\right ) & \\left ( b\\cdot c\\right ) & \\left ( c\\cdot c\\right ) & \\left ( c\\cdot d\\right ) \\\\ \\left ( a\\cdot d\\right ) & \\left ( b\\cdot d\\right ) & \\left ( c\\cdot d\\right ) & \\left ( d\\cdot d\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - " \\begin{align*} \\bm{a\\cdot (b c)} = & - \\left ( a\\cdot c\\right ) \\boldsymbol{b} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{align*} \r\n", - " \\begin{align*} \\bm{a\\cdot (b\\W c)} = & - \\left ( a\\cdot c\\right ) \\boldsymbol{b} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{align*} \r\n", - " \\begin{align*} \\bm{a\\cdot (b\\W c\\W d)} = & \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} \\\\ & - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{align*} \r\n", - "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} = 0 \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\r\n", - "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\r\n", - " \\begin{align*} \\bm{(a\\W b)\\times (c\\W d)} = & - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c} \\\\ & + \\left ( b\\cdot c\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{d} \\\\ & + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} \\\\ & - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{align*} \r\n", - "\\begin{equation*} E = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} E^{2} = \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 2 \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} + \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1 \\end{equation*}\r\n", - " \\begin{align*} E1 = (e2\\W e3) E = & \\left ( \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - " \\begin{align*} E2 =-(e1\\W e3) E = & \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - " \\begin{align*} E3 = (e1\\W e2) E = & \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - "\\begin{equation*} E1\\cdot e2 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E1\\cdot e3 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E2\\cdot e1 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E2\\cdot e3 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E3\\cdot e1 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E3\\cdot e2 = 0 \\end{equation*}\r\n", - "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\r\n", - " \\begin{align*} A = & A^{r} \\boldsymbol{e}_{r} \\\\ & + A^{\\theta } \\boldsymbol{e}_{\\theta } \\\\ & + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - " \\begin{align*} B = & B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } \\\\ & + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } \\\\ & + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - " \\begin{align*} \\boldsymbol{\\nabla} f = & \\partial_{r} f \\boldsymbol{e}_{r} \\\\ & + \\frac{\\partial_{\\theta } f }{r} \\boldsymbol{e}_{\\theta } \\\\ & + \\frac{\\partial_{\\phi } f }{r \\sin{\\left (\\theta \\right )}} \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{r \\partial_{r} A^{r} + 2 A^{r} + \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\theta } + \\frac{\\partial_{\\phi } A^{\\phi } }{\\sin{\\left (\\theta \\right )}}}{r} \\end{equation*}\r\n", - " \\begin{align*} -I (\\boldsymbol{\\nabla} \\W A) = & \\frac{\\frac{A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{r} \\\\ & + \\frac{- r \\partial_{r} A^{\\phi } - A^{\\phi } + \\frac{\\partial_{\\phi } A^{r} }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{\\theta } \\\\ & + \\frac{r \\partial_{r} A^{\\theta } + A^{\\theta } - \\partial_{\\theta } A^{r} }{r} \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r \\partial_{r} B^{\\theta \\phi } - \\frac{B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} + 2 B^{\\theta \\phi } - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - " \\begin{align*} B = \\bm{B\\gamma_{t}} = & - B^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - B^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - B^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} E = \\bm{E\\gamma_{t}} = & - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} F = E+IB = & - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{z} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + B^{y} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{x} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} J = & J^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + J^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + J^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + J^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} F = J \\end{equation*}\r\n", - " \\begin{align*} R = & \\cosh{\\left (\\frac{\\alpha }{2} \\right )} \\\\ & + \\sinh{\\left (\\frac{\\alpha }{2} \\right )} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger} \\end{equation*}\r\n", - " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( t' \\cosh{\\left (\\alpha \\right )} - x' \\sinh{\\left (\\alpha \\right )}\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - t' \\sinh{\\left (\\alpha \\right )} + x' \\cosh{\\left (\\alpha \\right )}\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - "\\begin{equation*} \\f{\\sinh}{\\alpha} = \\gamma\\beta \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\cosh}{\\alpha} = \\gamma \\end{equation*}\r\n", - " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\gamma \\left(- \\beta x' + t'\\right) \\boldsymbol{\\gamma }_{t} \\\\ & + \\gamma \\left(- \\beta t' + x'\\right) \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - " \\begin{align*} \\bm{A} = & A^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + A^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + A^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + A^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} \\bm{\\psi} = & \\psi \\\\ & + \\psi ^{tx} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & + \\psi ^{ty} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{tz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{xy} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{xz} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{yz} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{txyz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - "\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\bm{A} = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} \\bm{A} = & A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} \\bm{B} = & B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} \\boldsymbol{\\nabla} f = & \\partial_{x} f \\boldsymbol{e}_{x} \\\\ & + \\partial_{y} f \\boldsymbol{e}_{y} \\\\ & + \\partial_{z} f \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot \\bm{A} = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\n", + " \\begin{align*} \\boldsymbol{\\nabla} \\bm{A} = & \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} -I (\\boldsymbol{\\nabla} \\W \\bm{A}) = & \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{z} A^{x} - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} \\boldsymbol{\\nabla} \\bm{B} = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\\\ & + \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W \\bm{B} = \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} \\boldsymbol{\\nabla} \\cdot \\bm{B} = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cccc} \\left ( a\\cdot a\\right ) & \\left ( a\\cdot b\\right ) & \\left ( a\\cdot c\\right ) & \\left ( a\\cdot d\\right ) \\\\ \\left ( a\\cdot b\\right ) & \\left ( b\\cdot b\\right ) & \\left ( b\\cdot c\\right ) & \\left ( b\\cdot d\\right ) \\\\ \\left ( a\\cdot c\\right ) & \\left ( b\\cdot c\\right ) & \\left ( c\\cdot c\\right ) & \\left ( c\\cdot d\\right ) \\\\ \\left ( a\\cdot d\\right ) & \\left ( b\\cdot d\\right ) & \\left ( c\\cdot d\\right ) & \\left ( d\\cdot d\\right ) \\end{array}\\right ] \\end{equation*}\n", + " \\begin{align*} \\bm{a\\cdot (b c)} = & - \\left ( a\\cdot c\\right ) \\boldsymbol{b} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{align*} \n", + " \\begin{align*} \\bm{a\\cdot (b\\W c)} = & - \\left ( a\\cdot c\\right ) \\boldsymbol{b} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{align*} \n", + " \\begin{align*} \\bm{a\\cdot (b\\W c\\W d)} = & \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} \\\\ & - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{align*} \n", + "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} = 0 \\end{equation*}\n", + "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\n", + "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n", + "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\n", + "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\n", + " \\begin{align*} \\bm{(a\\W b)\\times (c\\W d)} = & - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c} \\\\ & + \\left ( b\\cdot c\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{d} \\\\ & + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} \\\\ & - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{align*} \n", + "\\begin{equation*} E = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} E^{2} = \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 2 \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} + \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1 \\end{equation*}\n", + " \\begin{align*} E1 = (e2\\W e3) E = & \\left ( \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + " \\begin{align*} E2 =-(e1\\W e3) E = & \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + " \\begin{align*} E3 = (e1\\W e2) E = & \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + "\\begin{equation*} E1\\cdot e2 = 0 \\end{equation*}\n", + "\\begin{equation*} E1\\cdot e3 = 0 \\end{equation*}\n", + "\\begin{equation*} E2\\cdot e1 = 0 \\end{equation*}\n", + "\\begin{equation*} E2\\cdot e3 = 0 \\end{equation*}\n", + "\\begin{equation*} E3\\cdot e1 = 0 \\end{equation*}\n", + "\\begin{equation*} E3\\cdot e2 = 0 \\end{equation*}\n", + "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\n", + " \\begin{align*} A = & A^{r} \\boldsymbol{e}_{r} \\\\ & + A^{\\theta } \\boldsymbol{e}_{\\theta } \\\\ & + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{align*} \n", + " \\begin{align*} B = & B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } \\\\ & + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } \\\\ & + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{align*} \n", + " \\begin{align*} \\boldsymbol{\\nabla} f = & \\partial_{r} f \\boldsymbol{e}_{r} \\\\ & + \\frac{\\partial_{\\theta } f }{r} \\boldsymbol{e}_{\\theta } \\\\ & + \\frac{\\partial_{\\phi } f }{r \\sin{\\left (\\theta \\right )}} \\boldsymbol{e}_{\\phi } \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{r \\partial_{r} A^{r} + 2 A^{r} + \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\theta } + \\frac{\\partial_{\\phi } A^{\\phi } }{\\sin{\\left (\\theta \\right )}}}{r} \\end{equation*}\n", + " \\begin{align*} -I (\\boldsymbol{\\nabla} \\W A) = & \\frac{\\frac{A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{r} \\\\ & + \\frac{- r \\partial_{r} A^{\\phi } - A^{\\phi } + \\frac{\\partial_{\\phi } A^{r} }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{\\theta } \\\\ & + \\frac{r \\partial_{r} A^{\\theta } + A^{\\theta } - \\partial_{\\theta } A^{r} }{r} \\boldsymbol{e}_{\\phi } \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r \\partial_{r} B^{\\theta \\phi } - \\frac{B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} + 2 B^{\\theta \\phi } - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{\\sin{\\left (\\theta \\right )}}}{r} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + " \\begin{align*} B = \\bm{B\\gamma_{t}} = & - B^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - B^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - B^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} E = \\bm{E\\gamma_{t}} = & - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} F = E+IB = & - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{z} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + B^{y} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{x} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} J = & J^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + J^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + J^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + J^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} F = J \\end{equation*}\n", + " \\begin{align*} R = & \\cosh{\\left (\\frac{\\alpha }{2} \\right )} \\\\ & + \\sinh{\\left (\\frac{\\alpha }{2} \\right )} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger} \\end{equation*}\n", + " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( t' \\cosh{\\left (\\alpha \\right )} - x' \\sinh{\\left (\\alpha \\right )}\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - t' \\sinh{\\left (\\alpha \\right )} + x' \\cosh{\\left (\\alpha \\right )}\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + "\\begin{equation*} \\f{\\sinh}{\\alpha} = \\gamma\\beta \\end{equation*}\n", + "\\begin{equation*} \\f{\\cosh}{\\alpha} = \\gamma \\end{equation*}\n", + " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\gamma \\left(- \\beta x' + t'\\right) \\boldsymbol{\\gamma }_{t} \\\\ & + \\gamma \\left(- \\beta t' + x'\\right) \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + " \\begin{align*} \\bm{A} = & A^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + A^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + A^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + A^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} \\bm{\\psi} = & \\psi \\\\ & + \\psi ^{tx} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & + \\psi ^{ty} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{tz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{xy} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{xz} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{yz} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{txyz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + "\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat print_check_latex.tex" + "check('print_check_latex')" ] }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 19, "metadata": {}, - "outputs": [], - "source": [ - "!python products_latex.py" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "3D Orthogonal Metric\\newline\r\n", - "Multvectors:\r\n", - "\\begin{equation*} s = s \\end{equation*}\r\n", - "\\begin{equation*} v = v^{x} \\boldsymbol{e}_{x} + v^{y} \\boldsymbol{e}_{y} + v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b = b^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "Products:\r\n", - "\\begin{equation*} s s = s^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\W s = s^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor s = s^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor s = s^{2} \\end{equation*}\r\n", - "\\begin{equation*} s v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\W v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor v = 0 \\end{equation*}\r\n", - "\\begin{equation*} s b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\W b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor b = 0 \\end{equation*}\r\n", - "\\begin{equation*} v s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\W s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor s = 0 \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v v = {\\left ( v^{x} \\right )}^{2} + {\\left ( v^{y} \\right )}^{2} + {\\left ( v^{z} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\W v = 0 \\end{equation*}\r\n", - "\\begin{equation*} v \\cdot v = {\\left ( v^{x} \\right )}^{2} + {\\left ( v^{y} \\right )}^{2} + {\\left ( v^{z} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor v = {\\left ( v^{x} \\right )}^{2} + {\\left ( v^{y} \\right )}^{2} + {\\left ( v^{z} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor v = {\\left ( v^{x} \\right )}^{2} + {\\left ( v^{y} \\right )}^{2} + {\\left ( v^{z} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} v b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} + \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\W b = \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\cdot b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor b = 0 \\end{equation*}\r\n", - "\\begin{equation*} b s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\W s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\rfloor s = 0 \\end{equation*}\r\n", - "\\begin{equation*} b \\lfloor s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b v = \\left ( b^{xy} v^{y} + b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} + \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\W v = \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\cdot v = \\left ( b^{xy} v^{y} + b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\rfloor v = 0 \\end{equation*}\r\n", - "\\begin{equation*} b \\lfloor v = \\left ( b^{xy} v^{y} + b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b b = - {\\left ( b^{xy} \\right )}^{2} - {\\left ( b^{xz} \\right )}^{2} - {\\left ( b^{yz} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} b \\W b = 0 \\end{equation*}\r\n", - "\\begin{equation*} b \\cdot b = - {\\left ( b^{xy} \\right )}^{2} - {\\left ( b^{xz} \\right )}^{2} - {\\left ( b^{yz} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} b \\rfloor b = - {\\left ( b^{xy} \\right )}^{2} - {\\left ( b^{xz} \\right )}^{2} - {\\left ( b^{yz} \\right )}^{2} \\end{equation*}\r\n", - "\\begin{equation*} b \\lfloor b = - {\\left ( b^{xy} \\right )}^{2} - {\\left ( b^{xz} \\right )}^{2} - {\\left ( b^{yz} \\right )}^{2} \\end{equation*}\r\n", - "Multivector Functions:\r\n", - "\\begin{equation*} s(X) = s \\end{equation*}\r\n", - "\\begin{equation*} v(X) = v^{x} \\boldsymbol{e}_{x} + v^{y} \\boldsymbol{e}_{y} + v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b(X) = b^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "Products:\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} s = \\partial_{x} s \\boldsymbol{e}_{x} + \\partial_{y} s \\boldsymbol{e}_{y} + \\partial_{z} s \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W s = \\partial_{x} s \\boldsymbol{e}_{x} + \\partial_{y} s \\boldsymbol{e}_{y} + \\partial_{z} s \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor s = 0 \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor s = \\partial_{x} s \\boldsymbol{e}_{x} + \\partial_{y} s \\boldsymbol{e}_{y} + \\partial_{z} s \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} v = \\left ( \\partial_{x} v^{x} + \\partial_{y} v^{y} + \\partial_{z} v^{z} \\right ) + \\left ( - \\partial_{y} v^{x} + \\partial_{x} v^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} v^{x} + \\partial_{x} v^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} v^{y} + \\partial_{y} v^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W v = \\left ( - \\partial_{y} v^{x} + \\partial_{x} v^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} v^{x} + \\partial_{x} v^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} v^{y} + \\partial_{y} v^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot v = \\partial_{x} v^{x} + \\partial_{y} v^{y} + \\partial_{z} v^{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor v = \\partial_{x} v^{x} + \\partial_{y} v^{y} + \\partial_{z} v^{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor v = \\partial_{x} v^{x} + \\partial_{y} v^{y} + \\partial_{z} v^{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} b = \\left ( - \\partial_{y} b^{xy} - \\partial_{z} b^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} b^{xy} - \\partial_{z} b^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} b^{xz} + \\partial_{y} b^{yz} \\right ) \\boldsymbol{e}_{z} + \\left ( \\partial_{z} b^{xy} - \\partial_{y} b^{xz} + \\partial_{x} b^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W b = \\left ( \\partial_{z} b^{xy} - \\partial_{y} b^{xz} + \\partial_{x} b^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot b = \\left ( - \\partial_{y} b^{xy} - \\partial_{z} b^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} b^{xy} - \\partial_{z} b^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} b^{xz} + \\partial_{y} b^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor b = \\left ( - \\partial_{y} b^{xy} - \\partial_{z} b^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} b^{xy} - \\partial_{z} b^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} b^{xz} + \\partial_{y} b^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor b = 0 \\end{equation*}\r\n", - "\\begin{equation*} s \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\r\n", - "\\begin{equation*} s \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = \\end{equation*}\r\n", - "\\begin{equation*} s s = {s }^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\W s = {s }^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor s = {s }^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor s = {s }^{2} \\end{equation*}\r\n", - "\\begin{equation*} s v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\W v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor v = 0 \\end{equation*}\r\n", - "\\begin{equation*} s b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\W b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor b = 0 \\end{equation*}\r\n", - "\\begin{equation*} v \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + v^{z} \\frac{\\partial}{\\partial z} + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\left ( - v^{y} \\frac{\\partial}{\\partial x} + v^{x} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\left ( - v^{z} \\frac{\\partial}{\\partial x} + v^{x} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( - v^{z} \\frac{\\partial}{\\partial y} + v^{y} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} v \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\left ( - v^{y} \\frac{\\partial}{\\partial x} + v^{x} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\left ( - v^{z} \\frac{\\partial}{\\partial x} + v^{x} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( - v^{z} \\frac{\\partial}{\\partial y} + v^{y} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} v \\cdot \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + v^{z} \\frac{\\partial}{\\partial z} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + v^{z} \\frac{\\partial}{\\partial z} \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + v^{z} \\frac{\\partial}{\\partial z} \\end{equation*}\r\n", - "\\begin{equation*} v s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\W s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor s = 0 \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v v = {v^{x} }^{2} + {v^{y} }^{2} + {v^{z} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\W v = 0 \\end{equation*}\r\n", - "\\begin{equation*} v \\cdot v = {v^{x} }^{2} + {v^{y} }^{2} + {v^{z} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor v = {v^{x} }^{2} + {v^{y} }^{2} + {v^{z} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor v = {v^{x} }^{2} + {v^{y} }^{2} + {v^{z} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} v b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} + \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\W b = \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\cdot b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor b = 0 \\end{equation*}\r\n", - "\\begin{equation*} b \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( b^{yz} \\frac{\\partial}{\\partial x} - b^{xz} \\frac{\\partial}{\\partial y} + b^{xy} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} b \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( b^{yz} \\frac{\\partial}{\\partial x} - b^{xz} \\frac{\\partial}{\\partial y} + b^{xy} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} b \\cdot \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} b \\rfloor \\boldsymbol{\\nabla} = \\end{equation*}\r\n", - "\\begin{equation*} b \\lfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} b s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\W s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\rfloor s = 0 \\end{equation*}\r\n", - "\\begin{equation*} b \\lfloor s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b v = \\left ( b^{xy} v^{y} + b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} + \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\W v = \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\cdot v = \\left ( b^{xy} v^{y} + b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b \\rfloor v = 0 \\end{equation*}\r\n", - "\\begin{equation*} b \\lfloor v = \\left ( b^{xy} v^{y} + b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b b = - {b^{xy} }^{2} - {b^{xz} }^{2} - {b^{yz} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} b \\W b = 0 \\end{equation*}\r\n", - "\\begin{equation*} b \\cdot b = - {b^{xy} }^{2} - {b^{xz} }^{2} - {b^{yz} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} b \\rfloor b = - {b^{xy} }^{2} - {b^{xz} }^{2} - {b^{yz} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} b \\lfloor b = - {b^{xy} }^{2} - {b^{xz} }^{2} - {b^{yz} }^{2} \\end{equation*}\r\n", - "General 2D Metric\\newline\r\n", - "Multivector Functions:\r\n", - "\\begin{equation*} s(X) = s \\end{equation*}\r\n", - "\\begin{equation*} v(X) = v^{x} \\boldsymbol{e}_{x} + v^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} b(X) = v^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "Products:\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} s = \\frac{- \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} s + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} s - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W s = \\frac{- \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} s + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} s - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot s = Not Allowed \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor s = 0 \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor s = \\frac{- \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} s + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} s - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} v = \\left ( \\partial_{x} v^{x} + \\partial_{y} v^{y} \\right ) + \\frac{- \\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} v^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} v^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W v = \\frac{- \\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} v^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} v^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot v = \\partial_{x} v^{x} + \\partial_{y} v^{y} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor v = \\partial_{x} v^{x} + \\partial_{y} v^{y} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor v = \\partial_{x} v^{x} + \\partial_{y} v^{y} \\end{equation*}\r\n", - "\\begin{equation*} s \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} s \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} s \\cdot \\boldsymbol{\\nabla} = Not Allowed \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = \\end{equation*}\r\n", - "\\begin{equation*} s s = {s }^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\W s = {s }^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\cdot s = Not Allowed \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor s = {s }^{2} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor s = {s }^{2} \\end{equation*}\r\n", - "\\begin{equation*} s v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} s \\W v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} s \\cdot v = Not Allowed \\end{equation*}\r\n", - "\\begin{equation*} s \\rfloor v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} s \\lfloor v = 0 \\end{equation*}\r\n", - "\\begin{equation*} v \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) v^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) v^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} v \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) v^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) v^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\r\n", - "\\begin{equation*} v \\cdot \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} \\end{equation*}\r\n", - "\\begin{equation*} v s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} v \\W s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} v \\cdot s = Not Allowed \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor s = 0 \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} v v = \\left ( e_{x}\\cdot e_{x}\\right ) {v^{x} }^{2} + 2 \\left ( e_{x}\\cdot e_{y}\\right ) v^{x} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) {v^{y} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\W v = 0 \\end{equation*}\r\n", - "\\begin{equation*} v \\cdot v = \\left ( e_{x}\\cdot e_{x}\\right ) {v^{x} }^{2} + 2 \\left ( e_{x}\\cdot e_{y}\\right ) v^{x} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) {v^{y} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\rfloor v = \\left ( e_{x}\\cdot e_{x}\\right ) {v^{x} }^{2} + 2 \\left ( e_{x}\\cdot e_{y}\\right ) v^{x} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) {v^{y} }^{2} \\end{equation*}\r\n", - "\\begin{equation*} v \\lfloor v = \\left ( e_{x}\\cdot e_{x}\\right ) {v^{x} }^{2} + 2 \\left ( e_{x}\\cdot e_{y}\\right ) v^{x} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) {v^{y} }^{2} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "3D Orthogonal Metric\\newline\n", + "Multvectors:\n", + "\\begin{equation*} s = s \\end{equation*}\n", + "\\begin{equation*} v = v^{x} \\boldsymbol{e}_{x} + v^{y} \\boldsymbol{e}_{y} + v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b = b^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "Products:\n", + "\\begin{equation*} s s = s^{2} \\end{equation*}\n", + "\\begin{equation*} s \\W s = s^{2} \\end{equation*}\n", + "\\begin{equation*} s \\rfloor s = s^{2} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor s = s^{2} \\end{equation*}\n", + "\\begin{equation*} s v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\W v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\rfloor v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor v = 0 \\end{equation*}\n", + "\\begin{equation*} s b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\W b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\rfloor b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor b = 0 \\end{equation*}\n", + "\\begin{equation*} v s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\W s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor s = 0 \\end{equation*}\n", + "\\begin{equation*} v \\lfloor s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v v = {\\left ( v^{x} \\right )}^{2} + {\\left ( v^{y} \\right )}^{2} + {\\left ( v^{z} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} v \\W v = 0 \\end{equation*}\n", + "\\begin{equation*} v \\cdot v = {\\left ( v^{x} \\right )}^{2} + {\\left ( v^{y} \\right )}^{2} + {\\left ( v^{z} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor v = {\\left ( v^{x} \\right )}^{2} + {\\left ( v^{y} \\right )}^{2} + {\\left ( v^{z} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} v \\lfloor v = {\\left ( v^{x} \\right )}^{2} + {\\left ( v^{y} \\right )}^{2} + {\\left ( v^{z} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} v b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} + \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\W b = \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\cdot b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\lfloor b = 0 \\end{equation*}\n", + "\\begin{equation*} b s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\W s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\rfloor s = 0 \\end{equation*}\n", + "\\begin{equation*} b \\lfloor s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b v = \\left ( b^{xy} v^{y} + b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} + \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\W v = \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\cdot v = \\left ( b^{xy} v^{y} + b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\rfloor v = 0 \\end{equation*}\n", + "\\begin{equation*} b \\lfloor v = \\left ( b^{xy} v^{y} + b^{xz} v^{z}\\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z}\\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y}\\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b b = - {\\left ( b^{xy} \\right )}^{2} - {\\left ( b^{xz} \\right )}^{2} - {\\left ( b^{yz} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} b \\W b = 0 \\end{equation*}\n", + "\\begin{equation*} b \\cdot b = - {\\left ( b^{xy} \\right )}^{2} - {\\left ( b^{xz} \\right )}^{2} - {\\left ( b^{yz} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} b \\rfloor b = - {\\left ( b^{xy} \\right )}^{2} - {\\left ( b^{xz} \\right )}^{2} - {\\left ( b^{yz} \\right )}^{2} \\end{equation*}\n", + "\\begin{equation*} b \\lfloor b = - {\\left ( b^{xy} \\right )}^{2} - {\\left ( b^{xz} \\right )}^{2} - {\\left ( b^{yz} \\right )}^{2} \\end{equation*}\n", + "Multivector Functions:\n", + "\\begin{equation*} s(X) = s \\end{equation*}\n", + "\\begin{equation*} v(X) = v^{x} \\boldsymbol{e}_{x} + v^{y} \\boldsymbol{e}_{y} + v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b(X) = b^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "Products:\n", + "\\begin{equation*} \\boldsymbol{\\nabla} s = \\partial_{x} s \\boldsymbol{e}_{x} + \\partial_{y} s \\boldsymbol{e}_{y} + \\partial_{z} s \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W s = \\partial_{x} s \\boldsymbol{e}_{x} + \\partial_{y} s \\boldsymbol{e}_{y} + \\partial_{z} s \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor s = 0 \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor s = \\partial_{x} s \\boldsymbol{e}_{x} + \\partial_{y} s \\boldsymbol{e}_{y} + \\partial_{z} s \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} v = \\left ( \\partial_{x} v^{x} + \\partial_{y} v^{y} + \\partial_{z} v^{z} \\right ) + \\left ( - \\partial_{y} v^{x} + \\partial_{x} v^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} v^{x} + \\partial_{x} v^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} v^{y} + \\partial_{y} v^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W v = \\left ( - \\partial_{y} v^{x} + \\partial_{x} v^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} v^{x} + \\partial_{x} v^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} v^{y} + \\partial_{y} v^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot v = \\partial_{x} v^{x} + \\partial_{y} v^{y} + \\partial_{z} v^{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor v = \\partial_{x} v^{x} + \\partial_{y} v^{y} + \\partial_{z} v^{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor v = \\partial_{x} v^{x} + \\partial_{y} v^{y} + \\partial_{z} v^{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} b = \\left ( - \\partial_{y} b^{xy} - \\partial_{z} b^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} b^{xy} - \\partial_{z} b^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} b^{xz} + \\partial_{y} b^{yz} \\right ) \\boldsymbol{e}_{z} + \\left ( \\partial_{z} b^{xy} - \\partial_{y} b^{xz} + \\partial_{x} b^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W b = \\left ( \\partial_{z} b^{xy} - \\partial_{y} b^{xz} + \\partial_{x} b^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot b = \\left ( - \\partial_{y} b^{xy} - \\partial_{z} b^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} b^{xy} - \\partial_{z} b^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} b^{xz} + \\partial_{y} b^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor b = \\left ( - \\partial_{y} b^{xy} - \\partial_{z} b^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} b^{xy} - \\partial_{z} b^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} b^{xz} + \\partial_{y} b^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor b = 0 \\end{equation*}\n", + "\\begin{equation*} s \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", + "\\begin{equation*} s \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", + "\\begin{equation*} s \\rfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = \\end{equation*}\n", + "\\begin{equation*} s s = {s }^{2} \\end{equation*}\n", + "\\begin{equation*} s \\W s = {s }^{2} \\end{equation*}\n", + "\\begin{equation*} s \\rfloor s = {s }^{2} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor s = {s }^{2} \\end{equation*}\n", + "\\begin{equation*} s v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\W v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\rfloor v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor v = 0 \\end{equation*}\n", + "\\begin{equation*} s b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\W b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\rfloor b = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor b = 0 \\end{equation*}\n", + "\\begin{equation*} v \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + v^{z} \\frac{\\partial}{\\partial z} + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\left ( - v^{y} \\frac{\\partial}{\\partial x} + v^{x} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\left ( - v^{z} \\frac{\\partial}{\\partial x} + v^{x} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( - v^{z} \\frac{\\partial}{\\partial y} + v^{y} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\n", + "\\begin{equation*} v \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\left ( - v^{y} \\frac{\\partial}{\\partial x} + v^{x} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\left ( - v^{z} \\frac{\\partial}{\\partial x} + v^{x} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( - v^{z} \\frac{\\partial}{\\partial y} + v^{y} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\n", + "\\begin{equation*} v \\cdot \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + v^{z} \\frac{\\partial}{\\partial z} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + v^{z} \\frac{\\partial}{\\partial z} \\end{equation*}\n", + "\\begin{equation*} v \\lfloor \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + v^{z} \\frac{\\partial}{\\partial z} \\end{equation*}\n", + "\\begin{equation*} v s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\W s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor s = 0 \\end{equation*}\n", + "\\begin{equation*} v \\lfloor s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} + s v^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v v = {v^{x} }^{2} + {v^{y} }^{2} + {v^{z} }^{2} \\end{equation*}\n", + "\\begin{equation*} v \\W v = 0 \\end{equation*}\n", + "\\begin{equation*} v \\cdot v = {v^{x} }^{2} + {v^{y} }^{2} + {v^{z} }^{2} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor v = {v^{x} }^{2} + {v^{y} }^{2} + {v^{z} }^{2} \\end{equation*}\n", + "\\begin{equation*} v \\lfloor v = {v^{x} }^{2} + {v^{y} }^{2} + {v^{z} }^{2} \\end{equation*}\n", + "\\begin{equation*} v b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} + \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\W b = \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\cdot b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor b = \\left ( - b^{xy} v^{y} - b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( b^{xy} v^{x} - b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( b^{xz} v^{x} + b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} v \\lfloor b = 0 \\end{equation*}\n", + "\\begin{equation*} b \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( b^{yz} \\frac{\\partial}{\\partial x} - b^{xz} \\frac{\\partial}{\\partial y} + b^{xy} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\n", + "\\begin{equation*} b \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( b^{yz} \\frac{\\partial}{\\partial x} - b^{xz} \\frac{\\partial}{\\partial y} + b^{xy} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\n", + "\\begin{equation*} b \\cdot \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", + "\\begin{equation*} b \\rfloor \\boldsymbol{\\nabla} = \\end{equation*}\n", + "\\begin{equation*} b \\lfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", + "\\begin{equation*} b s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\W s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\rfloor s = 0 \\end{equation*}\n", + "\\begin{equation*} b \\lfloor s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b v = \\left ( b^{xy} v^{y} + b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} + \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\W v = \\left ( b^{xy} v^{z} - b^{xz} v^{y} + b^{yz} v^{x} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\cdot v = \\left ( b^{xy} v^{y} + b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b \\rfloor v = 0 \\end{equation*}\n", + "\\begin{equation*} b \\lfloor v = \\left ( b^{xy} v^{y} + b^{xz} v^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( - b^{xy} v^{x} + b^{yz} v^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - b^{xz} v^{x} - b^{yz} v^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b b = - {b^{xy} }^{2} - {b^{xz} }^{2} - {b^{yz} }^{2} \\end{equation*}\n", + "\\begin{equation*} b \\W b = 0 \\end{equation*}\n", + "\\begin{equation*} b \\cdot b = - {b^{xy} }^{2} - {b^{xz} }^{2} - {b^{yz} }^{2} \\end{equation*}\n", + "\\begin{equation*} b \\rfloor b = - {b^{xy} }^{2} - {b^{xz} }^{2} - {b^{yz} }^{2} \\end{equation*}\n", + "\\begin{equation*} b \\lfloor b = - {b^{xy} }^{2} - {b^{xz} }^{2} - {b^{yz} }^{2} \\end{equation*}\n", + "General 2D Metric\\newline\n", + "Multivector Functions:\n", + "\\begin{equation*} s(X) = s \\end{equation*}\n", + "\\begin{equation*} v(X) = v^{x} \\boldsymbol{e}_{x} + v^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} b(X) = v^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "Products:\n", + "\\begin{equation*} \\boldsymbol{\\nabla} s = \\frac{- \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} s + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} s - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W s = \\frac{- \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} s + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} s - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot s = Not Allowed \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor s = 0 \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor s = \\frac{- \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} s + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} s - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} v = \\left ( \\partial_{x} v^{x} + \\partial_{y} v^{y} \\right ) + \\frac{- \\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} v^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} v^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W v = \\frac{- \\left ( e_{x}\\cdot e_{x}\\right ) \\partial_{y} v^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{x} v^{x} - \\left ( e_{x}\\cdot e_{y}\\right ) \\partial_{y} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) \\partial_{x} v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot v = \\partial_{x} v^{x} + \\partial_{y} v^{y} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\rfloor v = \\partial_{x} v^{x} + \\partial_{y} v^{y} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\lfloor v = \\partial_{x} v^{x} + \\partial_{y} v^{y} \\end{equation*}\n", + "\\begin{equation*} s \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", + "\\begin{equation*} s \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", + "\\begin{equation*} s \\cdot \\boldsymbol{\\nabla} = Not Allowed \\end{equation*}\n", + "\\begin{equation*} s \\rfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", + "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = \\end{equation*}\n", + "\\begin{equation*} s s = {s }^{2} \\end{equation*}\n", + "\\begin{equation*} s \\W s = {s }^{2} \\end{equation*}\n", + "\\begin{equation*} s \\cdot s = Not Allowed \\end{equation*}\n", + "\\begin{equation*} s \\rfloor s = {s }^{2} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor s = {s }^{2} \\end{equation*}\n", + "\\begin{equation*} s v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} s \\W v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} s \\cdot v = Not Allowed \\end{equation*}\n", + "\\begin{equation*} s \\rfloor v = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} s \\lfloor v = 0 \\end{equation*}\n", + "\\begin{equation*} v \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) v^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) v^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", + "\\begin{equation*} v \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) v^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) v^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) v^{y} }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", + "\\begin{equation*} v \\cdot \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} \\end{equation*}\n", + "\\begin{equation*} v \\lfloor \\boldsymbol{\\nabla} = v^{x} \\frac{\\partial}{\\partial x} + v^{y} \\frac{\\partial}{\\partial y} \\end{equation*}\n", + "\\begin{equation*} v s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} v \\W s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} v \\cdot s = Not Allowed \\end{equation*}\n", + "\\begin{equation*} v \\rfloor s = 0 \\end{equation*}\n", + "\\begin{equation*} v \\lfloor s = s v^{x} \\boldsymbol{e}_{x} + s v^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} v v = \\left ( e_{x}\\cdot e_{x}\\right ) {v^{x} }^{2} + 2 \\left ( e_{x}\\cdot e_{y}\\right ) v^{x} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) {v^{y} }^{2} \\end{equation*}\n", + "\\begin{equation*} v \\W v = 0 \\end{equation*}\n", + "\\begin{equation*} v \\cdot v = \\left ( e_{x}\\cdot e_{x}\\right ) {v^{x} }^{2} + 2 \\left ( e_{x}\\cdot e_{y}\\right ) v^{x} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) {v^{y} }^{2} \\end{equation*}\n", + "\\begin{equation*} v \\rfloor v = \\left ( e_{x}\\cdot e_{x}\\right ) {v^{x} }^{2} + 2 \\left ( e_{x}\\cdot e_{y}\\right ) v^{x} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) {v^{y} }^{2} \\end{equation*}\n", + "\\begin{equation*} v \\lfloor v = \\left ( e_{x}\\cdot e_{x}\\right ) {v^{x} }^{2} + 2 \\left ( e_{x}\\cdot e_{y}\\right ) v^{x} v^{y} + \\left ( e_{y}\\cdot e_{y}\\right ) {v^{y} }^{2} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat products_latex.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": {}, - "outputs": [], - "source": [ - "!python simple_check_latex.py" + "check('products_latex')" ] }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 20, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{x}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{z}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) & \\left ( e_{z}\\cdot e_{z}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} A = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} A_{+} = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} A_{-} = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} X Y = & \\left ( \\left ( e_{x}\\cdot e_{x}\\right ) X^{x} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{y} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{z}\\right ) \\\\ & + \\left ( X^{x} Y^{y} - X^{y} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( X^{x} Y^{z} - X^{z} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( X^{y} Y^{z} - X^{z} Y^{y}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} X\\W Y = \\left ( X^{x} Y^{y} - X^{y} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( X^{x} Y^{z} - X^{z} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( X^{y} Y^{z} - X^{z} Y^{y}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} X\\cdot Y = \\left ( e_{x}\\cdot e_{x}\\right ) X^{x} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{y} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{z} \\end{equation*}\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} X\\cdot A = - A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} + A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} X\\rfloor A = - A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} + A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A\\lfloor X = A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} - A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{x}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{z}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) & \\left ( e_{z}\\cdot e_{z}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} A = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} A_{+} = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} A_{-} = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} X Y = & \\left ( \\left ( e_{x}\\cdot e_{x}\\right ) X^{x} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{y} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{z}\\right ) \\\\ & + \\left ( X^{x} Y^{y} - X^{y} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( X^{x} Y^{z} - X^{z} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( X^{y} Y^{z} - X^{z} Y^{y}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} X\\W Y = \\left ( X^{x} Y^{y} - X^{y} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( X^{x} Y^{z} - X^{z} Y^{x}\\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( X^{y} Y^{z} - X^{z} Y^{y}\\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} X\\cdot Y = \\left ( e_{x}\\cdot e_{x}\\right ) X^{x} Y^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{x} Y^{y} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y} Y^{x} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{x} Y^{z} + \\left ( e_{x}\\cdot e_{z}\\right ) X^{z} Y^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y} Y^{y} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{y} Y^{z} + \\left ( e_{y}\\cdot e_{z}\\right ) X^{z} Y^{y} + \\left ( e_{z}\\cdot e_{z}\\right ) X^{z} Y^{z} \\end{equation*}\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} X\\cdot A = - A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} + A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} X\\rfloor A = - A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} + A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A\\lfloor X = A^{xy} \\left(\\left ( e_{x}\\cdot e_{y}\\right ) X^{x} + \\left ( e_{y}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{x} - A^{xy} \\left(\\left ( e_{x}\\cdot e_{x}\\right ) X^{x} + \\left ( e_{x}\\cdot e_{y}\\right ) X^{y}\\right) \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat simple_test_latex.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": {}, - "outputs": [], - "source": [ - "!python christoffel_symbols.py" + "check('simple_check_latex')" ] }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 21, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={9in,10in},total={8in,9in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\bm{\\mbox{Base manifold (three dimensional)}} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{\\mbox{Metric tensor (cartesian coordinates - norm = False)}} \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\ \\end{equation*}\r\n", - "\\begin{equation*} \\bm{\\mbox{Two dimensioanal submanifold - Unit sphere}} \\end{equation*}\r\n", - "\\begin{equation*} \\text{Basis not normalised} \\end{equation*}\r\n", - "\\begin{equation*} (\\theta,\\phi)\\rightarrow (r,\\theta,\\phi) = \\left [ 1, \\quad \\theta, \\quad \\phi\\right ] \\end{equation*}\r\n", - "\\begin{equation*} e_\\theta \\cdot e_\\theta = 1 \\end{equation*}\r\n", - "\\begin{equation*} e_\\phi \\cdot e_\\phi = {\\sin{\\left (\\theta \\right )}}^{2} \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & {\\sin{\\left (\\theta \\right )}}^{2} \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\text{g\\_inv = } \\left[\\begin{matrix}1 & 0\\\\0 & \\frac{1}{\\sin^{2}{\\left (\\theta \\right )}}\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\text{Christoffel symbols of the first kind: } \\end{equation*}\r\n", - "\\begin{equation*} \\Gamma_{1, \\alpha, \\beta} = \\left[\\begin{matrix}0 & 0\\\\0 & - \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] \\quad \\Gamma_{2, \\alpha, \\beta} = \\left[\\begin{matrix}0 & \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\\\\\frac{\\sin{\\left (2 \\theta \\right )}}{2} & 0\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\text{Christoffel symbols of the second kind: } \\end{equation*}\r\n", - "\\begin{equation*} \\Gamma^{1}_{\\phantom{1,}\\alpha, \\beta} = \\left[\\begin{matrix}0 & 0\\\\0 & - \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] \\quad \\Gamma^{2}_{\\phantom{2,}\\alpha, \\beta} = \\left[\\begin{matrix}0 & \\frac{1}{\\tan{\\left (\\theta \\right )}}\\\\\\frac{1}{\\tan{\\left (\\theta \\right )}} & 0\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} = \\boldsymbol{e}_{\\theta } \\frac{\\partial}{\\partial \\theta } + \\boldsymbol{e}_{\\phi } \\frac{1}{{\\sin{\\left (\\theta \\right )}}^{2}} \\frac{\\partial}{\\partial \\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{\\theta } f \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} F = F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} F = \\left ( \\frac{F^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } F^{\\phi } + \\partial_{\\theta } F^{\\theta } \\right ) + \\left ( \\frac{2 F^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } F^{\\phi } - \\frac{\\partial_{\\phi } F^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right ) \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\ \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{One dimensioanal submanifold} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Basis not normalised} \\end{equation*}\r\n", - "\\begin{equation*} (\\phi)\\rightarrow (\\theta,\\phi) = \\left [ \\frac{\\pi}{8}, \\quad \\phi\\right ] \\end{equation*}\r\n", - "\\begin{equation*} e_\\phi \\cdot e_\\phi = - \\frac{\\sqrt{2}}{4} + \\frac{1}{2} \\end{equation*}\r\n", - "\\begin{equation*} g = \\left[\\begin{matrix}- \\frac{\\sqrt{2}}{4} + \\frac{1}{2}\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} = \\boldsymbol{e}_{\\phi } \\left ( 2 \\sqrt{2} + 4\\right ) \\frac{\\partial}{\\partial \\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\nabla h = \\left(2 \\sqrt{2} + 4\\right) \\partial_{\\phi } h \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} H = H^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\nabla H = \\partial_{\\phi } H^{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\ \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={9in,10in},total={8in,9in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\bm{\\mbox{Base manifold (three dimensional)}} \\end{equation*}\n", + "\\begin{equation*} \\bm{\\mbox{Metric tensor (cartesian coordinates - norm = False)}} \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\ \\end{equation*}\n", + "\\begin{equation*} \\bm{\\mbox{Two dimensioanal submanifold - Unit sphere}} \\end{equation*}\n", + "\\begin{equation*} \\text{Basis not normalised} \\end{equation*}\n", + "\\begin{equation*} (\\theta,\\phi)\\rightarrow (r,\\theta,\\phi) = \\left [ 1, \\quad \\theta, \\quad \\phi\\right ] \\end{equation*}\n", + "\\begin{equation*} e_\\theta \\cdot e_\\theta = 1 \\end{equation*}\n", + "\\begin{equation*} e_\\phi \\cdot e_\\phi = {\\sin{\\left (\\theta \\right )}}^{2} \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & {\\sin{\\left (\\theta \\right )}}^{2} \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\text{g\\_inv = } \\left[\\begin{matrix}1 & 0\\\\0 & \\frac{1}{\\sin^{2}{\\left (\\theta \\right )}}\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\text{Christoffel symbols of the first kind: } \\end{equation*}\n", + "\\begin{equation*} \\Gamma_{1, \\alpha, \\beta} = \\left[\\begin{matrix}0 & 0\\\\0 & - \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] \\quad \\Gamma_{2, \\alpha, \\beta} = \\left[\\begin{matrix}0 & \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\\\\\frac{\\sin{\\left (2 \\theta \\right )}}{2} & 0\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\text{Christoffel symbols of the second kind: } \\end{equation*}\n", + "\\begin{equation*} \\Gamma^{1}_{\\phantom{1,}\\alpha, \\beta} = \\left[\\begin{matrix}0 & 0\\\\0 & - \\frac{\\sin{\\left (2 \\theta \\right )}}{2}\\end{matrix}\\right] \\quad \\Gamma^{2}_{\\phantom{2,}\\alpha, \\beta} = \\left[\\begin{matrix}0 & \\frac{1}{\\tan{\\left (\\theta \\right )}}\\\\\\frac{1}{\\tan{\\left (\\theta \\right )}} & 0\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} = \\boldsymbol{e}_{\\theta } \\frac{\\partial}{\\partial \\theta } + \\boldsymbol{e}_{\\phi } \\frac{1}{{\\sin{\\left (\\theta \\right )}}^{2}} \\frac{\\partial}{\\partial \\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{\\theta } f \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} F = F^{\\theta } \\boldsymbol{e}_{\\theta } + F^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} F = \\left ( \\frac{F^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } F^{\\phi } + \\partial_{\\theta } F^{\\theta } \\right ) + \\left ( \\frac{2 F^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } F^{\\phi } - \\frac{\\partial_{\\phi } F^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right ) \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\ \\end{equation*}\n", + "\\begin{equation*} \\mbox{One dimensioanal submanifold} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Basis not normalised} \\end{equation*}\n", + "\\begin{equation*} (\\phi)\\rightarrow (\\theta,\\phi) = \\left [ \\frac{\\pi}{8}, \\quad \\phi\\right ] \\end{equation*}\n", + "\\begin{equation*} e_\\phi \\cdot e_\\phi = - \\frac{\\sqrt{2}}{4} + \\frac{1}{2} \\end{equation*}\n", + "\\begin{equation*} g = \\left[\\begin{matrix}- \\frac{\\sqrt{2}}{4} + \\frac{1}{2}\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} = \\boldsymbol{e}_{\\phi } \\left ( 2 \\sqrt{2} + 4\\right ) \\frac{\\partial}{\\partial \\phi } \\end{equation*}\n", + "\\begin{equation*} \\nabla h = \\left(2 \\sqrt{2} + 4\\right) \\partial_{\\phi } h \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} H = H^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\nabla H = \\partial_{\\phi } H^{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\ \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat christoffel_symbols.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": {}, - "outputs": [], - "source": [ - "!python colored_christoffel_symbols.py" + "check('christoffel_symbols')" ] }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 22, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={9in,10in},total={8in,9in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}\r\n", - "\\definecolor{applegreen}{rgb}{0.55, 0.71, 0.0}\r\n", - "\\definecolor{atomictangerine}{rgb}{1.0, 0.6, 0.4}\r\n", - "\\begin{equation*} \\bm{\\mbox{Base manifold (three dimensional)}} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{\\mbox{Metric tensor (cartesian coordinates - norm = False)}} \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\ \\end{equation*}\r\n", - "\\begin{equation*} \\bm{\\mbox{Two dimensioanal submanifold - Unit sphere}} \\end{equation*}\r\n", - "\\begin{equation*} \\text{Basis not normalised} \\end{equation*}\r\n", - "\\begin{equation*} (\\theta,\\phi)\\rightarrow (r,\\theta,\\phi) = \\left [ 1, \\quad {\\color{airforceblue}\\theta}, \\quad {\\color{applegreen}\\phi}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} e_\\theta \\cdot e_\\theta = 1 \\end{equation*}\r\n", - "\\begin{equation*} e_\\phi \\cdot e_\\phi = {\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2} \\end{equation*}\r\n", - "\\begin{equation*} g = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & {\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2} \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\text{g\\_inv = } \\left[\\begin{matrix}1 & 0\\\\0 & \\frac{1}{\\sin^{2}{\\left ({\\color{airforceblue}\\theta} \\right )}}\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\text{Christoffel symbols of the first kind: } \\end{equation*}\r\n", - "\\begin{equation*} \\Gamma_{1, \\alpha, \\beta} = \\left[\\begin{matrix}0 & 0\\\\0 & - \\frac{\\sin{\\left (2 {\\color{airforceblue}\\theta} \\right )}}{2}\\end{matrix}\\right] \\quad \\Gamma_{2, \\alpha, \\beta} = \\left[\\begin{matrix}0 & \\frac{\\sin{\\left (2 {\\color{airforceblue}\\theta} \\right )}}{2}\\\\\\frac{\\sin{\\left (2 {\\color{airforceblue}\\theta} \\right )}}{2} & 0\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\text{Christoffel symbols of the second kind: } \\end{equation*}\r\n", - "\\begin{equation*} \\Gamma^{1}_{\\phantom{1,}\\alpha, \\beta} = \\left[\\begin{matrix}0 & 0\\\\0 & - \\frac{\\sin{\\left (2 {\\color{airforceblue}\\theta} \\right )}}{2}\\end{matrix}\\right] \\quad \\Gamma^{2}_{\\phantom{2,}\\alpha, \\beta} = \\left[\\begin{matrix}0 & \\frac{1}{\\tan{\\left ({\\color{airforceblue}\\theta} \\right )}}\\\\\\frac{1}{\\tan{\\left ({\\color{airforceblue}\\theta} \\right )}} & 0\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} = \\boldsymbol{e}_{{\\color{airforceblue}\\theta}} \\frac{\\partial}{\\partial {\\color{airforceblue}\\theta}} + \\boldsymbol{e}_{{\\color{applegreen}\\phi}} \\frac{1}{{\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2}} \\frac{\\partial}{\\partial {\\color{applegreen}\\phi}} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{{\\color{airforceblue}\\theta}} f \\boldsymbol{e}_{{\\color{airforceblue}\\theta}} + \\frac{\\partial_{{\\color{applegreen}\\phi}} f }{{\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2}} \\boldsymbol{e}_{{\\color{applegreen}\\phi}} \\end{equation*}\r\n", - "\\begin{equation*} F = F^{{\\color{airforceblue}\\theta}} \\boldsymbol{e}_{{\\color{airforceblue}\\theta}} + F^{{\\color{applegreen}\\phi}} \\boldsymbol{e}_{{\\color{applegreen}\\phi}} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} F = \\left ( \\frac{F^{{\\color{airforceblue}\\theta}} }{\\tan{\\left ({\\color{airforceblue}\\theta} \\right )}} + \\partial_{{\\color{airforceblue}\\theta}} F^{{\\color{airforceblue}\\theta}} + \\partial_{{\\color{applegreen}\\phi}} F^{{\\color{applegreen}\\phi}} \\right ) + \\left ( \\frac{2 F^{{\\color{applegreen}\\phi}} }{\\tan{\\left ({\\color{airforceblue}\\theta} \\right )}} + \\partial_{{\\color{airforceblue}\\theta}} F^{{\\color{applegreen}\\phi}} - \\frac{\\partial_{{\\color{applegreen}\\phi}} F^{{\\color{airforceblue}\\theta}} }{{\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2}}\\right ) \\boldsymbol{e}_{{\\color{airforceblue}\\theta}}\\wedge \\boldsymbol{e}_{{\\color{applegreen}\\phi}} \\end{equation*}\r\n", - "\\begin{equation*} \\ \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{One dimensioanal submanifold} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Basis not normalised} \\end{equation*}\r\n", - "\\begin{equation*} (\\phi)\\rightarrow (\\theta,\\phi) = \\left [ \\frac{\\pi}{8}, \\quad {\\color{atomictangerine}\\phi}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} e_\\phi \\cdot e_\\phi = - \\frac{\\sqrt{2}}{4} + \\frac{1}{2} \\end{equation*}\r\n", - "\\begin{equation*} g = \\left[\\begin{matrix}- \\frac{\\sqrt{2}}{4} + \\frac{1}{2}\\end{matrix}\\right] \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} = \\boldsymbol{e}_{{\\color{atomictangerine}\\phi}} \\left ( 2 \\sqrt{2} + 4\\right ) \\frac{\\partial}{\\partial {\\color{atomictangerine}\\phi}} \\end{equation*}\r\n", - "\\begin{equation*} \\nabla h = \\left(2 \\sqrt{2} + 4\\right) \\partial_{{\\color{atomictangerine}\\phi}} h \\boldsymbol{e}_{{\\color{atomictangerine}\\phi}} \\end{equation*}\r\n", - "\\begin{equation*} H = H^{{\\color{atomictangerine}\\phi}} \\boldsymbol{e}_{{\\color{atomictangerine}\\phi}} \\end{equation*}\r\n", - "\\begin{equation*} \\nabla H = \\partial_{{\\color{atomictangerine}\\phi}} H^{{\\color{atomictangerine}\\phi}} \\end{equation*}\r\n", - "\\begin{equation*} \\ \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={9in,10in},total={8in,9in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}\n", + "\\definecolor{applegreen}{rgb}{0.55, 0.71, 0.0}\n", + "\\definecolor{atomictangerine}{rgb}{1.0, 0.6, 0.4}\n", + "\\begin{equation*} \\bm{\\mbox{Base manifold (three dimensional)}} \\end{equation*}\n", + "\\begin{equation*} \\bm{\\mbox{Metric tensor (cartesian coordinates - norm = False)}} \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{ccc} 1 & 0 & 0 \\\\ 0 & 1 & 0 \\\\ 0 & 0 & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\ \\end{equation*}\n", + "\\begin{equation*} \\bm{\\mbox{Two dimensioanal submanifold - Unit sphere}} \\end{equation*}\n", + "\\begin{equation*} \\text{Basis not normalised} \\end{equation*}\n", + "\\begin{equation*} (\\theta,\\phi)\\rightarrow (r,\\theta,\\phi) = \\left [ 1, \\quad {\\color{airforceblue}\\theta}, \\quad {\\color{applegreen}\\phi}\\right ] \\end{equation*}\n", + "\\begin{equation*} e_\\theta \\cdot e_\\theta = 1 \\end{equation*}\n", + "\\begin{equation*} e_\\phi \\cdot e_\\phi = {\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2} \\end{equation*}\n", + "\\begin{equation*} g = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & {\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2} \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\text{g\\_inv = } \\left[\\begin{matrix}1 & 0\\\\0 & \\frac{1}{\\sin^{2}{\\left ({\\color{airforceblue}\\theta} \\right )}}\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\text{Christoffel symbols of the first kind: } \\end{equation*}\n", + "\\begin{equation*} \\Gamma_{1, \\alpha, \\beta} = \\left[\\begin{matrix}0 & 0\\\\0 & - \\frac{\\sin{\\left (2 {\\color{airforceblue}\\theta} \\right )}}{2}\\end{matrix}\\right] \\quad \\Gamma_{2, \\alpha, \\beta} = \\left[\\begin{matrix}0 & \\frac{\\sin{\\left (2 {\\color{airforceblue}\\theta} \\right )}}{2}\\\\\\frac{\\sin{\\left (2 {\\color{airforceblue}\\theta} \\right )}}{2} & 0\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\text{Christoffel symbols of the second kind: } \\end{equation*}\n", + "\\begin{equation*} \\Gamma^{1}_{\\phantom{1,}\\alpha, \\beta} = \\left[\\begin{matrix}0 & 0\\\\0 & - \\frac{\\sin{\\left (2 {\\color{airforceblue}\\theta} \\right )}}{2}\\end{matrix}\\right] \\quad \\Gamma^{2}_{\\phantom{2,}\\alpha, \\beta} = \\left[\\begin{matrix}0 & \\frac{1}{\\tan{\\left ({\\color{airforceblue}\\theta} \\right )}}\\\\\\frac{1}{\\tan{\\left ({\\color{airforceblue}\\theta} \\right )}} & 0\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} = \\boldsymbol{e}_{{\\color{airforceblue}\\theta}} \\frac{\\partial}{\\partial {\\color{airforceblue}\\theta}} + \\boldsymbol{e}_{{\\color{applegreen}\\phi}} \\frac{1}{{\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2}} \\frac{\\partial}{\\partial {\\color{applegreen}\\phi}} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{{\\color{airforceblue}\\theta}} f \\boldsymbol{e}_{{\\color{airforceblue}\\theta}} + \\frac{\\partial_{{\\color{applegreen}\\phi}} f }{{\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2}} \\boldsymbol{e}_{{\\color{applegreen}\\phi}} \\end{equation*}\n", + "\\begin{equation*} F = F^{{\\color{airforceblue}\\theta}} \\boldsymbol{e}_{{\\color{airforceblue}\\theta}} + F^{{\\color{applegreen}\\phi}} \\boldsymbol{e}_{{\\color{applegreen}\\phi}} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} F = \\left ( \\frac{F^{{\\color{airforceblue}\\theta}} }{\\tan{\\left ({\\color{airforceblue}\\theta} \\right )}} + \\partial_{{\\color{airforceblue}\\theta}} F^{{\\color{airforceblue}\\theta}} + \\partial_{{\\color{applegreen}\\phi}} F^{{\\color{applegreen}\\phi}} \\right ) + \\left ( \\frac{2 F^{{\\color{applegreen}\\phi}} }{\\tan{\\left ({\\color{airforceblue}\\theta} \\right )}} + \\partial_{{\\color{airforceblue}\\theta}} F^{{\\color{applegreen}\\phi}} - \\frac{\\partial_{{\\color{applegreen}\\phi}} F^{{\\color{airforceblue}\\theta}} }{{\\sin{\\left ({\\color{airforceblue}\\theta} \\right )}}^{2}}\\right ) \\boldsymbol{e}_{{\\color{airforceblue}\\theta}}\\wedge \\boldsymbol{e}_{{\\color{applegreen}\\phi}} \\end{equation*}\n", + "\\begin{equation*} \\ \\end{equation*}\n", + "\\begin{equation*} \\mbox{One dimensioanal submanifold} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Basis not normalised} \\end{equation*}\n", + "\\begin{equation*} (\\phi)\\rightarrow (\\theta,\\phi) = \\left [ \\frac{\\pi}{8}, \\quad {\\color{atomictangerine}\\phi}\\right ] \\end{equation*}\n", + "\\begin{equation*} e_\\phi \\cdot e_\\phi = - \\frac{\\sqrt{2}}{4} + \\frac{1}{2} \\end{equation*}\n", + "\\begin{equation*} g = \\left[\\begin{matrix}- \\frac{\\sqrt{2}}{4} + \\frac{1}{2}\\end{matrix}\\right] \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} = \\boldsymbol{e}_{{\\color{atomictangerine}\\phi}} \\left ( 2 \\sqrt{2} + 4\\right ) \\frac{\\partial}{\\partial {\\color{atomictangerine}\\phi}} \\end{equation*}\n", + "\\begin{equation*} \\nabla h = \\left(2 \\sqrt{2} + 4\\right) \\partial_{{\\color{atomictangerine}\\phi}} h \\boldsymbol{e}_{{\\color{atomictangerine}\\phi}} \\end{equation*}\n", + "\\begin{equation*} H = H^{{\\color{atomictangerine}\\phi}} \\boldsymbol{e}_{{\\color{atomictangerine}\\phi}} \\end{equation*}\n", + "\\begin{equation*} \\nabla H = \\partial_{{\\color{atomictangerine}\\phi}} H^{{\\color{atomictangerine}\\phi}} \\end{equation*}\n", + "\\begin{equation*} \\ \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat colored_christoffel_symbols.tex" + "check('colored_christoffel_symbols')" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -2787,7 +2622,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.5.4" } }, "nbformat": 4, From 6213adb9532520c29820443dd99c299140c7f2e9 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 16 Dec 2019 13:37:33 +0000 Subject: [PATCH 23/62] Don't allow *dop objects to be mutated As discovered in gh-150, printing out a laplacian changes the effect of the operator! In order to ensure immutability, this: * Changes the following from `list` to `tuple`: * `Sdop.terms` * `Pdop.terms` * Changes the following functions to return a new copy, rather than mutating in place _and_ returning themselves: * `Sdop.simplify` * `Pdop.simplify` * `Pdop.factor` * `Dop.consolidate_coefs` * Changes the following undocumented and unused functions to return a new copy, rather than mutating in place and returning `None`: * `Sdop.TSimplify` * `Pdop.TSimplify` * `Sdop.sort_terms`, which has been made private and renamed to `_with_sorted_terms` Crucially, this removes the use of `copy.deepcopy` which was duplicating sympy expressions in weird ways. --- examples/ipython/LaTeX.ipynb | 8 ++--- examples/ipython/Old Format.ipynb | 6 ++-- examples/ipython/dop.ipynb | 4 +-- galgebra/mv.py | 60 ++++++++++++++----------------- 4 files changed, 36 insertions(+), 42 deletions(-) diff --git a/examples/ipython/LaTeX.ipynb b/examples/ipython/LaTeX.ipynb index 9d00d1c7..bfee4739 100644 --- a/examples/ipython/LaTeX.ipynb +++ b/examples/ipython/LaTeX.ipynb @@ -477,7 +477,7 @@ "\\begin{document}\n", "\\begin{equation*} \\nabla = \\boldsymbol{e}_{x} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} \\frac{\\partial}{\\partial z} \\end{equation*}\n", "\\begin{equation*} \\nabla^{2} = \\nabla \\cdot \\nabla = \\frac{\\partial^{2}}{\\partial x^{2}} + \\frac{\\partial^{2}}{\\partial y^{2}} + \\frac{\\partial^{2}}{\\partial z^{2}} \\end{equation*}\n", - "\\begin{equation*} \\lp\\nabla^{2}\\rp f = \\partial^{2}_{y} f + \\partial^{2}_{z} f \\end{equation*}\n", + "\\begin{equation*} \\lp\\nabla^{2}\\rp f = \\partial^{2}_{x} f + \\partial^{2}_{y} f + \\partial^{2}_{z} f \\end{equation*}\n", "\\begin{equation*} \\nabla\\cdot\\lp\\nabla f\\rp = \\partial^{2}_{x} f + \\partial^{2}_{y} f + \\partial^{2}_{z} f \\end{equation*}\n", "\\begin{equation*} \\nabla^{2} = \\nabla\\cdot\\nabla = \\frac{2}{r} \\frac{\\partial}{\\partial r} + \\frac{1}{r^{2} \\tan{\\left (\\theta \\right )}} \\frac{\\partial}{\\partial \\theta } + \\frac{\\partial^{2}}{\\partial r^{2}} + r^{-2} \\frac{\\partial^{2}}{\\partial \\theta ^{2}} + \\frac{1}{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\frac{\\partial^{2}}{\\partial \\phi ^{2}} \\end{equation*}\n", "\\begin{equation*} \\lp\\nabla^{2}\\rp f = \\frac{r^{2} \\partial^{2}_{r} f + 2 r \\partial_{r} f + \\partial^{2}_{\\theta } f + \\frac{\\partial_{\\theta } f }{\\tan{\\left (\\theta \\right )}} + \\frac{\\partial^{2}_{\\phi } f }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\end{equation*}\n", @@ -2216,7 +2216,7 @@ "\\begin{equation*} s \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", "\\begin{equation*} s \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", "\\begin{equation*} s \\rfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", - "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = \\end{equation*}\n", + "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = 1 \\end{equation*}\n", "\\begin{equation*} s s = {s }^{2} \\end{equation*}\n", "\\begin{equation*} s \\W s = {s }^{2} \\end{equation*}\n", "\\begin{equation*} s \\rfloor s = {s }^{2} \\end{equation*}\n", @@ -2251,7 +2251,7 @@ "\\begin{equation*} b \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( b^{yz} \\frac{\\partial}{\\partial x} - b^{xz} \\frac{\\partial}{\\partial y} + b^{xy} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\n", "\\begin{equation*} b \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( b^{yz} \\frac{\\partial}{\\partial x} - b^{xz} \\frac{\\partial}{\\partial y} + b^{xy} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\n", "\\begin{equation*} b \\cdot \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", - "\\begin{equation*} b \\rfloor \\boldsymbol{\\nabla} = \\end{equation*}\n", + "\\begin{equation*} b \\rfloor \\boldsymbol{\\nabla} = 1 \\end{equation*}\n", "\\begin{equation*} b \\lfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", "\\begin{equation*} b s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", "\\begin{equation*} b \\W s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", @@ -2287,7 +2287,7 @@ "\\begin{equation*} s \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", "\\begin{equation*} s \\cdot \\boldsymbol{\\nabla} = Not Allowed \\end{equation*}\n", "\\begin{equation*} s \\rfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", - "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = \\end{equation*}\n", + "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = 1 \\end{equation*}\n", "\\begin{equation*} s s = {s }^{2} \\end{equation*}\n", "\\begin{equation*} s \\W s = {s }^{2} \\end{equation*}\n", "\\begin{equation*} s \\cdot s = Not Allowed \\end{equation*}\n", diff --git a/examples/ipython/Old Format.ipynb b/examples/ipython/Old Format.ipynb index f552ad18..fa7af4af 100644 --- a/examples/ipython/Old Format.ipynb +++ b/examples/ipython/Old Format.ipynb @@ -1027,7 +1027,7 @@ "s*grad = \\boldsymbol{e}_{x}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial z}\n", "s^grad = \\boldsymbol{e}_{x}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial z}\n", "sgrad = \n", + "s>grad = 1\n", "s*s = s**2\n", "s^s = s**2\n", "sgrad = \\boldsymbol{e}_{x}*(b^{xy} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial y} + b^{xz} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial z}) + \\boldsymbol{e}_{y}*(- b^{xy} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial x} + b^{yz} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial z}) + \\boldsymbol{e}_{z}*(- b^{xz} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial x} - b^{yz} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial y})\n", "b*s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n", "b^s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n", @@ -1100,7 +1100,7 @@ "s*grad = \\boldsymbol{e}_{x}*(\\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}) + \\boldsymbol{e}_{y}*(- \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y})\n", "s^grad = \\boldsymbol{e}_{x}*(\\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}) + \\boldsymbol{e}_{y}*(- \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y})\n", "sgrad = \n", + "s>grad = 1\n", "s*s = s**2\n", "s^s = s**2\n", "s Date: Tue, 17 Dec 2019 00:12:25 +0000 Subject: [PATCH 24/62] Correct the meaning of `Dop([])` and `Sdop([])`, which is zero, not one `Dop(terms)` is defined as the sum over the terms - the sum over zero terms is zero. To allow `self.terms == []`, we need to not use `zip(*terms)`, which fails when `terms == []`. --- examples/ipython/LaTeX.ipynb | 6 +-- examples/ipython/Old Format.ipynb | 6 +-- galgebra/mv.py | 85 +++++++++++++------------------ 3 files changed, 41 insertions(+), 56 deletions(-) diff --git a/examples/ipython/LaTeX.ipynb b/examples/ipython/LaTeX.ipynb index bfee4739..0da7b3ea 100644 --- a/examples/ipython/LaTeX.ipynb +++ b/examples/ipython/LaTeX.ipynb @@ -2216,7 +2216,7 @@ "\\begin{equation*} s \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", "\\begin{equation*} s \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", "\\begin{equation*} s \\rfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} s \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y} s \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z} s \\frac{\\partial}{\\partial z} \\end{equation*}\n", - "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = 1 \\end{equation*}\n", + "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = 0 \\end{equation*}\n", "\\begin{equation*} s s = {s }^{2} \\end{equation*}\n", "\\begin{equation*} s \\W s = {s }^{2} \\end{equation*}\n", "\\begin{equation*} s \\rfloor s = {s }^{2} \\end{equation*}\n", @@ -2251,7 +2251,7 @@ "\\begin{equation*} b \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( b^{yz} \\frac{\\partial}{\\partial x} - b^{xz} \\frac{\\partial}{\\partial y} + b^{xy} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\n", "\\begin{equation*} b \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\left ( b^{yz} \\frac{\\partial}{\\partial x} - b^{xz} \\frac{\\partial}{\\partial y} + b^{xy} \\frac{\\partial}{\\partial z}\\right ) \\end{equation*}\n", "\\begin{equation*} b \\cdot \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", - "\\begin{equation*} b \\rfloor \\boldsymbol{\\nabla} = 1 \\end{equation*}\n", + "\\begin{equation*} b \\rfloor \\boldsymbol{\\nabla} = 0 \\end{equation*}\n", "\\begin{equation*} b \\lfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( b^{xy} \\frac{\\partial}{\\partial y} + b^{xz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{y} \\left ( - b^{xy} \\frac{\\partial}{\\partial x} + b^{yz} \\frac{\\partial}{\\partial z}\\right ) + \\boldsymbol{e}_{z} \\left ( - b^{xz} \\frac{\\partial}{\\partial x} - b^{yz} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", "\\begin{equation*} b s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", "\\begin{equation*} b \\W s = b^{xy} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + b^{xz} s \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + b^{yz} s \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", @@ -2287,7 +2287,7 @@ "\\begin{equation*} s \\W \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", "\\begin{equation*} s \\cdot \\boldsymbol{\\nabla} = Not Allowed \\end{equation*}\n", "\\begin{equation*} s \\rfloor \\boldsymbol{\\nabla} = \\boldsymbol{e}_{x} \\left ( \\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) + \\boldsymbol{e}_{y} \\left ( - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s }{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}\\right ) \\end{equation*}\n", - "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = 1 \\end{equation*}\n", + "\\begin{equation*} s \\lfloor \\boldsymbol{\\nabla} = 0 \\end{equation*}\n", "\\begin{equation*} s s = {s }^{2} \\end{equation*}\n", "\\begin{equation*} s \\W s = {s }^{2} \\end{equation*}\n", "\\begin{equation*} s \\cdot s = Not Allowed \\end{equation*}\n", diff --git a/examples/ipython/Old Format.ipynb b/examples/ipython/Old Format.ipynb index fa7af4af..21e7af3b 100644 --- a/examples/ipython/Old Format.ipynb +++ b/examples/ipython/Old Format.ipynb @@ -1027,7 +1027,7 @@ "s*grad = \\boldsymbol{e}_{x}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial z}\n", "s^grad = \\boldsymbol{e}_{x}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial x} + \\boldsymbol{e}_{y}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial y} + \\boldsymbol{e}_{z}*s {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial z}\n", "sgrad = 1\n", + "s>grad = 0 \n", "s*s = s**2\n", "s^s = s**2\n", "sgrad = \\boldsymbol{e}_{x}*(b^{xy} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial y} + b^{xz} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial z}) + \\boldsymbol{e}_{y}*(- b^{xy} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial x} + b^{yz} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial z}) + \\boldsymbol{e}_{z}*(- b^{xz} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial x} - b^{yz} {\\left (x,y,z \\right )} \\frac{\\partial}{\\partial y})\n", "b*s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n", "b^s = b__xy*s*e_x^e_y + b__xz*s*e_x^e_z + b__yz*s*e_y^e_z\n", @@ -1100,7 +1100,7 @@ "s*grad = \\boldsymbol{e}_{x}*(\\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}) + \\boldsymbol{e}_{y}*(- \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y})\n", "s^grad = \\boldsymbol{e}_{x}*(\\frac{\\left ( e_{y}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} - \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y}) + \\boldsymbol{e}_{y}*(- \\frac{\\left ( e_{x}\\cdot e_{y}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial x} + \\frac{\\left ( e_{x}\\cdot e_{x}\\right ) s {\\left (x,y \\right )}}{\\left ( e_{x}\\cdot e_{x}\\right ) \\left ( e_{y}\\cdot e_{y}\\right ) - \\left ( e_{x}\\cdot e_{y}\\right ) ^{2}} \\frac{\\partial}{\\partial y})\n", "sgrad = 1\n", + "s>grad = 0 \n", "s*s = s**2\n", "s^s = s**2\n", "s Date: Tue, 17 Dec 2019 04:50:45 +0000 Subject: [PATCH 25/62] Fix obvious typos in Sdop.Add (#159) This makes `Sdop.__radd__` match `Dop.__radd__`, and fixes a typo in the if statement. --- galgebra/mv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 4c712c3d..cdf1ea8d 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1616,7 +1616,7 @@ def __neg__(self): @staticmethod def Add(sdop1, sdop2): - if isinstance(sdop1, Sdop) and isinstance(sdop1, Sdop): + if isinstance(sdop1, Sdop) and isinstance(sdop2, Sdop): if sdop1.Ga != sdop2.Ga: raise ValueError('In Sdop.Add sdop1.Ga != sdop2.Ga.') coefs1, pdiffs1 = list(zip(*sdop1.terms)) @@ -1678,7 +1678,7 @@ def __add__(self, sdop): return Sdop.Add(self, sdop) def __radd__(self, sdop): - return Sdop(self, sdop) + return Sdop.Add(sdop, self) def __sub__(self, sdop): return Sdop.Add(self, -sdop) From 932f3c1156ca980b98af436682f55afa612e29ca Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 10:48:06 +0000 Subject: [PATCH 26/62] Propagate python tracebacks in LaTeX.ipynb (#160) --- examples/ipython/LaTeX.ipynb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/ipython/LaTeX.ipynb b/examples/ipython/LaTeX.ipynb index 0da7b3ea..7427cdf1 100644 --- a/examples/ipython/LaTeX.ipynb +++ b/examples/ipython/LaTeX.ipynb @@ -14,7 +14,15 @@ "os.chdir('../LaTeX')\n", "\n", "def check(name):\n", - " subprocess.check_call([sys.executable, name + '.py'])\n", + " # todo: use subprocess.run once we drop Python 2.7\n", + " p = subprocess.Popen([sys.executable, name + '.py'], stderr=subprocess.PIPE, universal_newlines=True)\n", + " try:\n", + " stdout, stderr = p.communicate()\n", + " except:\n", + " p.kill()\n", + " if p.poll():\n", + " raise RuntimeError(\"The script raised an exception:\\n\\n\" + stderr)\n", + "\n", " with open(name + '.tex', 'r') as f:\n", " # can't use display.Latex here, it would result in CSS comparisons in the output.\n", " \n", From c597b63a223a4b13a689b3f56e051f837bf50d9e Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 11:25:22 +0000 Subject: [PATCH 27/62] Remove __div__ and alias it to __truediv__ These performed the same operation with different spellings anyway. Changes a ValueError to a TypeError too --- galgebra/mv.py | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 04e5a623..2e100322 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -6,6 +6,7 @@ import numbers import operator from functools import reduce, cmp_to_key +import sys from sympy import ( Symbol, Function, S, expand, Add, @@ -577,18 +578,15 @@ def __mul__(self, A): def __rmul__(self, A): return Mv(expand(A * self.obj), ga=self.Ga) - def __div__(self, A): - if isinstance(A,Mv): - return self * A.inv() - else: - return self * (S(1)/A) - def __truediv__(self, A): if isinstance(A,Mv): return self * A.inv() else: return self * (S(1)/A) + if sys.version_info.major < 3: + __div__ = __truediv__ + def __str__(self): if printer.GaLatexPrinter.latex_flg: Printer = printer.GaLatexPrinter @@ -2199,23 +2197,19 @@ def TSimplify(self): new_terms.append((metric.Simp.apply(coef), pdiff)) return Dop(new_terms, ga=self.Ga) - def __div__(self, a): - if isinstance(a, (Mv, Dop)): - raise TypeError('!!!!Can only divide Dop by sympy scalar expression!!!!') - else: - return (1/a) * self + def __truediv__(self, dopr): + if isinstance(dopr, (Dop, Mv)): + raise TypeError('In Dop.__truediv__ dopr must be a sympy scalar.') + return Dop([ + (coef / dopr, pdiff) for (coef, pdiff) in self.terms + ], ga=self.Ga) + + if sys.version_info.major < 3: + __div__ = __truediv__ def __mul__(self, dopr): # * geometric product return Dop.Mul(self, dopr, op='*') - def __truediv__(self, dopr): - if isinstance(dopr, (Dop, Mv)): - raise ValueError('In Dop.__truediv__ dopr must be a sympy scalar.') - terms = [] - for term in self.terms: - terms.append((term[0]/dopr,term[1])) - return Dop(terms, ga= self.Ga) - def __rmul__(self, dopl): # * geometric product return Dop.Mul(dopl, self, op='*') From eddd8510987e1a8753880389bc13fb68a8b207bc Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 11:42:40 +0000 Subject: [PATCH 28/62] Use list comprehensions for simplicity Apparently using comprehensions is also faster than using `append`, although it's likely marginal. --- galgebra/mv.py | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 2e100322..091d437f 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1000,10 +1000,7 @@ def components(self): (coefs, bases) = metric.linear_expand(self.obj) cb = list(zip(coefs, bases)) cb = sorted(cb, key=lambda x: self.Ga._all_blades_lst.index(x[1])) - terms = [] - for (coef, base) in cb: - terms.append(self.Ga.mv(coef * base)) - return terms + return [self.Ga.mv(coef * base) for (coef, base) in cb] def get_coefs(self, grade): (coefs, bases) = metric.linear_expand(self.obj) @@ -1343,19 +1340,16 @@ def simplify(self, modes=simplify): def subs(self, d): # For each scalar coef of the multivector apply substitution argument d (coefs, bases) = metric.linear_expand(self.obj) - obj = S(0) - for (coef, base) in zip(coefs, bases): - obj += coef.subs(d) * base + obj = sum(( + coef.subs(d) * base for coef, base in zip(coefs, bases) + ), S(0)) return Mv(obj, ga=self.Ga) def expand(self): - coefs,bases = metric.linear_expand(self.obj) - new_coefs = [] - for coef in coefs: - new_coefs.append(expand(coef)) - obj = S(0) - for coef,base in zip(new_coefs,bases): - obj += coef * base + coefs, bases = metric.linear_expand(self.obj) + obj = sum(( + expand(coef) * base for coef, base in zip(coefs, bases) + ), S(0)) return Mv(obj, ga=self.Ga) def list(self): @@ -1449,10 +1443,9 @@ def setGa(ga): return def TSimplify(self): - new_terms = [] - for (coef, pdiff) in self.terms: - new_terms.append((metric.Simp.apply(coef), pdiff)) - return Sdop(new_terms, ga=self.Ga) + return Sdop([ + (metric.Simp.apply(coef), pdiff) for (coef, pdiff) in self.terms + ], ga=self.Ga) @staticmethod def consolidate_coefs(sdop): @@ -2041,13 +2034,10 @@ def simplify(self, modes=simplify): """ Simplify each multivector coefficient of a partial derivative """ - new_coefs = [] - new_pd = [] - for (coef, pd) in self.terms: - tmp = coef.simplify(modes=modes) - new_coefs.append(tmp) - new_pd.append(pd) - return Dop(new_coefs, new_pd, ga=self.Ga, cmpflg=self.cmpflg) + return Dop( + [(coef.simplify(modes=modes), pd) for coef, pd in self.terms], + ga=self.Ga, cmpflg=self.cmpflg + ) def consolidate_coefs(self): """ @@ -2192,10 +2182,9 @@ def Mul(dopl, dopr, op='*'): # General multiplication of Dop's return product def TSimplify(self): - new_terms = [] - for (coef, pdiff) in self.terms: - new_terms.append((metric.Simp.apply(coef), pdiff)) - return Dop(new_terms, ga=self.Ga) + return Dop([ + (metric.Simp.apply(coef), pdiff) for (coef, pdiff) in self.terms + ], ga=self.Ga) def __truediv__(self, dopr): if isinstance(dopr, (Dop, Mv)): From ff11aa1b3ef64244a1c87e8f8bb321c3116871d8 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 12:37:38 +0000 Subject: [PATCH 29/62] Remove unused and undocumented setGa method (#163) Storing a ga globally like this isn't a good idea. Additionally, it's very confusing that both `some_dop.ga` and `some_dop.Ga` exist, but the former is always `None`. If anyone was actually using this, they can always use ```python import functools Pdop = functools.partial(Pdop, ga=my_ga) Sdop = functools.partial(Sdop, ga=my_ga) Dop = functools.partial(Dop, ga=my_ga) ``` --- galgebra/mv.py | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 091d437f..5011536c 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1433,15 +1433,8 @@ class Sdop(object): init_slots = {'ga': (None, 'Associated geometric algebra')} - ga = None str_mode = False - @staticmethod - def setGa(ga): - Sdop.ga = ga - Pdop.setGa(ga) - return - def TSimplify(self): return Sdop([ (metric.Simp.apply(coef), pdiff) for (coef, pdiff) in self.terms @@ -1566,10 +1559,7 @@ def __init__(self, *args, **kwargs): self.Ga = kwargs['ga'] # Associated geometric algebra (coords) if self.Ga is None: - if Sdop.ga is None: - raise ValueError('In Sdop.__init__ self.Ga must be defined.') - else: - self.Ga = Sdop.ga + raise ValueError('In Sdop.__init__ self.Ga must be defined.') if len(args[0]) == 1 and isinstance(args[0],Symbol): # Simple Pdop of order 1 self.terms = ((S(1), self.Ga.pdop(args[0])),) @@ -1715,15 +1705,8 @@ class Pdop(object): total number of differentiations """ - ga = None - init_slots = {'ga': (None, 'Associated geometric algebra')} - @staticmethod - def setGa(ga): - Pdop.ga = ga - return - @staticmethod def compare(pdop1, pdop2): # compare two Pdops if pdop1.order > pdop2.order: @@ -1774,10 +1757,7 @@ def __init__(self, *args, **kwargs): self.order = 0 if self.Ga is None: - if Pdop.ga is None: - raise ValueError('In Pdop.__init__ self.Ga must be defined.') - else: - self.Ga = Pdop.ga # use geometric algebra of class Pdop + raise ValueError('In Pdop.__init__ self.Ga must be defined.') if args[0] is None: # Pdop is the identity (1) self.pdiffs = {} @@ -1976,15 +1956,6 @@ class Dop(object): 'debug': (False, 'True to print out debugging information'), 'fmt_dop': (1, '1 for normal dop partial derivative formating')} - ga = None - - - @staticmethod - def setGa(ga): # set geometric algebra globally for all Dop's - Dop.ga = ga - Sdop.setGa(ga) - return - @staticmethod def flatten_one_level(lst): return [inner for outer in lst for inner in outer] @@ -1997,10 +1968,7 @@ def __init__(self, *args, **kwargs): self.Ga = kwargs['ga'] if self.Ga is None: - if Dop.ga is None: - raise ValueError('In Dop.__init__ self.Ga must be defined.') - else: - self.Ga = Dop.ga + raise ValueError('In Dop.__init__ self.Ga must be defined.') self.dop_fmt = kwargs['fmt_dop'] # Partial derivative output format (default 1) self.title = None From 0dd91d88ccc517212f2d88f54fb759a8cff3e0f6 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 12:39:08 +0000 Subject: [PATCH 30/62] Add mailmap to merge Alan's old usernames (#162) I've avoided putting any of his active email addresses here for spam reasons. --- .mailmap | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .mailmap diff --git a/.mailmap b/.mailmap new file mode 100644 index 00000000..1041f2d0 --- /dev/null +++ b/.mailmap @@ -0,0 +1,12 @@ +# Prevent git from showing duplicate names with commands like "git shortlog" +# See the manpage of git-shortlog for details. +# The syntax is: +# Name that should be used Bad name +# +# You can skip Bad name if it is the same as the one that should be used, and is unique. +# +# This file is up-to-date if the command git log --format="%aN <%aE>" | sort -u +# gives no duplicates. + +Alan Bromborsky brombo +Alan Bromborsky From 8e3dc35c90d06620c89cc62f0048921b3bdab45c Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 13:42:25 +0000 Subject: [PATCH 31/62] Save test results to circle-ci (#166) --- .circleci/config.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 169c762a..952cc3f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,13 +13,20 @@ defaults: &defaults - run: name: Test command: | - pytest -n 2 --dist loadscope --cov=galgebra --nbval examples/ipython/ test --current-env --sanitize-with test/.nbval_sanitize.cfg + mkdir test-reports + pytest -n 2 --dist loadscope --cov=galgebra --nbval examples/ipython/ test --current-env --sanitize-with test/.nbval_sanitize.cfg --junitxml=test-reports/junit.xml - run: name: Coverage when: on_success command: | sudo pip install codecov codecov + + - store_test_results: + path: test-reports + - store_artifacts: + path: test-reports + jobs: "python-3.7": <<: *defaults From bc09c38a2dae613c1ccafc8038918fd4766e81ce Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 15:54:00 +0000 Subject: [PATCH 32/62] Drop support for python 3.4 (#167) Python 3.4 was end of life back in march, and there's little value in continuing to support it. Removing the CI run will save some PR time and electricity :) Also modifies the setup.py to refuse to install on 3.4. --- .circleci/config.yml | 6 +----- README.md | 2 +- setup.py | 6 +++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 952cc3f9..eb4f0e59 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,10 +40,6 @@ jobs: <<: *defaults docker: - image: circleci/python:3.5 - "python-3.4": - <<: *defaults - docker: - - image: circleci/python:3.4 "python-2.7": <<: *defaults docker: @@ -55,5 +51,5 @@ workflows: jobs: - "python-3.7" - "python-3.6" - - "python-3.4" + - "python-3.5" - "python-2.7" diff --git a/README.md b/README.md index 19acf14a..5b719001 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Installing GAlgebra ### Prerequisites - Works on Linux, Windows, Mac OSX -- [Python](https://www.python.org/) 2.7 or 3 +- [Python](https://www.python.org/) 2.7 or >=3.5 - [SymPy](https://www.sympy.org) Note: diff --git a/setup.py b/setup.py index 74960b85..c383cdae 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,8 @@ packages=find_packages(), package_dir={'galgebra':'galgebra'}, install_requires = ['sympy'], + # 2.7 or >=3.5 + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', long_description=LONG_DESCRIPTION, classifiers=[ 'Development Status :: 4 - Beta', @@ -26,6 +28,8 @@ 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics']) From f35f01d5ade1c3b752e01473e0f3620e61840554 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 16:05:35 +0000 Subject: [PATCH 33/62] Change "Old Format.ipynb" to work on windows (#168) This is just like 4740ea2395cb0eaa1e5316ad6be6bde029a25fe6 (gh-153), in that it avoids using `cat`. Note that the diff is large because `\r\n` became `\n`. --- examples/ipython/Old Format.ipynb | 2024 ++++++++++++++--------------- 1 file changed, 990 insertions(+), 1034 deletions(-) diff --git a/examples/ipython/Old Format.ipynb b/examples/ipython/Old Format.ipynb index 21e7af3b..02e1c059 100644 --- a/examples/ipython/Old Format.ipynb +++ b/examples/ipython/Old Format.ipynb @@ -6,7 +6,28 @@ "metadata": {}, "outputs": [], "source": [ - "%cd -q ../Old Format" + "import subprocess\n", + "import sys\n", + "import os\n", + "from IPython.display import display_pretty\n", + "\n", + "os.chdir('../Old Format')\n", + "\n", + "def check_latex(name):\n", + " # todo: use subprocess.run once we drop Python 2.7\n", + " p = subprocess.Popen([sys.executable, name + '.py'], stderr=subprocess.PIPE, universal_newlines=True)\n", + " try:\n", + " stdout, stderr = p.communicate()\n", + " except:\n", + " p.kill()\n", + " if p.poll():\n", + " raise RuntimeError(\"The script raised an exception:\\n\\n\" + stderr)\n", + "\n", + " with open(name + '.tex', 'r') as f:\n", + " # can't use display.Latex here, it would result in CSS comparisons in the output.\n", + " \n", + " # using `display` forces this to be a separate output to any stdout from above.\n", + " display_pretty(f.read(), raw=True)" ] }, { @@ -18,13 +39,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "3*e_x + 4*e_y\r\n", - "5\r\n", - "25\r\n", - "3*e_x/5 + 4*e_y/5\r\n", - "3*e_x/25 + 4*e_y/25\r\n", - "1\r\n", - "3*e_x/25 + 4*e_y/25\r\n" + "3*e_x + 4*e_y\n", + "5\n", + "25\n", + "3*e_x/5 + 4*e_y/5\n", + "3*e_x/25 + 4*e_y/25\n", + "1\n", + "3*e_x/25 + 4*e_y/25\n" ] } ], @@ -91,523 +112,508 @@ { "cell_type": "code", "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ - "!python latex_check.py" - ] - }, - { - "cell_type": "code", - "execution_count": 6, "metadata": { - "collapsed": false, "scrolled": false }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def basic_multivector_operations_3D():\r\n", - " Print_Function()\r\n", - " (ex,ey,ez) = MV.setup('e*x|y|z')\r\n", - " A = MV('A','mv')\r\n", - " A.Fmt(1,'A')\r\n", - " A.Fmt(2,'A')\r\n", - " A.Fmt(3,'A')\r\n", - " A.even().Fmt(1,'%A_{+}')\r\n", - " A.odd().Fmt(1,'%A_{-}')\r\n", - " X = MV('X','vector')\r\n", - " Y = MV('Y','vector')\r\n", - " print('g_{ij} = ',MV.metric)\r\n", - " X.Fmt(1,'X')\r\n", - " Y.Fmt(1,'Y')\r\n", - " (X*Y).Fmt(2,'X*Y')\r\n", - " (X^Y).Fmt(2,'X^Y')\r\n", - " (X|Y).Fmt(2,'X|Y')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} A = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{x}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{z}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) & \\left ( e_{z}\\cdot e_{z}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def basic_multivector_operations_2D():\r\n", - " Print_Function()\r\n", - " (ex,ey) = MV.setup('e*x|y')\r\n", - " print('g_{ij} =',MV.metric)\r\n", - " X = MV('X','vector')\r\n", - " A = MV('A','spinor')\r\n", - " X.Fmt(1,'X')\r\n", - " A.Fmt(1,'A')\r\n", - " (X|A).Fmt(2,'X|A')\r\n", - " (XX).Fmt(2,'A>X')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def basic_multivector_operations_2D_orthogonal():\r\n", - " Print_Function()\r\n", - " (ex,ey) = MV.setup('e*x|y',metric='[1,1]')\r\n", - " print('g_{ii} =',MV.metric)\r\n", - " X = MV('X','vector')\r\n", - " A = MV('A','spinor')\r\n", - " X.Fmt(1,'X')\r\n", - " A.Fmt(1,'A')\r\n", - " (X*A).Fmt(2,'X*A')\r\n", - " (X|A).Fmt(2,'X|A')\r\n", - " (XA).Fmt(2,'X>A')\r\n", - " (A*X).Fmt(2,'A*X')\r\n", - " (A|X).Fmt(2,'A|X')\r\n", - " (AX).Fmt(2,'A>X')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ii} = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def check_generalized_BAC_CAB_formulas():\r\n", - " Print_Function()\r\n", - " (a,b,c,d) = MV.setup('a b c d')\r\n", - " print('g_{ij} =',MV.metric)\r\n", - " print('\\\\bm{a|(b*c)} =',a|(b*c))\r\n", - " print('\\\\bm{a|(b^c)} =',a|(b^c))\r\n", - " print('\\\\bm{a|(b^c^d)} =',a|(b^c^d))\r\n", - " print('\\\\bm{a|(b^c)+c|(a^b)+b|(c^a)} =',(a|(b^c))+(c|(a^b))+(b|(c^a)))\r\n", - " print('\\\\bm{a*(b^c)-b*(a^c)+c*(a^b)} =',a*(b^c)-b*(a^c)+c*(a^b))\r\n", - " print('\\\\bm{a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c)} =',a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c))\r\n", - " print('\\\\bm{(a^b)|(c^d)} =',(a^b)|(c^d))\r\n", - " print('\\\\bm{((a^b)|c)|d} =',((a^b)|c)|d)\r\n", - " print('\\\\bm{(a^b)\\\\times (c^d)} =',Ga.com(a^b,c^d))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cccc} \\left ( a\\cdot a\\right ) & \\left ( a\\cdot b\\right ) & \\left ( a\\cdot c\\right ) & \\left ( a\\cdot d\\right ) \\\\ \\left ( a\\cdot b\\right ) & \\left ( b\\cdot b\\right ) & \\left ( b\\cdot c\\right ) & \\left ( b\\cdot d\\right ) \\\\ \\left ( a\\cdot c\\right ) & \\left ( b\\cdot c\\right ) & \\left ( c\\cdot c\\right ) & \\left ( c\\cdot d\\right ) \\\\ \\left ( a\\cdot d\\right ) & \\left ( b\\cdot d\\right ) & \\left ( c\\cdot d\\right ) & \\left ( d\\cdot d\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a\\cdot (b c)} = - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a\\cdot (b\\W c)} = - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a\\cdot (b\\W c\\W d)} = \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} + \\left ( a\\cdot b\\right ) \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} = 0 \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\r\n", - "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\r\n", - "\\begin{equation*} \\bm{(a\\W b)\\times (c\\W d)} = - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c} + \\left ( b\\cdot c\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{d} + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def rounding_numerical_components():\r\n", - " Print_Function()\r\n", - " (ex,ey,ez) = MV.setup('e_x e_y e_z',metric='[1,1,1]')\r\n", - " X = 1.2*ex+2.34*ey+0.555*ez\r\n", - " Y = 0.333*ex+4*ey+5.3*ez\r\n", - " print('X =',X)\r\n", - " print('Nga(X,2) =',Nga(X,2))\r\n", - " print('X*Y =',X*Y)\r\n", - " print('Nga(X*Y,2) =',Nga(X*Y,2))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} X = 1 \\cdot 2 \\boldsymbol{e}_{x} + 2 \\cdot 34 \\boldsymbol{e}_{y} + 0 \\cdot 555 \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} Nga(X,2) = 1 \\cdot 2 \\boldsymbol{e}_{x} + 2 \\cdot 3 \\boldsymbol{e}_{y} + 0 \\cdot 55 \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} X Y = & 12 \\cdot 7011 \\\\ & + 4 \\cdot 02078 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6 \\cdot 175185 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10 \\cdot 182 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} Nga(X Y,2) = & 13 \\cdot 0 \\\\ & + 4 \\cdot 0 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6 \\cdot 2 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10 \\cdot 0 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def derivatives_in_rectangular_coordinates():\r\n", - " Print_Function()\r\n", - " X = (x,y,z) = symbols('x y z')\r\n", - " (ex,ey,ez,grad) = MV.setup('e_x e_y e_z',metric='[1,1,1]',coords=X)\r\n", - " f = MV('f','scalar',fct=True)\r\n", - " A = MV('A','vector',fct=True)\r\n", - " B = MV('B','grade2',fct=True)\r\n", - " C = MV('C','mv')\r\n", - " print('f =',f)\r\n", - " print('A =',A)\r\n", - " print('B =',B)\r\n", - " print('C =',C)\r\n", - " print('grad*f =',grad*f)\r\n", - " print('grad|A =',grad|A)\r\n", - " print('grad*A =',grad*A)\r\n", - " print(-MV.I)\r\n", - " print('-I*(grad^A) =',-MV.I*(grad^A))\r\n", - " print('grad*B =',grad*B)\r\n", - " print('grad^B =',grad^B)\r\n", - " print('grad|B =',grad|B)\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} A = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} B = B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} C = & C \\\\ & + C^{x} \\boldsymbol{e}_{x} + C^{y} \\boldsymbol{e}_{y} + C^{z} \\boldsymbol{e}_{z} \\\\ & + C^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + C^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + C^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + C^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{x} f \\boldsymbol{e}_{x} + \\partial_{y} f \\boldsymbol{e}_{y} + \\partial_{z} f \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} A = & \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} - \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{z} A^{x} - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} B = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\\\ & + \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot B = \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def derivatives_in_spherical_coordinates():\r\n", - " Print_Function()\r\n", - " X = (r,th,phi) = symbols('r theta phi')\r\n", - " curv = [[r*cos(phi)*sin(th),r*sin(phi)*sin(th),r*cos(th)],[1,r,r*sin(th)]]\r\n", - " (er,eth,ephi,grad) = MV.setup('e_r e_theta e_phi',metric='[1,1,1]',coords=X,curv=curv)\r\n", - " f = MV('f','scalar',fct=True)\r\n", - " A = MV('A','vector',fct=True)\r\n", - " B = MV('B','grade2',fct=True)\r\n", - " print('f =',f)\r\n", - " print('A =',A)\r\n", - " print('B =',B)\r\n", - " print('grad*f =',grad*f)\r\n", - " print('grad|A =',grad|A)\r\n", - " print('-I*(grad^A) =',(-MV.I*(grad^A)).simplify())\r\n", - " print('grad^B =',grad^B)\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} A = A^{r} \\boldsymbol{e}_{r} + A^{\\theta } \\boldsymbol{e}_{\\theta } + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} B = B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{r} f \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } A^{\\phi } + \\partial_{r} A^{r} + \\partial_{\\theta } A^{\\theta } + \\frac{2 A^{r} }{r} \\end{equation*}\r\n", - "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta \\right )}}^{2} \\partial_{r} A^{\\phi } - 2 r A^{\\phi } {\\sin{\\left (\\theta \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta } + 2 r A^{\\theta } - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi } + 4 r B^{\\theta \\phi } - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def conformal_representations_of_circles_lines_spheres_and_planes():\r\n", - " Print_Function()\r\n", - " global n,nbar\r\n", - " metric = '1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 2,0 0 0 2 0'\r\n", - " (e1,e2,e3,n,nbar) = MV.setup('e_1 e_2 e_3 n \\\\bar{n}',metric)\r\n", - " print('g_{ij} =',MV.metric)\r\n", - " e = n+nbar\r\n", - " #conformal representation of points\r\n", - " A = make_vector(e1) # point a = (1,0,0) A = F(a)\r\n", - " B = make_vector(e2) # point b = (0,1,0) B = F(b)\r\n", - " C = make_vector(-e1) # point c = (-1,0,0) C = F(c)\r\n", - " D = make_vector(e3) # point d = (0,0,1) D = F(d)\r\n", - " X = make_vector('x',3)\r\n", - " print('F(a) =',A)\r\n", - " print('F(b) =',B)\r\n", - " print('F(c) =',C)\r\n", - " print('F(d) =',D)\r\n", - " print('F(x) =',X)\r\n", - " print('#a = e1, b = e2, c = -e1, and d = e3')\r\n", - " print('#A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.')\r\n", - " print('#Circle through a, b, and c')\r\n", - " print('Circle: A^B^C^X = 0 =',(A^B^C^X))\r\n", - " print('#Line through a and b')\r\n", - " print('Line : A^B^n^X = 0 =',(A^B^n^X))\r\n", - " print('#Sphere through a, b, c, and d')\r\n", - " print('Sphere: A^B^C^D^X = 0 =',(((A^B)^C)^D)^X)\r\n", - " print('#Plane through a, b, and d')\r\n", - " print('Plane : A^B^n^D^X = 0 =',(A^B^n^D^X))\r\n", - " L = (A^B^e)^X\r\n", - " L.Fmt(3,'Hyperbolic\\\\;\\\\; Circle: (A^B^e)^X = 0')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} 1 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 2 \\\\ 0 & 0 & 0 & 2 & 0 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} F(a) = \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\begin{equation*} F(b) = \\boldsymbol{e}_{2} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\begin{equation*} F(c) = - \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\begin{equation*} F(d) = \\boldsymbol{e}_{3} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\begin{equation*} F(x) = x_{1} \\boldsymbol{e}_{1} + x_{2} \\boldsymbol{e}_{2} + x_{3} \\boldsymbol{e}_{3} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2}\\right ) \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "a = e1, b = e2, c = -e1, and d = e3\r\n", - "A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.\r\n", - "Circle through a, b, and c\r\n", - "\\begin{equation*} Circle: A\\W B\\W C\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{\\bar{n}} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "Line through a and b\r\n", - "\\begin{equation*} Line : A\\W B\\W n\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + \\left ( \\frac{x_{1}}{2} + \\frac{x_{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} + \\frac{x_{3}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} - \\frac{x_{3}}{2} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "Sphere through a, b, c, and d\r\n", - "\\begin{equation*} Sphere: A\\W B\\W C\\W D\\W X = 0 = \\left ( - \\frac{{\\left ( x_{1} \\right )}^{2}}{2} - \\frac{{\\left ( x_{2} \\right )}^{2}}{2} - \\frac{{\\left ( x_{3} \\right )}^{2}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "Plane through a, b, and d\r\n", - "\\begin{equation*} Plane : A\\W B\\W n\\W D\\W X = 0 = \\left ( - \\frac{x_{1}}{2} - \\frac{x_{2}}{2} - \\frac{x_{3}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def properties_of_geometric_objects():\r\n", - " global n,nbar\r\n", - " Print_Function()\r\n", - " metric = '# # # 0 0,'+ \\\r\n", - " '# # # 0 0,'+ \\\r\n", - " '# # # 0 0,'+ \\\r\n", - " '0 0 0 0 2,'+ \\\r\n", - " '0 0 0 2 0'\r\n", - " (p1,p2,p3,n,nbar) = MV.setup('p1 p2 p3 n \\\\bar{n}',metric)\r\n", - " print('g_{ij} =',MV.metric)\r\n", - " P1 = F(p1)\r\n", - " P2 = F(p2)\r\n", - " P3 = F(p3)\r\n", - " print('#%\\\\text{Extracting direction of line from }L = P1\\\\W P2\\\\W n')\r\n", - " L = P1^P2^n\r\n", - " delta = (L|n)|nbar\r\n", - " print('(L|n)|\\\\bar{n} =',delta)\r\n", - " print('#%\\\\text{Extracting plane of circle from }C = P1\\\\W P2\\\\W P3')\r\n", - " C = P1^P2^P3\r\n", - " delta = ((C^n)|n)|nbar\r\n", - " print('((C^n)|n)|\\\\bar{n}=',delta)\r\n", - " print('(p2-p1)^(p3-p1)=',(p2-p1)^(p3-p1))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} \\left ( p_{1}\\cdot p_{1}\\right ) & \\left ( p_{1}\\cdot p_{2}\\right ) & \\left ( p_{1}\\cdot p_{3}\\right ) & 0 & 0 \\\\ \\left ( p_{1}\\cdot p_{2}\\right ) & \\left ( p_{2}\\cdot p_{2}\\right ) & \\left ( p_{2}\\cdot p_{3}\\right ) & 0 & 0 \\\\ \\left ( p_{1}\\cdot p_{3}\\right ) & \\left ( p_{2}\\cdot p_{3}\\right ) & \\left ( p_{3}\\cdot p_{3}\\right ) & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 2 \\\\ 0 & 0 & 0 & 2 & 0 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\text{Extracting direction of line from }L = P1\\W P2\\W n \\end{equation*}\r\n", - " \\begin{align*} (L\\cdot n)\\cdot \\bar{n} = & 2 \\boldsymbol{p}_{1} \\\\ & -2 \\boldsymbol{p}_{2} \\end{align*} \r\n", - "\\begin{equation*} \\text{Extracting plane of circle from }C = P1\\W P2\\W P3 \\end{equation*}\r\n", - " \\begin{align*} ((C\\W n)\\cdot n)\\cdot \\bar{n}= & 2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} \\\\ & -2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} \\\\ & + 2 \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{align*} \r\n", - " \\begin{align*} (p2-p1)\\W (p3-p1)= & \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} \\\\ & - \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} \\\\ & + \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{align*} \r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def extracting_vectors_from_conformal_2_blade():\r\n", - " Print_Function()\r\n", - " print(r'B = P1\\W P2')\r\n", - " metric = '0 -1 #,'+ \\\r\n", - " '-1 0 #,'+ \\\r\n", - " '# # #'\r\n", - " (P1,P2,a) = MV.setup('P1 P2 a',metric)\r\n", - " print('g_{ij} =',MV.metric)\r\n", - " B = P1^P2\r\n", - " Bsq = B*B\r\n", - " print('%B^{2} =',Bsq)\r\n", - " ap = a-(a^B)*B\r\n", - " print(\"a' = a-(a^B)*B =\",ap)\r\n", - " Ap = ap+ap*B\r\n", - " Am = ap-ap*B\r\n", - " print(\"A+ = a'+a'*B =\",Ap)\r\n", - " print(\"A- = a'-a'*B =\",Am)\r\n", - " print('%(A+)^{2} =',Ap*Ap)\r\n", - " print('%(A-)^{2} =',Am*Am)\r\n", - " aB = a|B\r\n", - " print('a|B =',aB)\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} B = P1\\W P2 \\end{equation*}\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 0 & -1 & \\left ( P_{1}\\cdot a\\right ) \\\\ -1 & 0 & \\left ( P_{2}\\cdot a\\right ) \\\\ \\left ( P_{1}\\cdot a\\right ) & \\left ( P_{2}\\cdot a\\right ) & \\left ( a\\cdot a\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} B^{2} = 1 \\end{equation*}\r\n", - " \\begin{align*} a' = a-(a\\W B) B = & - \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} \\\\ & - \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{align*} \r\n", - "\\begin{equation*} A+ = a'+a' B = - 2 \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} \\end{equation*}\r\n", - "\\begin{equation*} A- = a'-a' B = - 2 \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{equation*}\r\n", - "\\begin{equation*} (A+)^{2} = 0 \\end{equation*}\r\n", - "\\begin{equation*} (A-)^{2} = 0 \\end{equation*}\r\n", - " \\begin{align*} a\\cdot B = & - \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} \\\\ & + \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{align*} \r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def reciprocal_frame_test():\r\n", - " Print_Function()\r\n", - " metric = '1 # #,'+ \\\r\n", - " '# 1 #,'+ \\\r\n", - " '# # 1'\r\n", - " (e1,e2,e3) = MV.setup('e1 e2 e3',metric)\r\n", - " print('g_{ij} =',MV.metric)\r\n", - " E = e1^e2^e3\r\n", - " Esq = (E*E).scalar()\r\n", - " print('E =',E)\r\n", - " print('%E^{2} =',Esq)\r\n", - " Esq_inv = 1/Esq\r\n", - " E1 = (e2^e3)*E\r\n", - " E2 = (-1)*(e1^e3)*E\r\n", - " E3 = (e1^e2)*E\r\n", - " print('E1 = (e2^e3)*E =',E1)\r\n", - " print('E2 =-(e1^e3)*E =',E2)\r\n", - " print('E3 = (e1^e2)*E =',E3)\r\n", - " w = (E1|e2)\r\n", - " w = w.expand()\r\n", - " print('E1|e2 =',w)\r\n", - " w = (E1|e3)\r\n", - " w = w.expand()\r\n", - " print('E1|e3 =',w)\r\n", - " w = (E2|e1)\r\n", - " w = w.expand()\r\n", - " print('E2|e1 =',w)\r\n", - " w = (E2|e3)\r\n", - " w = w.expand()\r\n", - " print('E2|e3 =',w)\r\n", - " w = (E3|e1)\r\n", - " w = w.expand()\r\n", - " print('E3|e1 =',w)\r\n", - " w = (E3|e2)\r\n", - " w = w.expand()\r\n", - " print('E3|e2 =',w)\r\n", - " w = (E1|e1)\r\n", - " w = (w.expand()).scalar()\r\n", - " Esq = expand(Esq)\r\n", - " print('%(E1\\\\cdot e1)/E^{2} =',simplify(w/Esq))\r\n", - " w = (E2|e2)\r\n", - " w = (w.expand()).scalar()\r\n", - " print('%(E2\\\\cdot e2)/E^{2} =',simplify(w/Esq))\r\n", - " w = (E3|e3)\r\n", - " w = (w.expand()).scalar()\r\n", - " print('%(E3\\\\cdot e3)/E^{2} =',simplify(w/Esq))\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 1 & \\left ( e_{1}\\cdot e_{2}\\right ) & \\left ( e_{1}\\cdot e_{3}\\right ) \\\\ \\left ( e_{1}\\cdot e_{2}\\right ) & 1 & \\left ( e_{2}\\cdot e_{3}\\right ) \\\\ \\left ( e_{1}\\cdot e_{3}\\right ) & \\left ( e_{2}\\cdot e_{3}\\right ) & 1 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} E = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} E^{2} = \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 2 \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} + \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1 \\end{equation*}\r\n", - " \\begin{align*} E1 = (e2\\W e3) E = & \\left ( \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - " \\begin{align*} E2 =-(e1\\W e3) E = & \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - " \\begin{align*} E3 = (e1\\W e2) E = & \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - "\\begin{equation*} E1\\cdot e2 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E1\\cdot e3 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E2\\cdot e1 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E2\\cdot e3 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E3\\cdot e1 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E3\\cdot e2 = 0 \\end{equation*}\r\n", - "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def basic_multivector_operations_3D():\n", + " Print_Function()\n", + " (ex,ey,ez) = MV.setup('e*x|y|z')\n", + " A = MV('A','mv')\n", + " A.Fmt(1,'A')\n", + " A.Fmt(2,'A')\n", + " A.Fmt(3,'A')\n", + " A.even().Fmt(1,'%A_{+}')\n", + " A.odd().Fmt(1,'%A_{-}')\n", + " X = MV('X','vector')\n", + " Y = MV('Y','vector')\n", + " print('g_{ij} = ',MV.metric)\n", + " X.Fmt(1,'X')\n", + " Y.Fmt(1,'Y')\n", + " (X*Y).Fmt(2,'X*Y')\n", + " (X^Y).Fmt(2,'X^Y')\n", + " (X|Y).Fmt(2,'X|Y')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} A = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{x}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{z}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) & \\left ( e_{z}\\cdot e_{z}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def basic_multivector_operations_2D():\n", + " Print_Function()\n", + " (ex,ey) = MV.setup('e*x|y')\n", + " print('g_{ij} =',MV.metric)\n", + " X = MV('X','vector')\n", + " A = MV('A','spinor')\n", + " X.Fmt(1,'X')\n", + " A.Fmt(1,'A')\n", + " (X|A).Fmt(2,'X|A')\n", + " (XX).Fmt(2,'A>X')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def basic_multivector_operations_2D_orthogonal():\n", + " Print_Function()\n", + " (ex,ey) = MV.setup('e*x|y',metric='[1,1]')\n", + " print('g_{ii} =',MV.metric)\n", + " X = MV('X','vector')\n", + " A = MV('A','spinor')\n", + " X.Fmt(1,'X')\n", + " A.Fmt(1,'A')\n", + " (X*A).Fmt(2,'X*A')\n", + " (X|A).Fmt(2,'X|A')\n", + " (XA).Fmt(2,'X>A')\n", + " (A*X).Fmt(2,'A*X')\n", + " (A|X).Fmt(2,'A|X')\n", + " (AX).Fmt(2,'A>X')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ii} = \\left [ \\begin{array}{cc} 1 & 0 \\\\ 0 & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def check_generalized_BAC_CAB_formulas():\n", + " Print_Function()\n", + " (a,b,c,d) = MV.setup('a b c d')\n", + " print('g_{ij} =',MV.metric)\n", + " print('\\\\bm{a|(b*c)} =',a|(b*c))\n", + " print('\\\\bm{a|(b^c)} =',a|(b^c))\n", + " print('\\\\bm{a|(b^c^d)} =',a|(b^c^d))\n", + " print('\\\\bm{a|(b^c)+c|(a^b)+b|(c^a)} =',(a|(b^c))+(c|(a^b))+(b|(c^a)))\n", + " print('\\\\bm{a*(b^c)-b*(a^c)+c*(a^b)} =',a*(b^c)-b*(a^c)+c*(a^b))\n", + " print('\\\\bm{a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c)} =',a*(b^c^d)-b*(a^c^d)+c*(a^b^d)-d*(a^b^c))\n", + " print('\\\\bm{(a^b)|(c^d)} =',(a^b)|(c^d))\n", + " print('\\\\bm{((a^b)|c)|d} =',((a^b)|c)|d)\n", + " print('\\\\bm{(a^b)\\\\times (c^d)} =',Ga.com(a^b,c^d))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cccc} \\left ( a\\cdot a\\right ) & \\left ( a\\cdot b\\right ) & \\left ( a\\cdot c\\right ) & \\left ( a\\cdot d\\right ) \\\\ \\left ( a\\cdot b\\right ) & \\left ( b\\cdot b\\right ) & \\left ( b\\cdot c\\right ) & \\left ( b\\cdot d\\right ) \\\\ \\left ( a\\cdot c\\right ) & \\left ( b\\cdot c\\right ) & \\left ( c\\cdot c\\right ) & \\left ( c\\cdot d\\right ) \\\\ \\left ( a\\cdot d\\right ) & \\left ( b\\cdot d\\right ) & \\left ( c\\cdot d\\right ) & \\left ( d\\cdot d\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\bm{a\\cdot (b c)} = - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}\n", + "\\begin{equation*} \\bm{a\\cdot (b\\W c)} = - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}\n", + "\\begin{equation*} \\bm{a\\cdot (b\\W c\\W d)} = \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} + \\left ( a\\cdot b\\right ) \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n", + "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} = 0 \\end{equation*}\n", + "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\n", + "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n", + "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\n", + "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\n", + "\\begin{equation*} \\bm{(a\\W b)\\times (c\\W d)} = - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c} + \\left ( b\\cdot c\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{d} + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def rounding_numerical_components():\n", + " Print_Function()\n", + " (ex,ey,ez) = MV.setup('e_x e_y e_z',metric='[1,1,1]')\n", + " X = 1.2*ex+2.34*ey+0.555*ez\n", + " Y = 0.333*ex+4*ey+5.3*ez\n", + " print('X =',X)\n", + " print('Nga(X,2) =',Nga(X,2))\n", + " print('X*Y =',X*Y)\n", + " print('Nga(X*Y,2) =',Nga(X*Y,2))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} X = 1 \\cdot 2 \\boldsymbol{e}_{x} + 2 \\cdot 34 \\boldsymbol{e}_{y} + 0 \\cdot 555 \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} Nga(X,2) = 1 \\cdot 2 \\boldsymbol{e}_{x} + 2 \\cdot 3 \\boldsymbol{e}_{y} + 0 \\cdot 55 \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} X Y = & 12 \\cdot 7011 \\\\ & + 4 \\cdot 02078 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6 \\cdot 175185 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10 \\cdot 182 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} Nga(X Y,2) = & 13 \\cdot 0 \\\\ & + 4 \\cdot 0 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + 6 \\cdot 2 \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + 10 \\cdot 0 \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def derivatives_in_rectangular_coordinates():\n", + " Print_Function()\n", + " X = (x,y,z) = symbols('x y z')\n", + " (ex,ey,ez,grad) = MV.setup('e_x e_y e_z',metric='[1,1,1]',coords=X)\n", + " f = MV('f','scalar',fct=True)\n", + " A = MV('A','vector',fct=True)\n", + " B = MV('B','grade2',fct=True)\n", + " C = MV('C','mv')\n", + " print('f =',f)\n", + " print('A =',A)\n", + " print('B =',B)\n", + " print('C =',C)\n", + " print('grad*f =',grad*f)\n", + " print('grad|A =',grad|A)\n", + " print('grad*A =',grad*A)\n", + " print(-MV.I)\n", + " print('-I*(grad^A) =',-MV.I*(grad^A))\n", + " print('grad*B =',grad*B)\n", + " print('grad^B =',grad^B)\n", + " print('grad|B =',grad|B)\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} A = A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} B = B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} C = & C \\\\ & + C^{x} \\boldsymbol{e}_{x} + C^{y} \\boldsymbol{e}_{y} + C^{z} \\boldsymbol{e}_{z} \\\\ & + C^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + C^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + C^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + C^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{x} f \\boldsymbol{e}_{x} + \\partial_{y} f \\boldsymbol{e}_{y} + \\partial_{z} f \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\n", + " \\begin{align*} \\boldsymbol{\\nabla} A = & \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} - \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{z} A^{x} - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} \\boldsymbol{\\nabla} B = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\\\ & + \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot B = \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def derivatives_in_spherical_coordinates():\n", + " Print_Function()\n", + " X = (r,th,phi) = symbols('r theta phi')\n", + " curv = [[r*cos(phi)*sin(th),r*sin(phi)*sin(th),r*cos(th)],[1,r,r*sin(th)]]\n", + " (er,eth,ephi,grad) = MV.setup('e_r e_theta e_phi',metric='[1,1,1]',coords=X,curv=curv)\n", + " f = MV('f','scalar',fct=True)\n", + " A = MV('A','vector',fct=True)\n", + " B = MV('B','grade2',fct=True)\n", + " print('f =',f)\n", + " print('A =',A)\n", + " print('B =',B)\n", + " print('grad*f =',grad*f)\n", + " print('grad|A =',grad|A)\n", + " print('-I*(grad^A) =',(-MV.I*(grad^A)).simplify())\n", + " print('grad^B =',grad^B)\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} A = A^{r} \\boldsymbol{e}_{r} + A^{\\theta } \\boldsymbol{e}_{\\theta } + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} B = B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{r} f \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } A^{\\phi } + \\partial_{r} A^{r} + \\partial_{\\theta } A^{\\theta } + \\frac{2 A^{r} }{r} \\end{equation*}\n", + "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta \\right )}}^{2} \\partial_{r} A^{\\phi } - 2 r A^{\\phi } {\\sin{\\left (\\theta \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta } + 2 r A^{\\theta } - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi } + 4 r B^{\\theta \\phi } - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def conformal_representations_of_circles_lines_spheres_and_planes():\n", + " Print_Function()\n", + " global n,nbar\n", + " metric = '1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 2,0 0 0 2 0'\n", + " (e1,e2,e3,n,nbar) = MV.setup('e_1 e_2 e_3 n \\\\bar{n}',metric)\n", + " print('g_{ij} =',MV.metric)\n", + " e = n+nbar\n", + " #conformal representation of points\n", + " A = make_vector(e1) # point a = (1,0,0) A = F(a)\n", + " B = make_vector(e2) # point b = (0,1,0) B = F(b)\n", + " C = make_vector(-e1) # point c = (-1,0,0) C = F(c)\n", + " D = make_vector(e3) # point d = (0,0,1) D = F(d)\n", + " X = make_vector('x',3)\n", + " print('F(a) =',A)\n", + " print('F(b) =',B)\n", + " print('F(c) =',C)\n", + " print('F(d) =',D)\n", + " print('F(x) =',X)\n", + " print('#a = e1, b = e2, c = -e1, and d = e3')\n", + " print('#A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.')\n", + " print('#Circle through a, b, and c')\n", + " print('Circle: A^B^C^X = 0 =',(A^B^C^X))\n", + " print('#Line through a and b')\n", + " print('Line : A^B^n^X = 0 =',(A^B^n^X))\n", + " print('#Sphere through a, b, c, and d')\n", + " print('Sphere: A^B^C^D^X = 0 =',(((A^B)^C)^D)^X)\n", + " print('#Plane through a, b, and d')\n", + " print('Plane : A^B^n^D^X = 0 =',(A^B^n^D^X))\n", + " L = (A^B^e)^X\n", + " L.Fmt(3,'Hyperbolic\\\\;\\\\; Circle: (A^B^e)^X = 0')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} 1 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 2 \\\\ 0 & 0 & 0 & 2 & 0 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} F(a) = \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\begin{equation*} F(b) = \\boldsymbol{e}_{2} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\begin{equation*} F(c) = - \\boldsymbol{e}_{1} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\begin{equation*} F(d) = \\boldsymbol{e}_{3} + \\frac{1}{2} \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\begin{equation*} F(x) = x_{1} \\boldsymbol{e}_{1} + x_{2} \\boldsymbol{e}_{2} + x_{3} \\boldsymbol{e}_{3} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2}\\right ) \\boldsymbol{n} - \\frac{1}{2} \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "a = e1, b = e2, c = -e1, and d = e3\n", + "A = F(a) = 1/2*(a*a*n+2*a-nbar), etc.\n", + "Circle through a, b, and c\n", + "\\begin{equation*} Circle: A\\W B\\W C\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{\\bar{n}} + \\left ( \\frac{{\\left ( x_{1} \\right )}^{2}}{2} + \\frac{{\\left ( x_{2} \\right )}^{2}}{2} + \\frac{{\\left ( x_{3} \\right )}^{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "Line through a and b\n", + "\\begin{equation*} Line : A\\W B\\W n\\W X = 0 = - x_{3} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n} + \\left ( \\frac{x_{1}}{2} + \\frac{x_{2}}{2} - \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} + \\frac{x_{3}}{2} \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} - \\frac{x_{3}}{2} \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "Sphere through a, b, c, and d\n", + "\\begin{equation*} Sphere: A\\W B\\W C\\W D\\W X = 0 = \\left ( - \\frac{{\\left ( x_{1} \\right )}^{2}}{2} - \\frac{{\\left ( x_{2} \\right )}^{2}}{2} - \\frac{{\\left ( x_{3} \\right )}^{2}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "Plane through a, b, and d\n", + "\\begin{equation*} Plane : A\\W B\\W n\\W D\\W X = 0 = \\left ( - \\frac{x_{1}}{2} - \\frac{x_{2}}{2} - \\frac{x_{3}}{2} + \\frac{1}{2}\\right ) \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3}\\wedge \\boldsymbol{n}\\wedge \\boldsymbol{\\bar{n}} \\end{equation*}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def properties_of_geometric_objects():\n", + " global n,nbar\n", + " Print_Function()\n", + " metric = '# # # 0 0,'+ \\\n", + " '# # # 0 0,'+ \\\n", + " '# # # 0 0,'+ \\\n", + " '0 0 0 0 2,'+ \\\n", + " '0 0 0 2 0'\n", + " (p1,p2,p3,n,nbar) = MV.setup('p1 p2 p3 n \\\\bar{n}',metric)\n", + " print('g_{ij} =',MV.metric)\n", + " P1 = F(p1)\n", + " P2 = F(p2)\n", + " P3 = F(p3)\n", + " print('#%\\\\text{Extracting direction of line from }L = P1\\\\W P2\\\\W n')\n", + " L = P1^P2^n\n", + " delta = (L|n)|nbar\n", + " print('(L|n)|\\\\bar{n} =',delta)\n", + " print('#%\\\\text{Extracting plane of circle from }C = P1\\\\W P2\\\\W P3')\n", + " C = P1^P2^P3\n", + " delta = ((C^n)|n)|nbar\n", + " print('((C^n)|n)|\\\\bar{n}=',delta)\n", + " print('(p2-p1)^(p3-p1)=',(p2-p1)^(p3-p1))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccccc} \\left ( p_{1}\\cdot p_{1}\\right ) & \\left ( p_{1}\\cdot p_{2}\\right ) & \\left ( p_{1}\\cdot p_{3}\\right ) & 0 & 0 \\\\ \\left ( p_{1}\\cdot p_{2}\\right ) & \\left ( p_{2}\\cdot p_{2}\\right ) & \\left ( p_{2}\\cdot p_{3}\\right ) & 0 & 0 \\\\ \\left ( p_{1}\\cdot p_{3}\\right ) & \\left ( p_{2}\\cdot p_{3}\\right ) & \\left ( p_{3}\\cdot p_{3}\\right ) & 0 & 0 \\\\ 0 & 0 & 0 & 0 & 2 \\\\ 0 & 0 & 0 & 2 & 0 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\text{Extracting direction of line from }L = P1\\W P2\\W n \\end{equation*}\n", + " \\begin{align*} (L\\cdot n)\\cdot \\bar{n} = & 2 \\boldsymbol{p}_{1} \\\\ & -2 \\boldsymbol{p}_{2} \\end{align*} \n", + "\\begin{equation*} \\text{Extracting plane of circle from }C = P1\\W P2\\W P3 \\end{equation*}\n", + " \\begin{align*} ((C\\W n)\\cdot n)\\cdot \\bar{n}= & 2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} \\\\ & -2 \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} \\\\ & + 2 \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{align*} \n", + " \\begin{align*} (p2-p1)\\W (p3-p1)= & \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{2} \\\\ & - \\boldsymbol{p}_{1}\\wedge \\boldsymbol{p}_{3} \\\\ & + \\boldsymbol{p}_{2}\\wedge \\boldsymbol{p}_{3} \\end{align*} \n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def extracting_vectors_from_conformal_2_blade():\n", + " Print_Function()\n", + " print(r'B = P1\\W P2')\n", + " metric = '0 -1 #,'+ \\\n", + " '-1 0 #,'+ \\\n", + " '# # #'\n", + " (P1,P2,a) = MV.setup('P1 P2 a',metric)\n", + " print('g_{ij} =',MV.metric)\n", + " B = P1^P2\n", + " Bsq = B*B\n", + " print('%B^{2} =',Bsq)\n", + " ap = a-(a^B)*B\n", + " print(\"a' = a-(a^B)*B =\",ap)\n", + " Ap = ap+ap*B\n", + " Am = ap-ap*B\n", + " print(\"A+ = a'+a'*B =\",Ap)\n", + " print(\"A- = a'-a'*B =\",Am)\n", + " print('%(A+)^{2} =',Ap*Ap)\n", + " print('%(A-)^{2} =',Am*Am)\n", + " aB = a|B\n", + " print('a|B =',aB)\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} B = P1\\W P2 \\end{equation*}\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 0 & -1 & \\left ( P_{1}\\cdot a\\right ) \\\\ -1 & 0 & \\left ( P_{2}\\cdot a\\right ) \\\\ \\left ( P_{1}\\cdot a\\right ) & \\left ( P_{2}\\cdot a\\right ) & \\left ( a\\cdot a\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} B^{2} = 1 \\end{equation*}\n", + " \\begin{align*} a' = a-(a\\W B) B = & - \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} \\\\ & - \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{align*} \n", + "\\begin{equation*} A+ = a'+a' B = - 2 \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} \\end{equation*}\n", + "\\begin{equation*} A- = a'-a' B = - 2 \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{equation*}\n", + "\\begin{equation*} (A+)^{2} = 0 \\end{equation*}\n", + "\\begin{equation*} (A-)^{2} = 0 \\end{equation*}\n", + " \\begin{align*} a\\cdot B = & - \\left ( P_{2}\\cdot a\\right ) \\boldsymbol{P}_{1} \\\\ & + \\left ( P_{1}\\cdot a\\right ) \\boldsymbol{P}_{2} \\end{align*} \n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def reciprocal_frame_test():\n", + " Print_Function()\n", + " metric = '1 # #,'+ \\\n", + " '# 1 #,'+ \\\n", + " '# # 1'\n", + " (e1,e2,e3) = MV.setup('e1 e2 e3',metric)\n", + " print('g_{ij} =',MV.metric)\n", + " E = e1^e2^e3\n", + " Esq = (E*E).scalar()\n", + " print('E =',E)\n", + " print('%E^{2} =',Esq)\n", + " Esq_inv = 1/Esq\n", + " E1 = (e2^e3)*E\n", + " E2 = (-1)*(e1^e3)*E\n", + " E3 = (e1^e2)*E\n", + " print('E1 = (e2^e3)*E =',E1)\n", + " print('E2 =-(e1^e3)*E =',E2)\n", + " print('E3 = (e1^e2)*E =',E3)\n", + " w = (E1|e2)\n", + " w = w.expand()\n", + " print('E1|e2 =',w)\n", + " w = (E1|e3)\n", + " w = w.expand()\n", + " print('E1|e3 =',w)\n", + " w = (E2|e1)\n", + " w = w.expand()\n", + " print('E2|e1 =',w)\n", + " w = (E2|e3)\n", + " w = w.expand()\n", + " print('E2|e3 =',w)\n", + " w = (E3|e1)\n", + " w = w.expand()\n", + " print('E3|e1 =',w)\n", + " w = (E3|e2)\n", + " w = w.expand()\n", + " print('E3|e2 =',w)\n", + " w = (E1|e1)\n", + " w = (w.expand()).scalar()\n", + " Esq = expand(Esq)\n", + " print('%(E1\\\\cdot e1)/E^{2} =',simplify(w/Esq))\n", + " w = (E2|e2)\n", + " w = (w.expand()).scalar()\n", + " print('%(E2\\\\cdot e2)/E^{2} =',simplify(w/Esq))\n", + " w = (E3|e3)\n", + " w = (w.expand()).scalar()\n", + " print('%(E3\\\\cdot e3)/E^{2} =',simplify(w/Esq))\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} 1 & \\left ( e_{1}\\cdot e_{2}\\right ) & \\left ( e_{1}\\cdot e_{3}\\right ) \\\\ \\left ( e_{1}\\cdot e_{2}\\right ) & 1 & \\left ( e_{2}\\cdot e_{3}\\right ) \\\\ \\left ( e_{1}\\cdot e_{3}\\right ) & \\left ( e_{2}\\cdot e_{3}\\right ) & 1 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} E = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} E^{2} = \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 2 \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} + \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1 \\end{equation*}\n", + " \\begin{align*} E1 = (e2\\W e3) E = & \\left ( \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + " \\begin{align*} E2 =-(e1\\W e3) E = & \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + " \\begin{align*} E3 = (e1\\W e2) E = & \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + "\\begin{equation*} E1\\cdot e2 = 0 \\end{equation*}\n", + "\\begin{equation*} E1\\cdot e3 = 0 \\end{equation*}\n", + "\\begin{equation*} E2\\cdot e1 = 0 \\end{equation*}\n", + "\\begin{equation*} E2\\cdot e3 = 0 \\end{equation*}\n", + "\\begin{equation*} E3\\cdot e1 = 0 \\end{equation*}\n", + "\\begin{equation*} E3\\cdot e2 = 0 \\end{equation*}\n", + "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat latex_check.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "!python matrix_latex.py" + "check_latex('latex_check')" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\left [ \\begin{array}{cc} 1 & 2 \\\\ 3 & 4 \\end{array}\\right ] \\left [ \\begin{array}{c} 5 \\\\ 6 \\end{array}\\right ] = \\left [ \\begin{array}{c} 17 \\\\ 39 \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} \\left [ \\begin{array}{cc} x^{3} & y^{3} \\end{array}\\right ] \\left [ \\begin{array}{cc} x^{2} & 2 x y \\\\ 2 x y & y^{2} \\end{array}\\right ] = \\left [ \\begin{array}{cc} x^{5} + 2 x y^{4} & 2 x^{4} y + y^{5} \\end{array}\\right ] \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\left [ \\begin{array}{cc} 1 & 2 \\\\ 3 & 4 \\end{array}\\right ] \\left [ \\begin{array}{c} 5 \\\\ 6 \\end{array}\\right ] = \\left [ \\begin{array}{c} 17 \\\\ 39 \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} \\left [ \\begin{array}{cc} x^{3} & y^{3} \\end{array}\\right ] \\left [ \\begin{array}{cc} x^{2} & 2 x y \\\\ 2 x y & y^{2} \\end{array}\\right ] = \\left [ \\begin{array}{cc} x^{5} + 2 x y^{4} & 2 x^{4} y + y^{5} \\end{array}\\right ] \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat matrix_latex.tex" + "check_latex('matrix_latex')" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "v__1\u001b[0m*\u001b[0;34me_1\u001b[0m + v__2\u001b[0m*\u001b[0;34me_2\u001b[0m + v__3\u001b[0m*\u001b[0;34me_3\u001b[0m\r\n", - "v__1\u001b[0m*\u001b[0;34me_1\u001b[0m + v__2\u001b[0m*\u001b[0;34me_2\u001b[0m + v__3\u001b[0m*\u001b[0;34me_3\u001b[0m\r\n", - "v__x\u001b[0m*\u001b[0;34me_x\u001b[0m + v__y\u001b[0m*\u001b[0;34me_y\u001b[0m + v__z\u001b[0m*\u001b[0;34me_z\u001b[0m\r\n", - "v__x*\u001b[0;34me_x\u001b[0m + v__y*\u001b[0;34me_y\u001b[0m + v__z*\u001b[0;34me_z\u001b[0m\r\n" + "v__1\u001b[0m*\u001b[0;34me_1\u001b[0m + v__2\u001b[0m*\u001b[0;34me_2\u001b[0m + v__3\u001b[0m*\u001b[0;34me_3\u001b[0m\n", + "v__1\u001b[0m*\u001b[0;34me_1\u001b[0m + v__2\u001b[0m*\u001b[0;34me_2\u001b[0m + v__3\u001b[0m*\u001b[0;34me_3\u001b[0m\n", + "v__x\u001b[0m*\u001b[0;34me_x\u001b[0m + v__y\u001b[0m*\u001b[0;34me_y\u001b[0m + v__z\u001b[0m*\u001b[0;34me_z\u001b[0m\n", + "v__x*\u001b[0;34me_x\u001b[0m + v__y*\u001b[0;34me_y\u001b[0m + v__z*\u001b[0;34me_z\u001b[0m\n" ] } ], @@ -617,308 +623,288 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "metadata": {}, - "outputs": [], - "source": [ - "!python physics_check_latex.py" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def Maxwells_Equations_in_Geometric_Calculus():\r\n", - " Print_Function()\r\n", - " X = symbols('t x y z')\r\n", - " (g0,g1,g2,g3,grad) = MV.setup('gamma*t|x|y|z',metric='[1,-1,-1,-1]',coords=X)\r\n", - " I = MV.I\r\n", - " B = MV('B','vector',fct=True)\r\n", - " E = MV('E','vector',fct=True)\r\n", - " B.set_coef(1,0,0)\r\n", - " E.set_coef(1,0,0)\r\n", - " B *= g0\r\n", - " E *= g0\r\n", - " J = MV('J','vector',fct=True)\r\n", - " F = E+I*B\r\n", - " print(r'\\text{Pseudo Scalar\\;\\;}I =',I)\r\n", - " print('\\\\text{Magnetic Field Bi-Vector\\\\;\\\\;} B = \\\\bm{B\\\\gamma_{t}} =',B)\r\n", - " print('\\\\text{Electric Field Bi-Vector\\\\;\\\\;} E = \\\\bm{E\\\\gamma_{t}} =',E)\r\n", - " print('\\\\text{Electromagnetic Field Bi-Vector\\\\;\\\\;} F = E+IB =',F)\r\n", - " print('%\\\\text{Four Current Density\\\\;\\\\;} J =',J)\r\n", - " gradF = grad*F\r\n", - " print('#Geometric Derivative of Electomagnetic Field Bi-Vector')\r\n", - " gradF.Fmt(3,'grad*F')\r\n", - " print('#Maxwell Equations')\r\n", - " print('grad*F = J')\r\n", - " print('#Div $E$ and Curl $H$ Equations')\r\n", - " (gradF.grade(1)-J).Fmt(3,'%\\\\grade{\\\\nabla F}_{1} -J = 0')\r\n", - " print('#Curl $E$ and Div $B$ equations')\r\n", - " (gradF.grade(3)).Fmt(3,'%\\\\grade{\\\\nabla F}_{3} = 0')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} \\text{Pseudo Scalar\\;\\;}I = \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\text{Magnetic Field Bi-Vector\\;\\;} B = \\bm{B\\gamma_{t}} = - B^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - B^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - B^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\text{Electric Field Bi-Vector\\;\\;} E = \\bm{E\\gamma_{t}} = - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\text{Electromagnetic Field Bi-Vector\\;\\;} F = E+IB = - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} - B^{z} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} + B^{y} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} - B^{x} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\text{Four Current Density\\;\\;} J = J^{t} \\boldsymbol{\\gamma }_{t} + J^{x} \\boldsymbol{\\gamma }_{x} + J^{y} \\boldsymbol{\\gamma }_{y} + J^{z} \\boldsymbol{\\gamma }_{z} \\end{equation*}\r\n", - "Geometric Derivative of Electomagnetic Field Bi-Vector\r\n", - "Maxwell Equations\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} F = J \\end{equation*}\r\n", - "Div $E$ and Curl $H$ Equations\r\n", - "Curl $E$ and Div $B$ equations\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def Dirac_Equation_in_Geometric_Calculus():\r\n", - " Print_Function()\r\n", - " vars = symbols('t x y z')\r\n", - " (g0,g1,g2,g3,grad) = MV.setup('gamma*t|x|y|z',metric='[1,-1,-1,-1]',coords=vars)\r\n", - " I = MV.I\r\n", - " (m,e) = symbols('m e')\r\n", - " psi = MV('psi','spinor',fct=True)\r\n", - " A = MV('A','vector',fct=True)\r\n", - " sig_z = g3*g0\r\n", - " print('\\\\text{4-Vector Potential\\\\;\\\\;}\\\\bm{A} =',A)\r\n", - " print('\\\\text{8-component real spinor\\\\;\\\\;}\\\\bm{\\\\psi} =',psi)\r\n", - " dirac_eq = (grad*psi)*I*sig_z-e*A*psi-m*psi*g0\r\n", - " dirac_eq.simplify()\r\n", - " dirac_eq.Fmt(3,r'%\\text{Dirac Equation\\;\\;}\\nabla \\bm{\\psi} I \\sigma_{z}-e\\bm{A}\\bm{\\psi}-m\\bm{\\psi}\\gamma_{t} = 0')\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - " \\begin{align*} \\text{4-Vector Potential\\;\\;}\\bm{A} = & A^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + A^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + A^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + A^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} \\text{8-component real spinor\\;\\;}\\bm{\\psi} = & \\psi \\\\ & + \\psi ^{tx} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & + \\psi ^{ty} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{tz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{xy} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{xz} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{yz} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{txyz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def Lorentz_Tranformation_in_Geometric_Algebra():\r\n", - " Print_Function()\r\n", - " (alpha,beta,gamma) = symbols('alpha beta gamma')\r\n", - " (x,t,xp,tp) = symbols(\"x t x' t'\")\r\n", - " (g0,g1) = MV.setup('gamma*t|x',metric='[1,-1]')\r\n", - " from sympy import sinh,cosh\r\n", - " R = cosh(alpha/2)+sinh(alpha/2)*(g0^g1)\r\n", - " X = t*g0+x*g1\r\n", - " Xp = tp*g0+xp*g1\r\n", - " print('R =',R)\r\n", - " print(r\"#%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger}\")\r\n", - " Xpp = R*Xp*R.rev()\r\n", - " Xpp = Xpp.collect()\r\n", - " Xpp = Xpp.subs({2*sinh(alpha/2)*cosh(alpha/2):sinh(alpha),sinh(alpha/2)**2+cosh(alpha/2)**2:cosh(alpha)})\r\n", - " print(r\"%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} =\",Xpp)\r\n", - " Xpp = Xpp.subs({sinh(alpha):gamma*beta,cosh(alpha):gamma})\r\n", - " print(r'%\\f{\\sinh}{\\alpha} = \\gamma\\beta')\r\n", - " print(r'%\\f{\\cosh}{\\alpha} = \\gamma')\r\n", - " print(r\"%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} =\",Xpp.collect())\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - " \\begin{align*} R = & \\cosh{\\left (\\frac{\\alpha }{2} \\right )} \\\\ & + \\sinh{\\left (\\frac{\\alpha }{2} \\right )} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger} \\end{equation*}\r\n", - " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t' - x' \\sinh{\\left (\\alpha \\right )}\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - t' \\sinh{\\left (\\alpha \\right )} + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - "\\begin{equation*} \\f{\\sinh}{\\alpha} = \\gamma\\beta \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\cosh}{\\alpha} = \\gamma \\end{equation*}\r\n", - " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( - \\beta \\gamma x' + 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t'\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - \\beta \\gamma t' + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - "\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def Maxwells_Equations_in_Geometric_Calculus():\n", + " Print_Function()\n", + " X = symbols('t x y z')\n", + " (g0,g1,g2,g3,grad) = MV.setup('gamma*t|x|y|z',metric='[1,-1,-1,-1]',coords=X)\n", + " I = MV.I\n", + " B = MV('B','vector',fct=True)\n", + " E = MV('E','vector',fct=True)\n", + " B.set_coef(1,0,0)\n", + " E.set_coef(1,0,0)\n", + " B *= g0\n", + " E *= g0\n", + " J = MV('J','vector',fct=True)\n", + " F = E+I*B\n", + " print(r'\\text{Pseudo Scalar\\;\\;}I =',I)\n", + " print('\\\\text{Magnetic Field Bi-Vector\\\\;\\\\;} B = \\\\bm{B\\\\gamma_{t}} =',B)\n", + " print('\\\\text{Electric Field Bi-Vector\\\\;\\\\;} E = \\\\bm{E\\\\gamma_{t}} =',E)\n", + " print('\\\\text{Electromagnetic Field Bi-Vector\\\\;\\\\;} F = E+IB =',F)\n", + " print('%\\\\text{Four Current Density\\\\;\\\\;} J =',J)\n", + " gradF = grad*F\n", + " print('#Geometric Derivative of Electomagnetic Field Bi-Vector')\n", + " gradF.Fmt(3,'grad*F')\n", + " print('#Maxwell Equations')\n", + " print('grad*F = J')\n", + " print('#Div $E$ and Curl $H$ Equations')\n", + " (gradF.grade(1)-J).Fmt(3,'%\\\\grade{\\\\nabla F}_{1} -J = 0')\n", + " print('#Curl $E$ and Div $B$ equations')\n", + " (gradF.grade(3)).Fmt(3,'%\\\\grade{\\\\nabla F}_{3} = 0')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} \\text{Pseudo Scalar\\;\\;}I = \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "\\begin{equation*} \\text{Magnetic Field Bi-Vector\\;\\;} B = \\bm{B\\gamma_{t}} = - B^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - B^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - B^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "\\begin{equation*} \\text{Electric Field Bi-Vector\\;\\;} E = \\bm{E\\gamma_{t}} = - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "\\begin{equation*} \\text{Electromagnetic Field Bi-Vector\\;\\;} F = E+IB = - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} - B^{z} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} + B^{y} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} - B^{x} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "\\begin{equation*} \\text{Four Current Density\\;\\;} J = J^{t} \\boldsymbol{\\gamma }_{t} + J^{x} \\boldsymbol{\\gamma }_{x} + J^{y} \\boldsymbol{\\gamma }_{y} + J^{z} \\boldsymbol{\\gamma }_{z} \\end{equation*}\n", + "Geometric Derivative of Electomagnetic Field Bi-Vector\n", + "Maxwell Equations\n", + "\\begin{equation*} \\boldsymbol{\\nabla} F = J \\end{equation*}\n", + "Div $E$ and Curl $H$ Equations\n", + "Curl $E$ and Div $B$ equations\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def Dirac_Equation_in_Geometric_Calculus():\n", + " Print_Function()\n", + " vars = symbols('t x y z')\n", + " (g0,g1,g2,g3,grad) = MV.setup('gamma*t|x|y|z',metric='[1,-1,-1,-1]',coords=vars)\n", + " I = MV.I\n", + " (m,e) = symbols('m e')\n", + " psi = MV('psi','spinor',fct=True)\n", + " A = MV('A','vector',fct=True)\n", + " sig_z = g3*g0\n", + " print('\\\\text{4-Vector Potential\\\\;\\\\;}\\\\bm{A} =',A)\n", + " print('\\\\text{8-component real spinor\\\\;\\\\;}\\\\bm{\\\\psi} =',psi)\n", + " dirac_eq = (grad*psi)*I*sig_z-e*A*psi-m*psi*g0\n", + " dirac_eq.simplify()\n", + " dirac_eq.Fmt(3,r'%\\text{Dirac Equation\\;\\;}\\nabla \\bm{\\psi} I \\sigma_{z}-e\\bm{A}\\bm{\\psi}-m\\bm{\\psi}\\gamma_{t} = 0')\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + " \\begin{align*} \\text{4-Vector Potential\\;\\;}\\bm{A} = & A^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + A^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + A^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + A^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} \\text{8-component real spinor\\;\\;}\\bm{\\psi} = & \\psi \\\\ & + \\psi ^{tx} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & + \\psi ^{ty} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{tz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{xy} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{xz} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{yz} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{txyz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def Lorentz_Tranformation_in_Geometric_Algebra():\n", + " Print_Function()\n", + " (alpha,beta,gamma) = symbols('alpha beta gamma')\n", + " (x,t,xp,tp) = symbols(\"x t x' t'\")\n", + " (g0,g1) = MV.setup('gamma*t|x',metric='[1,-1]')\n", + " from sympy import sinh,cosh\n", + " R = cosh(alpha/2)+sinh(alpha/2)*(g0^g1)\n", + " X = t*g0+x*g1\n", + " Xp = tp*g0+xp*g1\n", + " print('R =',R)\n", + " print(r\"#%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger}\")\n", + " Xpp = R*Xp*R.rev()\n", + " Xpp = Xpp.collect()\n", + " Xpp = Xpp.subs({2*sinh(alpha/2)*cosh(alpha/2):sinh(alpha),sinh(alpha/2)**2+cosh(alpha/2)**2:cosh(alpha)})\n", + " print(r\"%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} =\",Xpp)\n", + " Xpp = Xpp.subs({sinh(alpha):gamma*beta,cosh(alpha):gamma})\n", + " print(r'%\\f{\\sinh}{\\alpha} = \\gamma\\beta')\n", + " print(r'%\\f{\\cosh}{\\alpha} = \\gamma')\n", + " print(r\"%t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} =\",Xpp.collect())\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + " \\begin{align*} R = & \\cosh{\\left (\\frac{\\alpha }{2} \\right )} \\\\ & + \\sinh{\\left (\\frac{\\alpha }{2} \\right )} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger} \\end{equation*}\n", + " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t' - x' \\sinh{\\left (\\alpha \\right )}\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - t' \\sinh{\\left (\\alpha \\right )} + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + "\\begin{equation*} \\f{\\sinh}{\\alpha} = \\gamma\\beta \\end{equation*}\n", + "\\begin{equation*} \\f{\\cosh}{\\alpha} = \\gamma \\end{equation*}\n", + " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( - \\beta \\gamma x' + 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t'\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - \\beta \\gamma t' + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + "\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat physics_check_latex.tex" + "check_latex('physics_check_latex')" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 9, "metadata": {}, - "outputs": [], - "source": [ - "!python print_check_latex.py" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false, - "scrolled": false - }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} \\bm{A} = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} \\bm{A} = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} \\bm{A} = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} \\bm{A} = & A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} \\bm{B} = & B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} \\boldsymbol{\\nabla} f = & \\partial_{x} f \\boldsymbol{e}_{x} \\\\ & + \\partial_{y} f \\boldsymbol{e}_{y} \\\\ & + \\partial_{z} f \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot \\bm{A} = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} \\bm{A} = & \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} -I (\\boldsymbol{\\nabla} \\W \\bm{A}) = & \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{z} A^{x} - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} \\boldsymbol{\\nabla} \\bm{B} = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\\\ & + \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W \\bm{B} = \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} \\boldsymbol{\\nabla} \\cdot \\bm{B} = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cccc} \\left ( a\\cdot a\\right ) & \\left ( a\\cdot b\\right ) & \\left ( a\\cdot c\\right ) & \\left ( a\\cdot d\\right ) \\\\ \\left ( a\\cdot b\\right ) & \\left ( b\\cdot b\\right ) & \\left ( b\\cdot c\\right ) & \\left ( b\\cdot d\\right ) \\\\ \\left ( a\\cdot c\\right ) & \\left ( b\\cdot c\\right ) & \\left ( c\\cdot c\\right ) & \\left ( c\\cdot d\\right ) \\\\ \\left ( a\\cdot d\\right ) & \\left ( b\\cdot d\\right ) & \\left ( c\\cdot d\\right ) & \\left ( d\\cdot d\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - " \\begin{align*} \\bm{a\\cdot (b c)} = & - \\left ( a\\cdot c\\right ) \\boldsymbol{b} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{align*} \r\n", - " \\begin{align*} \\bm{a\\cdot (b\\W c)} = & - \\left ( a\\cdot c\\right ) \\boldsymbol{b} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{align*} \r\n", - " \\begin{align*} \\bm{a\\cdot (b\\W c\\W d)} = & \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} \\\\ & - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{align*} \r\n", - "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} = 0 \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\r\n", - "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\r\n", - "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\r\n", - " \\begin{align*} \\bm{(a\\W b)\\times (c\\W d)} = & - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c} \\\\ & + \\left ( b\\cdot c\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{d} \\\\ & + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} \\\\ & - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{align*} \r\n", - "\\begin{equation*} E = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\r\n", - "\\begin{equation*} E^{2} = \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 2 \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} + \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1 \\end{equation*}\r\n", - " \\begin{align*} E1 = (e2\\W e3) E = & \\left ( \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - " \\begin{align*} E2 =-(e1\\W e3) E = & \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - " \\begin{align*} E3 = (e1\\W e2) E = & \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{align*} \r\n", - "\\begin{equation*} E1\\cdot e2 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E1\\cdot e3 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E2\\cdot e1 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E2\\cdot e3 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E3\\cdot e1 = 0 \\end{equation*}\r\n", - "\\begin{equation*} E3\\cdot e2 = 0 \\end{equation*}\r\n", - "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\r\n", - "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\r\n", - " \\begin{align*} A = & A^{r} \\boldsymbol{e}_{r} \\\\ & + A^{\\theta } \\boldsymbol{e}_{\\theta } \\\\ & + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - " \\begin{align*} B = & B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } \\\\ & + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } \\\\ & + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - " \\begin{align*} \\boldsymbol{\\nabla} f = & \\partial_{r} f \\boldsymbol{e}_{r} \\\\ & + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } \\\\ & + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } A^{\\phi } + \\partial_{r} A^{r} + \\partial_{\\theta } A^{\\theta } + \\frac{2 A^{r} }{r} \\end{equation*}\r\n", - " \\begin{align*} -I (\\boldsymbol{\\nabla} \\W A) = & \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} \\\\ & + \\frac{- r^{2} {\\sin{\\left (\\theta \\right )}}^{2} \\partial_{r} A^{\\phi } - 2 r A^{\\phi } {\\sin{\\left (\\theta \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } \\\\ & + \\frac{r^{2} \\partial_{r} A^{\\theta } + 2 r A^{\\theta } - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi } + 4 r B^{\\theta \\phi } - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - " \\begin{align*} B = \\bm{B\\gamma_{t}} = & - B^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - B^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - B^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} E = \\bm{E\\gamma_{t}} = & - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} F = E+IB = & - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{z} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + B^{y} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{x} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} J = & J^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + J^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + J^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + J^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} F = J \\end{equation*}\r\n", - " \\begin{align*} R = & \\cosh{\\left (\\frac{\\alpha }{2} \\right )} \\\\ & + \\sinh{\\left (\\frac{\\alpha }{2} \\right )} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger} \\end{equation*}\r\n", - " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t' - x' \\sinh{\\left (\\alpha \\right )}\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - t' \\sinh{\\left (\\alpha \\right )} + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - "\\begin{equation*} \\f{\\sinh}{\\alpha} = \\gamma\\beta \\end{equation*}\r\n", - "\\begin{equation*} \\f{\\cosh}{\\alpha} = \\gamma \\end{equation*}\r\n", - " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( - \\beta \\gamma x' + 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t'\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - \\beta \\gamma t' + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \r\n", - " \\begin{align*} \\bm{A} = & A^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + A^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + A^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + A^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - " \\begin{align*} \\bm{\\psi} = & \\psi \\\\ & + \\psi ^{tx} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & + \\psi ^{ty} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{tz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{xy} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{xz} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{yz} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{txyz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \r\n", - "\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} \\bm{A} = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} \\bm{A} = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} \\bm{A} = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} \\bm{A} = & A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} \\bm{B} = & B^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + B^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + B^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} \\boldsymbol{\\nabla} f = & \\partial_{x} f \\boldsymbol{e}_{x} \\\\ & + \\partial_{y} f \\boldsymbol{e}_{y} \\\\ & + \\partial_{z} f \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot \\bm{A} = \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\end{equation*}\n", + " \\begin{align*} \\boldsymbol{\\nabla} \\bm{A} = & \\left ( \\partial_{x} A^{x} + \\partial_{y} A^{y} + \\partial_{z} A^{z} \\right ) \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + \\left ( - \\partial_{z} A^{x} + \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} -I (\\boldsymbol{\\nabla} \\W \\bm{A}) = & \\left ( - \\partial_{z} A^{y} + \\partial_{y} A^{z} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{z} A^{x} - \\partial_{x} A^{z} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( - \\partial_{y} A^{x} + \\partial_{x} A^{y} \\right ) \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} \\boldsymbol{\\nabla} \\bm{B} = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\\\ & + \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W \\bm{B} = \\left ( \\partial_{z} B^{xy} - \\partial_{y} B^{xz} + \\partial_{x} B^{yz} \\right ) \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} \\boldsymbol{\\nabla} \\cdot \\bm{B} = & \\left ( - \\partial_{y} B^{xy} - \\partial_{z} B^{xz} \\right ) \\boldsymbol{e}_{x} \\\\ & + \\left ( \\partial_{x} B^{xy} - \\partial_{z} B^{yz} \\right ) \\boldsymbol{e}_{y} \\\\ & + \\left ( \\partial_{x} B^{xz} + \\partial_{y} B^{yz} \\right ) \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cccc} \\left ( a\\cdot a\\right ) & \\left ( a\\cdot b\\right ) & \\left ( a\\cdot c\\right ) & \\left ( a\\cdot d\\right ) \\\\ \\left ( a\\cdot b\\right ) & \\left ( b\\cdot b\\right ) & \\left ( b\\cdot c\\right ) & \\left ( b\\cdot d\\right ) \\\\ \\left ( a\\cdot c\\right ) & \\left ( b\\cdot c\\right ) & \\left ( c\\cdot c\\right ) & \\left ( c\\cdot d\\right ) \\\\ \\left ( a\\cdot d\\right ) & \\left ( b\\cdot d\\right ) & \\left ( c\\cdot d\\right ) & \\left ( d\\cdot d\\right ) \\end{array}\\right ] \\end{equation*}\n", + " \\begin{align*} \\bm{a\\cdot (b c)} = & - \\left ( a\\cdot c\\right ) \\boldsymbol{b} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{align*} \n", + " \\begin{align*} \\bm{a\\cdot (b\\W c)} = & - \\left ( a\\cdot c\\right ) \\boldsymbol{b} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{align*} \n", + " \\begin{align*} \\bm{a\\cdot (b\\W c\\W d)} = & \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} \\\\ & - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\\\ & + \\left ( a\\cdot b\\right ) \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{align*} \n", + "\\begin{equation*} \\bm{a\\cdot (b\\W c)+c\\cdot (a\\W b)+b\\cdot (c\\W a)} = 0 \\end{equation*}\n", + "\\begin{equation*} \\bm{a (b\\W c)-b (a\\W c)+c (a\\W b)} = 3 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c} \\end{equation*}\n", + "\\begin{equation*} \\bm{a (b\\W c\\W d)-b (a\\W c\\W d)+c (a\\W b\\W d)-d (a\\W b\\W c)} = 4 \\boldsymbol{a}\\wedge \\boldsymbol{b}\\wedge \\boldsymbol{c}\\wedge \\boldsymbol{d} \\end{equation*}\n", + "\\begin{equation*} \\bm{(a\\W b)\\cdot (c\\W d)} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\n", + "\\begin{equation*} \\bm{((a\\W b)\\cdot c)\\cdot d} = - \\left ( a\\cdot c\\right ) \\left ( b\\cdot d\\right ) + \\left ( a\\cdot d\\right ) \\left ( b\\cdot c\\right ) \\end{equation*}\n", + " \\begin{align*} \\bm{(a\\W b)\\times (c\\W d)} = & - \\left ( b\\cdot d\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{c} \\\\ & + \\left ( b\\cdot c\\right ) \\boldsymbol{a}\\wedge \\boldsymbol{d} \\\\ & + \\left ( a\\cdot d\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{c} \\\\ & - \\left ( a\\cdot c\\right ) \\boldsymbol{b}\\wedge \\boldsymbol{d} \\end{align*} \n", + "\\begin{equation*} E = \\boldsymbol{e}_{1}\\wedge \\boldsymbol{e}_{2}\\wedge \\boldsymbol{e}_{3} \\end{equation*}\n", + "\\begin{equation*} E^{2} = \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 2 \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} + \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1 \\end{equation*}\n", + " \\begin{align*} E1 = (e2\\W e3) E = & \\left ( \\left ( e_{2}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + " \\begin{align*} E2 =-(e1\\W e3) E = & \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) - \\left ( e_{1}\\cdot e_{3}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{3}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + " \\begin{align*} E3 = (e1\\W e2) E = & \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{2}\\cdot e_{3}\\right ) + \\left ( e_{1}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{1} \\\\ & + \\left ( - \\left ( e_{1}\\cdot e_{2}\\right ) \\left ( e_{1}\\cdot e_{3}\\right ) + \\left ( e_{2}\\cdot e_{3}\\right ) \\right ) \\boldsymbol{e}_{2} \\\\ & + \\left ( \\left ( e_{1}\\cdot e_{2}\\right ) ^{2} - 1\\right ) \\boldsymbol{e}_{3} \\end{align*} \n", + "\\begin{equation*} E1\\cdot e2 = 0 \\end{equation*}\n", + "\\begin{equation*} E1\\cdot e3 = 0 \\end{equation*}\n", + "\\begin{equation*} E2\\cdot e1 = 0 \\end{equation*}\n", + "\\begin{equation*} E2\\cdot e3 = 0 \\end{equation*}\n", + "\\begin{equation*} E3\\cdot e1 = 0 \\end{equation*}\n", + "\\begin{equation*} E3\\cdot e2 = 0 \\end{equation*}\n", + "\\begin{equation*} (E1\\cdot e1)/E^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} (E2\\cdot e2)/E^{2} = 1 \\end{equation*}\n", + "\\begin{equation*} (E3\\cdot e3)/E^{2} = 1 \\end{equation*}\n", + " \\begin{align*} A = & A^{r} \\boldsymbol{e}_{r} \\\\ & + A^{\\theta } \\boldsymbol{e}_{\\theta } \\\\ & + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{align*} \n", + " \\begin{align*} B = & B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } \\\\ & + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } \\\\ & + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{align*} \n", + " \\begin{align*} \\boldsymbol{\\nabla} f = & \\partial_{r} f \\boldsymbol{e}_{r} \\\\ & + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } \\\\ & + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } A^{\\phi } + \\partial_{r} A^{r} + \\partial_{\\theta } A^{\\theta } + \\frac{2 A^{r} }{r} \\end{equation*}\n", + " \\begin{align*} -I (\\boldsymbol{\\nabla} \\W A) = & \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} \\\\ & + \\frac{- r^{2} {\\sin{\\left (\\theta \\right )}}^{2} \\partial_{r} A^{\\phi } - 2 r A^{\\phi } {\\sin{\\left (\\theta \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } \\\\ & + \\frac{r^{2} \\partial_{r} A^{\\theta } + 2 r A^{\\theta } - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi } + 4 r B^{\\theta \\phi } - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + " \\begin{align*} B = \\bm{B\\gamma_{t}} = & - B^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - B^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - B^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} E = \\bm{E\\gamma_{t}} = & - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} F = E+IB = & - E^{x} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & - E^{y} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & - E^{z} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{z} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + B^{y} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & - B^{x} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} J = & J^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + J^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + J^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + J^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + "\\begin{equation*} \\boldsymbol{\\nabla} F = J \\end{equation*}\n", + " \\begin{align*} R = & \\cosh{\\left (\\frac{\\alpha }{2} \\right )} \\\\ & + \\sinh{\\left (\\frac{\\alpha }{2} \\right )} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + "\\begin{equation*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = t'\\bm{\\gamma'_{t}}+x'\\bm{\\gamma'_{x}} = R\\lp t'\\bm{\\gamma_{t}}+x'\\bm{\\gamma_{x}}\\rp R^{\\dagger} \\end{equation*}\n", + " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t' - x' \\sinh{\\left (\\alpha \\right )}\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - t' \\sinh{\\left (\\alpha \\right )} + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + "\\begin{equation*} \\f{\\sinh}{\\alpha} = \\gamma\\beta \\end{equation*}\n", + "\\begin{equation*} \\f{\\cosh}{\\alpha} = \\gamma \\end{equation*}\n", + " \\begin{align*} t\\bm{\\gamma_{t}}+x\\bm{\\gamma_{x}} = & \\left ( - \\beta \\gamma x' + 2 t' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + t'\\right ) \\boldsymbol{\\gamma }_{t} \\\\ & + \\left ( - \\beta \\gamma t' + 2 x' {\\sinh{\\left (\\frac{\\alpha }{2} \\right )}}^{2} + x'\\right ) \\boldsymbol{\\gamma }_{x} \\end{align*} \n", + " \\begin{align*} \\bm{A} = & A^{t} \\boldsymbol{\\gamma }_{t} \\\\ & + A^{x} \\boldsymbol{\\gamma }_{x} \\\\ & + A^{y} \\boldsymbol{\\gamma }_{y} \\\\ & + A^{z} \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + " \\begin{align*} \\bm{\\psi} = & \\psi \\\\ & + \\psi ^{tx} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x} \\\\ & + \\psi ^{ty} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{tz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{xy} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y} \\\\ & + \\psi ^{xz} \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{yz} \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\\\ & + \\psi ^{txyz} \\boldsymbol{\\gamma }_{t}\\wedge \\boldsymbol{\\gamma }_{x}\\wedge \\boldsymbol{\\gamma }_{y}\\wedge \\boldsymbol{\\gamma }_{z} \\end{align*} \n", + "\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat print_check_latex.tex" + "check_latex('print_check_latex')" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -944,9 +930,8 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 11, "metadata": { - "collapsed": false, "scrolled": false }, "outputs": [ @@ -1133,179 +1118,165 @@ }, { "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [], - "source": [ - "!python reflect_test.py" - ] - }, - { - "cell_type": "code", - "execution_count": 17, + "execution_count": 12, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} a = a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b = \\boldsymbol{e}_{x} + \\boldsymbol{e}_{y} + \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} c = c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} + c^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} a\\mbox{ reflect in }xy = a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} a\\mbox{ reflect in }yz = - a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} a\\mbox{ reflect in }zx = a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} a\\mbox{ reflect in plane }(x=y) = a^{y} \\boldsymbol{e}_{x} + a^{x} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} b\\mbox{ reflect in plane }(x+y+z=0) = - \\boldsymbol{e}_{x} - \\boldsymbol{e}_{y} - \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{x} = a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{y} = - a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{z} = - a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} c\\mbox{ reflect in }xy = - c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} - c^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} c\\mbox{ reflect in }xyz = - c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} + c^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} wx\\mbox{ reflect in }yz = \\boldsymbol{e}_{w}\\wedge \\boldsymbol{e}_{x} \\end{equation*}\r\n", - "\\begin{equation*} wx\\mbox{ reflect in }xy = - \\boldsymbol{e}_{w}\\wedge \\boldsymbol{e}_{x} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} a = a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b = \\boldsymbol{e}_{x} + \\boldsymbol{e}_{y} + \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} c = c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} + c^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} a\\mbox{ reflect in }xy = a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} a\\mbox{ reflect in }yz = - a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} a\\mbox{ reflect in }zx = a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} a\\mbox{ reflect in plane }(x=y) = a^{y} \\boldsymbol{e}_{x} + a^{x} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} b\\mbox{ reflect in plane }(x+y+z=0) = - \\boldsymbol{e}_{x} - \\boldsymbol{e}_{y} - \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{x} = a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{y} = - a^{x} \\boldsymbol{e}_{x} + a^{y} \\boldsymbol{e}_{y} - a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} \\mbox{Reflect in }\\bm{e}_{z} = - a^{x} \\boldsymbol{e}_{x} - a^{y} \\boldsymbol{e}_{y} + a^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} c\\mbox{ reflect in }xy = - c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} - c^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} c\\mbox{ reflect in }xyz = - c^{w} \\boldsymbol{e}_{w} + c^{x} \\boldsymbol{e}_{x} + c^{y} \\boldsymbol{e}_{y} + c^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} wx\\mbox{ reflect in }yz = \\boldsymbol{e}_{w}\\wedge \\boldsymbol{e}_{x} \\end{equation*}\n", + "\\begin{equation*} wx\\mbox{ reflect in }xy = - \\boldsymbol{e}_{w}\\wedge \\boldsymbol{e}_{x} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat reflect_test.tex" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [], - "source": [ - "!python simple_check_latex.py" + "check_latex('reflect_test')" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 13, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{x}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{z}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) & \\left ( e_{z}\\cdot e_{z}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} A = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\r\n", - " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\r\n", - "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) \\end{array}\\right ] \\end{equation*}\r\n", - "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{ccc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{x}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) \\\\ \\left ( e_{x}\\cdot e_{z}\\right ) & \\left ( e_{y}\\cdot e_{z}\\right ) & \\left ( e_{z}\\cdot e_{z}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} A = A + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{equation*}\n", + " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} + A^{y} \\boldsymbol{e}_{y} + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + " \\begin{align*} A = & A \\\\ & + A^{x} \\boldsymbol{e}_{x} \\\\ & + A^{y} \\boldsymbol{e}_{y} \\\\ & + A^{z} \\boldsymbol{e}_{z} \\\\ & + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\\\ & + A^{xz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{yz} \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\\\ & + A^{xyz} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y}\\wedge \\boldsymbol{e}_{z} \\end{align*} \n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} + X^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} Y = Y^{x} \\boldsymbol{e}_{x} + Y^{y} \\boldsymbol{e}_{y} + Y^{z} \\boldsymbol{e}_{z} \\end{equation*}\n", + "\\begin{equation*} g_{ij} = \\left [ \\begin{array}{cc} \\left ( e_{x}\\cdot e_{x}\\right ) & \\left ( e_{x}\\cdot e_{y}\\right ) \\\\ \\left ( e_{x}\\cdot e_{y}\\right ) & \\left ( e_{y}\\cdot e_{y}\\right ) \\end{array}\\right ] \\end{equation*}\n", + "\\begin{equation*} X = X^{x} \\boldsymbol{e}_{x} + X^{y} \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\begin{equation*} A = A + A^{xy} \\boldsymbol{e}_{x}\\wedge \\boldsymbol{e}_{y} \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat simple_check_latex.tex" + "check_latex('simple_check_latex')" ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -1329,109 +1300,101 @@ }, { "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [], - "source": [ - "!python spherical_latex.py" - ] - }, - { - "cell_type": "code", - "execution_count": 22, + "execution_count": 15, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\r\n", - "\\documentclass[10pt,fleqn]{report}\r\n", - "\\usepackage[vcentering]{geometry}\r\n", - "\\geometry{papersize={14in,11in},total={13in,10in}}\r\n", - "\r\n", - "\\pagestyle{empty}\r\n", - "\\usepackage[latin1]{inputenc}\r\n", - "\\usepackage{amsmath}\r\n", - "\\usepackage{amsfonts}\r\n", - "\\usepackage{amssymb}\r\n", - "\\usepackage{amsbsy}\r\n", - "\\usepackage{tensor}\r\n", - "\\usepackage{listings}\r\n", - "\\usepackage{color}\r\n", - "\\usepackage{xcolor}\r\n", - "\\usepackage{bm}\r\n", - "\\usepackage{breqn}\r\n", - "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\r\n", - "\\setlength{\\parindent}{0pt}\r\n", - "\\DeclareMathOperator{\\Tr}{Tr}\r\n", - "\\DeclareMathOperator{\\Adj}{Adj}\r\n", - "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\r\n", - "\\newcommand{\\lp}{\\left (}\r\n", - "\\newcommand{\\rp}{\\right )}\r\n", - "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\r\n", - "\\newcommand{\\half}{\\frac{1}{2}}\r\n", - "\\newcommand{\\llt}{\\left <}\r\n", - "\\newcommand{\\rgt}{\\right >}\r\n", - "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\r\n", - "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\r\n", - "\\newcommand{\\lbrc}{\\left \\{}\r\n", - "\\newcommand{\\rbrc}{\\right \\}}\r\n", - "\\newcommand{\\W}{\\wedge}\r\n", - "\\newcommand{\\prm}[1]{{#1}'}\r\n", - "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\r\n", - "\\newcommand{\\R}{\\dagger}\r\n", - "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\r\n", - "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\r\n", - "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\r\n", - "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\r\n", - "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\r\n", - "\\newcommand{\\eb}{\\boldsymbol{e}}\r\n", - "\\usepackage{float}\r\n", - "\\floatstyle{plain} % optionally change the style of the new float\r\n", - "\\newfloat{Code}{H}{myc}\r\n", - "\\lstloadlanguages{Python}\r\n", - "\r\n", - "\\begin{document}\r\n", - "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\r\n", - "def derivatives_in_spherical_coordinates():\r\n", - " Print_Function()\r\n", - " X = (r,th,phi) = symbols('r theta phi')\r\n", - " curv = [[r*cos(phi)*sin(th),r*sin(phi)*sin(th),r*cos(th)],[1,r,r*sin(th)]]\r\n", - " (er,eth,ephi,grad) = MV.setup('e_r e_theta e_phi',metric='[1,1,1]',coords=X,curv=curv)\r\n", - " f = MV('f','scalar',fct=True)\r\n", - " A = MV('A','vector',fct=True)\r\n", - " B = MV('B','grade2',fct=True)\r\n", - " print('f =',f)\r\n", - " print('A =',A)\r\n", - " print('B =',B)\r\n", - " print('grad*f =',grad*f)\r\n", - " print('grad|A =',grad|A)\r\n", - " print('-I*(grad^A) =',-MV.I*(grad^A))\r\n", - " print('grad^B =',grad^B)\r\n", - " return\r\n", - "\\end{lstlisting}\r\n", - "Code Output:\r\n", - "\\begin{equation*} f = f \\end{equation*}\r\n", - "\\begin{equation*} A = A^{r} \\boldsymbol{e}_{r} + A^{\\theta } \\boldsymbol{e}_{\\theta } + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} B = B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{r} f \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } A^{\\phi } + \\partial_{r} A^{r} + \\partial_{\\theta } A^{\\theta } + \\frac{2 A^{r} }{r} \\end{equation*}\r\n", - "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta \\right )}}^{2} \\partial_{r} A^{\\phi } - 2 r A^{\\phi } {\\sin{\\left (\\theta \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta } + 2 r A^{\\theta } - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi } + 4 r B^{\\theta \\phi } - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\r\n", - "\\end{document}\r\n" - ] + "data": { + "text/plain": [ + "\n", + "\\documentclass[10pt,fleqn]{report}\n", + "\\usepackage[vcentering]{geometry}\n", + "\\geometry{papersize={14in,11in},total={13in,10in}}\n", + "\n", + "\\pagestyle{empty}\n", + "\\usepackage[latin1]{inputenc}\n", + "\\usepackage{amsmath}\n", + "\\usepackage{amsfonts}\n", + "\\usepackage{amssymb}\n", + "\\usepackage{amsbsy}\n", + "\\usepackage{tensor}\n", + "\\usepackage{listings}\n", + "\\usepackage{color}\n", + "\\usepackage{xcolor}\n", + "\\usepackage{bm}\n", + "\\usepackage{breqn}\n", + "\\definecolor{gray}{rgb}{0.95,0.95,0.95}\n", + "\\setlength{\\parindent}{0pt}\n", + "\\DeclareMathOperator{\\Tr}{Tr}\n", + "\\DeclareMathOperator{\\Adj}{Adj}\n", + "\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}\n", + "\\newcommand{\\lp}{\\left (}\n", + "\\newcommand{\\rp}{\\right )}\n", + "\\newcommand{\\paren}[1]{\\lp {#1} \\rp}\n", + "\\newcommand{\\half}{\\frac{1}{2}}\n", + "\\newcommand{\\llt}{\\left <}\n", + "\\newcommand{\\rgt}{\\right >}\n", + "\\newcommand{\\abs}[1]{\\left |{#1}\\right | }\n", + "\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}\n", + "\\newcommand{\\lbrc}{\\left \\{}\n", + "\\newcommand{\\rbrc}{\\right \\}}\n", + "\\newcommand{\\W}{\\wedge}\n", + "\\newcommand{\\prm}[1]{{#1}'}\n", + "\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}\n", + "\\newcommand{\\R}{\\dagger}\n", + "\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}\n", + "\\newcommand{\\grade}[1]{\\left < {#1} \\right >}\n", + "\\newcommand{\\f}[2]{{#1}\\lp{#2}\\rp}\n", + "\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}\n", + "\\newcommand{\\Nabla}{\\boldsymbol{\\nabla}}\n", + "\\newcommand{\\eb}{\\boldsymbol{e}}\n", + "\\usepackage{float}\n", + "\\floatstyle{plain} % optionally change the style of the new float\n", + "\\newfloat{Code}{H}{myc}\n", + "\\lstloadlanguages{Python}\n", + "\n", + "\\begin{document}\n", + "\\\\begin{lstlisting}[language=Python,showspaces=false,showstringspaces=false,backgroundcolor=\\color{gray},frame=single]\n", + "def derivatives_in_spherical_coordinates():\n", + " Print_Function()\n", + " X = (r,th,phi) = symbols('r theta phi')\n", + " curv = [[r*cos(phi)*sin(th),r*sin(phi)*sin(th),r*cos(th)],[1,r,r*sin(th)]]\n", + " (er,eth,ephi,grad) = MV.setup('e_r e_theta e_phi',metric='[1,1,1]',coords=X,curv=curv)\n", + " f = MV('f','scalar',fct=True)\n", + " A = MV('A','vector',fct=True)\n", + " B = MV('B','grade2',fct=True)\n", + " print('f =',f)\n", + " print('A =',A)\n", + " print('B =',B)\n", + " print('grad*f =',grad*f)\n", + " print('grad|A =',grad|A)\n", + " print('-I*(grad^A) =',-MV.I*(grad^A))\n", + " print('grad^B =',grad^B)\n", + " return\n", + "\\end{lstlisting}\n", + "Code Output:\n", + "\\begin{equation*} f = f \\end{equation*}\n", + "\\begin{equation*} A = A^{r} \\boldsymbol{e}_{r} + A^{\\theta } \\boldsymbol{e}_{\\theta } + A^{\\phi } \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} B = B^{r\\theta } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta } + B^{r\\phi } \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\phi } + B^{\\theta \\phi } \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} f = \\partial_{r} f \\boldsymbol{e}_{r} + \\frac{\\partial_{\\theta } f }{r^{2}} \\boldsymbol{e}_{\\theta } + \\frac{\\partial_{\\phi } f }{r^{2} {\\sin{\\left (\\theta \\right )}}^{2}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\cdot A = \\frac{A^{\\theta } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\phi } A^{\\phi } + \\partial_{r} A^{r} + \\partial_{\\theta } A^{\\theta } + \\frac{2 A^{r} }{r} \\end{equation*}\n", + "\\begin{equation*} -I (\\boldsymbol{\\nabla} \\W A) = \\frac{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}} \\left(\\frac{2 A^{\\phi } }{\\tan{\\left (\\theta \\right )}} + \\partial_{\\theta } A^{\\phi } - \\frac{\\partial_{\\phi } A^{\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}\\right)}{r^{2}} \\boldsymbol{e}_{r} + \\frac{- r^{2} {\\sin{\\left (\\theta \\right )}}^{2} \\partial_{r} A^{\\phi } - 2 r A^{\\phi } {\\sin{\\left (\\theta \\right )}}^{2} + \\partial_{\\phi } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\theta } + \\frac{r^{2} \\partial_{r} A^{\\theta } + 2 r A^{\\theta } - \\partial_{\\theta } A^{r} }{\\sqrt{r^{4} {\\sin{\\left (\\theta \\right )}}^{2}}} \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\begin{equation*} \\boldsymbol{\\nabla} \\W B = \\frac{r^{2} \\partial_{r} B^{\\theta \\phi } + 4 r B^{\\theta \\phi } - \\frac{2 B^{r\\phi } }{\\tan{\\left (\\theta \\right )}} - \\partial_{\\theta } B^{r\\phi } + \\frac{\\partial_{\\phi } B^{r\\theta } }{{\\sin{\\left (\\theta \\right )}}^{2}}}{r^{2}} \\boldsymbol{e}_{r}\\wedge \\boldsymbol{e}_{\\theta }\\wedge \\boldsymbol{e}_{\\phi } \\end{equation*}\n", + "\\end{document}\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "!cat spherical_latex.tex" + "check_latex('spherical_latex')" ] }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 16, "metadata": { - "collapsed": false, "scrolled": false }, "outputs": [ @@ -1587,13 +1550,6 @@ "source": [ "!python terminal_check.py" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -1612,7 +1568,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.1" + "version": "3.5.4" } }, "nbformat": 4, From f5da64fd19f4ae675570f6955135221dd1f5ea5a Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 16:09:38 +0000 Subject: [PATCH 34/62] Replace the broken linear_expand(x, mode=False) (#165) This introduces a new `linear_expand_terms` function with the same meaning as the above The original was incorrect because the early return paths did not respect the mode argument. By using this function through mv.py, we can remove a line or two from a lot of functions --- galgebra/metric.py | 13 ++++++++----- galgebra/mv.py | 45 +++++++++++++++++---------------------------- 2 files changed, 25 insertions(+), 33 deletions(-) diff --git a/galgebra/metric.py b/galgebra/metric.py index f8b5bfde..975f807a 100644 --- a/galgebra/metric.py +++ b/galgebra/metric.py @@ -24,7 +24,7 @@ def apply_function_list(f,x): return f(x) -def linear_expand(expr, mode=True): +def linear_expand(expr): if isinstance(expr, Expr): expr = expand(expr) @@ -58,10 +58,13 @@ def linear_expand(expr, mode=True): else: bases.append(base) coefs.append(coef) - if mode: - return (coefs, bases) - else: - return list(zip(coefs, bases)) + return (coefs, bases) + + +def linear_expand_terms(expr): + coefs, bases = linear_expand(expr) + return zip(coefs, bases) + def collect(A, nc_list): """ diff --git a/galgebra/mv.py b/galgebra/mv.py index 5011536c..e89b3763 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -906,9 +906,8 @@ def collect(self,deep=False): self.obj = self.obj.collect(c) return self """ - coefs, bases = metric.linear_expand(self.obj) obj_dict = {} - for (coef, base) in zip(coefs, bases): + for coef, base in metric.linear_expand_terms(self.obj): if base in list(obj_dict.keys()): obj_dict[base] += coef else: @@ -997,14 +996,12 @@ def get_grade(self, r): return Mv(self.Ga.get_grade(self.obj, r), ga=self.Ga) def components(self): - (coefs, bases) = metric.linear_expand(self.obj) - cb = list(zip(coefs, bases)) + cb = metric.linear_expand_terms(self.obj) cb = sorted(cb, key=lambda x: self.Ga._all_blades_lst.index(x[1])) return [self.Ga.mv(coef * base) for (coef, base) in cb] def get_coefs(self, grade): - (coefs, bases) = metric.linear_expand(self.obj) - cb = list(zip(coefs, bases)) + cb = metric.linear_expand_terms(self.obj) cb = sorted(cb, key=lambda x: self.Ga.blades[grade].index(x[1])) (coefs, bases) = list(zip(*cb)) return coefs @@ -1040,9 +1037,8 @@ def proj(self, bases_lst): part of multivector with the same bases as in the bases_lst. """ bases_lst = [x.obj for x in bases_lst] - (coefs, bases) = metric.linear_expand(self.obj) obj = 0 - for (coef, base) in zip(coefs, bases): + for coef, base in metric.linear_expand_terms(self.obj): if base in bases_lst: obj += coef * base return Mv(obj, ga=self.Ga) @@ -1313,9 +1309,8 @@ def inv(self): raise TypeError('In inv() for self =' + str(self) + 'self, or self*self or self*self.rev() is not a scalar') def func(self, fct): # Apply function, fct, to each coefficient of multivector - (coefs, bases) = metric.linear_expand(self.obj) s = S(0) - for (coef, base) in zip(coefs, bases): + for coef, base in metric.linear_expand_terms(self.obj): s += fct(coef) * base fct_self = Mv(s, ga=self.Ga) fct_self.characterise_Mv() @@ -1325,38 +1320,33 @@ def trigsimp(self): return self.func(trigsimp) def simplify(self, modes=simplify): - (coefs, bases) = metric.linear_expand(self.obj) + if not isinstance(modes, (list, tuple)): + modes = [modes] + obj = S(0) - if isinstance(modes, list) or isinstance(modes, tuple): - for (coef, base) in zip(coefs, bases): - for mode in modes: - coef = mode(coef) - obj += coef * base - else: - for (coef, base) in zip(coefs, bases): - obj += modes(coef) * base + for coef, base in metric.linear_expand_terms(self.obj): + for mode in modes: + coef = mode(coef) + obj += coef * base return Mv(obj, ga=self.Ga) def subs(self, d): # For each scalar coef of the multivector apply substitution argument d - (coefs, bases) = metric.linear_expand(self.obj) obj = sum(( - coef.subs(d) * base for coef, base in zip(coefs, bases) + coef.subs(d) * base for coef, base in metric.linear_expand_terms(self.obj) ), S(0)) return Mv(obj, ga=self.Ga) def expand(self): - coefs, bases = metric.linear_expand(self.obj) obj = sum(( - expand(coef) * base for coef, base in zip(coefs, bases) + expand(coef) * base for coef, base in metric.linear_expand_terms(self.obj) ), S(0)) return Mv(obj, ga=self.Ga) def list(self): - (coefs, bases) = metric.linear_expand(self.obj) indexes = [] key_coefs = [] - for (coef, base) in zip(coefs, bases): + for coef, base in metric.linear_expand_terms(self.obj): if base in self.Ga.basis: index = self.Ga.basis.index(base) key_coefs.append((coef, index)) @@ -2032,7 +2022,7 @@ def blade_rep(self): coefs = N * [[]] bases = N * [0] for term in self.terms: - for (coef, base) in metric.linear_expand(self.terms[0].obj, mode=False): + for coef, base in metric.linear_expand_terms(self.terms[0].obj): index = self.blades.index(base) coefs[index] = coef bases[index] = base @@ -2256,8 +2246,7 @@ def Dop_mv_expand(self, modes=None): for (coef, pdiff) in self.terms: if isinstance(coef, Mv) and not coef.is_scalar(): - mv_terms = metric.linear_expand(coef.obj, mode=False) - for (mv_coef, mv_base) in mv_terms: + for mv_coef, mv_base in metric.linear_expand_terms(coef.obj): if mv_base in bases: index = bases.index(mv_base) coefs[index] += Sdop([(mv_coef, pdiff)], ga=self.Ga) From f55efb532bde6d466904afbbdacad82d4900985d Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 16:10:06 +0000 Subject: [PATCH 35/62] Use a substitution that sympy 1.3.0 understands (#169) The original substitution does not seem to work in sympy 1.3.0, but works in 1.5.0. The modified one is equivalent, but works in both versions. A direct substitution is easier to understand here anyway. Part of the work to migrate to a newer sympy --- examples/LaTeX/latex_check.py | 2 +- examples/Old Format/latex_check.py | 2 +- examples/ipython/LaTeX.ipynb | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/LaTeX/latex_check.py b/examples/LaTeX/latex_check.py index 448cdf0f..34c33ef7 100644 --- a/examples/LaTeX/latex_check.py +++ b/examples/LaTeX/latex_check.py @@ -231,7 +231,7 @@ def noneuclidian_distance_calculation(): W = W.subs(c**2,(C+1)/2) W = W.subs(s**2,(C-1)/2) W = simplify(W) - W = W.subs(1/Binv,Bmag) + W = W.subs(Binv,1/Bmag) W = expand(W) print('#%S = \\f{\\sinh}{\\alpha} \\text{ and } C = \\f{\\cosh}{\\alpha}') diff --git a/examples/Old Format/latex_check.py b/examples/Old Format/latex_check.py index 9fe312e3..3d2ec70b 100644 --- a/examples/Old Format/latex_check.py +++ b/examples/Old Format/latex_check.py @@ -219,7 +219,7 @@ def noneuclidian_distance_calculation(): W = W.subs(c**2,(C+1)/2) W = W.subs(s**2,(C-1)/2) W = simplify(W) - W = W.subs(1/Binv,Bmag) + W = W.subs(Binv,1/Bmag) W = expand(W) print('#%S = \\f{\\sinh}{\\alpha} \\text{ and } C = \\f{\\cosh}{\\alpha}') diff --git a/examples/ipython/LaTeX.ipynb b/examples/ipython/LaTeX.ipynb index 7427cdf1..1411aa61 100644 --- a/examples/ipython/LaTeX.ipynb +++ b/examples/ipython/LaTeX.ipynb @@ -1131,7 +1131,7 @@ " W = W.subs(c**2,(C+1)/2)\n", " W = W.subs(s**2,(C-1)/2)\n", " W = simplify(W)\n", - " W = W.subs(1/Binv,Bmag)\n", + " W = W.subs(Binv,1/Bmag)\n", " W = expand(W)\n", " print('#%S = \\\\f{\\\\sinh}{\\\\alpha} \\\\text{ and } C = \\\\f{\\\\cosh}{\\\\alpha}')\n", " print('W =',W)\n", @@ -1179,9 +1179,9 @@ "\\begin{equation*} e^{\\alpha B/{2\\abs{B}}} = c + (1/B) s \\boldsymbol{X}\\wedge \\boldsymbol{Y} - (1/B) \\left ( Y\\cdot e\\right ) s \\boldsymbol{X}\\wedge \\boldsymbol{e} + (1/B) \\left ( X\\cdot e\\right ) s \\boldsymbol{Y}\\wedge \\boldsymbol{e} \\end{equation*}\n", "\\begin{equation*} W = Z\\cdot Y = (1/B)^{2} \\left ( X\\cdot Y\\right ) ^{3} s^{2} - 4 (1/B)^{2} \\left ( X\\cdot Y\\right ) ^{2} \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) s^{2} + 4 (1/B)^{2} \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) ^{2} \\left ( Y\\cdot e\\right ) ^{2} s^{2} + 2 (1/B) \\left ( X\\cdot Y\\right ) ^{2} c s - 4 (1/B) \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) c s + \\left ( X\\cdot Y\\right ) c^{2} \\end{equation*}\n", "\\begin{equation*} S = \\f{\\sinh}{\\alpha} \\text{ and } C = \\f{\\cosh}{\\alpha} \\end{equation*}\n", - "\\begin{equation*} W = (1/B) \\left ( X\\cdot Y\\right ) C \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } - (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) C \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + S \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", - "\\begin{equation*} \\text{Scalar Coefficient} = (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", - "\\begin{equation*} \\text{Cosh Coefficient} = (1/B) \\left ( X\\cdot Y\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } - (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", + "\\begin{equation*} W = \\left ( X\\cdot Y\\right ) C - \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) C + \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) + S \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", + "\\begin{equation*} \\text{Scalar Coefficient} = \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\end{equation*}\n", + "\\begin{equation*} \\text{Cosh Coefficient} = \\left ( X\\cdot Y\\right ) - \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\end{equation*}\n", "\\begin{equation*} \\text{Sinh Coefficient} = \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", "\\begin{equation*} \\abs{B} = \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n", "\\begin{equation*} \\text{Require } aC^{2}+bC+c = 0 \\end{equation*}\n", From d8e533f51bd28c4e81d9f70a9545b0fbe17cc1f2 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 16:55:46 +0000 Subject: [PATCH 36/62] Use a substitution that sympy 1.3.0 understands (#170) Same as f55efb532bde6d466904afbbdacad82d4900985d, but in another copy of the same code --- examples/Terminal/terminal_check.py | 2 +- examples/ipython/Terminal.ipynb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/Terminal/terminal_check.py b/examples/Terminal/terminal_check.py index f4b360f0..55a051ac 100755 --- a/examples/Terminal/terminal_check.py +++ b/examples/Terminal/terminal_check.py @@ -228,7 +228,7 @@ def noneuclidian_distance_calculation(): W = W.subs(c**2,(C+1)/2) W = W.subs(s**2,(C-1)/2) W = simplify(W) - W = W.subs(1/Binv,Bmag) + W = W.subs(Binv,1/Bmag) W = expand(W) print('S = sinh(alpha) and C = cosh(alpha)') diff --git a/examples/ipython/Terminal.ipynb b/examples/ipython/Terminal.ipynb index 4b727c96..6ae50ca4 100644 --- a/examples/ipython/Terminal.ipynb +++ b/examples/ipython/Terminal.ipynb @@ -146,9 +146,9 @@ "Objective is to determine value of C = cosh(alpha) such that W = 0\n", "Z|Y = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**3*(1/B)**2*s**2 - 4*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*(1/B)**2*s**2 + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2*(1/B)*c*s + 4*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)**2*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)**2*(1/B)**2*s**2 - 4*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*(1/B)*c*s + (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*c**2\n", "S = sinh(alpha) and C = cosh(alpha)\n", - "W = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(1/B)*C*sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)) - (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*(1/B)*C*sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)) + (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*(1/B)*sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)) + S*sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))\n", - "Scalar Coefficient = (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*(1/B)*sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))\n", - "Cosh Coefficient = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(1/B)*sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)) - (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*(1/B)*sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))\n", + "W = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*C - (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*C + (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m) + S*sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))\n", + "Scalar Coefficient = (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)\n", + "Cosh Coefficient = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m) - (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)\n", "Sinh Coefficient = sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))\n", "|B| = sqrt((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))\n", "Require a*C**2+b*C+c = 0\n", From e40c7b0dbabd4380cf84a4e3e80a182bc3b31274 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 00:22:49 +0000 Subject: [PATCH 37/62] Add a sympy 1.5 run for CircleCI (#164) This needs some extra sanitization rules in nbval --- .circleci/config.yml | 12 ++++++++++++ test/.nbval_sanitize.cfg | 26 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index eb4f0e59..da83b7d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,10 @@ defaults: &defaults command: | sudo pip install -r test_requirements.txt sudo pip install -e . + if [ -n "$PIP_EXTRA_INSTALLATION" ]; then + # deliberately not quoted + sudo pip install $PIP_EXTRA_INSTALLATION + fi sudo pip check - run: name: Test @@ -28,6 +32,13 @@ defaults: &defaults path: test-reports jobs: + "python-3.7-sympy-1.5": + <<: *defaults + environment: + PIP_EXTRA_INSTALLATION: sympy==1.5 + docker: + - image: circleci/python:3.7 + "python-3.7": <<: *defaults docker: @@ -53,3 +64,4 @@ workflows: - "python-3.6" - "python-3.5" - "python-2.7" + - "python-3.7-sympy-1.5" diff --git a/test/.nbval_sanitize.cfg b/test/.nbval_sanitize.cfg index 72336bee..177c3bde 100644 --- a/test/.nbval_sanitize.cfg +++ b/test/.nbval_sanitize.cfg @@ -10,3 +10,29 @@ replace: $ regex: \s*\$\s* replace: $ + +[sympy printing changes] +regex: \\left \( +replace: \\left( +regex: \\right \) +replace: \\right) +regex: \\left \[ +replace: \\left[ +regex: \\right \] +replace: \\right] + +# note hacks to avoid trailing spaces which editors may trim +regex: , \\quad( ) +replace: , \ \1 + +# sympy 1.5 seems to reorder a few additions compared to 1.3 +regex: \\begin\{matrix}- \\frac\{\\sqrt\{2}}\{4} \+ \\frac\{1}\{2}\\end\{matrix} +replace: \\begin{matrix}\\frac{1}{2} - \\frac{\\sqrt{2}}{4}\\end{matrix} +regex: =( +)- \\frac\{\\sqrt\{2}}\{4} \+ \\frac\{1}\{2}(?=\$| \\end\{equation\*}) +replace: =\1\\frac{1}{2} - \\frac{\\sqrt{2}}{4} + +regex: \{- \\left\( e_\{E}\\cdot e_\{B}\\right\) \^\{2} \+ 1\} +replace: {1 - \\left( e_{E}\\cdot e_{B}\\right) ^{2}} + +regex: eu\.ev_r = -1/2 \+ 1/2(?=\n) +replace: eu.ev_r = 1/2 - 1/2 From 8ce4920e18ec7ddeb0a2389cb195f617950c4456 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 00:39:07 +0000 Subject: [PATCH 38/62] Add `galgebra.__version__` for easy version inspection (#172) This uses the same approach as clifford and pyganja --- galgebra/__init__.py | 1 + galgebra/_version.py | 8 ++++++++ setup.py | 7 +++++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 galgebra/_version.py diff --git a/galgebra/__init__.py b/galgebra/__init__.py index 5a29635b..0d975537 100644 --- a/galgebra/__init__.py +++ b/galgebra/__init__.py @@ -22,3 +22,4 @@ from __future__ import absolute_import, division from __future__ import print_function +from ._version import __version__ diff --git a/galgebra/_version.py b/galgebra/_version.py new file mode 100644 index 00000000..fa9dc68e --- /dev/null +++ b/galgebra/_version.py @@ -0,0 +1,8 @@ +# Package versioning solution originally found here: +# http://stackoverflow.com/q/458550 + +# Store the version here so: +# 1) we don't load dependencies by storing it in __init__.py +# 2) we can import it in setup.py for the same reason +# 3) we can import it into your module +__version__ = '0.4.4' diff --git a/setup.py b/setup.py index c383cdae..7f1511cb 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,17 @@ #!/usr/bin/env python from setuptools import setup, find_packages from distutils.core import Extension +import os + +version_path = os.path.join('galgebra', '_version.py') +exec(open(version_path).read()) -VERSION = '0.4.4' LONG_DESCRIPTION = """ Symbolic Geometric Algebra/Calculus package for SymPy. BSD License. """ setup(name='galgebra', - version=VERSION, + version=__version__, description='Symbolic Geometric Algebra/Calculus package for SymPy.', author='Alan Bromborsky', author_email='hadfield.hugo@gmail.com', From dbf44c52007b3900b306c931dda73003aed78559 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 10:03:30 +0000 Subject: [PATCH 39/62] Preserve cmpflg in __truediv__ --- galgebra/mv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index e89b3763..6533ba5a 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -2149,7 +2149,7 @@ def __truediv__(self, dopr): raise TypeError('In Dop.__truediv__ dopr must be a sympy scalar.') return Dop([ (coef / dopr, pdiff) for (coef, pdiff) in self.terms - ], ga=self.Ga) + ], ga=self.Ga, cmpflg=self.cmpflg) if sys.version_info.major < 3: __div__ = __truediv__ From b2e4fc423d53d6f94a259c773fe3b7edaf410ab1 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 10:06:50 +0000 Subject: [PATCH 40/62] Add tests for differential operators This should hopefully improve coverage. One of these tests fails right now --- test/test_differential_ops.py | 83 +++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 test/test_differential_ops.py diff --git a/test/test_differential_ops.py b/test/test_differential_ops.py new file mode 100644 index 00000000..6beb37ac --- /dev/null +++ b/test/test_differential_ops.py @@ -0,0 +1,83 @@ +from sympy import symbols +import pytest + +from galgebra.ga import Ga +from galgebra.mv import Dop + + +class TestDop(object): + + def test_associativity_and_distributivity(self): + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + v = ga.mv('v', 'vector', f=True) + laplacian = ga.grad * ga.grad + rlaplacian = ga.rgrad * ga.rgrad + + # check addition distributes + assert (laplacian + ga.grad) * v == laplacian * v + ga.grad * v != 0 + assert (laplacian + 1234567) * v == laplacian * v + 1234567 * v != 0 + # check subtraction distributes + assert (laplacian - ga.grad) * v == laplacian * v - ga.grad * v != 0 + assert (laplacian - 1234567) * v == laplacian * v - 1234567 * v != 0 + # check unary subtraction distributes + assert (-ga.grad) * v == -(ga.grad * v) != 0 + # check division is associative + assert v * (ga.rgrad / 2) == (v * ga.rgrad) / 2 != 0 + # check multiplication is associative + assert (20 * ga.grad) * v == 20 * (ga.grad * v) != 0 + assert v * (ga.rgrad * 20) == (v * ga.rgrad) * 20 != 0 + assert (ex ^ ga.grad) ^ v == ex ^ (ga.grad ^ v) != 0 + assert (20 ^ ga.grad) ^ v == 20 ^ (ga.grad ^ v) != 0 + assert v ^ (ga.rgrad ^ ex) == (v ^ ga.rgrad) ^ ex != 0 + assert v ^ (ga.rgrad ^ 20) == (v ^ ga.rgrad) ^ 20 != 0 + + @pytest.mark.xfail(raises=IndexError) + def test_empty_dop(self): + """ Test that dop with zero terms is equivalent to multiplying by zero """ + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + v = ga.mv('v', 'vector', f=True) + + make_zero = Dop([], ga=ga) + assert make_zero * v == 0 + assert make_zero * make_zero * v == 0 + assert (make_zero + make_zero) * v == 0 + assert (-make_zero) * v == 0 + + def test_misc(self): + """ Other miscellaneous tests """ + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + v = ga.mv('v', 'vector', f=True) + laplacian = ga.grad * ga.grad + rlaplacian = ga.rgrad * ga.rgrad + + # laplacian is a scalar operator, so applying it from either side + # is the same + assert laplacian * v == v * rlaplacian + + assert laplacian.is_scalar() + assert not ga.grad.is_scalar() + + # inconsistent cmpflg, not clear which side the operator goes on + with pytest.raises(ValueError): + ga.grad + ga.rgrad + with pytest.raises(ValueError): + ga.grad * ga.rgrad + + def test_mixed_algebras(self): + coords = x, y, z = symbols('x y z', real=True) + ga1, ex1, ey1, ez1 = Ga.build('e1*x|y|z', g=[1, 1, 1], coords=coords) + ga2, ex2, ey2, ez2 = Ga.build('e2*x|y|z', g=[1, 1, 1], coords=coords) + assert ga1 != ga2 + + v1 = ga1.mv('v', 'vector', f=True) + v2 = ga2.mv('v', 'vector', f=True) + + with pytest.raises(ValueError): + ga1.grad * v2 + with pytest.raises(ValueError): + v1 * ga2.rgrad + with pytest.raises(ValueError): + ga1.grad * ga2.grad From 33ea37aa93d44a71b9104ce0a35136d200e4ae4d Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 17 Dec 2019 12:02:32 +0000 Subject: [PATCH 41/62] Fix the behavior of `Dop` with no arguments This fixes the `TestDop.test_empty_dop` test. --- galgebra/mv.py | 29 ++++++++++++++--------------- test/test_differential_ops.py | 1 - 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 6533ba5a..f52ec750 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1964,16 +1964,20 @@ def __init__(self, *args, **kwargs): self.title = None if len(args) == 2: - if len(args[0]) != len(args[1]): + coefs, pdiffs = args + if len(coefs) != len(pdiffs): raise ValueError('In Dop.__init__ coefficent list and Pdop list must be same length.') - self.terms = tuple(zip(args[0], args[1])) + self.terms = tuple(zip(coefs, pdiffs)) elif len(args) == 1: - if isinstance(args[0][0][0], Mv): # Mv expansion [(Mv, Pdop)] - self.terms = tuple(args[0]) - elif isinstance(args[0][0][0], Sdop): # Sdop expansion [(Sdop, Mv)] + arg, = args + if len(arg) == 0: + self.terms = () + elif isinstance(arg[0][0], Mv): # Mv expansion [(Mv, Pdop)] + self.terms = tuple(arg) + elif isinstance(arg[0][0], Sdop): # Sdop expansion [(Sdop, Mv)] coefs = [] pdiffs = [] - for (sdop, mv) in args[0]: + for (sdop, mv) in arg: for (coef, pdiff) in sdop.terms: if pdiff in pdiffs: index = pdiffs.index(pdiff) @@ -2037,23 +2041,18 @@ def Add(dop1, dop2): if dop1.cmpflg != dop2.cmpflg: raise ValueError('In Dop.Add complement flags have different values: %s vs. %s' % (dop1.cmpflg, dop2.cmpflg)) - coefs1, pdiffs1 = list(zip(*dop1.terms)) - coefs2, pdiffs2 = list(zip(*dop2.terms)) - - pdiffs1 = list(pdiffs1) - pdiffs2 = list(pdiffs2) + pdiffs1 = [pdiff for _, pdiff in dop1.terms] + pdiffs2 = [pdiff for _, pdiff in dop2.terms] pdiffs = pdiffs1 + [x for x in pdiffs2 if x not in pdiffs1] coefs = len(pdiffs) * [S(0)] - for pdiff in pdiffs1: + for coef, pdiff in dop1.terms: index = pdiffs.index(pdiff) - coef = coefs1[pdiffs1.index(pdiff)] coefs[index] += coef - for pdiff in pdiffs2: + for coef, pdiff in dop2.terms: index = pdiffs.index(pdiff) - coef = coefs2[pdiffs2.index(pdiff)] coefs[index] += coef return Dop(coefs, pdiffs, cmpflg=dop1.cmpflg, ga=dop1.Ga) diff --git a/test/test_differential_ops.py b/test/test_differential_ops.py index 6beb37ac..815520a6 100644 --- a/test/test_differential_ops.py +++ b/test/test_differential_ops.py @@ -32,7 +32,6 @@ def test_associativity_and_distributivity(self): assert v ^ (ga.rgrad ^ ex) == (v ^ ga.rgrad) ^ ex != 0 assert v ^ (ga.rgrad ^ 20) == (v ^ ga.rgrad) ^ 20 != 0 - @pytest.mark.xfail(raises=IndexError) def test_empty_dop(self): """ Test that dop with zero terms is equivalent to multiplying by zero """ coords = x, y, z = symbols('x y z', real=True) From fc4585acfcc623f5f61d450614b141738986457d Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 13:52:32 +0000 Subject: [PATCH 42/62] Fix AttributeError in er_blade (#181) `_dot` was removed in gh-142, but when inlining, this call site was missed. --- galgebra/ga.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 45d87194..34a1e1f1 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -1663,9 +1663,9 @@ def er_blade(self, er, blade, mode='*', left=True): return self.wedge(blade, er) else: if left: - return self._dot(er, blade, mode=mode) + return self.Mul(er, blade, mode=mode) else: - return self._dot(blade, er, mode=mode) + return self.Mul(blade, er, mode=mode) def blade_derivation(self, blade, ib): """ From 78977e69a49a2a1407290aff5f8d1d942799b430 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 13:53:52 +0000 Subject: [PATCH 43/62] Use sympy scalars in more places (#179) This reduces the chance of obtaining imprecise floating-point numbers when dividing at the call site. Far from an exhaustive replacement. --- galgebra/deprecated.py | 6 +++--- galgebra/ga.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/galgebra/deprecated.py b/galgebra/deprecated.py index e1b230ca..6efed748 100644 --- a/galgebra/deprecated.py +++ b/galgebra/deprecated.py @@ -1,6 +1,6 @@ import copy from itertools import combinations -from sympy import trigsimp +from sympy import trigsimp, S from . import ga from .mv import Mv from . import utils @@ -63,7 +63,7 @@ def ReciprocalFrame(basis, mode='norm'): for igrade in index[-2:]: grade = [] for iblade in igrade: - blade = Mv(1, 'scalar', ga=GA) + blade = Mv(S(1), 'scalar', ga=GA) for ibasis in iblade: blade ^= basis[ibasis] blade = blade.trigsimp() @@ -75,7 +75,7 @@ def ReciprocalFrame(basis, mode='norm'): duals = copy.copy(MFbasis[-2]) duals.reverse() - sgn = 1 + sgn = S(1) rbasis = [] for dual in duals: recpv = (sgn * dual * E).trigsimp() diff --git a/galgebra/ga.py b/galgebra/ga.py index 34a1e1f1..0eb117ac 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -1023,7 +1023,7 @@ def reduce_basis_loop(g, blst): @staticmethod def blade_reduce(lst): - sgn = 1 + sgn = S(1) for i in range(1, len(lst)): save = lst[i] j = i @@ -1033,7 +1033,7 @@ def blade_reduce(lst): j -= 1 lst[j] = save if lst[j] == lst[j - 1]: - return 0, None + return S(0), None return sgn, lst def wedge_product_basis_blades(self, blade12): # blade12 = blade1*blade2 @@ -1045,12 +1045,12 @@ def wedge_product_basis_blades(self, blade12): # blade12 = blade1*blade2 index12 = list(index1 + index2) if len(index12) > self.n: - return 0 + return S(0) (sgn, wedge12) = Ga.blade_reduce(index12) if sgn != 0: return(sgn * self.indexes_to_blades_dict[tuple(wedge12)]) else: - return 0 + return S(0) #****** Dot (|) product, reft (<) and right (>) contractions ******# @@ -1089,8 +1089,8 @@ def dot_product_basis_blades(self, blade12, mode): return zero n = len(index) - sgn = 1 - result = 1 + sgn = S(1) + result = S(1) ordered = False while n > grade: ordered = True @@ -1102,7 +1102,7 @@ def dot_product_basis_blades(self, blade12, mode): if index1 == index2: n -= 2 if n < grade: - return 0 + return zero result *= self.g[index1, index1] index = index[:i1] + index[i2 + 1:] elif index1 > index2: @@ -1116,7 +1116,7 @@ def dot_product_basis_blades(self, blade12, mode): if ordered: break if n > grade: - return 0 + return zero else: if index == []: return sgn * result From 82c37193afa162e0c50dee1e1b49f8936356fc13 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 13:57:36 +0000 Subject: [PATCH 44/62] Remove unused `flatten_one_level` function (#175) This has nothing to do with differential operators, and isn't used or documented. In the very unlikely event that anyone was using this, the builtin `itertools.chain.from_iterable` provides similar functionality. --- galgebra/mv.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index f52ec750..3f32f420 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1946,10 +1946,6 @@ class Dop(object): 'debug': (False, 'True to print out debugging information'), 'fmt_dop': (1, '1 for normal dop partial derivative formating')} - @staticmethod - def flatten_one_level(lst): - return [inner for outer in lst for inner in outer] - def __init__(self, *args, **kwargs): kwargs = metric.test_init_slots(Dop.init_slots, **kwargs) From d4fe3db196b14f819b3e45f0899ecf5a8fd4f85f Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 13:59:36 +0000 Subject: [PATCH 45/62] Forbid passing coefficients to odd Mvs (#180) Closes gh-81. This makes this consistent with the `even` and `mv` constructors. --- galgebra/mv.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 3f32f420..3ca9acde 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -248,10 +248,12 @@ def _make_spinor(ga, __name, **kwargs): )) @staticmethod - def _make_odd(ga, __name_or_coeffs, **kwargs): + def _make_odd(ga, __name, **kwargs): """ Make a general odd multivector """ + if not isinstance(__name, str): + raise TypeError("Must be a string") return reduce(operator.add, ( - Mv._make_grade(ga, __name_or_coeffs, grade, **kwargs) + Mv._make_grade(ga, __name, grade, **kwargs) for grade in range(1, ga.n + 1, 2) ), S(0)) # base case needed in case n == 0 From 2ff8ac65f3cabcd0ee9e1acca2fa249b9e21aa07 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 15:10:54 +0000 Subject: [PATCH 46/62] Fix Dop.__eq__ --- galgebra/mv.py | 11 ++--------- test/test_differential_ops.py | 3 +++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 3ca9acde..790e7224 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -2006,8 +2006,6 @@ def consolidate_coefs(self): new_coefs = [] new_pdiffs = [] for (coef, pd) in self.terms: - if isinstance(coef, Mv) and coef.is_scalar(): - coef = coef.obj if coef != S(0): if pd in new_pdiffs: index = new_pdiffs.index(pd) @@ -2180,13 +2178,8 @@ def __eq__(self, dop): if self.Ga != dop.Ga: return False - self = Sdop.consolidate_coefs(self) - dop = Sdop.consolidate_coefs(dop) - if len(self.terms) != len(dop.terms): - return False - if set(self.terms) != set(dop.terms): - return False - return True + diff = self - dop + return all(coef == S(0) for coef, _ in diff.terms) else: return False diff --git a/test/test_differential_ops.py b/test/test_differential_ops.py index 815520a6..f559af02 100644 --- a/test/test_differential_ops.py +++ b/test/test_differential_ops.py @@ -59,6 +59,9 @@ def test_misc(self): assert laplacian.is_scalar() assert not ga.grad.is_scalar() + assert ga.grad == ga.grad + assert ga.grad != laplacian + # inconsistent cmpflg, not clear which side the operator goes on with pytest.raises(ValueError): ga.grad + ga.rgrad From 72d6c97f26cf1eeff69ceedb9958d446e8c34d41 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 15:11:20 +0000 Subject: [PATCH 47/62] Add a test for Dop.components() This is only possible now that `__eq__` is implemented --- test/test_differential_ops.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test_differential_ops.py b/test/test_differential_ops.py index f559af02..722ad646 100644 --- a/test/test_differential_ops.py +++ b/test/test_differential_ops.py @@ -83,3 +83,14 @@ def test_mixed_algebras(self): v1 * ga2.rgrad with pytest.raises(ValueError): ga1.grad * ga2.grad + + def test_components(self): + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + + components = ga.grad.components() + assert components == ( + ex * (ex | ga.grad), + ey * (ey | ga.grad), + ez * (ez | ga.grad), + ) From 44d1b79f018111eb2d2468d99ab7522ec222ef8b Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 17:32:14 +0000 Subject: [PATCH 48/62] Fix the alias operator constructors on Ga objects Previously: * `Ga.pdop` was unusable, since it would call `Pdop.__init__` with a `tuple`, but that function expects a `Symbol` or `Dict` * `Ga.sdop` was not callable with one argument, since it would pass on an unwanted `None` argument to `pdiffs` Also groups these functions to be adjacent, for clarity --- galgebra/ga.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 0eb117ac..b257baf9 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -516,9 +516,6 @@ def mv_x(self): def X(self): return self.mv(sum([coord*base for (coord, base) in zip(self.coords, self.basis)])) - def sdop(self, coefs, pdiffs=None): - return mv.Sdop(coefs, pdiffs, ga=self) - def mv(self, root=None, *args, **kwargs): """ Instanciate and return a multivector for this, 'self', @@ -612,13 +609,17 @@ def grads(self): raise ValueError("Ga must have been initialized with coords to compute grads") return self.grad, self.rgrad + def pdop(self, *args, **kwargs): + """ Shorthand to construct a :class:`~galgebra.mv.Pdop` for this algebra """ + return mv.Pdop(*args, ga=self, **kwargs) + def dop(self, *args, **kwargs): - """ - Instanciate and return a multivector differential operator for - this, 'self', geometric algebra. - """ - kwargs['ga'] = self - return mv.Dop(*args, **kwargs) + """ Shorthand to construct a :class:`~galgebra.mv.Dop` for this algebra """ + return mv.Dop(*args, ga=self, **kwargs) + + def sdop(self, *args, **kwargs): + """ Shorthand to construct a :class:`~galgebra.mv.Sdop` for this algebra """ + return mv.Sdop(*args, ga=self, **kwargs) def lt(self, *args, **kwargs): """ @@ -1710,9 +1711,6 @@ def blade_derivation(self, blade, ib): self._dbases[key] = db return db - def pdop(self,*args): - return mv.Pdop(args,ga=self) - def pDiff(self, A, coord): """ Compute partial derivative of multivector function 'A' with From 6e3a60c71370f7b4ab27d33cd8ddb5626c19142f Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Wed, 18 Dec 2019 17:33:23 +0000 Subject: [PATCH 49/62] Don't allow a ga kwarg to be passed and ignored Previously, `sm`, `lt`, and `mv` would all ignore a `ga` kwarg if passed. Now it is an error to pass the argument. The code is simpler too. --- galgebra/ga.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index b257baf9..81a03471 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -524,7 +524,8 @@ def mv(self, root=None, *args, **kwargs): if root is None: # Return ga basis and compute grad and rgrad return self.mv_basis - kwargs['ga'] = self + # ensure that ga is not already in kwargs + kwargs = dict(ga=self, **kwargs) if not utils.isstr(root): return mv.Mv(root, *args, **kwargs) @@ -630,17 +631,14 @@ def lt(self, *args, **kwargs): self._lt_flg = True (self.lt_coords, self.lt_x) = lt.Lt.setup(ga=self) - kwargs['ga'] = self - return lt.Lt(*args, **kwargs) + return lt.Lt(*args, ga=self, **kwargs) def sm(self, *args, **kwargs): """ Instanciate and return a submanifold for this geometric algebra. See :class:`Sm` for instantiation inputs. """ - kwargs['ga'] = self - SM = Sm(*args, **kwargs) - return SM + return Sm(*args, ga=self, **kwargs) def parametric(self, coords): if not isinstance(coords, list): From 48f126d079f2c9cd5130a1f532f2f077e5fa2c82 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 09:38:22 +0000 Subject: [PATCH 50/62] Update release notes from some previous PRs (#186) --- doc/changelog.rst | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index a1b2888b..da90a1e4 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -2,12 +2,23 @@ Changelog ========= +- :bug:`151` ``Dop([], ga=ga)`` and ``Sdop([], ga=ga)`` now evaluate to multiplication by zero, not by one. + Multiplication by one can as always be spelt ``Dop([(S(1), ga.Pdop_identity)], ga=ga)``. +- :bug:`177` :class:`~galgebra.mv.Dop` objects that evaluate to ``0`` no longer raise cryptic ``ValueError``\ s when operated on. +- :support:`175` ``Dop.flatten_one_level`` has been removed, use ``itertools.chain.from_iterable`` for this functionality. +- :feature:`172` :data:`galgebra.__version__` has been added, which contains the version string. +- :feature:`164` (and :issue:`169`, :issue:`170`) Sympy 1.5 is officially supported and tested. +- :support:`167` Python 3.4 is no longer supported. +- :bug:`165` :func:`galgebra.metric.linear_expand` no longer accepts a mode argument, as this did not work properly. + For the old behavior of ``linear_expand(x, mode=True)``, use ``linear_expand_terms(x)`` instead. +- :bug:`151` (also :issue:`150`) :class:`~galgebra.mv.Dop`, :class:`~galgebra.mv.Sdop`, and :class:`~galgebra.mv.Pdop` no longer have mutating methods. + This fixed issues where not only would the laplacian be sometimes calculated incorrectly, but its correctness would vary depending on whether it had been printed! - :bug:`134` :attr:`~galgebra.ga.Ga.dot_table_dict` now contains correct values (zero) for scalar keys -- :bug:`90` :attr:`~galgebra.ga.Ga.blades`, :attr:`~galgebra.ga.Ga.bases`, and :attr:`~galgebra.ga.Ga.indices` - now reference the scalar ``S(0)`` as the single grade-0 object. Previously they listed no grade 0 objects. -- :bug:`80` (also :issue:`57`, :issue:`58`, :issue:`97`) The :class:`galgebra.mv.Mv` constructor no longer silently accepts illegal arguments, and produces better error messages +- :bug:`90` :attr:`~galgebra.ga.Ga.blades`, :attr:`~galgebra.ga.Ga.bases`, and :attr:`~galgebra.ga.Ga.indices` now reference the scalar ``S(0)`` as the single grade-0 object. Previously they listed no grade 0 objects. +- :bug:`81` (also :issue:`180`) Passing coefficients as ``Mv(coefs, 'odd', ga=ga)`` is forbidden. +- :bug:`80` (also :issue:`57`, :issue:`58`, :issue:`97`) The :class:`galgebra.mv.Mv` constructor no longer silently accepts illegal arguments, and produces better error messages. - :feature:`78` :meth:`~galgebra.ga.Ga.grads` now raises a better error when it fails, and is faster. -- :support:`72` Other internal cleanup +- :support:`72` Other internal cleanup. - :feature:`66` (also :issue:`67`, :issue:`71`) Remove unused code in the public API: * ``Ga.mul_table``, ``Ga.wedge_table``, ``Ga.dot_table``, ``Ga.left_contract_table``, From d2e75ea79af585192d088072ad30cc3d26711829 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 10:42:40 +0000 Subject: [PATCH 51/62] Extract duplicated consolidation code to helper functions (#184) --- galgebra/mv.py | 142 +++++++++++++++++++------------------------------ 1 file changed, 55 insertions(+), 87 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 790e7224..776657c3 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1406,6 +1406,44 @@ def compare(A,B): else: raise TypeError('In compare both arguments are not multivectors\n') + +def _consolidate_terms(terms): + """ + Remove zero coefs and consolidate coefs with repeated pdiffs. + """ + new_coefs = [] + new_pdiffs = [] + for (coef, pd) in terms: + if coef != S(0): + if pd in new_pdiffs: + index = new_pdiffs.index(pd) + new_coefs[index] += coef + else: + new_coefs.append(coef) + new_pdiffs.append(pd) + return tuple(zip(new_coefs, new_pdiffs)) + + +def _merge_terms(terms1, terms2): + """ Concatenate and consolidate two sets of already-consolidated terms """ + pdiffs1 = [pdiff for _, pdiff in terms1] + pdiffs2 = [pdiff for _, pdiff in terms2] + + pdiffs = pdiffs1 + [x for x in pdiffs2 if x not in pdiffs1] + coefs = len(pdiffs) * [S(0)] + + for coef, pdiff in terms1: + index = pdiffs.index(pdiff) + coefs[index] += coef + + for coef, pdiff in terms2: + index = pdiffs.index(pdiff) + coefs[index] += coef + + # remove zeros + return [(coef, pdiff) for coef, pdiff in zip(coefs, pdiffs) if coef != S(0)] + + ################ Scalar Partial Differential Operator Class ############ class Sdop(object): @@ -1438,26 +1476,9 @@ def consolidate_coefs(sdop): Remove zero coefs and consolidate coefs with repeated pdiffs. """ if isinstance(sdop, Sdop): - terms = sdop.terms + return Sdop(_consolidate_terms(sdop.terms), ga=sdop.Ga) else: - terms = sdop - - new_coefs = [] - new_pdiffs = [] - for (coef, pd) in terms: - if coef != S(0): - if pd in new_pdiffs: - index = new_pdiffs.index(pd) - new_coefs[index] += coef - else: - new_coefs.append(coef) - new_pdiffs.append(pd) - new_terms = list(zip(new_coefs, new_pdiffs)) - - if isinstance(sdop, Sdop): - return Sdop(new_terms, ga=sdop.Ga) - else: - return new_terms + return _consolidate_terms(sdop) def simplify(self, modes=simplify): return Sdop([ @@ -1588,21 +1609,7 @@ def Add(sdop1, sdop2): if sdop1.Ga != sdop2.Ga: raise ValueError('In Sdop.Add sdop1.Ga != sdop2.Ga.') - pdiffs1 = [pdiff for _, pdiff in sdop1.terms] - pdiffs2 = [pdiff for _, pdiff in sdop2.terms] - - pdiffs = pdiffs1 + [x for x in pdiffs2 if x not in pdiffs1] - coefs = len(pdiffs) * [S(0)] - - for coef, pdiff in sdop1.terms: - index = pdiffs.index(pdiff) - coefs[index] += coef - - for coef, pdiff in sdop2.terms: - index = pdiffs.index(pdiff) - coefs[index] += coef - - sdop_sum = Sdop(coefs, pdiffs, ga=sdop1.Ga) + sdop_sum = Sdop(_merge_terms(sdop1.terms, sdop2.terms), ga=sdop1.Ga) elif isinstance(sdop1, Sdop): coefs, pdiffs = list(zip(*sdop1.terms)) if sdop1.Ga.Pdop_identity in pdiffs: @@ -1973,17 +1980,11 @@ def __init__(self, *args, **kwargs): elif isinstance(arg[0][0], Mv): # Mv expansion [(Mv, Pdop)] self.terms = tuple(arg) elif isinstance(arg[0][0], Sdop): # Sdop expansion [(Sdop, Mv)] - coefs = [] - pdiffs = [] - for (sdop, mv) in arg: - for (coef, pdiff) in sdop.terms: - if pdiff in pdiffs: - index = pdiffs.index(pdiff) - coefs[index] += coef * mv - else: - pdiffs.append(pdiff) - coefs.append(coef * mv) - self.terms = tuple(zip(coefs, pdiffs)) + self.terms = _consolidate_terms( + (coef * mv, pdiff) + for (sdop, mv) in arg + for (coef, pdiff) in sdop.terms + ) else: raise ValueError('In Dop.__init__ args[0] form not allowed. args = ' + str(args)) else: @@ -2003,18 +2004,7 @@ def consolidate_coefs(self): """ Remove zero coefs and consolidate coefs with repeated pdiffs. """ - new_coefs = [] - new_pdiffs = [] - for (coef, pd) in self.terms: - if coef != S(0): - if pd in new_pdiffs: - index = new_pdiffs.index(pd) - new_coefs[index] += coef - else: - new_coefs.append(coef) - new_pdiffs.append(pd) - - return Dop(new_coefs, new_pdiffs, ga=self.Ga, cmpflg=self.cmpflg) + return Dop(_consolidate_terms(self.terms), ga=self.Ga, cmpflg=self.cmpflg) def blade_rep(self): @@ -2037,21 +2027,7 @@ def Add(dop1, dop2): if dop1.cmpflg != dop2.cmpflg: raise ValueError('In Dop.Add complement flags have different values: %s vs. %s' % (dop1.cmpflg, dop2.cmpflg)) - pdiffs1 = [pdiff for _, pdiff in dop1.terms] - pdiffs2 = [pdiff for _, pdiff in dop2.terms] - - pdiffs = pdiffs1 + [x for x in pdiffs2 if x not in pdiffs1] - coefs = len(pdiffs) * [S(0)] - - for coef, pdiff in dop1.terms: - index = pdiffs.index(pdiff) - coefs[index] += coef - - for coef, pdiff in dop2.terms: - index = pdiffs.index(pdiff) - coefs[index] += coef - - return Dop(coefs, pdiffs, cmpflg=dop1.cmpflg, ga=dop1.Ga) + return Dop(_merge_terms(dop1.terms, dop2.terms), cmpflg=dop1.cmpflg, ga=dop1.Ga) else: if isinstance(dop1, Dop): # dop1 is Dop if not isinstance(dop2, Mv): @@ -2213,21 +2189,13 @@ def is_scalar(self): return True def components(self): - dop_lst = [] - for (sdop, base) in self.Dop_mv_expand(): - new_coefs = [] - new_pdiffs = [] - for (coef, pdiff) in sdop.terms: - if pdiff in new_pdiffs: - index = new_pdiffs.index(pdiff) - new_coefs[index] += coef * base - else: - new_pdiffs.append(pdiff) - new_coefs.append(coef * base) - new_coefs = [Mv(x, ga=self.Ga) for x in new_coefs] - terms = list(zip(new_coefs, new_pdiffs)) - dop_lst.append(Dop(terms, ga=self.Ga)) - return tuple(dop_lst) + return tuple( + Dop(_consolidate_terms( + (Mv(coef * base, ga=self.Ga), pdiff) + for (coef, pdiff) in sdop.terms + ), ga=self.Ga) + for (sdop, base) in self.Dop_mv_expand() + ) def Dop_mv_expand(self, modes=None): coefs = [] From aa29146fb20bb21999f5889ddb231d88b25850a4 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 11:02:15 +0000 Subject: [PATCH 52/62] Fix Pdop and Sdop shorthands (#187) The previous code was nonsense - `len(args[0]) == 1 and isinstance(args[0],Symbol)` was never true, as `Symbol.__len__` is undefined. This also makes it illegal to pass extra ignored arguments to `Pdop`. Finally, this deprecates `Pdop(None, ga=ga)` as an alias for `Pdop({}, ga=ga)` - there's no reason to have two ways to spell the same thing, and the second is more natural. --- galgebra/mv.py | 30 +++++++++++++++------------ test/test_differential_ops.py | 38 +++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 776657c3..77d6e28f 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -7,6 +7,7 @@ import operator from functools import reduce, cmp_to_key import sys +import warnings from sympy import ( Symbol, Function, S, expand, Add, @@ -1574,8 +1575,8 @@ def __init__(self, *args, **kwargs): if self.Ga is None: raise ValueError('In Sdop.__init__ self.Ga must be defined.') - if len(args[0]) == 1 and isinstance(args[0],Symbol): # Simple Pdop of order 1 - self.terms = ((S(1), self.Ga.pdop(args[0])),) + if len(args) == 1 and isinstance(args[0],Symbol): # Simple Pdop of order 1 + self.terms = ((S(1), Pdop(args[0], ga=self.Ga)),) else: if len(args) == 2 and isinstance(args[0],list) and isinstance(args[1],list): if len(args[0]) != len(args[1]): @@ -1739,7 +1740,7 @@ def __eq__(self,A): return True return False - def __init__(self, *args, **kwargs): + def __init__(self, __arg, **kwargs): """ The partial differential operator is a partial derivative with respect to a set of real symbols (variables). The allowed @@ -1753,22 +1754,25 @@ def __init__(self, *args, **kwargs): kwargs = metric.test_init_slots(Pdop.init_slots, **kwargs) self.Ga = kwargs['ga'] # Associated geometric algebra - self.order = 0 if self.Ga is None: raise ValueError('In Pdop.__init__ self.Ga must be defined.') - if args[0] is None: # Pdop is the identity (1) - self.pdiffs = {} - elif isinstance(args[0], dict): # Pdop defined by dictionary - self.pdiffs = args[0] - elif isinstance(args[0],Symbol): # First order derivative with respect to symbol - self.pdiffs = {args[0]:1} + # galgebra 0.4.5 + if __arg is None: + warnings.warn( + "`Pdop(None)` is deprecated, use `Pdop({})` instead", + DeprecationWarning, stacklevel=2) + __arg = {} + + if isinstance(__arg, dict): # Pdop defined by dictionary + self.pdiffs = __arg + elif isinstance(__arg, Symbol): # First order derivative with respect to symbol + self.pdiffs = {__arg: 1} else: - raise ValueError('In pdop args = ', str(args)) + raise TypeError('A dictionary or symbol is required, got {!r}'.format(__arg)) - for x in list(self.pdiffs.keys()): - self.order += self.pdiffs[x] + self.order = sum(self.pdiffs.values()) def factor(self): """ diff --git a/test/test_differential_ops.py b/test/test_differential_ops.py index 722ad646..5ae2b162 100644 --- a/test/test_differential_ops.py +++ b/test/test_differential_ops.py @@ -1,8 +1,8 @@ -from sympy import symbols +from sympy import symbols, S import pytest from galgebra.ga import Ga -from galgebra.mv import Dop +from galgebra.mv import Dop, Sdop, Pdop class TestDop(object): @@ -94,3 +94,37 @@ def test_components(self): ey * (ey | ga.grad), ez * (ez | ga.grad), ) + + +class TestSdop(object): + + def test_shorthand(self): + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + + # TODO: __eq__ is broken, remove `repr` when it is fixed + assert repr(Sdop(x, ga=ga)) == repr(Sdop([(S(1), Pdop({x: 1}, ga=ga))], ga=ga)) + + def test_empty_sdop(self): + """ Test that sdop with zero terms is equivalent to multiplying by zero """ + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + v = ga.mv('v', 'vector', f=True) + + make_zero = Sdop([], ga=ga) + assert make_zero * v == 0 + assert make_zero * make_zero * v == 0 + assert (make_zero + make_zero) * v == 0 + assert (-make_zero) * v == 0 + + +class TestPdop(object): + + def test_deprecation(self): + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + + # passing `None` is a deprecate way to spell `{}` + with pytest.warns(DeprecationWarning): + p = Pdop(None, ga=ga) + assert p == Pdop({}, ga=ga) From ccddb0a8060add95d1248b00567ec807eb6574b1 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 11:05:00 +0000 Subject: [PATCH 53/62] Remove the broken and redundant Dop.basic (#185) This: * Raises NameError, because `true` should be spelt `True` * If fixed, raises `AttributeError` for `ga.pdx` * Is attempting to set `ga.lgrad` as a weird alias of `ga.grad` * Is just a weird way to spell `ga.grads()` --- galgebra/mv.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 77d6e28f..5690a803 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -2343,18 +2343,6 @@ def Fmt(self, fmt=1, title=None, dop_fmt=None): else: return s - @staticmethod - def basic(ga): - r_basis = list(ga.r_basis) - - if not ga.is_ortho: - r_basis = [x / ga.e_sq for x in r_basis] - if ga.norm: - r_basis = [x / e_norm for (x, e_norm) in zip(r_basis, ga.e_norm)] - - ga.lgrad = Dop(r_basis, ga.pdx, ga=ga) - ga.rgrad = Dop(r_basis, ga.pdx, ga=ga, cmpflg=true) - return ga.lgrad, ga.rgrad ################################# Alan Macdonald's additions ######################### From 8f2e91fc35d0766b386f3a0c31d2c9921aeee8b4 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 11:49:42 +0000 Subject: [PATCH 54/62] Fix heterogeneous sdop.Add (#157) Before this change, any addition other than `Sdop + Sdop` would raise a NameError, since the variable `coef` is not defined in the `elif` and `else` branch. The intent of the old code was fairly clear - it was to insert a multiplicative term for `sdop2.Ga.Pdop_identity`, such that `(sdop + 2)(x) == sdop(x) + 2*x`, which is reflected by the repr in a shell. This change just copies the code from `Dop`, which succeeds in doing exactly the same thing This also adds a bunch more tests for both Sdop and Dop operations --- galgebra/mv.py | 43 ++++++++++++++++------------------- test/test_differential_ops.py | 24 +++++++++++++++++++ 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 5690a803..68616e52 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1609,28 +1609,20 @@ def Add(sdop1, sdop2): if isinstance(sdop1, Sdop) and isinstance(sdop2, Sdop): if sdop1.Ga != sdop2.Ga: raise ValueError('In Sdop.Add sdop1.Ga != sdop2.Ga.') - - sdop_sum = Sdop(_merge_terms(sdop1.terms, sdop2.terms), ga=sdop1.Ga) - elif isinstance(sdop1, Sdop): - coefs, pdiffs = list(zip(*sdop1.terms)) - if sdop1.Ga.Pdop_identity in pdiffs: - index = pdiffs.index(sdop1.Ga.Pdop_identity) - coef[index] += sdop2 - else: - coef.append(sdop2) - pdiff.append(sdop1.Ga.Pdop_identity) - return Sdop(coefs, pdiffs, ga=sdop1.Ga) + return Sdop(_merge_terms(sdop1.terms, sdop2.terms), ga=sdop1.Ga) else: - coefs, pdiffs = list(zip(*sdop2.terms)) - if sdop2.Ga.Pdop_identity in pdiffs: - index = pdiffs.index(sdop2.Ga.Pdop_identity) - coef[index] += sdop1 + # convert values to multiplicative operators + if isinstance(sdop1, Sdop): + if not isinstance(sdop2, Mv): + sdop2 = sdop1.Ga.mv(sdop2) + sdop2 = Sdop([(sdop2, sdop1.Ga.Pdop_identity)], ga=sdop1.Ga) + elif isinstance(sdop2, Sdop): + if not isinstance(sdop1, Mv): + sdop1 = sdop2.Ga.mv(sdop1) + sdop1 = Sdop([(sdop1, sdop2.Ga.Pdop_identity)], ga=sdop2.Ga) else: - coef.append(sdop1) - pdiff.append(sdop2.Ga.Pdop_identity) - sdop_sum = Sdop(coefs, pdiffs, ga=sdop2.Ga) - - return Sdop.consolidate_coefs(sdop_sum) + raise TypeError("Neither argument is a Dop instance") + return Sdop.Add(sdop1, sdop2) def __eq__(self, sdop): if isinstance(sdop, Sdop): @@ -2033,14 +2025,17 @@ def Add(dop1, dop2): return Dop(_merge_terms(dop1.terms, dop2.terms), cmpflg=dop1.cmpflg, ga=dop1.Ga) else: - if isinstance(dop1, Dop): # dop1 is Dop + # convert values to multiplicative operators + if isinstance(dop1, Dop): if not isinstance(dop2, Mv): dop2 = dop1.Ga.mv(dop2) - dop2 = Dop([dop2], [dop1.Ga.Pdop_identity], cmpflg=dop1.cmpflg, ga=dop1.Ga) - else: # dop2 is Dop + dop2 = Dop([(dop2, dop1.Ga.Pdop_identity)], cmpflg=dop1.cmpflg, ga=dop1.Ga) + elif isinstance(dop2, Dop): if not isinstance(dop1, Mv): dop1 = dop2.Ga.mv(dop1) - dop1 = Dop([dop1], [dop2.Ga.Pdop_identity], cmpflg=dop2.cmpflg, ga=dop2.Ga) + dop1 = Dop([(dop1, dop2.Ga.Pdop_identity)], cmpflg=dop2.cmpflg, ga=dop2.Ga) + else: + raise TypeError("Neither argument is a Dop instance") return Dop.Add(dop1, dop2) def __add__(self, dop): diff --git a/test/test_differential_ops.py b/test/test_differential_ops.py index 5ae2b162..8b3295d6 100644 --- a/test/test_differential_ops.py +++ b/test/test_differential_ops.py @@ -17,16 +17,22 @@ def test_associativity_and_distributivity(self): # check addition distributes assert (laplacian + ga.grad) * v == laplacian * v + ga.grad * v != 0 assert (laplacian + 1234567) * v == laplacian * v + 1234567 * v != 0 + assert (1234 * ex + ga.grad) * v == 1234 * ex * v + ga.grad * v != 0 # check subtraction distributes assert (laplacian - ga.grad) * v == laplacian * v - ga.grad * v != 0 assert (laplacian - 1234567) * v == laplacian * v - 1234567 * v != 0 + assert (1234 * ex - ga.grad) * v == 1234 * ex * v - ga.grad * v != 0 # check unary subtraction distributes assert (-ga.grad) * v == -(ga.grad * v) != 0 # check division is associative assert v * (ga.rgrad / 2) == (v * ga.rgrad) / 2 != 0 # check multiplication is associative + assert (ex * ga.grad) * v == ex * (ga.grad * v) != 0 assert (20 * ga.grad) * v == 20 * (ga.grad * v) != 0 + assert v * (ga.rgrad * ex) == (v * ga.rgrad) * ex != 0 assert v * (ga.rgrad * 20) == (v * ga.rgrad) * 20 != 0 + assert (laplacian * ga.grad) * v == laplacian * (ga.grad * v) != 0 + # check wedge is associative assert (ex ^ ga.grad) ^ v == ex ^ (ga.grad ^ v) != 0 assert (20 ^ ga.grad) ^ v == 20 ^ (ga.grad ^ v) != 0 assert v ^ (ga.rgrad ^ ex) == (v ^ ga.rgrad) ^ ex != 0 @@ -128,3 +134,21 @@ def test_deprecation(self): with pytest.warns(DeprecationWarning): p = Pdop(None, ga=ga) assert p == Pdop({}, ga=ga) + + def test_associativity_and_distributivity(self): + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + v = ga.mv('v', 'vector', f=True) + laplacian = Sdop((ga.grad * ga.grad).terms, ga=ga) + + # check addition distributes + assert (laplacian + 20) * v == laplacian * v + 20 * v != 0 + assert (20 + laplacian) * v == laplacian * v + 20 * v != 0 + # check subtraction distributes + assert (laplacian - 20) * v == laplacian * v - 20 * v != 0 + assert (20 - laplacian) * v == 20 * v - laplacian * v != 0 + # check unary subtraction distributes + assert (-laplacian) * v == -(laplacian * v) != 0 + # check multiplication is associative + assert (20 * laplacian) * v == 20 * (laplacian * v) != 0 + assert (laplacian * laplacian) * v == laplacian * (laplacian * v) != 0 From fce2622863fed27bed0f6d4a4acf8ba55104f399 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 12:02:39 +0000 Subject: [PATCH 55/62] Remove dead code (#189) This code is unreachable, because the contract of `cls.__mul__(a, b)` is that `isinstance(a, cls)` is _always_ `True` --- galgebra/mv.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 68616e52..a5e81534 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1652,7 +1652,7 @@ def __rsub__(self, sdop): def __mul__(self, sdopr): sdopl = self - if isinstance(sdopl, Sdop) and isinstance(sdopr, Sdop): + if isinstance(sdopr, Sdop): if sdopl.Ga != sdopr.Ga: raise ValueError('In Sdop.__mul__ Sdop arguments are not from same geometric algebra') terms = [] @@ -1662,13 +1662,8 @@ def __mul__(self, sdopr): terms += Dsdopl product = Sdop(terms, ga=sdopl.Ga) return Sdop.consolidate_coefs(product) - else: - if not isinstance(sdopl, Sdop): # sdopl is a scalar - terms = [(sdopl * x[0], x[1]) for x in sdopr.terms] - product = Sdop(terms, ga=sdopr.Ga) # returns Sdop - return Sdop.consolidate_coefs(product) - else: # sdopr is a scalar or a multivector - return sum([x[0] * x[1](sdopr) for x in sdopl.terms], S(0)) # returns scalar + else: # sdopr is a scalar or a multivector + return sum([x[0] * x[1](sdopr) for x in sdopl.terms], S(0)) # returns scalar def __rmul__(self,sdop): terms = [(sdop * x[0], x[1]) for x in self.terms] From 6e5a07cc58eee62f6e7f8acecbd9cf267a738190 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 12:25:29 +0000 Subject: [PATCH 56/62] Unpack tuples by name for clarity (#190) This makes Sdop a little more consistent with Dop --- galgebra/mv.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index a5e81534..875848a7 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1594,15 +1594,15 @@ def __call__(self, arg): terms = [] for (coef, pdiff) in self.terms: new_terms = pdiff(arg.terms) - new_terms = [ (coef * x[0], x[1]) for x in new_terms] + new_terms = [(coef * c, p) for c, p in new_terms] terms += new_terms return Sdop(terms, ga=self.Ga) else: - return sum([x[0] * x[1](arg) for x in self.terms], S(0)) + return sum([coef * pdiff(arg) for coef, pdiff in self.terms], S(0)) def __neg__(self): - return Sdop([(-x[0], x[1]) for x in self.terms], ga=self.Ga) + return Sdop([(-coef, pdiff) for coef, pdiff in self.terms], ga=self.Ga) @staticmethod def Add(sdop1, sdop2): @@ -1658,15 +1658,15 @@ def __mul__(self, sdopr): terms = [] for (coef, pdiff) in sdopl.terms: Dsdopl = pdiff(sdopr.terms) # list of terms - Dsdopl = [(coef * x[0], x[1]) for x in Dsdopl] + Dsdopl = [(coef * c, p) for c, p in Dsdopl] terms += Dsdopl product = Sdop(terms, ga=sdopl.Ga) return Sdop.consolidate_coefs(product) else: # sdopr is a scalar or a multivector - return sum([x[0] * x[1](sdopr) for x in sdopl.terms], S(0)) # returns scalar + return sum([coef * pdiff(sdopr) for coef, pdiff in sdopl.terms], S(0)) # returns scalar - def __rmul__(self,sdop): - terms = [(sdop * x[0], x[1]) for x in self.terms] + def __rmul__(self, sdop): + terms = [(sdop * coef, pdiff) for coef, pdiff in self.terms] return Sdop(terms, ga=self.Ga) #################### Partial Derivative Operator Class ################# @@ -2066,14 +2066,14 @@ def Mul(dopl, dopr, op='*'): # General multiplication of Dop's terms = [] for (coef, pdiff) in dopl.terms: #Apply each dopl term to dopr Ddopl = pdiff(dopr.terms) # list of terms - Ddopl = [(Mv.Mul(coef, x[0], op=op), x[1]) for x in Ddopl] + Ddopl = [(Mv.Mul(coef, c, op=op), p) for c, p in Ddopl] terms += Ddopl product = Dop(terms, ga=ga) else: # dopl and dopr operate on left argument terms = [] for (coef, pdiff) in dopr.terms: Ddopr = pdiff(dopl.terms) # list of terms - Ddopr = [(Mv.Mul(x[0], coef, op=op), x[1]) for x in Ddopr] + Ddopr = [(Mv.Mul(c, coef, op=op), p) for c, p in Ddopr] terms += Ddopr product = Dop(terms, ga=ga, cmpflg=True) else: @@ -2085,10 +2085,10 @@ def Mul(dopl, dopr, op='*'): # General multiplication of Dop's ga = dopl.Ga if not dopr.cmpflg: # dopr operates on right argument - terms = [(Mv.Mul(dopl, x[0], op=op), x[1]) for x in dopr.terms] + terms = [(Mv.Mul(dopl, coef, op=op), pdiff) for coef, pdiff in dopr.terms] return Dop(terms, ga=ga) # returns Dop else: - product = sum([Mv.Mul(x[1](dopl), x[0], op=op) for x in dopr.terms], Mv(0, ga=ga)) # returns multivector + product = sum([Mv.Mul(pdiff(dopl), coef, op=op) for coef, pdiff in dopr.terms], Mv(0, ga=ga)) # returns multivector else: # dopr is a scalar or a multivector if isinstance(dopr, Mv) and dopl.Ga != dopr.Ga: @@ -2096,9 +2096,9 @@ def Mul(dopl, dopr, op='*'): # General multiplication of Dop's ga = dopl.Ga if not dopl.cmpflg: # dopl operates on right argument - return sum([Mv.Mul(x[0], x[1](dopr), op=op) for x in dopl.terms], Mv(0, ga=ga)) # returns multivector + return sum([Mv.Mul(coef, pdiff(dopr), op=op) for coef, pdiff in dopl.terms], Mv(0, ga=ga)) # returns multivector else: - terms = [(Mv.Mul(x[0], dopr, op=op), x[1]) for x in dopl.terms] + terms = [(Mv.Mul(coef, dopr, op=op), pdiff) for coef, pdiff in dopl.terms] product = Dop(terms, ga=dopl.Ga, cmpflg=True) # returns Dop complement if isinstance(product, Dop): product = product.consolidate_coefs() @@ -2177,8 +2177,8 @@ def _repr_latex_(self): return latex_str def is_scalar(self): - for x in self.terms: - if isinstance(x[0], Mv) and not x[0].is_scalar(): + for coef, pdiff in self.terms: + if isinstance(coef, Mv) and not coef.is_scalar(): return False return True From 732a1e3ed2dac72f2d9b07edf5375749e031b47b Mon Sep 17 00:00:00 2001 From: Utensil Song Date: Thu, 19 Dec 2019 20:56:45 +0800 Subject: [PATCH 57/62] Add a Py 3.7 build with SymEngine enabled (#192) Extracted from #37 . This will only partially enable SymEngine. --- .circleci/config.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index da83b7d3..dfdb5f62 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,13 +32,19 @@ defaults: &defaults path: test-reports jobs: + "python-3.7-symengine": + <<: *defaults + environment: + PIP_EXTRA_INSTALLATION: numpy symengine==0.5.0 + USE_SYMENGINE: 1 + docker: + - image: circleci/python:3.7 "python-3.7-sympy-1.5": <<: *defaults environment: PIP_EXTRA_INSTALLATION: sympy==1.5 docker: - image: circleci/python:3.7 - "python-3.7": <<: *defaults docker: @@ -60,8 +66,9 @@ workflows: version: 2 build: jobs: + - "python-3.7-symengine" + - "python-3.7-sympy-1.5" - "python-3.7" - "python-3.6" - "python-3.5" - "python-2.7" - - "python-3.7-sympy-1.5" From 09b6a73cec494bc563f4d8c96207f8e0ad4a05ff Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 12:59:38 +0000 Subject: [PATCH 58/62] Merge the equivalent `Sdop.__call__` and `Sdop.__mul__` (#191) The only differences were: * The variable names * A missing consolidation step in `__call__` --- galgebra/mv.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 875848a7..3f1d0075 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1590,13 +1590,15 @@ def __init__(self, *args, **kwargs): def __call__(self, arg): if isinstance(arg, Sdop): if self.Ga != arg.Ga: - raise ValueError('In Sdop.__call__ self.Ga != arg.Ga.') + raise ValueError( + 'When chaining scalar differential operators, self.Ga != arg.Ga.') terms = [] for (coef, pdiff) in self.terms: new_terms = pdiff(arg.terms) new_terms = [(coef * c, p) for c, p in new_terms] terms += new_terms - return Sdop(terms, ga=self.Ga) + product = Sdop(terms, ga=self.Ga) + return Sdop.consolidate_coefs(product) else: return sum([coef * pdiff(arg) for coef, pdiff in self.terms], S(0)) @@ -1651,19 +1653,8 @@ def __rsub__(self, sdop): return Sdop.Add(-self, sdop) def __mul__(self, sdopr): - sdopl = self - if isinstance(sdopr, Sdop): - if sdopl.Ga != sdopr.Ga: - raise ValueError('In Sdop.__mul__ Sdop arguments are not from same geometric algebra') - terms = [] - for (coef, pdiff) in sdopl.terms: - Dsdopl = pdiff(sdopr.terms) # list of terms - Dsdopl = [(coef * c, p) for c, p in Dsdopl] - terms += Dsdopl - product = Sdop(terms, ga=sdopl.Ga) - return Sdop.consolidate_coefs(product) - else: # sdopr is a scalar or a multivector - return sum([coef * pdiff(sdopr) for coef, pdiff in sdopl.terms], S(0)) # returns scalar + # alias for applying the operator + return self.__call__(sdopr) def __rmul__(self, sdop): terms = [(sdop * coef, pdiff) for coef, pdiff in self.terms] From 31a16a013f88b4dcb080017ff8a5380ed9af7c07 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 13:45:06 +0000 Subject: [PATCH 59/62] Fix the broken `Sdop.__eq__`, and add the missing `__ne__` operators. (#193) `__ne__` is needed by python 2 (https://stackoverflow.com/q/4352244/102441), else it defaults to `x is not y` Also: * move some tests that ended up in the wrong place after a merge/rebase * use the helper alias methods in `Ga` to increase coverage --- galgebra/mv.py | 46 ++++++++++++++---------- test/test_differential_ops.py | 67 +++++++++++++++++++++++++++-------- 2 files changed, 79 insertions(+), 34 deletions(-) diff --git a/galgebra/mv.py b/galgebra/mv.py index 3f1d0075..bdc13091 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1626,19 +1626,19 @@ def Add(sdop1, sdop2): raise TypeError("Neither argument is a Dop instance") return Sdop.Add(sdop1, sdop2) - def __eq__(self, sdop): - if isinstance(sdop, Sdop): - if self.Ga != sdop.Ga: - return False - self = Sdop.consolidate_coefs(self) - sdop = Sdop.consolidate_coefs(sdop) - if len(self.terms) != len(sdop.terms): - return False - if set(self.terms) != set(sdop.terms): - return False - return True + def __eq__(self, other): + if isinstance(other, Sdop): + if self.Ga != other.Ga: + return NotImplemented + + diff = self - other + return len(diff.terms) == 0 else: - return False + return NotImplemented + + if sys.version_info.major < 3: + def __ne__(self, other): + return not (self == other) def __add__(self, sdop): return Sdop.Add(self, sdop) @@ -1718,6 +1718,10 @@ def __eq__(self,A): return True return False + if sys.version_info.major < 3: + def __ne__(self, other): + return not (self == other) + def __init__(self, __arg, **kwargs): """ The partial differential operator is a partial derivative with @@ -2134,15 +2138,19 @@ def __lt__(self, dopr): # < left contraction def __gt__(self, dopr): # > right contraction return Dop.Mul(self, dopr, op='>') - def __eq__(self, dop): - if isinstance(dop, Dop): - if self.Ga != dop.Ga: - return False + def __eq__(self, other): + if isinstance(other, Dop): + if self.Ga != other.Ga: + return NotImplemented - diff = self - dop - return all(coef == S(0) for coef, _ in diff.terms) + diff = self - other + return len(diff.terms) == 0 else: - return False + return NotImplemented + + if sys.version_info.major < 3: + def __ne__(self, other): + return not (self == other) def __str__(self): if printer.GaLatexPrinter.latex_flg: diff --git a/test/test_differential_ops.py b/test/test_differential_ops.py index 8b3295d6..1371332e 100644 --- a/test/test_differential_ops.py +++ b/test/test_differential_ops.py @@ -44,7 +44,7 @@ def test_empty_dop(self): ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) v = ga.mv('v', 'vector', f=True) - make_zero = Dop([], ga=ga) + make_zero = ga.dop([]) assert make_zero * v == 0 assert make_zero * make_zero * v == 0 assert (make_zero + make_zero) * v == 0 @@ -65,8 +65,13 @@ def test_misc(self): assert laplacian.is_scalar() assert not ga.grad.is_scalar() + # test comparison assert ga.grad == ga.grad + assert not (ga.grad != ga.grad) assert ga.grad != laplacian + assert not (ga.grad == laplacian) + assert ga.grad != object() + assert not (ga.grad == object()) # inconsistent cmpflg, not clear which side the operator goes on with pytest.raises(ValueError): @@ -108,8 +113,7 @@ def test_shorthand(self): coords = x, y, z = symbols('x y z', real=True) ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) - # TODO: __eq__ is broken, remove `repr` when it is fixed - assert repr(Sdop(x, ga=ga)) == repr(Sdop([(S(1), Pdop({x: 1}, ga=ga))], ga=ga)) + assert Sdop(x, ga=ga) == Sdop([(S(1), Pdop({x: 1}, ga=ga))], ga=ga) def test_empty_sdop(self): """ Test that sdop with zero terms is equivalent to multiplying by zero """ @@ -123,18 +127,6 @@ def test_empty_sdop(self): assert (make_zero + make_zero) * v == 0 assert (-make_zero) * v == 0 - -class TestPdop(object): - - def test_deprecation(self): - coords = x, y, z = symbols('x y z', real=True) - ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) - - # passing `None` is a deprecate way to spell `{}` - with pytest.warns(DeprecationWarning): - p = Pdop(None, ga=ga) - assert p == Pdop({}, ga=ga) - def test_associativity_and_distributivity(self): coords = x, y, z = symbols('x y z', real=True) ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) @@ -152,3 +144,48 @@ def test_associativity_and_distributivity(self): # check multiplication is associative assert (20 * laplacian) * v == 20 * (laplacian * v) != 0 assert (laplacian * laplacian) * v == laplacian * (laplacian * v) != 0 + + + def test_misc(self): + """ Other miscellaneous tests """ + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + laplacian = ga.sdop((ga.grad * ga.grad).terms) + lap2 = laplacian*laplacian + + # test comparison + assert lap2 == lap2 + assert not (lap2 != lap2) + assert lap2 != laplacian + assert not (lap2 == laplacian) + assert lap2 != object() + assert not (lap2 == object()) + + +class TestPdop(object): + + def test_deprecation(self): + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + + # passing `None` is a deprecate way to spell `{}` + with pytest.warns(DeprecationWarning): + p = Pdop(None, ga=ga) + assert p == Pdop({}, ga=ga) + + def test_misc(self): + """ Other miscellaneous tests """ + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + + pxa = ga.pdop({x: 1}) + pxb = ga.pdop({x: 1}) + p1 = ga.pdop({}) + + # test comparison + assert pxa == pxb + assert not (pxa != pxb) + assert p1 != pxa + assert not (p1 == pxa) + assert pxa != object() + assert not (pxa == object()) From 0b8c38a5e33e915aab1ac9bafc25a378a091bb13 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 14:39:04 +0000 Subject: [PATCH 60/62] Deprecate Pdiffs, sPds, and Pdop_identity (#194) These attributes all have shorter spellings, and now that `__eq__` and `__ne__` work, there's little need to cache them. --- galgebra/ga.py | 48 +++++++++++++++++++---------------- galgebra/mv.py | 16 +++++++----- test/test_differential_ops.py | 12 +++++++++ 3 files changed, 47 insertions(+), 29 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 81a03471..704f89aa 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -1,7 +1,7 @@ """ Geometric Algebra (inherits Metric) """ - +import warnings import operator import copy from collections import OrderedDict @@ -268,20 +268,6 @@ class Ga(metric.Metric): Derivatives of basis functions. Two dimensional list. First entry is differentiating coordinate index. Second entry is basis vector index. Quantities are linear combinations of basis vector symbols. - .. attribute:: Pdop_identity - - Partial differential operator identity (operates on multivector function to return function). - - .. attribute:: Pdiffs - - Dictionary of partial differential operators (operates on multivector functions) for each coordinate - :math:`\{x: \partial_{x}, ...\}` - - .. attribute:: sPds - - Dictionary of scalar partial differential operators (operates on scalar functions) for each coordinate - :math:`\{x: \partial_{x}, ...\}` - .. attribute:: grad Geometric derivative operator from left. ``grad*F`` returns multivector @@ -420,12 +406,6 @@ def __init__(self, bases, **kwargs): if self.coords is not None: self.coord_vec = sum([coord * base for (coord, base) in zip(self.coords, self.basis)]) self._build_reciprocal_basis(self.gsym) - self.Pdop_identity = mv.Pdop({},ga=self) # Identity Pdop = 1 - self.Pdiffs = {} - self.sPds = {} - for x in self.coords: # Partial derivative operator for each coordinate - self.Pdiffs[x] = mv.Pdop({x:1}, ga=self) - self.sPds[x] = mv.Sdop([(S(1), self.Pdiffs[x])], ga=self) self._build_grads() else: self.r_basis_mv = None @@ -516,6 +496,30 @@ def mv_x(self): def X(self): return self.mv(sum([coord*base for (coord, base) in zip(self.coords, self.basis)])) + @property + def Pdiffs(self): + # galgebra 0.4.5 + warnings.warn( + "ga.Pdiffs[x] is deprecated, use `ga.pdop(x)` instead", + DeprecationWarning, stacklevel=2) + return {x: self.pdop(x) for x in self.coords} + + @property + def sPds(self): + # galgebra 0.4.5 + warnings.warn( + "ga.sPds[x] is deprecated, use `ga.sdop(x)` instead", + DeprecationWarning, stacklevel=2) + return {x: self.sdop(x) for x in self.coords} + + @property + def Pdop_identity(self): + # galgebra 0.4.5 + warnings.warn( + "ga.Pdop_identity is deprecated, use `ga.pdop({})` instead", + DeprecationWarning, stacklevel=2) + return self.pdop({}) + def mv(self, root=None, *args, **kwargs): """ Instanciate and return a multivector for this, 'self', @@ -600,7 +604,7 @@ def _build_grads(self): if self.norm: r_basis = [x / e_norm for (x, e_norm) in zip(self.r_basis_mv, self.e_norm)] - pdx = [self.Pdiffs[x] for x in self.coords] + pdx = [self.pdop(x) for x in self.coords] self.grad = mv.Dop(r_basis, pdx, ga=self) self.rgrad = mv.Dop(r_basis, pdx, ga=self, cmpflg=True) diff --git a/galgebra/mv.py b/galgebra/mv.py index bdc13091..0fdd7616 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -1617,11 +1617,11 @@ def Add(sdop1, sdop2): if isinstance(sdop1, Sdop): if not isinstance(sdop2, Mv): sdop2 = sdop1.Ga.mv(sdop2) - sdop2 = Sdop([(sdop2, sdop1.Ga.Pdop_identity)], ga=sdop1.Ga) + sdop2 = Sdop([(sdop2, Pdop({}, ga=sdop1.Ga))], ga=sdop1.Ga) elif isinstance(sdop2, Sdop): if not isinstance(sdop1, Mv): sdop1 = sdop2.Ga.mv(sdop1) - sdop1 = Sdop([(sdop1, sdop2.Ga.Pdop_identity)], ga=sdop2.Ga) + sdop1 = Sdop([(sdop1, Pdop({}, ga=sdop2.Ga))], ga=sdop2.Ga) else: raise TypeError("Neither argument is a Dop instance") return Sdop.Add(sdop1, sdop2) @@ -1677,10 +1677,12 @@ class Pdop(object): Attributes ---------- pdiffs : dict - a dictionary where coordinates are keys and key value are the number of + A dictionary where coordinates are keys and key value are the number of times one differentiates with respect to the key. order : int - total number of differentiations + Total number of differentiations. + When this is zero (i.e. when :attr:`pdiffs` is ``{}``) then this object + is the identity operator, and returns its operand unchanged. """ init_slots = {'ga': (None, 'Associated geometric algebra')} @@ -1774,7 +1776,7 @@ def factor(self): del new_pdiffs[x] else: new_pdiffs[x] -= 1 - return Pdop(new_pdiffs, ga=self.Ga), self.Ga.Pdiffs[x] + return Pdop(new_pdiffs, ga=self.Ga), Pdop(x, ga=self.Ga) def __call__(self, arg): """ @@ -2019,11 +2021,11 @@ def Add(dop1, dop2): if isinstance(dop1, Dop): if not isinstance(dop2, Mv): dop2 = dop1.Ga.mv(dop2) - dop2 = Dop([(dop2, dop1.Ga.Pdop_identity)], cmpflg=dop1.cmpflg, ga=dop1.Ga) + dop2 = Dop([(dop2, Pdop({}, ga=dop1.Ga))], cmpflg=dop1.cmpflg, ga=dop1.Ga) elif isinstance(dop2, Dop): if not isinstance(dop1, Mv): dop1 = dop2.Ga.mv(dop1) - dop1 = Dop([(dop1, dop2.Ga.Pdop_identity)], cmpflg=dop2.cmpflg, ga=dop2.Ga) + dop1 = Dop([(dop1, Pdop({}, ga=dop2.Ga))], cmpflg=dop2.cmpflg, ga=dop2.Ga) else: raise TypeError("Neither argument is a Dop instance") return Dop.Add(dop1, dop2) diff --git a/test/test_differential_ops.py b/test/test_differential_ops.py index 1371332e..d97c33a1 100644 --- a/test/test_differential_ops.py +++ b/test/test_differential_ops.py @@ -109,6 +109,13 @@ def test_components(self): class TestSdop(object): + def test_deprecation(self): + coords = x, y, z = symbols('x y z', real=True) + ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) + + with pytest.warns(DeprecationWarning): + ga.sPds + def test_shorthand(self): coords = x, y, z = symbols('x y z', real=True) ga, ex, ey, ez = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) @@ -173,6 +180,11 @@ def test_deprecation(self): p = Pdop(None, ga=ga) assert p == Pdop({}, ga=ga) + with pytest.warns(DeprecationWarning): + ga.Pdop_identity + with pytest.warns(DeprecationWarning): + ga.Pdiffs + def test_misc(self): """ Other miscellaneous tests """ coords = x, y, z = symbols('x y z', real=True) From c312ff987c858a8a2c35f686ea24087c3bdb94a6 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 14:29:49 +0000 Subject: [PATCH 61/62] Deprecate `mv_I` and `mx_x` No one should be using these, there are better alternatives --- galgebra/ga.py | 10 +++++++++- test/test_mv.py | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 704f89aa..8033901d 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -484,14 +484,22 @@ def I(self): # Noromalized pseudo-scalar @property def mv_I(self): # This exists for backwards compatibility. Note this is not `I()`! + # galgebra 0.4.5 + warnings.warn( + "`ga.mv_I` is deprecated, use `ga.E()` instead, or perhaps `ga.I()`", + DeprecationWarning, stacklevel=2) # default pseudoscalar return self.E() @property def mv_x(self): # This exists for backwards compatibility. + # galgebra 0.4.5 + warnings.warn( + "`ga.mv_x` is deprecated, use `ga.mv(your_name, 'vector')` instead", + DeprecationWarning, stacklevel=2) # testing vectors - return Mv('XxXx', 'vector', ga=self) + return mv.Mv('XxXx', 'vector', ga=self) def X(self): return self.mv(sum([coord*base for (coord, base) in zip(self.coords, self.basis)])) diff --git a/test/test_mv.py b/test/test_mv.py index 8996e039..b070ec8a 100644 --- a/test/test_mv.py +++ b/test/test_mv.py @@ -1,10 +1,19 @@ import unittest + +import pytest from sympy import Symbol from galgebra.ga import Ga from galgebra import utils class TestMv(unittest.TestCase): + def test_deprecations(self): + ga, e_1, e_2, e_3 = Ga.build('e*1|2|3') + with pytest.warns(DeprecationWarning): + ga.mv_x + with pytest.warns(DeprecationWarning): + ga.mv_I + def test_is_base(self): """ Various tests on several multivectors. From 7a03fc6436f6ce5843aa0b77f6875e7b885c469c Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 19 Dec 2019 14:31:33 +0000 Subject: [PATCH 62/62] Make `XOX` private It's intended only for use within `is_versor` Every member we can remove from `Ga` makes galgebra easier to understand --- galgebra/ga.py | 2 +- galgebra/mv.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/galgebra/ga.py b/galgebra/ga.py index 8033901d..fd1374c9 100644 --- a/galgebra/ga.py +++ b/galgebra/ga.py @@ -447,7 +447,7 @@ def __init__(self, bases, **kwargs): self.a = [] # List of dummy vectors for Mlt calculations self._agrads = {} # cache of gradient operator with respect to vector a self.dslot = -1 # args slot for dervative, -1 for coordinates - self.XOX = self.mv('XOX','vector') # Versor test vector + self._XOX = self.mv('XOX','vector') # cached vector for use in is_versor def make_grad(self, a, cmpflg=False): # make gradient operator with respect to vector a diff --git a/galgebra/mv.py b/galgebra/mv.py index 0fdd7616..c908ea7f 100644 --- a/galgebra/mv.py +++ b/galgebra/mv.py @@ -981,7 +981,7 @@ def is_versor(self): if not test.is_scalar(): return self.versor_flg # see if self*x*self.rev() returns a vector for x an arbitrary vector - test = self * self.Ga.XOX * self.rev() + test = self * self.Ga._XOX * self.rev() self.versor_flg = test.is_vector() return self.versor_flg