-
Notifications
You must be signed in to change notification settings - Fork 68
0.4.3 release #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.4.3 release #11
Changes from all commits
a3b5758
a179957
27743b0
d8b8012
7085dbe
37e78ba
0f26536
6f72e46
a018c14
0c0a982
0bbe5e2
1fd0093
78efe65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,16 @@ Installing Galgebra | |
|
||
### Dependencies | ||
|
||
- [Python](https://www.python.org/) 2.7 | ||
- with experimental Python 3 support | ||
- [Python](https://www.python.org/) 2.7 & 3 | ||
- tests pass under both Python 2.7 & 3.6 | ||
- [SymPy](https://www.sympy.org) | ||
|
||
### Installing Galgebra From PyPI | ||
|
||
```bash | ||
pip install galgebra | ||
``` | ||
|
||
### Installing Galgebra From Source | ||
|
||
To install from local source code, run from the repository root: | ||
|
@@ -31,8 +36,6 @@ To install from local source code, run from the repository root: | |
pip install . | ||
``` | ||
|
||
We are also working towards a PyPI release based on pygae/galgebra. | ||
|
||
### Running tests to verify the installation | ||
|
||
Run from the repository root: | ||
|
@@ -51,10 +54,6 @@ pytest test | |
TODO | ||
----- | ||
|
||
Get compatible with python 3 | ||
|
||
Get Travis set up with some good tests | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 2 TODOs are done. 😄 |
||
Get the docs on read the docs | ||
|
||
Ensure functions are documented | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
from printer import Format,xpdf | ||
from ga import Ga | ||
from mv import Com | ||
from __future__ import absolute_import, division | ||
from __future__ import print_function | ||
from galgebra.printer import Format, xpdf | ||
from galgebra.ga import Ga | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the users install galgebra from pip, the way of importing the modules has to conform to the standard "namespaced" way instead of just importing modules from a global namespace. This might break some old code but it's a necessary transition process. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed |
||
|
||
Format() | ||
g4d = Ga('a b c d') | ||
(a,b,c,d) = g4d.mv() | ||
|
||
print 'g_{ij} =',g4d.g | ||
print '\\bm{a|(b*c)} =',a|(b*c) | ||
print '\\bm{a|(b^c)} =',a|(b^c) | ||
print '\\bm{a|(b^c^d)} =',a|(b^c^d) | ||
print '\\bm{a|(b^c)+c|(a^b)+b|(c^a)} =',(a|(b^c))+(c|(a^b))+(b|(c^a)) | ||
print '\\bm{a*(b^c)-b*(a^c)+c*(a^b)} =',a*(b^c)-b*(a^c)+c*(a^b) | ||
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) | ||
print '\\bm{(a^b)|(c^d)} =',(a^b)|(c^d) | ||
print '\\bm{((a^b)|c)|d} =',((a^b)|c)|d | ||
print '\\bm{(a^b)\\times (c^d)} =',Com(a^b,c^d) | ||
xpdf(paper='letter',prog=True) | ||
|
||
|
||
|
||
(a, b, c, d) = g4d.mv() | ||
|
||
print('g_{ij} =', g4d.g) | ||
print('\\bm{a|(b*c)} =', a | (b * c)) | ||
print('\\bm{a|(b^c)} =', a | (b ^ c)) | ||
print('\\bm{a|(b^c^d)} =', a | (b ^ c ^ d)) | ||
# FIXME:FIXED this should print 0, got blank | ||
print('\\bm{a|(b^c)+c|(a^b)+b|(c^a)} =', | ||
(a | (b ^ c)) + (c | (a ^ b)) + (b | (c ^ a))) | ||
print('\\bm{a*(b^c)-b*(a^c)+c*(a^b)} =', | ||
a * (b ^ c) - b * (a ^ c) + c * (a ^ b)) | ||
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)) | ||
print('\\bm{(a^b)|(c^d)} =', (a ^ b) | (c ^ d)) | ||
print('\\bm{((a^b)|c)|d} =', ((a ^ b) | c) | d) | ||
print('\\bm{(a^b)\\times (c^d)} =', Ga.com(a ^ b, c ^ d)) | ||
xpdf(paper='letter', prog=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
|
||
from __future__ import absolute_import, division | ||
from __future__ import print_function | ||
import sys | ||
from sympy import symbols,sin,cos | ||
from printer import Format,xpdf,Get_Program,Print_Function | ||
from ga import Ga | ||
from sympy import symbols, sin, cos | ||
from galgebra.printer import Format, xpdf, Get_Program, Print_Function | ||
from galgebra.ga import Ga | ||
|
||
Format() | ||
coords = symbols('t x y z',real=True) | ||
(st4d,g0,g1,g2,g3) = Ga.build('gamma*t|x|y|z',g=[1,-1,-1,-1],coords=coords) | ||
coords = symbols('t x y z', real=True) | ||
(st4d, g0, g1, g2, g3) = Ga.build( | ||
'gamma*t|x|y|z', g=[1, -1, -1, -1], coords=coords) | ||
I = st4d.i | ||
|
||
(m,e) = symbols('m e') | ||
(m, e) = symbols('m e') | ||
|
||
psi = st4d.mv('psi','spinor',f=True) | ||
A = st4d.mv('A','vector',f=True) | ||
sig_z = g3*g0 | ||
psi = st4d.mv('psi', 'spinor', f=True) | ||
A = st4d.mv('A', 'vector', f=True) | ||
sig_z = g3 * g0 | ||
|
||
print '\\text{4-Vector Potential\\;\\;}\\bm{A} =',A | ||
print '\\text{8-component real spinor\\;\\;}\\bm{\\psi} =',psi | ||
print('\\text{4-Vector Potential\\;\\;}\\bm{A} =', A) | ||
print('\\text{8-component real spinor\\;\\;}\\bm{\\psi} =', psi) | ||
|
||
dirac_eq = (st4d.grad*psi)*I*sig_z-e*A*psi-m*psi*g0 | ||
dirac_eq = (st4d.grad * psi) * I * sig_z - e * A * psi - m * psi * g0 | ||
dirac_eq = dirac_eq.simplify() | ||
|
||
dirac_eq.Fmt(3,r'%\text{Dirac Equation\;\;}\nabla \bm{\psi}'+\ | ||
r' I \sigma_{z}-e\bm{A}\bm{\psi}-m\bm{\psi}\gamma_{t} = 0') | ||
xpdf(paper='landscape',prog=True) | ||
# FIXME terms of \psi^{ty} are not grouped together | ||
print(dirac_eq.Fmt(3, r'%\text{Dirac Equation\;\;}\nabla \bm{\psi}' + | ||
r' I \sigma_{z}-e\bm{A}\bm{\psi}-m\bm{\psi}\gamma_{t} = 0')) | ||
xpdf(paper='landscape', prog=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,44 @@ | ||
from __future__ import absolute_import, division | ||
from __future__ import print_function | ||
from sympy import symbols, sin | ||
from printer import Format,xpdf | ||
from ga import Ga | ||
from galgebra.printer import Format, xpdf | ||
from galgebra.ga import Ga | ||
|
||
Format() | ||
coords = (x,y,z) = symbols('x y z',real=True) | ||
(o3d,ex,ey,ez) = Ga.build('e*x|y|z',g=[1,1,1],coords=coords) | ||
X = x*ex+y*ey+z*ez | ||
coords = (x, y, z) = symbols('x y z', real=True) | ||
(o3d, ex, ey, ez) = Ga.build('e*x|y|z', g=[1, 1, 1], coords=coords) | ||
X = x * ex + y * ey + z * ez | ||
I = o3d.i | ||
v = o3d.mv('v','vector') | ||
f = o3d.mv('f','scalar',f=True) | ||
A = o3d.mv('A','vector',f=True) | ||
dd = v|o3d.grad | ||
lap = o3d.grad*o3d.grad | ||
print r'\bm{X} =',X | ||
print r'\bm{v} =',v | ||
print r'\bm{A} =', A | ||
print r'%\bm{v}\cdot\nabla =', dd | ||
print r'%\nabla^{2} =',lap | ||
print r'%\bm{v}\cdot\nabla f =',dd*f | ||
print r'%\nabla^{2} f =',lap*f | ||
print r'%\nabla^{2} \bm{A} =',lap*A | ||
print r'%\bar{\nabla}\cdot v =', o3d.rgrad|v | ||
Xgrad = X|o3d.grad | ||
rgradX = o3d.rgrad|X | ||
print r'%\bm{X}\cdot \nabla =', Xgrad | ||
print r'%\bar{\nabla}\cdot \bm{X} =', rgradX | ||
com = Xgrad - rgradX | ||
print r'%\bm{X}\cdot \nabla - \bar{\nabla}\cdot \bm{X} =', com | ||
sph_coords = (r,th,phi) = symbols('r theta phi',real=True) | ||
(sp3d,er,eth,ephi) = Ga.build('e',g=[1,r**2,r**2*sin(th)**2],\ | ||
coords=sph_coords,norm=True) | ||
f = sp3d.mv('f','scalar',f=True) | ||
lap = sp3d.grad*sp3d.grad | ||
print r'%\nabla^{2} = \nabla\cdot\nabla =', lap | ||
print r'%\lp\nabla^{2}\rp f =', lap*f | ||
print r'%\nabla\cdot\lp\nabla f\rp =',sp3d.grad|(sp3d.grad*f) | ||
xpdf(paper='landscape',crop=True) | ||
v = o3d.mv('v', 'vector') | ||
f = o3d.mv('f', 'scalar', f=True) | ||
A = o3d.mv('A', 'vector', f=True) | ||
dd = v | o3d.grad | ||
lap = o3d.grad * o3d.grad | ||
print(r'\bm{X} =', X) | ||
print(r'\bm{v} =', v) | ||
print(r'\bm{A} =', A) | ||
print(r'%\bm{v}\cdot\nabla =', dd) | ||
print(r'%\nabla^{2} =', lap) | ||
print(r'%\bm{v}\cdot\nabla f =', dd * f) | ||
print(r'%\nabla^{2} f =', lap * f) | ||
print(r'%\nabla^{2} \bm{A} =', lap * A) | ||
print(r'%\bar{\nabla}\cdot v =', o3d.rgrad | v) | ||
Xgrad = X | o3d.grad | ||
rgradX = o3d.rgrad | X | ||
print(r'%\bm{X}\cdot \nabla =', Xgrad) | ||
# FIXME This outputs incorrectly, the scalar part 3 is missing | ||
print(r'%\bar{\nabla}\cdot \bm{X} =', rgradX) | ||
# FIXME The following code complains: | ||
# ValueError: In Dop.Add complement flags have different values: False vs. True | ||
# com = Xgrad - rgradX | ||
# print(r'%\bm{X}\cdot \nabla - \bar{\nabla}\cdot \bm{X} =', com) | ||
sph_coords = (r, th, phi) = symbols('r theta phi', real=True) | ||
(sp3d, er, eth, ephi) = Ga.build('e', g=[1, r**2, r**2 * sin(th)**2], | ||
coords=sph_coords, norm=True) | ||
f = sp3d.mv('f', 'scalar', f=True) | ||
lap = sp3d.grad * sp3d.grad | ||
print(r'%\nabla^{2} = \nabla\cdot\nabla =', lap) | ||
print(r'%\lp\nabla^{2}\rp f =', lap * f) | ||
print(r'%\nabla\cdot\lp\nabla f\rp =', sp3d.grad | (sp3d.grad * f)) | ||
# FIXME crop didn't work, but pdf can be generated with TexLive 2017 installed | ||
xpdf(paper='landscape', crop=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests covers more forms of tests and collects the coverage stat data in one go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats neat