# \[ANN\] Quaternions.jl v0.7.0

**URL:** https://discourse.julialang.org/t/ann-quaternions-jl-v0-7-0/91368
**Category:** Package Announcements
**Tags:** math, algebra, geometry
**Created:** [December 7, 2022, 3:04pm UTC](https://discourse.julialang.org/t/ann-quaternions-jl-v0-7-0/91368 "2022-12-07T15:04:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![hyrodium](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hyrodium/32/27015_2.png) [@hyrodium](https://discourse.julialang.org/u/hyrodium)
#### Post date: [December 7, 2022, 3:04pm UTC](https://discourse.julialang.org/t/ann-quaternions-jl-v0-7-0/91368/1 "2022-12-07T15:04:10Z")

</div>

@sethaxen and I have been working on maintaining the [Quaternion.jl](https://github.com/JuliaGeometry/Quaternions.jl) this year.

Today, version [v0.7.0](https://github.com/JuliaGeometry/Quaternions.jl/releases/tag/v0.7.0) has been released with some breaking changes, and this will likely be the last release before v1.0.0.

The changes we worked on include:

- `Octonion` has been removed.
  - [Octonions.jl](https://github.com/JuliaGeometry/Octonions.jl) now provides this type.

- `DualQuaternion` has been removed.
  - `Quaternion{ForwardDiff.Dual}` can take its place.

- The field `norm::Bool` has been removed from `Quaternion` struct.
  - This field was used as a flag to indicate whether the quaternions were normalized or not, but it was inefficient.
  - See [Makie.jl/quaternions.jl at f2970dcd77bc16f311f8bb3226ef7d716395b369 · MakieOrg/Makie.jl · GitHub](https://github.com/MakieOrg/Makie.jl/blob/f2970dcd77bc16f311f8bb3226ef7d716395b369/src/utilities/quaternions.jl#L1-L5).

- `Complex`-`Quaternion` compatibility has been removed.
  - This is because we cannot choose one natural mapping \mathbb{C} \to \mathbb{H}.
  - The previous implementation for the compatibility was incomplete, and we choose to remove them.

- Add more tests
  - Coverage 43% → 99% 🎉

- Add documentation page with [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl)
  - [Home · Quaternions.jl](https://juliageometry.github.io/Quaternions.jl/stable/)

- Rotation-related functions have been removed.
  - Quaternions.jl used to provide a function that converts a unit quaternion to DCM. This function was inefficient because the return type was `Matrix{Float64}` but not `StaticMatrix{3,3,Float64}`.
  - [Rotations.jl](https://github.com/JuliaGeometry/Rotations.jl) provides a similar function with `StaticMatrix`.

- The `Base`’s analytic functions have been extended to quaternion.
  - See [Extend all analytic functions in base for quaternions by sethaxen · Pull Request #56 · JuliaGeometry/Quaternions.jl · GitHub](https://github.com/JuliaGeometry/Quaternions.jl/pull/56) for more information.

Note that some other packages define their own `Quaternion` struct.

- [Makie.jl](https://github.com/MakieOrg/Makie.jl/blob/f2970dcd77bc16f311f8bb3226ef7d716395b369/src/utilities/quaternions.jl#L7-L11)
- [Quaternionic.jl](https://github.com/moble/Quaternionic.jl)
- [ReferenceFrameRotations.jl](https://github.com/JuliaSpace/ReferenceFrameRotations.jl/blob/84483453682cc2c7deba4c275b9fb902eba7f0fd/src/types.jl#L197-L202)

The Quaternions.jl package does not have dependencies except for standard packages, and is maintained under [JuliaGeometry organization](https://github.com/JuliaGeometry). I hope every other package which uses quaternions has a dependency on our Quaternions.jl package.

Here’s the package logo designed with [Luxor.jl](https://github.com/JuliaGraphics/Luxor.jl). 😄  
 ![](https://juliageometry.github.io/Quaternions.jl/stable/assets/logo.svg)

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [December 8, 2022, 2:02pm UTC](https://discourse.julialang.org/t/ann-quaternions-jl-v0-7-0/91368/2 "2022-12-08T14:02:39Z")

</div>

It took me quite a while to find this, but

`normalize(q::Quaternion)` was removed and (to be consistent with LinearAlgebra) there is not `sign(q)`.

---

<div class="post-metadata">

### Author: ![\_stla](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/_stla/32/35613_2.png) [@\_stla](https://discourse.julialang.org/u/_stla)
#### Post date: [December 9, 2022, 9:18pm UTC](https://discourse.julialang.org/t/ann-quaternions-jl-v0-7-0/91368/3 "2022-12-09T21:18:09Z")

</div>

Looks good. Do you intend to implement the usual mathematical functions such as the exponential and the logarithm? They are useful.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [December 10, 2022, 12:50am UTC](https://discourse.julialang.org/t/ann-quaternions-jl-v0-7-0/91368/4 "2022-12-10T00:50:12Z")

</div>

> [@\_stla](#):
>
> Do you intend to implement the usual mathematical functions such as the exponential and the logarithm? They are useful.

They are already implemented [here](https://github.com/JuliaGeometry/Quaternions.jl/blob/9094925d108bd936c65cfa1347007f51c9df53bc/src/Quaternion.jl#L228-L235) and [here](https://github.com/JuliaGeometry/Quaternions.jl/blob/9094925d108bd936c65cfa1347007f51c9df53bc/src/Quaternion.jl#L262-L275).

---

<div class="post-metadata">

### Author: ![sethaxen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sethaxen/32/35604_2.png) [@sethaxen](https://discourse.julialang.org/u/sethaxen)
#### Post date: [December 15, 2022, 1:51pm UTC](https://discourse.julialang.org/t/ann-quaternions-jl-v0-7-0/91368/5 "2022-12-15T13:51:08Z")

</div>

> [@\_stla](#):
>
> Looks good. Do you intend to implement the usual mathematical functions such as the exponential and the logarithm? They are useful.

As @stevengj pointed out, these are implemented already, but we also extend all complex analytic functions defined in Base to the quaternions and offer a function [`extend_analytic`](https://juliageometry.github.io/Quaternions.jl/stable/api/#Quaternions.extend_analytic) that a user can use to extend any other complex analytic function.
