Comments (17)
The following is not slow for me -
'
from galgebra.ga import Ga
from sympy import Symbol
from galgebra.printer import Format, xtex
Format()
GA, e_0, e_1, e_2, e_3 = Ga.build("e*0|1|2|3", g='-1 0 0 0, 0 1 0 0, 0 0 1 0, 0 0 0 1')
e_0_inv = e_0.inv()
print('e_0^{-1} =', e_0_inv)
p = GA.mv((1, Symbol('p1'), Symbol('p2'), Symbol('p3')), 'vector')
q = GA.mv((0, Symbol('q1'), Symbol('q2'), Symbol('q3')), 'vector')
r = GA.mv((0, Symbol('r1'), Symbol('r2'), Symbol('r3')), 'vector')
print('p =',p)
print('q =',q)
print('r =',r)
A = q ^ r
X = (p ^ A) # A plane
print(r'q\W r = A =',A)
print(r'p\W A = X =',X)
D = e_0_inv<X
print(r'e_0^{-1}\lfloor X = D =', e_0_inv<X)
#Dinv = D.rev()/(DD.rev()).scalar()
Dinv = D.inv()
print('D^{-1} =', Dinv.Fmt(3))
print('DD^{-1} =', DDinv)
N = e_0_inv < (e_0 ^ X)
print(r'e_0^{-1}\lfloor (e_0\W X) = N', N)
d = (e_0_inv < (e_0 ^ X)) * Dinv # Support vector from plane
print(r'(e_0^{-1}\lfloor (e_0\W X)) D^{-1} =',d.Fmt(3))
print('N/D =',N/D)
xtex()
'
Output is attached -
newslow.pdf
from galgebra.
It seems you don't compute d.inv() only d, but maybe I can compute d.inv() without calling this method.
from galgebra.
Here is the code for multivector division. The limitation in the code is that it only works if A.inv()
can be computed which for my code can only be computed if A*A.rev()
is a scalar. For you case there should be no problem since in 3d the inverse of any bivector can be computed.
def __div__(self, A):
if isinstance(A,Mv):
return self * A.inv()
else:
return self * (S(1)/A)
from galgebra.
Here is the whole thing method test11_6. This test checks a few formulas about duality with projective geometry. I don't restrain myself to P4 because I want to check various sign issues.
from galgebra.
Remind me how to run your code. It has been a long time since I used unittest.
from galgebra.
If you use pycharm, the IDE is able to run tests.
If you don't, you can add at the end of the file.
if __name__ == '__main__':
unittest.main()
If you run the script, it will run all the tests. You can just delete other tests. If it complains about path. You can add them at the top with
import sys
sys.path.append("a-path-to-galgebra")
from galgebra.
Is it supposed to pass all the tests?
from galgebra.
do you have a write up for what test11_12_2_2
is testing for? Symbolically (LaTeX) what is being tested? A reference or a link would be good if possible.
from galgebra.
One problem I found was that subs for a multivector expression was not substituting correctly.
from galgebra.
All tests available in test_chapter11.py pass. You can ignore all test but test11_6 for this issue. test11_12_2_2 is an attempt at solving an exercise in Leo Dorst book. L
and x_t
describe the same line, t_x
just retrieve t
from x
if x
is a point of L
.
from galgebra.
One problem I found was that subs for a multivector expression was not substituting correctly.
Which one ?
from galgebra.
test11_12_2_2 could have a problem with subs. If I comment that test out all the others run successfully in 5 sec.
from galgebra.
Sorry, I disabled the slow expressions before committing my work. You need to remove several #
.
from galgebra.
To get an idea of what is happening I ran a python notebook -
chap11slow.zip
I think the output shows why everthing slows down.
I also ordered a copy of Dorst's book so I know what you are talking about. I should get the book Wednesday so if you could tell me which equations you are programming that would help.
from galgebra.
I don't know if this has any relevance to your issues but I included some conformal model tests in my examples. Three of the examples in this file are for the conformal model -
latex_check.pdf
from galgebra.
I read the book and learn how to use galbegra. When I read something interesting, I write a test named after the chapter or the exercise. If a test is named test11_6, you can open the book at the chapter 11 section 6 and you will find the equations. I will probably add a few tests about the conformal model later, thanks.
d
becomes a very large expression.
from galgebra.
We can close this issue. galgebra isn't designed to make geometric proof but calculus. If I want to achieve some kind of proofs, I need to reduce the expression lenght myself by fixing things, ignoring norms if useless, using the right basis... :)
from galgebra.
Related Issues (20)
- Looking to Contribute GUI or Some Geometric Algorithms HOT 1
- Projective geometric algebra HOT 7
- Ubuntu 20.04 HOT 1
- Getting coords of multivector HOT 2
- Getting wrong type of multivector HOT 8
- Run tests on latest sympy HOT 1
- Extra `\cdot` since SymPy 1.10 HOT 2
- Broken `MatrixFunction` since SymPy 1.11 HOT 2
- Broken doc since #487 HOT 2
- Sync upstream updates HOT 2
- The sundial problem and a cheat sheet by Russell Goyder
- Mv class return 1 for all negative integer power HOT 20
- expression like 1/<Mv> raise exception HOT 2
- diff and pdiff method of class Mv throws exception when differentiate by a coordinate symbol HOT 4
- Mv.dual() method return wrong result HOT 7
- The wedge product operator ^ returns wrong result HOT 1
- Mv.grades return None under some situations HOT 1
- Mv.__pow__ is not returning Mv instance as return value when raise to power of zero HOT 5
- Make `__pow__` more performant
- Make `__pow__` support rational powers as well
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from galgebra.