Rotation matrix

Rotation matrix

From Wikipedia, the free encyclopedia
In linear algebra, a rotation matrix is a matrix that is used to perform a rotation in Euclidean space. For example the matrix
R =  begin{bmatrix} cos theta & -sin theta \ sin theta & cos theta \ end{bmatrix}
rotates points in the xyCartesian plane counterclockwise through an angle θ about the origin of the Cartesian coordinate system. To perform the rotation, the position of each point must be represented by a column vector v, containing the coordinates of the point. A rotated vector is obtained by using the matrix multiplication Rv (see below for details).
In two and three dimensions, rotation matrices are among the simplest algebraic descriptions of rotations, and are used extensively for computations in geometryphysics, and computer graphics. Though most applications involve rotations in two or three dimensions, rotation matrices can be defined for n-dimensional space.
Rotation matrices are always square, with real entries. Algebraically, a rotation matrix in n-dimensions is a n × n special orthogonal matrix, that is an orthogonal matrix whose determinant is 1:
R^{T} = R^{-1}, det R = 1,.
The set of all rotation matrices forms a group, known as the rotation group or the special orthogonal group. It is a subset of the orthogonal group, which includes reflections and consists of all orthogonal matrices with determinant 1 or -1, and of the special linear group, which includes all volume-preserving transformations and consists of matrices with determinant 1.
http://en.wikipedia.org/wiki/Rotation_matrix

As in two dimensions a matrix can be used to rotate a point (xyz) to a point (x′, y′, z′). The matrix used is a 3 × 3 matrix,
mathbf{A} = begin{pmatrix} a & b & c \ d & e & f \ g & h & i  end{pmatrix}
This is multiplied by a vector representing the point to give the result
  mathbf{A}  begin{pmatrix} x \ y \ z end{pmatrix} =  begin{pmatrix} a & b & c \ d & e & f \ g & h & i  end{pmatrix}  begin{pmatrix} x \ y \ z end{pmatrix} =  begin{pmatrix} x' \ y' \ z' end{pmatrix}
The matrix A is a member of the three dimensional special orthogonal group, SO(3), that is it is an orthogonal matrix withdeterminant 1. That it is an orthogonal matrix means that its rows are a set of orthogonal unit vectors (so they are an orthonormal basis) as are its columns, making it easy to spot and check if a matrix is a valid rotation matrix. The determinant must be 1 as if it is -1 (the only other possibility for an orthogonal matrix) then the transformation given by it is a reflectionimproper rotation or inversion in a point, i.e. not a rotation.
Matrices are often used for doing transformations, especially when a large number of points are being transformed, as they are a direct representation of the linear operator. Rotations represented in other ways are often converted to matrices before being used. They can be extended to represent rotations and transformations at the same time using Homogeneous coordinates. Transformations in this space are represented by 4 × 4 matrices, which are not rotation matrices but which have a 3 × 3 rotation matrix in the upper left corner.
The main disadvantage of matrices is that they are more expensive to calculate and do calculations with. Also in calculations wherenumerical instability is a concern matrices can be more prone to it, so calculations to restore orthonormality, which are expensive to do for matrices, need to be done more often.

Spectral theorem

Spectral theorem

From Wikipedia, the free encyclopedia
In mathematics, particularly linear algebra and functional analysis, the spectral theorem is any of a number of results about linear operators or about matrices. In broad terms the spectral theorem provides conditions under which an operator or a matrix can bediagonalized (that is, represented as a diagonal matrix in some basis). This concept of diagonalization is relatively straightforward for operators on finite-dimensional spaces, but requires some modification for operators on infinite-dimensional spaces. In general, the spectral theorem identifies a class of linear operators that can be modelled by multiplication operators, which are as simple as one can hope to find. In more abstract language, the spectral theorem is a statement about commutative C*-algebras. See also spectral theory for a historical perspective.
Examples of operators to which the spectral theorem applies are self-adjoint operators or more generally normal operators on Hilbert spaces.
The spectral theorem also provides a canonical decomposition, called the spectral decompositioneigenvalue decomposition, or eigendecomposition, of the underlying vector space on which the operator acts.
In this article we consider mainly the simplest kind of spectral theorem, that for a self-adjoint operator on a Hilbert space. However, as noted above, the spectral theorem also holds for normal operators on a Hilbert space.

Krylov subspace

Krylov subspace

