File: Scientific_12.html

package info (click to toggle)
python-scientific 2.4.11-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,956 kB
  • ctags: 3,063
  • sloc: python: 9,157; ansic: 4,483; xml: 4,145; makefile: 126; sh: 18; csh: 1
file content (151 lines) | stat: -rw-r--r-- 4,643 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<a name="Module:Scientific.Geometry"><h1>Module Scientific.Geometry</h1></a>

<p>This subpackage contains classes that deal with geometrical
quantities and objects. The geometrical quantities are vectors and
tensors, transformations, and quaternions as descriptions of
rotations.  There are also tensor fields, which were included here
(rather than in the subpackage Scientific.Functions) because they are
most often used in a geometric context. Finally, there are classes for
elementary geometrical objects such as spheres and planes.
</p>

<h1>Submodules:</h1>
<ul><li><a href="Scientific_13.html">Module Scientific.Geometry.Objects3D</a></ul>
<ul><li><a href="Scientific_14.html">Module Scientific.Geometry.Quaternion</a></ul>
<ul><li><a href="Scientific_15.html">Module Scientific.Geometry.TensorAnalysis</a></ul>
<ul><li><a href="Scientific_16.html">Module Scientific.Geometry.Transformation</a></ul>
<hr width=70%>
<a name="Class:Scientific.Geometry.Tensor"><h2>Class Tensor: Tensor in 3D space</h2></a>

<p>Constructor: Tensor([[xx, xy, xz], [yx, yy, yz], [zx, zy, zz]])</p>

<p>Tensors support the usual arithmetic operations
(<tt>t1</tt>, <tt>t2</tt>: tensors, <tt>v</tt>: vector, <tt>s</tt>: scalar): </p>

<ul>
<li> <p>

<tt>t1+t2</tt>        (addition)
</p><li> <p>

<tt>t1-t2</tt>        (subtraction)
</p><li> <p>

<tt>t1*t2</tt>        (tensorial (outer) product)
</p><li> <p>

<tt>t1*v</tt>         (contraction with a vector, same as t1.dot(v.asTensor()))
</p><li> <p>

<tt>s*t1</tt>, <tt>t1*s</tt> (multiplication with a scalar)
</p><li> <p>

<tt>t1/s</tt>         (division by a scalar)</p></ul>
<p>The coordinates can be extracted by indexing; a tensor of rank N
can be indexed like an array of dimension N.</p>

<p>Tensors are <i>immutable</i>, i.e. their elements cannot be changed.</p>

<p>Tensor elements can be any objects on which the standard
arithmetic operations are defined. However, eigenvalue calculation
is supported only for float elements.
</p>

<b>Methods:</b><br>
<ul>
<li> <b><i>asVector</i></b>()
<p>Returns an equivalent vector object (only for rank 1).</p>

<li> <b><i>dot</i></b>(<i>other</i>)
<p>Returns the contraction with <i>other</i>.</p>

<li> <b><i>trace</i></b>(<i>axis1</i>=<tt>0</tt>, <i>axis2</i>=<tt>1</tt>)
<p>Returns the trace of a rank-2 tensor.</p>

<li> <b><i>transpose</i></b>()
<p>Returns the transposed (index reversed) tensor.</p>

<li> <b><i>symmetricalPart</i></b>()
<p>Returns the symmetrical part of a rank-2 tensor.</p>

<li> <b><i>asymmetricalPart</i></b>()
<p>Returns the asymmetrical part of a rank-2 tensor.</p>

<li> <b><i>eigenvalues</i></b>()
<p>Returns the eigenvalues of a rank-2 tensor in an array.</p>

<li> <b><i>diagonalization</i></b>()
<p>Returns the eigenvalues of a rank-2 tensor and a tensor
representing the rotation matrix to the diagonalized form.</p>

<li> <b><i>inverse</i></b>()
<p>Returns the inverse of a rank-2 tensor.</p>

</ul>
<hr width=70%>
<a name="Class:Scientific.Geometry.Vector"><h2>Class Vector: Vector in 3D space</h2></a>

<p>Constructor:</p>

<ul>
<li> <p>
Vector(<i>x</i>, <i>y</i>, <i>z</i>)   (from three coordinates)
</p><li> <p>
Vector(<i>coordinates</i>)   (from any sequence containing three coordinates)</p></ul>
<p>Vectors support the usual arithmetic operations
(<tt>v1</tt>, <tt>v2</tt>: vectors, <tt>s</tt>: scalar): </p>

<ul>
<li> <p>

<tt>v1+v2</tt>           (addition)
</p><li> <p>

<tt>v1-v2</tt>           (subtraction)
</p><li> <p>

<tt>v1*v2</tt>           (scalar product)
</p><li> <p>

<tt>s*v1</tt>, <tt>v1*s</tt>    (multiplication with a scalar)
</p><li> <p>

<tt>v1/s</tt>            (division by a scalar)</p></ul>
<p>The three coordinates can be extracted by indexing.</p>

<p>Vectors are <i>immutable</i>, i.e. their elements cannot be changed.</p>

<p>Vector elements can be any objects on which the standard
arithmetic operations plus the functions sqrt and arccos are defined.
</p>

<b>Methods:</b><br>
<ul>
<li> <b><i>x</i></b>()
<p>Returns the x coordinate.</p>

<li> <b><i>y</i></b>()
<p>Returns the y coordinate.</p>

<li> <b><i>z</i></b>()
<p>Returns the z coordinate.</p>

<li> <b><i>length</i></b>()
<p>Returns the length (norm).</p>

<li> <b><i>normal</i></b>()
<p>Returns a normalized copy.</p>

<li> <b><i>cross</i></b>(<i>other</i>)
<p>Returns the cross product with vector <i>other</i>.</p>

<li> <b><i>asTensor</i></b>()
<p>Returns an equivalent tensor object of rank 1.</p>

<li> <b><i>dyadicProduct</i></b>(<i>other</i>)
<p>Returns the dyadic product with vector or tensor <i>other</i>.</p>

<li> <b><i>angle</i></b>(<i>other</i>)
<p>Returns the angle to vector <i>other</i>.</p>

</ul>