Giter Club home page Giter Club logo

Comments (17)

 avatar commented on August 18, 2024 1

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} =', D
Dinv)
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.

meuns avatar meuns commented on August 18, 2024

It seems you don't compute d.inv() only d, but maybe I can compute d.inv() without calling this method.

from galgebra.

 avatar commented on August 18, 2024

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.

meuns avatar meuns commented on August 18, 2024

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.

 avatar commented on August 18, 2024

Remind me how to run your code. It has been a long time since I used unittest.

from galgebra.

meuns avatar meuns commented on August 18, 2024

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.

 avatar commented on August 18, 2024

Is it supposed to pass all the tests?

from galgebra.

 avatar commented on August 18, 2024

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.

 avatar commented on August 18, 2024

One problem I found was that subs for a multivector expression was not substituting correctly.

from galgebra.

meuns avatar meuns commented on August 18, 2024

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.

meuns avatar meuns commented on August 18, 2024

One problem I found was that subs for a multivector expression was not substituting correctly.

Which one ?

from galgebra.

 avatar commented on August 18, 2024

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.

meuns avatar meuns commented on August 18, 2024

Sorry, I disabled the slow expressions before committing my work. You need to remove several #.

from galgebra.

 avatar commented on August 18, 2024

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.

 avatar commented on August 18, 2024

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.

meuns avatar meuns commented on August 18, 2024

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.

meuns avatar meuns commented on August 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.