Ask Your Question
0

How to find the norm of a quaternion?

asked 2019-08-23 05:16:49 -0500

Shouvik gravatar image

updated 2019-08-31 10:00:00 -0500

dan_fulea gravatar image

EDIT︠ED: (never start with the code, always put the wanted question also in the posted question, not only in the title.)

N.<a1,a2,a3,a4,b1,b2,b3,b4,a,b> = QQ[]
H.<i,j,k> = QuaternionAlgebra(Frac(N),-1,-1)
p = a1 + a2 * i + a3 * j + a4 * k
q = b1 + b2 * i + b3 * j + b4 * k
r=(1-a-2*b)*(1-p*q+a*p)
r.norm()
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2019-08-23 05:50:04 -0500

Emmanuel Charpentier gravatar image

[ Please, take the time to format your code properly, using the "101010` butten orf the damn' editor...]

(Sort-of) WorksForMe ... *provided * that you take the pain to use Sage's syntax (which requires the use of * to denote multiplication...).

sage: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:N.<a1,a2,a3,a4,b1,b2,b3,b4,a,b> = QQ[]
:H.<i,j,k> = QuaternionAlgebra(Frac(N),-1,-1)
:p = a1 + a2 * i + a3 * j + a4 * k
:q = b1 + b2 * i + b3 * j + b4 * k
:r=(1-a-2*b)*(1-p*q+a*p)
:
:--

Indeed, r parent's category, which is:

sage: r.parent()
Quaternion Algebra (-1, -1) with base ring Fraction Field of Multivariate Polynomial Ring in a1, a2, a3, a4, b1, b2, b3, b4, a, b over Rational Field

, by the way), has no norm, method. But it has ûreduced_norm:

sage: r.reduced_norm().factor()
(a + 2*b - 1)^2 * (a1^2*b1^2 + a2^2*b1^2 + a3^2*b1^2 + a4^2*b1^2 + a1^2*b2^2 + a2^2*b2^2 + a3^2*b2^2 + a4^2*b2^2 + a1^2*b3^2 + a2^2*b3^2 + a3^2*b3^2 + a4^2*b3^2 + a1^2*b4^2 + a2^2*b4^2 + a3^2*b4^2 + a4^2*b4^2 - 2*a1^2*b1*a - 2*a2^2*b1*a - 2*a3^2*b1*a - 2*a4^2*b1*a + a1^2*a^2 + a2^2*a^2 + a3^2*a^2 + a4^2*a^2 - 2*a1*b1 + 2*a2*b2 + 2*a3*b3 + 2*a4*b4 + 2*a1*a + 1)

HTH,

edit flag offensive delete link more

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: 2019-08-23 05:16:49 -0500

Seen: 68 times

Last updated: Aug 31 '19