Ask Your Question

Spreeter's profile - activity

2019-01-03 19:25:01 +0200 commented question Quaternion * integer

class kvat(object):

a=0
b=0
c=0
d=0
def __init__(self,a,b,c,d):
    self.a = RR(a)
    self.b = RR(b)
    self.c = RR(c)
    self.d = RR(d)

def __repr__(self):
    return str(self.a) + "+" + str(self.b) + "i" + "+" + str(self.c) + "j" + "+" + str(self.d) + "k"


def __add__(self,other):

    q = self.a + other.a
    w = self.b + other.b
    v = self.c + other.c
    t = self.d + other.d
    return kvat(q,w,v,t)

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

2019-01-03 17:50:35 +0200 commented answer Quaternion * integer

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)
2019-01-03 16:36:01 +0200 asked a question 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'="">'

2019-01-03 14:52:33 +0200 received badge  Supporter (source)
2019-01-03 14:52:02 +0200 commented answer 3dplot molecule drawing

and how can i write something in/on a sphere?

2019-01-02 23:14:53 +0200 received badge  Student (source)
2019-01-02 23:03:25 +0200 asked a question 3dplot molecule drawing

Hello! I have to make a 3d model of the sulfur acid molecule, so that the name and mass of the molecules are visible on it and the bonds too(if 1 or 2 between 2 atoms). Can someone send a code or some info about 3d plotting?