-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Feb 5, 2024
1 parent
d7fa633
commit e986692
Showing
8 changed files
with
58 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-12-23T03:53:19","documenter_version":"1.2.1"}} | ||
{"documenter":{"julia_version":"1.10.0","generation_timestamp":"2024-02-05T03:38:28","documenter_version":"1.2.1"}} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>The type parameter T in Quaternion{T} · Quaternions.jl</title><meta name="title" content="The type parameter T in Quaternion{T} · Quaternions.jl"/><meta property="og:title" content="The type parameter T in Quaternion{T} · Quaternions.jl"/><meta property="twitter:title" content="The type parameter T in Quaternion{T} · Quaternions.jl"/><meta name="description" content="Documentation for Quaternions.jl."/><meta property="og:description" content="Documentation for Quaternions.jl."/><meta property="twitter:description" content="Documentation for Quaternions.jl."/><meta property="og:url" content="https://JuliaGeometry.github.io/Quaternions.jl/examples/type_parameter/"/><meta property="twitter:url" content="https://JuliaGeometry.github.io/Quaternions.jl/examples/type_parameter/"/><link rel="canonical" href="https://JuliaGeometry.github.io/Quaternions.jl/examples/type_parameter/"/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script><link href="../../assets/custom.css" rel="stylesheet" type="text/css"/><link href="../../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.svg" alt="Quaternions.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">Quaternions.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Home</a></li><li><a class="tocitem" href="../../api/">APIs</a></li><li><span class="tocitem">Examples</span><ul><li><a class="tocitem" href="../basics/">Basics</a></li><li class="is-active"><a class="tocitem" href>The type parameter <code>T</code> in <code>Quaternion{T}</code></a><ul class="internal"><li><a class="tocitem" href="#Lipschitz-quaternions"><span>Lipschitz quaternions</span></a></li><li><a class="tocitem" href="#Hurwitz-quaternions"><span>Hurwitz quaternions</span></a></li><li><a class="tocitem" href="#Biquaternions"><span>Biquaternions</span></a></li></ul></li><li><a class="tocitem" href="../rotations/">Rotations with quaternions</a></li><li><a class="tocitem" href="../dual_quaternions/">Dual quaternions</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Examples</a></li><li class="is-active"><a href>The type parameter <code>T</code> in <code>Quaternion{T}</code></a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>The type parameter <code>T</code> in <code>Quaternion{T}</code></a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/JuliaGeometry/Quaternions.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/JuliaGeometry/Quaternions.jl/blob/main/docs/src/examples/type_parameter.md#" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="The-type-parameter-T-in-Quaternion{T}"><a class="docs-heading-anchor" href="#The-type-parameter-T-in-Quaternion{T}">The type parameter <code>T</code> in <code>Quaternion{T}</code></a><a id="The-type-parameter-T-in-Quaternion{T}-1"></a><a class="docs-heading-anchor-permalink" href="#The-type-parameter-T-in-Quaternion{T}" title="Permalink"></a></h1><p>The type parameter <code>T <: Real</code> in <code>Quaternion{T}</code> represents the type of real and imaginary parts of a quaternion.</p><h2 id="Lipschitz-quaternions"><a class="docs-heading-anchor" href="#Lipschitz-quaternions">Lipschitz quaternions</a><a id="Lipschitz-quaternions-1"></a><a class="docs-heading-anchor-permalink" href="#Lipschitz-quaternions" title="Permalink"></a></h2><p>By using this type parameter, some special quaternions such as <a href="https://en.wikipedia.org/wiki/Hurwitz_quaternion"><strong>Lipschitz quaternions</strong></a> <span>$L$</span> can be represented.</p><p class="math-container">\[L = \left\{a+bi+cj+dk \in \mathbb{H} \mid a,b,c,d \in \mathbb{Z}\right\}\]</p><pre><code class="language-julia-repl hljs" style="display:block;">julia> q1 = Quaternion{Int}(1,2,3,4)</code><code class="nohighlight hljs ansi" style="display:block;">Quaternion{Int64}(1, 2, 3, 4)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> q2 = Quaternion{Int}(5,6,7,8)</code><code class="nohighlight hljs ansi" style="display:block;">Quaternion{Int64}(5, 6, 7, 8)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> islipschitz(q::Quaternion) = isinteger(q.s) & isinteger(q.v1) & isinteger(q.v2) & isinteger(q.v3)</code><code class="nohighlight hljs ansi" style="display:block;">islipschitz (generic function with 1 method)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> islipschitz(q1)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> islipschitz(q2)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> islipschitz(q1 + q2)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> islipschitz(q1 * q2)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> islipschitz(q1 / q2) # Division is not defined on L.</code><code class="nohighlight hljs ansi" style="display:block;">false</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> q1 * q2 == q2 * q1 # non-commutative</code><code class="nohighlight hljs ansi" style="display:block;">false</code></pre><h2 id="Hurwitz-quaternions"><a class="docs-heading-anchor" href="#Hurwitz-quaternions">Hurwitz quaternions</a><a id="Hurwitz-quaternions-1"></a><a class="docs-heading-anchor-permalink" href="#Hurwitz-quaternions" title="Permalink"></a></h2><p>If all coefficients of a quaternion are integers or half-integers, the quaternion is called a <a href="https://en.wikipedia.org/wiki/Hurwitz_quaternion"><strong>Hurwitz quaternion</strong></a>. The set of Hurwitz quaternions is defined by</p><p class="math-container">\[H = \left\{a+bi+cj+dk \in \mathbb{H} \mid a,b,c,d \in \mathbb{Z} \ \text{or} \ a,b,c,d \in \mathbb{Z} + \tfrac{1}{2}\right\}.\]</p><p>Hurwitz quaternions can be implemented with <a href="https://github.com/sostock/HalfIntegers.jl">HalfIntegers.jl</a> package.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia> using HalfIntegers</code><code class="nohighlight hljs ansi" style="display:block;"></code><br/><code class="language-julia-repl hljs" style="display:block;">julia> q1 = Quaternion{HalfInt}(1, 2, 3, 4)</code><code class="nohighlight hljs ansi" style="display:block;">Quaternion{Half{Int64}}(1, 2, 3, 4)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> q2 = Quaternion{HalfInt}(5.5, 6.5, 7.5, 8.5)</code><code class="nohighlight hljs ansi" style="display:block;">Quaternion{Half{Int64}}(11/2, 13/2, 15/2, 17/2)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> q3 = Quaternion{HalfInt}(1, 2, 3, 4.5) # not Hurwitz quaternion</code><code class="nohighlight hljs ansi" style="display:block;">Quaternion{Half{Int64}}(1, 2, 3, 9/2)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> ishalfodd(x::Number) = isodd(twice(x)) # Should be defined in HalfIntegers.jl (HalfIntegers.jl#59)</code><code class="nohighlight hljs ansi" style="display:block;">ishalfodd (generic function with 1 method)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> ishurwitz(q::Quaternion) = (isinteger(q.s) & isinteger(q.v1) & isinteger(q.v2) & isinteger(q.v3)) | (ishalfodd(q.s) & ishalfodd(q.v1) & ishalfodd(q.v2) & ishalfodd(q.v3))</code><code class="nohighlight hljs ansi" style="display:block;">ishurwitz (generic function with 1 method)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> ishurwitz(q1)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> ishurwitz(q2)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> ishurwitz(q3)</code><code class="nohighlight hljs ansi" style="display:block;">false</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> ishurwitz(q1 + q2)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> ishurwitz(q1 * q2)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> ishurwitz(q1 / q2) # Division is not defined on H.</code><code class="nohighlight hljs ansi" style="display:block;">false</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> q1 * q2 == q2 * q1 # non-commucative</code><code class="nohighlight hljs ansi" style="display:block;">false</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> abs2(q1) # Squared norm is always an integer.</code><code class="nohighlight hljs ansi" style="display:block;">30.0</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> abs2(q2) # Squared norm is always an integer.</code><code class="nohighlight hljs ansi" style="display:block;">201.0</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> abs2(q3) # Squared norm is not an integer because `q3` is not Hurwitz quaternion.</code><code class="nohighlight hljs ansi" style="display:block;">34.25</code></pre><h2 id="Biquaternions"><a class="docs-heading-anchor" href="#Biquaternions">Biquaternions</a><a id="Biquaternions-1"></a><a class="docs-heading-anchor-permalink" href="#Biquaternions" title="Permalink"></a></h2><p>If all coefficients of a quaternion are complex numbers, the quaternion is called a <a href="https://en.wikipedia.org/wiki/Biquaternion"><strong>Biquaternion</strong></a>. However, the type parameter <code>T</code> is restricted to <code><:Real</code>, so biquaternions are not supported in this package. Note that <code>Base.Complex</code> has the same type parameter restriction, and <a href="https://en.wikipedia.org/wiki/Bicomplex_number">bicomplex numbers</a> are not supported in Base. See <a href="https://github.com/JuliaGeometry/Quaternions.jl/issues/79">issue#79</a> for more discussion.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../basics/">« Basics</a><a class="docs-footer-nextpage" href="../rotations/">Rotations with quaternions »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="auto">Automatic (OS)</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.2.1 on <span class="colophon-date" title="Monday 5 February 2024 03:38">Monday 5 February 2024</span>. Using Julia version 1.10.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Oops, something went wrong.