﻿ RotationMatrix – Algosim documentation
Algosim documentation: RotationMatrix

# RotationMatrix

Creates a rotation matrix.

## Syntax

• `RotationMatrix(θ, v)`

• `θ` is a real number

• `v` is a three-dimensional vector

• `RotationMatrix(θ[, n[, i, j]])`

• `θ` is a real number

• `n` is a positive integer

• `i` and `j` are distinct positive integers in `[1, n]`

## Description

If `θ` is a real number and `v` a vector in ℝ³, then `RotationMatrix(θ, v)` returns the matrix for a rotation `θ` radians about `v`.

If `θ` is a real number, `n` a positive integer, and `i` and `j` are distinct integers between `1` and `n`, then `RotationMatrix(θ, n, i, j)` returns the matrix for a rotation `θ` radians in the `ij` plane of ℝⁿ. If omitted, `n` defaults to `2` and `(i, j)` to `(1, 2)`.

## Examples

`RotationMatrix(π/6, ❨1, 3, −1❩)`
```⎛ 0.878204912531   0.187294198529    0.44008750812⎞
⎜−0.114217146048   0.975640982506  −0.187294198529⎟
⎝−0.464446525614   0.114217146048   0.878204912531⎠
```
`RotationMatrix(π/6, 4, 3, 4)`
```⎛             1               0               0               0⎞
⎜             0               1               0               0⎟
⎜             0               0  0.866025403784            −0.5⎟
⎝             0               0             0.5  0.866025403784⎠
```