# Quaternion * integer

how can i multiply my own quaternion group elements with a normal integer?

it says this: unsupported operand parent(s) for +: 'Integer Ring' and '<class 'quater'="">'

Quaternion * integer

how can i multiply my own quaternion group elements with a normal integer?

it says this: unsupported operand parent(s) for +: 'Integer Ring' and '<class 'quater'="">'

1

by defining a method `def __mul__(self, other):`

in your class called `quater`

. Something like this:

```
def __mul__(self, other):
if isinstance(other, Integer):
...
return something
elif isinstance(other, quater):
...
return something else
else:
raise TypeError('multiplication with other(={}) not defined'.format(other))
```

i wrote it like this, and it works with two group elements but i cant multiply with 5,for example

def __mul__(self,other):

```
q = self.a * other.a - self.b * other.b - self.c * other.c - self.d * other.d
w = self.a * other.b + self.b * other.a + self.c * other.d - self.d * other.c
v = self.a * other.c + self.c * other.a + self.d * other.b - self.b * other.d
t = self.a * other.d + self.d * other.a + self.b * other.c - self.c * other.b
return quater(q,w,v,t)
```

Asked: **
2019-01-03 09:36:01 -0600
**

Seen: **74 times**

Last updated: **Jan 06**

morphism between permutation group and matrix group

Check if a finitely generated matrix group is finite (works with QQ and not with CC)

Matrix Group over Symbolic Ring

How to make group act on a set?

PermutationGroupMorphism_im_gens

How to use elements of cartesian product of two groups?

Univariate Polynomial Multiplication

question about galoisgroup of show(G[1](a)) of Q(x^6)

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.

Culd you please provide your implementation of the quaternions ?

class kvat(object):

and the mul down below, max comment lenght was reached but i copied it here already anyway