MAGIKS
1.1
Manipulator General Inverse Kinematic Solver
Main Page
Related Pages
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Pages
software
python
math_tools
algebra
complex.py
Go to the documentation of this file.
1
2
## @file complex.py
3
# @brief this module provides tools by which you can work with complex numbers
4
# @author Nima Ramezani Taghiabadi
5
#
6
# PhD Researcher
7
# Faculty of Engineering and Information Technology
8
# University of Technology Sydney (UTS)
9
# Broadway, Ultimo, NSW 2007, Australia
10
# Phone No. : 04 5027 4611
11
# Email(1) : nima.ramezani@gmail.com
12
# Email(2) : Nima.RamezaniTaghiabadi@uts.edu.au
13
# @version 1.0
14
#
15
# Start date: Februaty 2010
16
# Last Revision: 03 January 2015
17
18
import
math
19
20
class
Complex_Number
:
21
22
def
__init__
(self):
23
24
self.
ro
= 0
25
self.
teta
= 0
26
self.
re
= 0
27
self.
im
= 0
28
29
def
polar_to_cartesian
(self):
30
31
self.
re
= self.
ro
*math.cos(self.
teta
)
32
self.
im
= self.
ro
*math.sin(self.
teta
)
33
34
def
cartesian_to_polar
(self):
35
36
self.
ro
= math.sqrt(self.
re
*self-re+self.
im
*self.
im
)
37
self.
teta
= math.atan2(self.
im
,self.
re
)
38
39
40
41
42
43
def
complex_multiply
(c1,c2):
44
45
'''
46
This function multiplies c1 and c2 and returns the product
47
'''
48
49
c3.re = c1.re*c2.re-c1.im*c2.im
50
c3.im = c1.re*c2.im+c1.im*c2.re
51
52
c3.ro = c1.ro * c2.ro
53
c3.teta = c1.teta + c2.teta
54
55
while
c3.teta > 2*math.pi:
56
c3.teta = c3.teta-2*math.pi
57
58
while
c3.teta < -2*math.pi:
59
c3.teta = c3.teta+2*math.pi
60
math_tools.algebra.complex.Complex_Number.teta
teta
Definition:
complex.py:25
math_tools.algebra.complex.Complex_Number.re
re
Definition:
complex.py:26
math_tools.algebra.complex.Complex_Number.ro
ro
Definition:
complex.py:24
math_tools.algebra.complex.Complex_Number
Definition:
complex.py:20
math_tools.algebra.complex.complex_multiply
def complex_multiply
Definition:
complex.py:43
math_tools.algebra.complex.Complex_Number.im
im
Definition:
complex.py:27
math_tools.algebra.complex.Complex_Number.cartesian_to_polar
def cartesian_to_polar
Definition:
complex.py:34
math_tools.algebra.complex.Complex_Number.polar_to_cartesian
def polar_to_cartesian
Definition:
complex.py:29
math_tools.algebra.complex.Complex_Number.__init__
def __init__
Definition:
complex.py:22
Generated on Sat Jun 4 2016 20:04:29 for MAGIKS by
1.8.8