Ask Your Question
2

Symbolic variables with Clifford algebra

asked 2021-11-11 21:48:57 +0100

anon2203 gravatar image

Hello, a similar question was asked previously, but I am unable to use multiple symbolic variables with the answer. What I would like to do is the following:

sage: Q = QuadraticForm(ZZ,2,[1,1,1])                                                                                                                              
sage: Cl.<x,y> = CliffordAlgebra(Q)

Then, I would like to define two symbolic a and b variables

sage: a*x+b*y

such that this output is produced:

sage: (a*x+b*y)*(a*x+b*y)
a^2+b^2

How do I declare a and b so that this is possible?


I have tried a, b = var('a b') but a*x gives an error

sage: a*x
TypeError: unsupported operand parent(s) for *: 'Symbolic Ring' and 'The Clifford algebra of the Quadratic form in 2 variables over Integer Ring with coefficients: 
[ 1 1 ]
[ * 1 ]'

I have also tried R.<a> = PolynomialRing(ZZ) and it works for 1 variable. But if I also tried to add b, it fails

sage: R.<a,b> = PolynomialRing(ZZ)
sage: a*x+b*y
TypeError: unsupported operand parent(s) for +: 'Multivariate Polynomial Ring in a, b over Integer Ring' and 'The Clifford algebra of the Quadratic form in 2 variables over Integer Ring with coefficients: 
[ 1 1 ]
[ * 1 ]'
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2021-11-12 14:00:35 +0100

Max Alekseyev gravatar image

You can define Q over polynomial ring in a and b:

R.<a,b> = PolynomialRing(ZZ)
Q = QuadraticForm(R,2,[1,1,1])                                                                                                                              
Cl.<x,y> = CliffordAlgebra(Q)
edit flag offensive delete link more
0

answered 2024-04-28 02:48:25 +0100

anon2203 gravatar image

The correct answer is:

from sage.algebras.clifford_algebra import CliffordAlgebra
from sage.quadratic_forms.quadratic_form import QuadraticForm
from sage.symbolic.ring import SR

# Define the quadratic form for GA(3,1) over the Symbolic Ring
Q = QuadraticForm(SR, 4, [-1, 0, 0, 0, 1, 0, 0, 1, 0, 1])

# Initialize the GA(3,1) algebra over the Symbolic Ring
algebra = CliffordAlgebra(Q)

# Define the basis vectors
e0, e1, e2, e3 = algebra.gens()

# Define the scalar variables for each basis element
a, t, x, y, z, f01, f02, f03, f12, f23, f13, v, w, q, p, b = var('a t x y z f01 f02 f03 f12 f23 f13 v w q p b')

# Create a general multivector
u = a+t*e0+x*e1+y*e2+z*e3+f01*e0*e1+f02*e0*e2+f03*e0*e3+f12*e1*e2+f13*e1*e3+f23*e2*e3
edit flag offensive delete link more

Comments

In what sense it is "correct"? Was it incorrect before or what? Also it looks quite irrelevant to the question asked. Did you misplace it from https://ask.sagemath.org/question/771... by any chance?

Max Alekseyev gravatar imageMax Alekseyev ( 2024-04-28 03:39:50 +0100 )edit

What I mean is that I had to use SR instead of ZZ or PolynomialRing, and it works.

anon2203 gravatar imageanon2203 ( 2024-04-29 23:44:42 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-11-11 21:32:25 +0100

Seen: 389 times

Last updated: Apr 28