Replies: 8 comments
-
Your mistake is that you use |
Beta Was this translation helpful? Give feedback.
-
No.
Even if your argument would be true, it would only reinforce the problem that the galgebra module is incompatible with the rest of the world, mainly by overloading fundamental operators like *. My Use Case: In a jupyter notebook with python-sagemath kernel I would like to use galgebra to calculate some geometric objects and visualize the result using SageMath. But when trying the visualization after using galgebra I get the error that the |
Beta Was this translation helpful? Give feedback.
-
Can you share the exact code you're using for 2 |
Beta Was this translation helpful? Give feedback.
-
Attached is a version that does not produce excess terms by avoiding any use of math. From my other experiments it seems that excess terms are produced as soon as math is involved, for example by using in this script
import math
pim=math.cos(math.pi)
u=e_1+2*e_2+(3*pim)*e_3 import sympy
from sympy import symbols
from galgebra.ga import *
from galgebra.printer import latex
from IPython.display import Math
#import math
#pi=math.pi
pi=sympy.pi
# tell sympy to use our printing by default
sympy.init_printing(latex_printer=latex, use_latex='mathjax')
xyz = (x, y, z) = symbols('x y z', real=True)
o3d = Ga('e_1 e_2 e_3', g=[1, 1, 1], coords=xyz)
e_1, e_2, e_3 = o3d.mv()
print('sympy, pi, e, sin, cos and galgebra loaded')
def normed(x):
return (1/x.norm())*x
theta=pi/4
I=e_1*e_2*e_3
n=normed(e_1+e_2+e_3)
i=n*I
it=i*(theta/2)
u=e_1+2*e_2+3*e_3
v=((-it).exp())*u*(it.exp())
show(v) |
Beta Was this translation helpful? Give feedback.
-
Yes, as soon as you use the Note you can paste code directly into comments here by using |
Beta Was this translation helpful? Give feedback.
-
In GAlgebra's *mv.py* module there are various built-in functions. Three
of them
*proj(B:Mv, A:Mv)*
# projects the multivector *A* onto the subspace defined by the blade
*B*
*rot(itheta:Mv, A:Mv)*
# rotates the multivector *A* through the directed angle defined by the
2-blade *itheta*
*refl(B:Mv, A:Mv)*
# reflects the multivector *A* through the subspace spanned by the
blade *B*
were added over a decade ago while Alan Macdonald was writing his
textbook *Linear
and Geometric Algebra*. (Many of that textbook 's problems suggest the use
of GAlgebra.)
Some coding effort would be saved were you to simply use *rot(itheta, A)*.
The answers by other respondents about round-off errors from use of the
module math are still relevant.
…On Sun, Apr 2, 2023 at 6:14 AM Eric Wieser ***@***.***> wrote:
Yes, as soon as you use the math module you are working with
floating-point approximations and not symbolic calculations.
Note you can paste code directly into comments here by using ``` around it
—
Reply to this email directly, view it on GitHub
<#484 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG2OCIDDDGAIDUQG45QKGSDW7FNPNANCNFSM6AAAAAAVWJCBSE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Indeed, the function referred to by @Greg1950 can be found in the docs here |
Beta Was this translation helpful? Give feedback.
-
The meaning of the Lines 1093 to 1100 in 3a53b29 |
Beta Was this translation helpful? Give feedback.
-
I am trying to calculate the image of a 3D vector$u=e_1+2e_2+3e_3$ under the rotation with axis vector $e_1+e_2+e_3$ . I would expect to get a vector as image but the calculation yields a vector + a tiny multiple of $e_1\wedge e_2\wedge e_3$ , perhaps due to rounding errors.
The code is attached
gaerror.txt
Edit: Using an updated version of galgebra as described in http://www.faculty.luther.edu/~macdonal/GAlgebraPrimer.pdf and then using the exp() method from galgebra yields exactly the same result.
Beta Was this translation helpful? Give feedback.
All reactions