DGCV 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of DGCV might be problematic. Click here for more details.
- {dgcv-0.2.0/src/DGCV.egg-info → dgcv-0.2.2}/PKG-INFO +3 -3
- {dgcv-0.2.0 → dgcv-0.2.2}/README.md +2 -2
- {dgcv-0.2.0 → dgcv-0.2.2}/pyproject.toml +1 -1
- {dgcv-0.2.0 → dgcv-0.2.2}/setup.cfg +1 -1
- {dgcv-0.2.0 → dgcv-0.2.2}/setup.py +1 -1
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/RiemannianGeometry.py +49 -97
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/__init__.py +1 -1
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/classesAndVariables.py +1 -2
- dgcv-0.2.0/src/DGCV/complexGeometry.py → dgcv-0.2.2/src/DGCV/complexStructures.py +1 -3
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/coordinateMaps.py +1 -1
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/polynomials.py +61 -4
- {dgcv-0.2.0 → dgcv-0.2.2/src/DGCV.egg-info}/PKG-INFO +3 -3
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV.egg-info/SOURCES.txt +1 -1
- {dgcv-0.2.0 → dgcv-0.2.2}/LICENSE.txt +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/MANIFEST.in +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/CRGeometry.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/DGCVFormatter.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/DGCV_display.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/_safeguards.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/__init__.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-Black.ttf +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-Black.woff2 +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-Bold.ttf +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-Bold.woff2 +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-ExtraBold.ttf +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-ExtraBold.woff2 +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-Medium.ttf +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-Medium.woff2 +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-Regular.ttf +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-Regular.woff2 +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-SemiBold.ttf +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/Orbitron-SemiBold.woff2 +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/PatrickHand-Regular.ttf +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/fonts/fonts.css +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/inversions/__init__.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/inversions/populator.ipynb +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/inversions/precomputed_2x2.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/inversions/precomputed_3x3.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/inversions/precomputed_4x4.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/inversions/precomputed_5x5.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/inversions/precomputed_6x6.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/assets/inversions/precomputed_7x7.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/combinatorics.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/config.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/finiteDimAlgebras.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/styles.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV/vectorFieldsAndDifferentialForms.py +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV.egg-info/dependency_links.txt +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV.egg-info/requires.txt +0 -0
- {dgcv-0.2.0 → dgcv-0.2.2}/src/DGCV.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DGCV
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Differential Geometry with Complex Variables
|
|
5
5
|
Author: David Sykes
|
|
6
6
|
Author-email: David Sykes <david@realandimaginary.com>
|
|
@@ -24,7 +24,7 @@ DGCV was developed using Python 3.12, with dependencies on the SymPy and Pandas
|
|
|
24
24
|
- Fully featured symbolic representations of vector fields, differential forms, and tensor fields
|
|
25
25
|
- Intuitive interactions with complex structures from holomorphic coordinate systems: DGCV objects dynamically manage coordinate transformations between real and holomorphic coordinates during computation as necessary, so objects can be represented in and freely converted between either coordinate format at any time.
|
|
26
26
|
- Dedicated python classes for representing common differential geometric structures including Riemannian metrics, Kahler structures, and more
|
|
27
|
-
- Custom LaTeX rendering
|
|
27
|
+
- Custom LaTeX rendering for clean visual representation of mathematical objects, ideal for sharing mathematical ideas through clear Jupyter notebooks.
|
|
28
28
|
|
|
29
29
|
## Installation
|
|
30
30
|
|
|
@@ -66,7 +66,7 @@ DGCV documentation is hosted at [https://www.realandimaginary.com/dgcv/](https:/
|
|
|
66
66
|
DGCV is licensed under the MIT License. See the `LICENSE.txt` file for more information.
|
|
67
67
|
|
|
68
68
|
## Author
|
|
69
|
-
DGCV was created and is maintained by [David Sykes](https://
|
|
69
|
+
DGCV was created and is maintained by [David Sykes](https://www.realandimaginary.com).
|
|
70
70
|
|
|
71
71
|
---
|
|
72
72
|
|
|
@@ -10,7 +10,7 @@ DGCV was developed using Python 3.12, with dependencies on the SymPy and Pandas
|
|
|
10
10
|
- Fully featured symbolic representations of vector fields, differential forms, and tensor fields
|
|
11
11
|
- Intuitive interactions with complex structures from holomorphic coordinate systems: DGCV objects dynamically manage coordinate transformations between real and holomorphic coordinates during computation as necessary, so objects can be represented in and freely converted between either coordinate format at any time.
|
|
12
12
|
- Dedicated python classes for representing common differential geometric structures including Riemannian metrics, Kahler structures, and more
|
|
13
|
-
- Custom LaTeX rendering
|
|
13
|
+
- Custom LaTeX rendering for clean visual representation of mathematical objects, ideal for sharing mathematical ideas through clear Jupyter notebooks.
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -52,7 +52,7 @@ DGCV documentation is hosted at [https://www.realandimaginary.com/dgcv/](https:/
|
|
|
52
52
|
DGCV is licensed under the MIT License. See the `LICENSE.txt` file for more information.
|
|
53
53
|
|
|
54
54
|
## Author
|
|
55
|
-
DGCV was created and is maintained by [David Sykes](https://
|
|
55
|
+
DGCV was created and is maintained by [David Sykes](https://www.realandimaginary.com).
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
requires-python = ">=3.6"
|
|
7
7
|
name = "DGCV"
|
|
8
|
-
version = "0.2.
|
|
8
|
+
version = "0.2.2"
|
|
9
9
|
description = "Differential Geometry with Complex Variables"
|
|
10
10
|
authors = [{ name = "David Sykes", email = "david@realandimaginary.com" }]
|
|
11
11
|
license = { text = "MIT" }
|
|
@@ -15,7 +15,7 @@ To get started, check out the Jupyter Notebook tutorials:
|
|
|
15
15
|
|
|
16
16
|
setup(
|
|
17
17
|
name="DGCV",
|
|
18
|
-
version="0.2.
|
|
18
|
+
version="0.2.2",
|
|
19
19
|
description="Differential Geometry with Complex Variables",
|
|
20
20
|
long_description=long_description, # This shows up on PyPI
|
|
21
21
|
long_description_content_type='text/markdown',
|
|
@@ -665,85 +665,6 @@ class metricClass(Basic):
|
|
|
665
665
|
else:
|
|
666
666
|
return f"\\left({latex(coeff)}\\right)"
|
|
667
667
|
|
|
668
|
-
def __add__(self, other):
|
|
669
|
-
"""
|
|
670
|
-
Adds two differential forms (i.e., DFClass instances). The addition is performed
|
|
671
|
-
by combining the coefficients of both forms. If the variable spaces of the forms
|
|
672
|
-
are not the same, the resulting form will have a variable space that is the union
|
|
673
|
-
of both input spaces.
|
|
674
|
-
|
|
675
|
-
Parameters
|
|
676
|
-
----------
|
|
677
|
-
other : DFClass
|
|
678
|
-
Another differential form to add. The variable spaces of the two forms need not
|
|
679
|
-
be identical. The result will use the union of the variable spaces of the two
|
|
680
|
-
forms.
|
|
681
|
-
|
|
682
|
-
Returns
|
|
683
|
-
-------
|
|
684
|
-
DFClass
|
|
685
|
-
A new differential form representing the sum of the two input forms.
|
|
686
|
-
|
|
687
|
-
Raises
|
|
688
|
-
------
|
|
689
|
-
TypeError
|
|
690
|
-
If the argument `other` is not an instance of `DFClass`.
|
|
691
|
-
|
|
692
|
-
Examples
|
|
693
|
-
--------
|
|
694
|
-
>>> from sympy import symbols
|
|
695
|
-
>>> from DGCV import DFClass
|
|
696
|
-
>>> x1, x2 = symbols('x1 x2')
|
|
697
|
-
>>> d_x1 = DFClass([x1], {0: 1}, 1)
|
|
698
|
-
>>> d_x2 = DFClass([x2], {0: 1}, 1)
|
|
699
|
-
>>> d_sum = d_x1 + d_x2
|
|
700
|
-
>>> print(d_sum)
|
|
701
|
-
d_x1 + d_x2
|
|
702
|
-
"""
|
|
703
|
-
if isinstance(other, DFClass):
|
|
704
|
-
return addDF(self, other)
|
|
705
|
-
else:
|
|
706
|
-
raise TypeError("Unsupported operand type(s) for + with DFClass")
|
|
707
|
-
|
|
708
|
-
def __sub__(self, other):
|
|
709
|
-
"""
|
|
710
|
-
Subtracts one differential form from another (i.e., DFClass instances). The subtraction
|
|
711
|
-
is performed by negating the second form and then adding it to the first form. If the
|
|
712
|
-
variable spaces of the forms are not the same, the resulting form will have a variable
|
|
713
|
-
space that is the sum of both input spaces.
|
|
714
|
-
|
|
715
|
-
Parameters
|
|
716
|
-
----------
|
|
717
|
-
other : DFClass
|
|
718
|
-
Another differential form to subtract. The variable spaces of the two forms need not
|
|
719
|
-
be identical. The result will use the sum of the variable spaces of the two forms.
|
|
720
|
-
|
|
721
|
-
Returns
|
|
722
|
-
-------
|
|
723
|
-
DFClass
|
|
724
|
-
A new differential form representing the difference between the two input forms.
|
|
725
|
-
|
|
726
|
-
Raises
|
|
727
|
-
------
|
|
728
|
-
TypeError
|
|
729
|
-
If the argument `other` is not an instance of `DFClass`.
|
|
730
|
-
|
|
731
|
-
Examples
|
|
732
|
-
--------
|
|
733
|
-
>>> from sympy import symbols
|
|
734
|
-
>>> from DGCV import DFClass
|
|
735
|
-
>>> x1, x2 = symbols('x1 x2')
|
|
736
|
-
>>> d_x1 = DFClass([x1], {0: 1}, 1)
|
|
737
|
-
>>> d_x2 = DFClass([x2], {0: 1}, 1)
|
|
738
|
-
>>> d_diff = d_x1 - d_x2
|
|
739
|
-
>>> print(d_diff)
|
|
740
|
-
d_x1 - d_x2
|
|
741
|
-
"""
|
|
742
|
-
if isinstance(other, DFClass):
|
|
743
|
-
return addDF(self, scaleDF(-1, other))
|
|
744
|
-
else:
|
|
745
|
-
raise TypeError("Unsupported operand type(s) for - with DFClass")
|
|
746
|
-
|
|
747
668
|
class LeviCivitaConnectionClass(Basic):
|
|
748
669
|
|
|
749
670
|
def __new__(cls, varSpace, Christoffel_symbols_of_the_second_kind, variable_handling_default='standard'):
|
|
@@ -751,37 +672,68 @@ class LeviCivitaConnectionClass(Basic):
|
|
|
751
672
|
obj = Basic.__new__(cls, varSpace,Christoffel_symbols_of_the_second_kind)
|
|
752
673
|
return obj
|
|
753
674
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
if
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
675
|
+
from sympy.tensor.array import ImmutableSparseNDimArray
|
|
676
|
+
|
|
677
|
+
def __init__(self, varSpace, Christoffel_symbols_of_the_second_kind, variable_handling_default='standard'):
|
|
678
|
+
# Attempt to convert the input to an ImmutableSparseNDimArray
|
|
679
|
+
if not isinstance(Christoffel_symbols_of_the_second_kind, ImmutableSparseNDimArray):
|
|
680
|
+
try:
|
|
681
|
+
Christoffel_symbols_of_the_second_kind = ImmutableSparseNDimArray(Christoffel_symbols_of_the_second_kind)
|
|
682
|
+
except Exception as e:
|
|
683
|
+
raise TypeError(
|
|
684
|
+
'The `LeviCivitaConnection` class initializer expects an ImmutableSparseNDimArray '
|
|
685
|
+
'or array-like data that can be converted to one. '
|
|
686
|
+
f'Failed to convert the input: {e}'
|
|
687
|
+
)
|
|
688
|
+
|
|
689
|
+
# Check the shape of the Christoffel symbols
|
|
690
|
+
shapeCheck = Christoffel_symbols_of_the_second_kind.shape
|
|
691
|
+
if len(shapeCheck) != 3 or len(set(shapeCheck)) != 1:
|
|
692
|
+
raise TypeError(
|
|
693
|
+
'The `LeviCivitaConnection` class initializer was given array data for the '
|
|
694
|
+
'`Christoffel_symbols_of_the_second_kind` of invalid shape.'
|
|
695
|
+
)
|
|
696
|
+
|
|
697
|
+
# Check that the coordinate space matches the Christoffel symbols' size
|
|
698
|
+
if len(varSpace) != shapeCheck[0]:
|
|
699
|
+
raise TypeError(
|
|
700
|
+
'The `LeviCivitaConnection` class initializer was given array data for the '
|
|
701
|
+
'`Christoffel_symbols_of_the_second_kind` of invalid size relative to the provided coordinate space. '
|
|
702
|
+
'Number of coordinates must match the Christoffel symbols\' index range.'
|
|
703
|
+
)
|
|
704
|
+
|
|
705
|
+
# Handle variable type based on the default handling mode
|
|
706
|
+
if variable_handling_default == 'complex':
|
|
707
|
+
if all(var in variable_registry['conversion_dictionaries']['realToSym'] for var in varSpace):
|
|
708
|
+
self._varSpace_type = 'real'
|
|
709
|
+
elif all(var in variable_registry['conversion_dictionaries']['symToReal'] for var in varSpace):
|
|
766
710
|
self._varSpace_type = 'complex'
|
|
767
711
|
else:
|
|
768
|
-
raise KeyError(
|
|
712
|
+
raise KeyError(
|
|
713
|
+
'To initialize a `LeviCivitaConnectionClass` instance with variable_handling_default=\'complex\', '
|
|
714
|
+
'`varSpace` must contain only variables from DGCV\'s complex variables systems, and all variables in '
|
|
715
|
+
'`varSpace` must be simultaneously among the real and imaginary types, or simultaneously among the '
|
|
716
|
+
'holomorphic and antiholomorphic types. Use `complexVarProc` to easily create DGCV complex variable systems.'
|
|
717
|
+
)
|
|
769
718
|
else:
|
|
770
|
-
self._varSpace_type='standard'
|
|
719
|
+
self._varSpace_type = 'standard'
|
|
720
|
+
|
|
721
|
+
# Assign attributes
|
|
771
722
|
self.Christoffel_symbols = Christoffel_symbols_of_the_second_kind
|
|
772
|
-
self.varSpace=varSpace
|
|
723
|
+
self.varSpace = varSpace
|
|
773
724
|
|
|
774
725
|
def __call__(self,vf1,vf2):
|
|
775
726
|
if not all([isinstance(vf1,VFClass), isinstance(vf2,VFClass)]):
|
|
776
727
|
raise TypeError('`LeviCivitaConnectionClass` only operates on pairs of VFClass objects.')
|
|
777
728
|
dimLoc=len(self.varSpace)
|
|
778
729
|
def _coeff(VF1,VF2,l):
|
|
779
|
-
term1=
|
|
780
|
-
term2=
|
|
730
|
+
term1=sum([diff(VF2.coeffs[l],self.varSpace[j])*VF1.coeffs[j] for j in range(dimLoc)])
|
|
731
|
+
term2=sum([self.Christoffel_symbols[j,k,l]*VF1.coeffs[j]*VF2.coeffs[k] for j in range(dimLoc) for k in range(dimLoc)])
|
|
732
|
+
return term1+term2
|
|
781
733
|
|
|
782
734
|
if self._varSpace_type=='standard':
|
|
783
735
|
vf1=changeVFBasis(vf1,self.varSpace)
|
|
784
|
-
vf2=
|
|
736
|
+
vf2=changeVFBasis(vf2,self.varSpace)
|
|
785
737
|
newCoeffs=[_coeff(vf1,vf2,l) for l in range(dimLoc)]
|
|
786
738
|
return VFClass(self.varSpace,newCoeffs)
|
|
787
739
|
elif self._varSpace_type=='real':
|
|
@@ -11,7 +11,7 @@ _ = get_variable_registry()
|
|
|
11
11
|
############# library
|
|
12
12
|
from .classesAndVariables import DFClass, VFClass, STFClass, TFClass, DGCVPolyClass, FAClass, AlgebraElement, createVariables, holToReal, realToSym, symToHol, holToSym, realToHol, symToReal, allToReal, allToHol, allToSym, complex_struct_op, conjugate_DGCV, conj_with_real_coor, re_with_real_coor, im_with_real_coor, conj_with_hol_coor, re_with_hol_coor, im_with_hol_coor, cleanUpConjugation, compressDGCVClass, VF_coeffs, changeVFBasis, addVF, scaleVF, VF_bracket, changeDFBasis, changeTFBasis, changeSTFBasis, scaleDF, addDF, exteriorProduct, addSTF, addTF, scaleTF, tensorProduct, holVF_coeffs, antiholVF_coeffs, complexVFC, conjComplex, realPartOfVF, createFiniteAlg, algebraDataFromVF, algebraDataFromMatRep, killingForm, adjointRepresentation, listVar, clearVar, DGCV_snapshot, variableSummary
|
|
13
13
|
from .combinatorics import chooseOp, permSign, carProd
|
|
14
|
-
from .
|
|
14
|
+
from .complexStructures import Del, DelBar, KahlerStructure
|
|
15
15
|
from .CRGeometry import tangencyObstruction, weightedHomogeneousVF, findWeightedCRSymmetries, model2Nondegenerate
|
|
16
16
|
from .polynomials import createPolynomial, createBigradPolynomial, monomialWeight, getWeightedTerms
|
|
17
17
|
from .RiemannianGeometry import metricClass, metric_from_matrix, LeviCivitaConnectionClass
|
|
@@ -2633,7 +2633,7 @@ class DGCVPolyClass(Basic):
|
|
|
2633
2633
|
return filtered_monomials
|
|
2634
2634
|
|
|
2635
2635
|
def get_coeffs(self, min_degree=0, max_degree=None, format='unformatted', return_coeffs=False):
|
|
2636
|
-
return get_monomials(self, min_degree=0, max_degree=max_degree, format=format, return_coeffs=True)
|
|
2636
|
+
return self.get_monomials(self, min_degree=0, max_degree=max_degree, format=format, return_coeffs=True)
|
|
2637
2637
|
|
|
2638
2638
|
@property
|
|
2639
2639
|
def holomorphic_part(self):
|
|
@@ -3295,7 +3295,6 @@ class FAClass(Basic):
|
|
|
3295
3295
|
return det != 0
|
|
3296
3296
|
|
|
3297
3297
|
# algebra element class
|
|
3298
|
-
|
|
3299
3298
|
class AlgebraElement(Basic):
|
|
3300
3299
|
def __new__(cls, algebra, coeffs, format_sparse=False):
|
|
3301
3300
|
# Ensure the algebra is of type FAClass
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
DGCV: Differential Geometry with Complex Variables
|
|
3
3
|
|
|
4
|
-
This module provides tools uniquely relevant for complex differential geometry within the DGCV package. It includes
|
|
5
|
-
Dolbeault operators (Del and DelBar) and a class for constructing and analyzing Kähler
|
|
6
|
-
structures.
|
|
4
|
+
This module provides tools uniquely relevant for complex differential geometry within the DGCV package. It includes Dolbeault operators (Del and DelBar) and a class for constructing and analyzing Kähler structures.
|
|
7
5
|
|
|
8
6
|
Key Functions:
|
|
9
7
|
- Del(): Applies the holomorphic Dolbeault operator ∂ to a differential form or scalar.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
from .classesAndVariables import allToReal, allToSym, VF_coeffs, addVF, STFClass, DFClass, TFClass
|
|
3
3
|
from .RiemannianGeometry import metricClass
|
|
4
|
-
from .
|
|
4
|
+
from .complexStructures import KahlerStructure
|
|
5
5
|
from .vectorFieldsAndDifferentialForms import get_VF, get_DF
|
|
6
6
|
from .config import get_variable_registry
|
|
7
7
|
from sympy import Basic, simplify, re, im
|
|
@@ -1,12 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DGCV: Polynomial Tools
|
|
3
|
+
|
|
4
|
+
This module integrates DGCV's complex variable handling features with SymPy's core polynomial functionality.
|
|
5
|
+
It provides functions for creating and manipulating polynomials with variable coefficients registered
|
|
6
|
+
in DGCV's Variable Management Framework (VMF). The polynomials created by these functions are compatible
|
|
7
|
+
with the DGCVPolyClass, which wraps SymPy.Poly objects to support DGCV's framework for managing complex
|
|
8
|
+
variable systems.
|
|
9
|
+
|
|
10
|
+
Key Functions:
|
|
11
|
+
|
|
12
|
+
Polynomial Creation:
|
|
13
|
+
- createPolynomial(): Constructs a polynomial with specified degree and variables, supporting
|
|
14
|
+
homogeneous and weighted homogeneous options.
|
|
15
|
+
- createBigradPolynomial(): Creates a polynomial that is weighted-homogeneous with respect
|
|
16
|
+
to two independent weight systems.
|
|
17
|
+
|
|
18
|
+
Term and Monomial Handling:
|
|
19
|
+
- getWeightedTerms(): Extracts terms from a polynomial that satisfy specific weighted homogeneity
|
|
20
|
+
conditions.
|
|
21
|
+
- monomialWeight(): Computes the weight of a monomial with respect to a given weight system.
|
|
22
|
+
|
|
23
|
+
Usage Notes:
|
|
24
|
+
- All functions in this module register created variables in the VMF for consistency across the DGCV framework.
|
|
25
|
+
- These functions are designed to work seamlessly with DGCVPolyClass objects but can also operate on standard
|
|
26
|
+
SymPy expressions.
|
|
27
|
+
|
|
28
|
+
Dependencies:
|
|
29
|
+
- sympy: Core symbolic mathematics library used for polynomial manipulation.
|
|
30
|
+
- functools: Provides the `reduce` function for processing monomials.
|
|
31
|
+
- operator: Supplies the `mul` operator for combining monomial components.
|
|
32
|
+
- warnings: Used for issuing warnings in functions.
|
|
33
|
+
- DGCV modules:
|
|
34
|
+
- combinatorics: Handles combinatorial logic for generating polynomial terms.
|
|
35
|
+
- classesAndVariables: Interfaces with the DGCV framework for variable management.
|
|
36
|
+
- config: Provides `_cached_caller_globals` for managing global variable states.
|
|
37
|
+
|
|
38
|
+
Author: David Sykes (https://www.realandimaginary.com/dgcv/)
|
|
39
|
+
|
|
40
|
+
License:
|
|
41
|
+
MIT License
|
|
42
|
+
"""
|
|
43
|
+
|
|
1
44
|
############## dependencies
|
|
2
45
|
import sympy
|
|
3
|
-
from sympy import prod, ln, exp
|
|
46
|
+
from sympy import prod, ln, exp, expand
|
|
4
47
|
from .combinatorics import *
|
|
5
48
|
from .classesAndVariables import *
|
|
6
49
|
from .config import _cached_caller_globals
|
|
7
50
|
from functools import reduce
|
|
8
51
|
from operator import mul
|
|
9
|
-
|
|
52
|
+
import warnings
|
|
10
53
|
|
|
11
54
|
############## creating polynomials (monomialsOfPoly is in classesAndVariables.py)
|
|
12
55
|
|
|
@@ -170,6 +213,8 @@ def createBigradPolynomial(arg1, arg2, arg3, arg4, arg5, _tempVar=None, returnMo
|
|
|
170
213
|
else:
|
|
171
214
|
return sum(monomials)
|
|
172
215
|
|
|
216
|
+
from sympy import simplify, expand, ln, exp, Poly
|
|
217
|
+
import warnings
|
|
173
218
|
|
|
174
219
|
def monomialWeight(arg1, arg2, arg3):
|
|
175
220
|
"""
|
|
@@ -192,16 +237,28 @@ def monomialWeight(arg1, arg2, arg3):
|
|
|
192
237
|
Raises
|
|
193
238
|
------
|
|
194
239
|
ValueError
|
|
195
|
-
If the length of *arg2* and *arg3* do not match
|
|
196
|
-
|
|
240
|
+
If the length of *arg2* and *arg3* do not match.
|
|
241
|
+
|
|
197
242
|
Notes
|
|
198
243
|
-----
|
|
244
|
+
- A warning is issued if the input is not detected as a monomial.
|
|
199
245
|
- The weight is computed by taking the logarithm of the monomial and substituting
|
|
200
246
|
each variable with an exponential weight as specified in *arg3*.
|
|
201
247
|
"""
|
|
202
248
|
if len(arg2) != len(arg3):
|
|
203
249
|
raise ValueError("The number of variables and weights must match.")
|
|
204
250
|
|
|
251
|
+
# Expand and simplify the expression
|
|
252
|
+
arg1 = simplify(expand(arg1))
|
|
253
|
+
|
|
254
|
+
# Check if the expression is a monomial
|
|
255
|
+
try:
|
|
256
|
+
poly = Poly(arg1, *arg2)
|
|
257
|
+
if len(poly.terms()) > 1:
|
|
258
|
+
warnings.warn(f"Input {arg1} is not a monomial (contains multiple terms). Proceeding anyway.")
|
|
259
|
+
except Exception:
|
|
260
|
+
warnings.warn(f"Input {arg1} could not be interpreted as a polynomial in {arg2}. Proceeding anyway.")
|
|
261
|
+
|
|
205
262
|
# Isolate the coefficient by setting all variables to 1
|
|
206
263
|
coeffLoc = simplify(arg1.subs([(var, 1) for var in arg2]))
|
|
207
264
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DGCV
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Differential Geometry with Complex Variables
|
|
5
5
|
Author: David Sykes
|
|
6
6
|
Author-email: David Sykes <david@realandimaginary.com>
|
|
@@ -24,7 +24,7 @@ DGCV was developed using Python 3.12, with dependencies on the SymPy and Pandas
|
|
|
24
24
|
- Fully featured symbolic representations of vector fields, differential forms, and tensor fields
|
|
25
25
|
- Intuitive interactions with complex structures from holomorphic coordinate systems: DGCV objects dynamically manage coordinate transformations between real and holomorphic coordinates during computation as necessary, so objects can be represented in and freely converted between either coordinate format at any time.
|
|
26
26
|
- Dedicated python classes for representing common differential geometric structures including Riemannian metrics, Kahler structures, and more
|
|
27
|
-
- Custom LaTeX rendering
|
|
27
|
+
- Custom LaTeX rendering for clean visual representation of mathematical objects, ideal for sharing mathematical ideas through clear Jupyter notebooks.
|
|
28
28
|
|
|
29
29
|
## Installation
|
|
30
30
|
|
|
@@ -66,7 +66,7 @@ DGCV documentation is hosted at [https://www.realandimaginary.com/dgcv/](https:/
|
|
|
66
66
|
DGCV is licensed under the MIT License. See the `LICENSE.txt` file for more information.
|
|
67
67
|
|
|
68
68
|
## Author
|
|
69
|
-
DGCV was created and is maintained by [David Sykes](https://
|
|
69
|
+
DGCV was created and is maintained by [David Sykes](https://www.realandimaginary.com).
|
|
70
70
|
|
|
71
71
|
---
|
|
72
72
|
|
|
@@ -12,7 +12,7 @@ src/DGCV/__init__.py
|
|
|
12
12
|
src/DGCV/_safeguards.py
|
|
13
13
|
src/DGCV/classesAndVariables.py
|
|
14
14
|
src/DGCV/combinatorics.py
|
|
15
|
-
src/DGCV/
|
|
15
|
+
src/DGCV/complexStructures.py
|
|
16
16
|
src/DGCV/config.py
|
|
17
17
|
src/DGCV/coordinateMaps.py
|
|
18
18
|
src/DGCV/finiteDimAlgebras.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|