From Wikipedia, the free encyclopedia
In linear algebra, the order-r Krylov subspace generated by an n-by-n matrix A and a vector b of dimension n is the linear subspacespanned by the images of b under the first r powers of A (starting from A0 = I), that is,
mathcal{K}_r(A,b) = operatorname{span} , { b, Ab, A^2b, ldots, A^{r-1}b }. ,
It is named after Russian applied mathematician and naval engineer Alexei Krylov, who published a paper on this issue in 1931.[1]
Modern iterative methods for finding one (or a few) eigenvalues of large sparse matrices or solving large systems of linear equations avoid matrix-matrix operations, but rather multiply vectors by the matrix and work with the resulting vectors. Starting with a vector, b, one computes Ab, then one multiplies that vector by A to find A2b and so on. All algorithms that work this way are referred to as Krylov subspace methods; they are among the most successful methods currently available in numerical linear algebra.
Because the vectors tend very quickly to become almost linearly dependent, methods relying on Krylov subspace frequently involve some orthogonalization scheme, such as Lanczos iteration for Hermitian matrices or Arnoldi iteration for more general matrices.
The best known Krylov subspace methods are the ArnoldiLanczosConjugate gradientGMRES (generalized minimum residual),BiCGSTAB (biconjugate gradient stabilized), QMR (quasi minimal residual), TFQMR (transpose-free QMR), and MINRES (minimal residual) methods.

References

  1. ^ Mike Botchev (2002). “A.N.Krylov, a short biography”.

La aritmética de Trachtenberg

Así como Viktor Emil Frankl desarrollo la logoterapia para superar los rigores de los campos de concentración Nazi, Jakow Trachtenberg ocupo su mente en desarrollar un sistema de aritmética mental al verse en la misma situación.

El sistema Trachtenberg de rápido cálculo mental, similar a las matemáticas Védicas, consiste en un conjunto de patrones para realizar operaciones aritméticas. Los algoritmos más importantes son multiplicación,división, y adición. El método también incluye algoritmos especializados para realizar multiplicaciones por números entre 5 y 13.

Multiplicación por 11

Abusando de la notación

(11)a = 11Σai10i =

an10n+1 + [Σj=0n-1(aj+aj+1)10j ]+ a0

Multiplicación por 12

(12)a = 12Σai10i =

an10n+1 + [Σj=0n-1 (aj+2aj+1)10j ]+ 2a0

Multiplicación por 6

Definiendo

bj = aj/2, donde / denota división entera

cj = aj mod 2

tenemos

aj = 2bj + cj

(6)a = (10/2)Σai10i  + Σai10i =

Σbi10i+1 + Σ(ai + 5ci)10i

bn10n+1 + [Σj=1n(aj + 5cj + bj-1)10j ]+ (a0 + 5c0)

Expresando el algoritmo en python:

def x6(number):
previous = 0
result = 0
power_of_10 = 1
while (number):
digit = number%10
odd_term = 5 if digit%2 else 0
result =
(digit + odd_term + previous ) *
power_of_10 + result
previous = digit//2
power_of_10 *= 10
number = number // 10
result = previous * power_of_10 + result
return result

Multiplicación por 7

De manera similar al caso anterior:

aj = 2bj + cj

(7)a = (10/2)Σai10i  + Σ2ai10i =

Σbi10i+1 + Σ(2ai + 5ci)10i

bn10n+1 + [Σj=1n(2aj + 5cj + bj-1)10j ]+ (a0 + 5c0)

Expresando el algoritmo en python:

def x7(number):
previous = 0
result = 0
power_of_10 = 1
while (number):
digit = number%10
odd_term = 5 if digit%2 else 0
result =
(2*digit + odd_term + previous ) *
power_of_10 + result
previous = digit//2
power_of_10 *= 10
number = number // 10
result = previous * power_of_10 + result
return result

Multiplicación por 5

De manera similar al caso anterior:

aj = 2bj + cj

(5)a = (10/2)Σai10i   =

Σbi10i+1 + Σ(5ci)10i

bn 10n+1 + [Σj=1n(5cj + bj-1)10j ]+ (5c0)

Expresando el algoritmo en python:

def x5(number):
previous = 0
result = 0
power_of_10 = 1
while (number):
digit = number%10
odd_term = 5 if digit%2 else 0
result =
(odd_term + previous ) *
power_of_10 + result
previous = digit//2
power_of_10 *= 10
number = number // 10
result = previous * power_of_10 + result
return result

Multiplicación por 9

Definiendo

b = 10n+1 – Σj=0naj , o sea el complemento a 10 de a

