biVector forum

Problem with the generated example code

Hi everybody,

I tried the python example code ‘’ from the /tools section and got a problem at the first step. It seems like the product does not work as expected in the line

ROT = rotor(math.pi/2.0,E1*E2)


ZeroDivisionError Traceback (most recent call last)
~/Downloads/ in
416 # Elements of the even subalgebra (scalar + bivector + pss) of unit length are motors
–> 417 ROT = rotor(math.pi/2.0,E1*E2)
419 # The outer product ^ is the MEET. Here we intersect the yz (x=0) and xz (y=0) planes.

~/Downloads/ in rotor(angle, line)
374 # A rotor (Euclidean line) and translator (Ideal line)
375 def rotor(angle,line):
–> 376 return math.cos(angle/2.0) + math.sin(angle/2.0)*line.normalized()
378 def translator(dist,line):

~/Downloads/ in normalized(a)
371 def normalized(a):
–> 372 return a*(1/a.norm())
374 # A rotor (Euclidean line) and translator (Ideal line)

ZeroDivisionError: float division by zero

Whenever I multiply a basis element by itself it returns 0.
Is there a problem with my python setup?

1 Like

Apparently, the website section /tools contains old example code.
The working version is here

There also appears to be a problem with the generated code examples in the /tools section for the PGA2D. For example, the inner (Dot) and outer (Wedge) products appear to be missing a single line of code which sets the first element of the multi-vector result. So does the full geometric product. For the geometric product I had to work out what the missing line should have been. The same mistake(?) appears in all the different languages provided (cpp, cs, py, rs). I could not find these 2D examples code on the github site to see if it had corrected. Am I missing something?

The generator online at the tools section of, has been updated to the latest generator. These issues should be fixed.



1 Like