QQuaterelle
Workflows

Coding workflows · Hamilton quaternion multiplication

03
Built around your work

A concrete starting point

Multiply two four-component Hamilton quaternions in scalar-first order with finite components bounded by ±10^6. Test identity and reversed basis products, rejecting Boolean components without silently normalizing inputs or claiming unit rotations.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Hamilton quaternion multiplication

A concrete starting point
import math

def quaternion_product(a, b):
    for q in (a, b):
        if type(q) not in (list, tuple) or len(q) != 4:
            raise ValueError("quaternion.shape")
        if any(type(x) not in (int, float) or not -10**6 <= x <= 10**6 or not math.isfinite(x) for x in q):
            raise ValueError("quaternion.value")
    w, x, y, z = a
    v, i, j, k = b
    return (w*v-x*i-y*j-z*k, w*i+x*v+y*k-z*j,
            w*j-x*k+y*v+z*i, w*k+x*j-y*i+z*v)

The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.

AI coding workspace

Your next change starts here.

Get the Windows app ↗