Python3 Basics

Preliminaries

All code in this section expects you to have the followoing import in the beginning of your file

from dqrobotics import *

Binary Operations

Preliminaries

Suppose you have the dual quaternions

\(\dq{h_1}=1+\imi+\imj+\imk+\dual(1 + \imi + \imj + \imk)\)

and

\(\dq{h_2}=2+2\imi+2\imj+2\imk+\dual(2 + 2\imi + 2\imj + 2\imk)\).

They can be declared in DQ Robotics as

h1 = DQ([1,1,1,1,1,1,1,1])
h2 = DQ([2,2,2,2,2,2,2,2])

Operations

  1. Sum \(\dq{h_3} = \dq{h_1} + \dq{h_2}\)

h3 = h1+h2 #Python
h3 = h1+h2; %Matlab
DQ h3 = h1+h2; //cpp
  1. Subtraction \(\dq{h_3} = \dq{h_1} - \dq{h_2}\)

h3 = h1-h2
  1. Multiplication \(\dq{h_3} = \dq{h_1}\dq{h_2}\)

h3 = h1*h2