tenemos

(9)a = 10a –a =

10a –a + b – b =

10a + b – 10n+1 =

(an – 1)10n+1 + [Σj=1n(bj + aj-1)10j ]+ (b0 )

Expresando el algoritmo en python:

def x9(number):
previous = number%10
result = 10 - previous
power_of_10 = 10
number = number // 10
while (number):
digit = number%10
result =
(9 - digit + previous ) *
power_of_10 + result
previous = digit
power_of_10 *= 10
number = number // 10
result =
(previous-1) * power_of_10 +
result
return result

Multiplicación por 8

Definiendo

b = 10n+1 – Σj=0naj , o sea el complemento a 10 de a

tenemos

(8)a = 10a –2a =

10a –2a +2 b – 2b =

10a + 2b – (2)10n+1 =

(an – 2)10n+1 + [Σj=1n(2bj + aj-1)10j ]+ (2b0 )

Expresando el algoritmo en python:

def x8(number):
previous = number%10
result = 2*(10 - previous)
power_of_10 = 10
number = number // 10
while (number):
digit = number%10
result =
(2*(9 - digit) + previous ) *
power_of_10 + result
previous = digit
power_of_10 *= 10
number = number // 10
result =
(previous-2) *
power_of_10 + result
return result

Multiplicación por 3 y por 4

Los algoritmos para multiplicar por 3 y por 4 combinan las ideas usadas en la multiplicación por 5 y por 9.

Definiendo

b = 10n+1 – Σj=0naj , o sea el complemento a 10 de a

ai = 2ci + di, donde

ci = ai/2

di = ai mod 2

tenemos

(4)a = 5a –a =

10c + 5d + b – 10n+1

(3)a = 5a –2a =

10c + + 5d + 2b – (2)10n+1

Expresando los algoritmos en python:

def x3(number):
digit = number%10
result = 2*(10 - digit)
if digit % 2:
result += 5
previous = digit // 2
power_of_10 = 10
number = number // 10
while (number):
digit = number%10
odd_term = 5 if digit%2 else 0
result +=(2*(9 - digit) + odd_term + previous ) * power_of_10
previous = digit//2
power_of_10 *= 10
number = number // 10
result = (previous-2) * power_of_10 + result
return result

def x4(number):
digit = number%10
result = (10 - digit)
if digit % 2:
result += 5
previous = digit // 2
power_of_10 = 10
number = number // 10
while (number):
digit = number%10
odd_term = 5 if digit%2 else 0
result +=((9 - digit) + odd_term + previous ) * power_of_10
previous = digit//2
power_of_10 *= 10
number = number // 10
result = (previous-1) * power_of_10 + result
return result

Referencias

Aritmética y memoria; 513 Sticker

 

Es posible mediante el ejercicio de la memoria acelerar cálculos aritméticos. Este es un patrón general que también se aplica a la implementación algorítmica.

Por ejemplo, al multiplicar números de dos dígitos tenemos

a1a0 x b1b0 = (10a1+a0)(10b1+bo)=

100a1b1+10(a1bo+a0b1)+a0bo

Al multiplicar números de tres dígitos tenemos

a2a1a0 x b2b1b0 = (100a2+10a1+a0)(100b2+10b1+bo)=
10000a2b2 + 1000(a2b1+a1b2) +
100(a2b0+a1b1+a0b2) + 10(a1bo+a0b1)+a0bo

Si recordamos las fórmulas podemos encontrar los dígitos del producto directamente.

Al calcular el cuadrado de un número de 2 dígitos

(a1a0 )2 = (10a1+a0)2=
100a12+10(2a1a0)+a02

Al calcular el cuadrado de un número que termina en 1

(a11 )2 = (10a1+1)2=
100a12+10(2a1)+1

Al calcular el cuadrado de un número que termina en 5

(a15 )2 = (10a1+5)2=
100(a12+a1) + 25=
100a1(a1+1) + 25

Al calcular el cuadrado de un número que empiezan en 5

(5a0 )2 = (50 + a0)2=
100(25 +a0) + a02

Al calcular el productos de números de tres dígitos que empiezan con 1

(1a1 a0)(1b1b0) =
(100 + 10a1 + a0)(100 + 10 b1 + b0) =
10000 + 1000(a1 + b1) + 100(a1b1 +  a0 +  b0) +
10(a1b0 + a0b1) + a0b0

Multiplicar un número menor que 100 por 99

(a)(99) = 100 (a – 1)  + (100 – a)

Referencias