509 lines
192 KiB
HTML
509 lines
192 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Mathematics · The Julia Language</title><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||
|
||
ga('create', 'UA-28835595-6', 'auto');
|
||
ga('send', 'pageview');
|
||
</script><link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js" data-main="../assets/documenter.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link href="../assets/highlightjs/default.css" rel="stylesheet" type="text/css"/><link href="../assets/documenter.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><a href="../index.html"><img class="logo" src="../assets/logo.png" alt="The Julia Language logo"/></a><h1>The Julia Language</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" action="../search.html"><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../index.html">Home</a></li><li><span class="toctext">Manual</span><ul><li><a class="toctext" href="../manual/introduction.html">Introduction</a></li><li><a class="toctext" href="../manual/getting-started.html">Getting Started</a></li><li><a class="toctext" href="../manual/variables.html">Variables</a></li><li><a class="toctext" href="../manual/integers-and-floating-point-numbers.html">Integers and Floating-Point Numbers</a></li><li><a class="toctext" href="../manual/mathematical-operations.html">Mathematical Operations and Elementary Functions</a></li><li><a class="toctext" href="../manual/complex-and-rational-numbers.html">Complex and Rational Numbers</a></li><li><a class="toctext" href="../manual/strings.html">Strings</a></li><li><a class="toctext" href="../manual/functions.html">Functions</a></li><li><a class="toctext" href="../manual/control-flow.html">Control Flow</a></li><li><a class="toctext" href="../manual/variables-and-scoping.html">Scope of Variables</a></li><li><a class="toctext" href="../manual/types.html">Types</a></li><li><a class="toctext" href="../manual/methods.html">Methods</a></li><li><a class="toctext" href="../manual/constructors.html">Constructors</a></li><li><a class="toctext" href="../manual/conversion-and-promotion.html">Conversion and Promotion</a></li><li><a class="toctext" href="../manual/interfaces.html">Interfaces</a></li><li><a class="toctext" href="../manual/modules.html">Modules</a></li><li><a class="toctext" href="../manual/documentation.html">Documentation</a></li><li><a class="toctext" href="../manual/metaprogramming.html">Metaprogramming</a></li><li><a class="toctext" href="../manual/arrays.html">Multi-dimensional Arrays</a></li><li><a class="toctext" href="../manual/linear-algebra.html">Linear algebra</a></li><li><a class="toctext" href="../manual/networking-and-streams.html">Networking and Streams</a></li><li><a class="toctext" href="../manual/parallel-computing.html">Parallel Computing</a></li><li><a class="toctext" href="../manual/dates.html">Date and DateTime</a></li><li><a class="toctext" href="../manual/interacting-with-julia.html">Interacting With Julia</a></li><li><a class="toctext" href="../manual/running-external-programs.html">Running External Programs</a></li><li><a class="toctext" href="../manual/calling-c-and-fortran-code.html">Calling C and Fortran Code</a></li><li><a class="toctext" href="../manual/handling-operating-system-variation.html">Handling Operating System Variation</a></li><li><a class="toctext" href="../manual/environment-variables.html">Environment Variables</a></li><li><a class="toctext" href="../manual/embedding.html">Embedding Julia</a></li><li><a class="toctext" href="../manual/packages.html">Packages</a></li><li><a class="toctext" href="../manual/profile.html">Profiling</a></li><li><a class="toctext" href="../manual/stacktraces.html">Stack Traces</a></li><li><a class="toctext" href="../manual/performance-tips.html">Performance Tips</a></li><li><a class="toctext" href="../manual/workflow-tips.html">Workflow Tips</a></li><li><a class="toctext" href="../manual/style-guide.html">Style Guide</a></li><li><a class="toctext" href="../manual/faq.html">Frequently Asked Questions</a></li><li><a class="toctext" href="../manual/noteworthy-differences.html">Noteworthy Differences from other Languages</a></li><li><a class="toctext" href="../manual/unicode-input.html">Unicode Input</a></li></ul></li><li><span class="toctext">Standard Library</span><ul><li><a class="toctext" href="base.html">Essentials</a></li><li><a class="toctext" href="collections.html">Collections and Data Structures</a></li><li class="current"><a class="toctext" href="math.html">Mathematics</a><ul class="internal"><li><a class="toctext" href="#math-ops-1">Mathematical Operators</a></li><li><a class="toctext" href="#Mathematical-Functions-1">Mathematical Functions</a></li><li><a class="toctext" href="#Statistics-1">Statistics</a></li><li><a class="toctext" href="#Signal-Processing-1">Signal Processing</a></li></ul></li><li><a class="toctext" href="numbers.html">Numbers</a></li><li><a class="toctext" href="strings.html">Strings</a></li><li><a class="toctext" href="arrays.html">Arrays</a></li><li><a class="toctext" href="parallel.html">Tasks and Parallel Computing</a></li><li><a class="toctext" href="linalg.html">Linear Algebra</a></li><li><a class="toctext" href="constants.html">Constants</a></li><li><a class="toctext" href="file.html">Filesystem</a></li><li><a class="toctext" href="io-network.html">I/O and Network</a></li><li><a class="toctext" href="punctuation.html">Punctuation</a></li><li><a class="toctext" href="sort.html">Sorting and Related Functions</a></li><li><a class="toctext" href="pkg.html">Package Manager Functions</a></li><li><a class="toctext" href="dates.html">Dates and Time</a></li><li><a class="toctext" href="iterators.html">Iteration utilities</a></li><li><a class="toctext" href="test.html">Unit Testing</a></li><li><a class="toctext" href="c.html">C Interface</a></li><li><a class="toctext" href="libc.html">C Standard Library</a></li><li><a class="toctext" href="libdl.html">Dynamic Linker</a></li><li><a class="toctext" href="profile.html">Profiling</a></li><li><a class="toctext" href="stacktraces.html">StackTraces</a></li><li><a class="toctext" href="simd-types.html">SIMD Support</a></li></ul></li><li><span class="toctext">Developer Documentation</span><ul><li><a class="toctext" href="../devdocs/reflection.html">Reflection and introspection</a></li><li><span class="toctext">Documentation of Julia's Internals</span><ul><li><a class="toctext" href="../devdocs/init.html">Initialization of the Julia runtime</a></li><li><a class="toctext" href="../devdocs/ast.html">Julia ASTs</a></li><li><a class="toctext" href="../devdocs/types.html">More about types</a></li><li><a class="toctext" href="../devdocs/object.html">Memory layout of Julia Objects</a></li><li><a class="toctext" href="../devdocs/eval.html">Eval of Julia code</a></li><li><a class="toctext" href="../devdocs/callconv.html">Calling Conventions</a></li><li><a class="toctext" href="../devdocs/compiler.html">High-level Overview of the Native-Code Generation Process</a></li><li><a class="toctext" href="../devdocs/functions.html">Julia Functions</a></li><li><a class="toctext" href="../devdocs/cartesian.html">Base.Cartesian</a></li><li><a class="toctext" href="../devdocs/meta.html">Talking to the compiler (the <code>:meta</code> mechanism)</a></li><li><a class="toctext" href="../devdocs/subarrays.html">SubArrays</a></li><li><a class="toctext" href="../devdocs/sysimg.html">System Image Building</a></li><li><a class="toctext" href="../devdocs/llvm.html">Working with LLVM</a></li><li><a class="toctext" href="../devdocs/stdio.html">printf() and stdio in the Julia runtime</a></li><li><a class="toctext" href="../devdocs/boundscheck.html">Bounds checking</a></li><li><a class="toctext" href="../devdocs/locks.html">Proper maintenance and care of multi-threading locks</a></li><li><a class="toctext" href="../devdocs/offset-arrays.html">Arrays with custom indices</a></li><li><a class="toctext" href="../devdocs/libgit2.html">Base.LibGit2</a></li><li><a class="toctext" href="../devdocs/require.html">Module loading</a></li></ul></li><li><span class="toctext">Developing/debugging Julia's C code</span><ul><li><a class="toctext" href="../devdocs/backtraces.html">Reporting and analyzing crashes (segfaults)</a></li><li><a class="toctext" href="../devdocs/debuggingtips.html">gdb debugging tips</a></li><li><a class="toctext" href="../devdocs/valgrind.html">Using Valgrind with Julia</a></li><li><a class="toctext" href="../devdocs/sanitizers.html">Sanitizer support</a></li></ul></li></ul></li></ul></nav><article id="docs"><header><nav><ul><li>Standard Library</li><li><a href="math.html">Mathematics</a></li></ul><a class="edit-page" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/doc/src/stdlib/math.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>Mathematics</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Mathematics-1" href="#Mathematics-1">Mathematics</a></h1><h2><a class="nav-anchor" id="math-ops-1" href="#math-ops-1">Mathematical Operators</a></h2><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:--Tuple{Any}" href="#Base.:--Tuple{Any}"><code>Base.:-</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">-(x)</code></pre><p>Unary minus operator.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L66-L70">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:+" href="#Base.:+"><code>Base.:+</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">+(x, y...)</code></pre><p>Addition operator. <code>x+y+z+...</code> calls this function with all arguments, i.e. <code>+(x, y, z, ...)</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L2281-L2285">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:--Tuple{Any,Any}" href="#Base.:--Tuple{Any,Any}"><code>Base.:-</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">-(x, y)</code></pre><p>Subtraction operator.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L73-L77">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:*-Tuple{Any,Vararg{Any,N} where N}" href="#Base.:*-Tuple{Any,Vararg{Any,N} where N}"><code>Base.:*</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">*(x, y...)</code></pre><p>Multiplication operator. <code>x*y*z*...</code> calls this function with all arguments, i.e. <code>*(x, y, z, ...)</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1917-L1923">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:/" href="#Base.:/"><code>Base.:/</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">/(x, y)</code></pre><p>Right division operator: multiplication of <code>x</code> by the inverse of <code>y</code> on the right. Gives floating-point results for integer arguments.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L522-L527">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:\\-Tuple{Any,Any}" href="#Base.:\\-Tuple{Any,Any}"><code>Base.:\</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">\(x, y)</code></pre><p>Left division operator: multiplication of <code>y</code> by the inverse of <code>x</code> on the left. Gives floating-point results for integer arguments.</p><pre><code class="language-julia-repl">julia> 3 \ 6
|
||
2.0
|
||
|
||
julia> inv(3) * 6
|
||
2.0
|
||
|
||
julia> A = [1 2; 3 4]; x = [5, 6];
|
||
|
||
julia> A \ x
|
||
2-element Array{Float64,1}:
|
||
-4.0
|
||
4.5
|
||
|
||
julia> inv(A) * x
|
||
2-element Array{Float64,1}:
|
||
-4.0
|
||
4.5</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L431-L456">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:^-Tuple{Number,Number}" href="#Base.:^-Tuple{Number,Number}"><code>Base.:^</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">^(x, y)</code></pre><p>Exponentiation operator. If <code>x</code> is a matrix, computes matrix exponentiation.</p><p>If <code>y</code> is an <code>Int</code> literal (e.g. <code>2</code> in <code>x^2</code> or <code>-3</code> in <code>x^-3</code>), the Julia code <code>x^y</code> is transformed by the compiler to <code>Base.literal_pow(^, x, Val{y})</code>, to enable compile-time specialization on the value of the exponent. (As a default fallback we have <code>Base.literal_pow(^, x, Val{y}) = ^(x,y)</code>, where usually <code>^ == Base.^</code> unless <code>^</code> has been defined in the calling namespace.)</p><pre><code class="language-julia-repl">julia> 3^5
|
||
243
|
||
|
||
julia> A = [1 2; 3 4]
|
||
2×2 Array{Int64,2}:
|
||
1 2
|
||
3 4
|
||
|
||
julia> A^3
|
||
2×2 Array{Int64,2}:
|
||
37 54
|
||
81 118</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/promotion.jl#L254-L280">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.fma" href="#Base.fma"><code>Base.fma</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fma(x, y, z)</code></pre><p>Computes <code>x*y+z</code> without rounding the intermediate result <code>x*y</code>. On some systems this is significantly more expensive than <code>x*y+z</code>. <code>fma</code> is used to improve accuracy in certain algorithms. See <a href="math.html#Base.muladd"><code>muladd</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L2264-L2270">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.muladd" href="#Base.muladd"><code>Base.muladd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">muladd(x, y, z)</code></pre><p>Combined multiply-add, computes <code>x*y+z</code> in an efficient manner. This may on some systems be equivalent to <code>x*y+z</code>, or to <code>fma(x,y,z)</code>. <code>muladd</code> is used to improve performance. See <a href="math.html#Base.fma"><code>fma</code></a>.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> muladd(3, 2, 1)
|
||
7
|
||
|
||
julia> 3 * 2 + 1
|
||
7</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L927-L942">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.div" href="#Base.div"><code>Base.div</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">div(x, y)
|
||
÷(x, y)</code></pre><p>The quotient from Euclidean division. Computes <code>x/y</code>, truncated to an integer.</p><pre><code class="language-julia-repl">julia> 9 ÷ 4
|
||
2
|
||
|
||
julia> -5 ÷ 3
|
||
-1</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L616-L629">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.fld" href="#Base.fld"><code>Base.fld</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fld(x, y)</code></pre><p>Largest integer less than or equal to <code>x/y</code>.</p><pre><code class="language-julia-repl">julia> fld(7.3,5.5)
|
||
1.0</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L568-L577">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.cld" href="#Base.cld"><code>Base.cld</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cld(x, y)</code></pre><p>Smallest integer larger than or equal to <code>x/y</code>.</p><pre><code class="language-julia-repl">julia> cld(5.5,2.2)
|
||
3.0</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L580-L588">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.mod" href="#Base.mod"><code>Base.mod</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">mod(x, y)
|
||
rem(x, y, RoundDown)</code></pre><p>The reduction of <code>x</code> modulo <code>y</code>, or equivalently, the remainder of <code>x</code> after floored division by <code>y</code>, i.e.</p><pre><code class="language-julia">x - y*fld(x,y)</code></pre><p>if computed without intermediate rounding.</p><p>The result will have the same sign as <code>y</code>, and magnitude less than <code>abs(y)</code> (with some exceptions, see note below).</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>When used with floating point values, the exact result may not be representable by the type, and so rounding error may occur. In particular, if the exact result is very close to <code>y</code>, then it may be rounded to <code>y</code>.</p></div></div><pre><code class="language-julia-repl">julia> mod(8, 3)
|
||
2
|
||
|
||
julia> mod(9, 3)
|
||
0
|
||
|
||
julia> mod(8.9, 3)
|
||
2.9000000000000004
|
||
|
||
julia> mod(eps(), 3)
|
||
2.220446049250313e-16
|
||
|
||
julia> mod(-eps(), 3)
|
||
3.0</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/int.jl#L132-L168">source</a><br/><div><pre><code class="language-none">rem(x::Integer, T::Type{<:Integer}) -> T
|
||
mod(x::Integer, T::Type{<:Integer}) -> T
|
||
%(x::Integer, T::Type{<:Integer}) -> T</code></pre><p>Find <code>y::T</code> such that <code>x</code> ≡ <code>y</code> (mod n), where n is the number of integers representable in <code>T</code>, and <code>y</code> is an integer in <code>[typemin(T),typemax(T)]</code>. If <code>T</code> can represent any integer (e.g. <code>T == BigInt</code>), then this operation corresponds to a conversion to <code>T</code>.</p><pre><code class="language-julia-repl">julia> 129 % Int8
|
||
-127</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/int.jl#L369-L383">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.rem" href="#Base.rem"><code>Base.rem</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">rem(x, y)
|
||
%(x, y)</code></pre><p>Remainder from Euclidean division, returning a value of the same sign as <code>x</code>, and smaller in magnitude than <code>y</code>. This value is always exact.</p><pre><code class="language-julia-repl">julia> x = 15; y = 4;
|
||
|
||
julia> x % y
|
||
3
|
||
|
||
julia> x == div(x, y) * y + rem(x, y)
|
||
true</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L596-L612">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.rem2pi" href="#Base.Math.rem2pi"><code>Base.Math.rem2pi</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">rem2pi(x, r::RoundingMode)</code></pre><p>Compute the remainder of <code>x</code> after integer division by <code>2π</code>, with the quotient rounded according to the rounding mode <code>r</code>. In other words, the quantity</p><pre><code class="language-none">x - 2π*round(x/(2π),r)</code></pre><p>without any intermediate rounding. This internally uses a high precision approximation of 2π, and so will give a more accurate result than <code>rem(x,2π,r)</code></p><ul><li><p>if <code>r == RoundNearest</code>, then the result is in the interval <span>$[-π, π]$</span>. This will generally be the most accurate result.</p></li><li><p>if <code>r == RoundToZero</code>, then the result is in the interval <span>$[0, 2π]$</span> if <code>x</code> is positive,. or <span>$[-2π, 0]$</span> otherwise.</p></li><li><p>if <code>r == RoundDown</code>, then the result is in the interval <span>$[0, 2π]$</span>.</p></li><li><p>if <code>r == RoundUp</code>, then the result is in the interval <span>$[-2π, 0]$</span>.</p></li></ul><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> rem2pi(7pi/4, RoundNearest)
|
||
-0.7853981633974485
|
||
|
||
julia> rem2pi(7pi/4, RoundDown)
|
||
5.497787143782138</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L761-L790">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.mod2pi" href="#Base.Math.mod2pi"><code>Base.Math.mod2pi</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">mod2pi(x)</code></pre><p>Modulus after division by <code>2π</code>, returning in the range <span>$[0,2π)$</span>.</p><p>This function computes a floating point representation of the modulus after division by numerically exact <code>2π</code>, and is therefore not exactly the same as <code>mod(x,2π)</code>, which would compute the modulus of <code>x</code> relative to division by the floating-point number <code>2π</code>.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> mod2pi(9*pi/4)
|
||
0.7853981633974481</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L908-L922">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.divrem" href="#Base.divrem"><code>Base.divrem</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">divrem(x, y)</code></pre><p>The quotient and remainder from Euclidean division. Equivalent to <code>(div(x,y), rem(x,y))</code> or <code>(x÷y, x%y)</code>.</p><pre><code class="language-julia-repl">julia> divrem(3,7)
|
||
(0, 3)
|
||
|
||
julia> divrem(7,3)
|
||
(2, 1)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/number.jl#L50-L63">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.fldmod" href="#Base.fldmod"><code>Base.fldmod</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fldmod(x, y)</code></pre><p>The floored quotient and modulus after division. Equivalent to <code>(fld(x,y), mod(x,y))</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/number.jl#L66-L70">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.fld1" href="#Base.fld1"><code>Base.fld1</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fld1(x, y)</code></pre><p>Flooring division, returning a value consistent with <code>mod1(x,y)</code></p><p>See also: <a href="math.html#Base.mod1"><code>mod1</code></a>.</p><pre><code class="language-julia-repl">julia> x = 15; y = 4;
|
||
|
||
julia> fld1(x, y)
|
||
4
|
||
|
||
julia> x == fld(x, y) * y + mod(x, y)
|
||
true
|
||
|
||
julia> x == (fld1(x, y) - 1) * y + mod1(x, y)
|
||
true</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L652-L671">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.mod1" href="#Base.mod1"><code>Base.mod1</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">mod1(x, y)</code></pre><p>Modulus after flooring division, returning a value <code>r</code> such that <code>mod(r, y) == mod(x, y)</code> in the range <span>$(0, y]$</span> for positive <code>y</code> and in the range <span>$[y,0)$</span> for negative <code>y</code>.</p><pre><code class="language-julia-repl">julia> mod1(4, 2)
|
||
2
|
||
|
||
julia> mod1(4, 3)
|
||
1</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L633-L646">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.fldmod1" href="#Base.fldmod1"><code>Base.fldmod1</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fldmod1(x, y)</code></pre><p>Return <code>(fld1(x,y), mod1(x,y))</code>.</p><p>See also: <a href="math.html#Base.fld1"><code>fld1</code></a>, <a href="math.html#Base.mod1"><code>mod1</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L676-L682">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.://" href="#Base.://"><code>Base.://</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">//(num, den)</code></pre><p>Divide two integers or rational numbers, giving a <a href="numbers.html#Base.Rational"><code>Rational</code></a> result.</p><pre><code class="language-julia-repl">julia> 3 // 5
|
||
3//5
|
||
|
||
julia> (3 // 5) // (2 // 1)
|
||
3//10</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rational.jl#L27-L39">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.rationalize" href="#Base.rationalize"><code>Base.rationalize</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">rationalize([T<:Integer=Int,] x; tol::Real=eps(x))</code></pre><p>Approximate floating point number <code>x</code> as a <a href="numbers.html#Base.Rational"><code>Rational</code></a> number with components of the given integer type. The result will differ from <code>x</code> by no more than <code>tol</code>. If <code>T</code> is not provided, it defaults to <code>Int</code>.</p><pre><code class="language-julia-repl">julia> rationalize(5.6)
|
||
28//5
|
||
|
||
julia> a = rationalize(BigInt, 10.3)
|
||
103//10
|
||
|
||
julia> typeof(numerator(a))
|
||
BigInt</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rational.jl#L109-L126">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.numerator" href="#Base.numerator"><code>Base.numerator</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">numerator(x)</code></pre><p>Numerator of the rational representation of <code>x</code>.</p><pre><code class="language-julia-repl">julia> numerator(2//3)
|
||
2
|
||
|
||
julia> numerator(4)
|
||
4</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rational.jl#L189-L201">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.denominator" href="#Base.denominator"><code>Base.denominator</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">denominator(x)</code></pre><p>Denominator of the rational representation of <code>x</code>.</p><pre><code class="language-julia-repl">julia> denominator(2//3)
|
||
3
|
||
|
||
julia> denominator(4)
|
||
1</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rational.jl#L205-L217">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:<<" href="#Base.:<<"><code>Base.:<<</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none"><<(x, n)</code></pre><p>Left bit shift operator, <code>x << n</code>. For <code>n >= 0</code>, the result is <code>x</code> shifted left by <code>n</code> bits, filling with <code>0</code>s. This is equivalent to <code>x * 2^n</code>. For <code>n < 0</code>, this is equivalent to <code>x >> -n</code>.</p><pre><code class="language-julia-repl">julia> Int8(3) << 2
|
||
12
|
||
|
||
julia> bits(Int8(3))
|
||
"00000011"
|
||
|
||
julia> bits(Int8(12))
|
||
"00001100"</code></pre><p>See also <a href="math.html#Base.:>>"><code>>></code></a>, <a href="math.html#Base.:>>>"><code>>>></code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L463-L481">source</a><br/><div><pre><code class="language-none"><<(B::BitVector, n) -> BitVector</code></pre><p>Left bit shift operator, <code>B << n</code>. For <code>n >= 0</code>, the result is <code>B</code> with elements shifted <code>n</code> positions backwards, filling with <code>false</code> values. If <code>n < 0</code>, elements are shifted forwards. Equivalent to <code>B >> -n</code>.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> B = BitVector([true, false, true, false, false])
|
||
5-element BitArray{1}:
|
||
true
|
||
false
|
||
true
|
||
false
|
||
false
|
||
|
||
julia> B << 1
|
||
5-element BitArray{1}:
|
||
false
|
||
true
|
||
false
|
||
false
|
||
false
|
||
|
||
julia> B << -1
|
||
5-element BitArray{1}:
|
||
false
|
||
true
|
||
false
|
||
true
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/bitarray.jl#L1422-L1457">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:>>" href="#Base.:>>"><code>Base.:>></code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">>>(x, n)</code></pre><p>Right bit shift operator, <code>x >> n</code>. For <code>n >= 0</code>, the result is <code>x</code> shifted right by <code>n</code> bits, where <code>n >= 0</code>, filling with <code>0</code>s if <code>x >= 0</code>, <code>1</code>s if <code>x < 0</code>, preserving the sign of <code>x</code>. This is equivalent to <code>fld(x, 2^n)</code>. For <code>n < 0</code>, this is equivalent to <code>x << -n</code>.</p><pre><code class="language-julia-repl">julia> Int8(13) >> 2
|
||
3
|
||
|
||
julia> bits(Int8(13))
|
||
"00001101"
|
||
|
||
julia> bits(Int8(3))
|
||
"00000011"
|
||
|
||
julia> Int8(-14) >> 2
|
||
-4
|
||
|
||
julia> bits(Int8(-14))
|
||
"11110010"
|
||
|
||
julia> bits(Int8(-4))
|
||
"11111100"</code></pre><p>See also <a href="math.html#Base.:>>>"><code>>>></code></a>, <a href="math.html#Base.:<<"><code><<</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L491-L520">source</a><br/><div><pre><code class="language-none">>>(B::BitVector, n) -> BitVector</code></pre><p>Right bit shift operator, <code>B >> n</code>. For <code>n >= 0</code>, the result is <code>B</code> with elements shifted <code>n</code> positions forward, filling with <code>false</code> values. If <code>n < 0</code>, elements are shifted backwards. Equivalent to <code>B << -n</code>.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> B = BitVector([true, false, true, false, false])
|
||
5-element BitArray{1}:
|
||
true
|
||
false
|
||
true
|
||
false
|
||
false
|
||
|
||
julia> B >> 1
|
||
5-element BitArray{1}:
|
||
false
|
||
true
|
||
false
|
||
true
|
||
false
|
||
|
||
julia> B >> -1
|
||
5-element BitArray{1}:
|
||
false
|
||
true
|
||
false
|
||
false
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/bitarray.jl#L1383-L1418">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:>>>" href="#Base.:>>>"><code>Base.:>>></code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">>>>(x, n)</code></pre><p>Unsigned right bit shift operator, <code>x >>> n</code>. For <code>n >= 0</code>, the result is <code>x</code> shifted right by <code>n</code> bits, where <code>n >= 0</code>, filling with <code>0</code>s. For <code>n < 0</code>, this is equivalent to <code>x << -n</code>.</p><p>For <a href="numbers.html#Core.Unsigned"><code>Unsigned</code></a> integer types, this is equivalent to <a href="math.html#Base.:>>"><code>>></code></a>. For <a href="numbers.html#Core.Signed"><code>Signed</code></a> integer types, this is equivalent to <code>signed(unsigned(x) >> n)</code>.</p><pre><code class="language-julia-repl">julia> Int8(-14) >>> 2
|
||
60
|
||
|
||
julia> bits(Int8(-14))
|
||
"11110010"
|
||
|
||
julia> bits(Int8(60))
|
||
"00111100"</code></pre><p><a href="numbers.html#Base.GMP.BigInt"><code>BigInt</code></a>s are treated as if having infinite size, so no filling is required and this is equivalent to <a href="math.html#Base.:>>"><code>>></code></a>.</p><p>See also <a href="math.html#Base.:>>"><code>>></code></a>, <a href="math.html#Base.:<<"><code><<</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L530-L555">source</a><br/><div><pre><code class="language-none">>>>(B::BitVector, n) -> BitVector</code></pre><p>Unsigned right bitshift operator, <code>B >>> n</code>. Equivalent to <code>B >> n</code>. See <a href="math.html#Base.:>>"><code>>></code></a> for details and examples.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/bitarray.jl#L1460-L1465">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.colon" href="#Base.colon"><code>Base.colon</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">colon(start, [step], stop)</code></pre><p>Called by <code>:</code> syntax for constructing ranges.</p><pre><code class="language-julia-repl">julia> colon(1, 2, 5)
|
||
1:2:5</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/range.jl#L18-L27">source</a><br/><div><pre><code class="language-none">:(start, [step], stop)</code></pre><p>Range operator. <code>a:b</code> constructs a range from <code>a</code> to <code>b</code> with a step size of 1, and <code>a:s:b</code> is similar but uses a step size of <code>s</code>. These syntaxes call the function <code>colon</code>. The colon is also used in indexing to select whole dimensions.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/range.jl#L39-L45">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.range" href="#Base.range"><code>Base.range</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">range(start, [step], length)</code></pre><p>Construct a range by length, given a starting value and optional step (defaults to 1).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/range.jl#L55-L59">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.OneTo" href="#Base.OneTo"><code>Base.OneTo</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">Base.OneTo(n)</code></pre><p>Define an <code>AbstractUnitRange</code> that behaves like <code>1:n</code>, with the added distinction that the lower limit is guaranteed (by the type system) to be 1.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/range.jl#L166-L172">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.StepRangeLen" href="#Base.StepRangeLen"><code>Base.StepRangeLen</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">StepRangeLen{T,R,S}(ref::R, step::S, len, [offset=1])</code></pre><p>A range <code>r</code> where <code>r[i]</code> produces values of type <code>T</code>, parametrized by a <code>ref</code>erence value, a <code>step</code>, and the <code>len</code>gth. By default <code>ref</code> is the starting value <code>r[1]</code>, but alternatively you can supply it as the value of <code>r[offset]</code> for some other index <code>1 <= offset <= len</code>. In conjunction with <code>TwicePrecision</code> this can be used to implement ranges that are free of roundoff error.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/range.jl#L181-L190">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:==" href="#Base.:=="><code>Base.:==</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">==(x, y)</code></pre><p>Generic equality operator, giving a single <a href="numbers.html#Core.Bool"><code>Bool</code></a> result. Falls back to <code>===</code>. Should be implemented for all types with a notion of equality, based on the abstract value that an instance represents. For example, all numeric types are compared by numeric value, ignoring type. Strings are compared as sequences of characters, ignoring encoding.</p><p>Follows IEEE semantics for floating-point numbers.</p><p>Collections should generally implement <code>==</code> by calling <code>==</code> recursively on all contents.</p><p>New numeric types should implement this function for two arguments of the new type, and handle comparison to other types via promotion rules where possible.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1674-L1688">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:!=" href="#Base.:!="><code>Base.:!=</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">!=(x, y)
|
||
≠(x,y)</code></pre><p>Not-equals comparison operator. Always gives the opposite answer as <code>==</code>. New types should generally not implement this, and rely on the fallback definition <code>!=(x,y) = !(x==y)</code> instead.</p><pre><code class="language-julia-repl">julia> 3 != 2
|
||
true
|
||
|
||
julia> "foo" ≠ "foo"
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L114-L128">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:!==" href="#Base.:!=="><code>Base.:!==</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">!==(x, y)
|
||
≢(x,y)</code></pre><p>Equivalent to <code>!(x === y)</code>.</p><pre><code class="language-julia-repl">julia> a = [1, 2]; b = [1, 2];
|
||
|
||
julia> a ≢ b
|
||
true
|
||
|
||
julia> a ≢ a
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L156-L171">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:<" href="#Base.:<"><code>Base.:<</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none"><(x, y)</code></pre><p>Less-than comparison operator. New numeric types should implement this function for two arguments of the new type. Because of the behavior of floating-point NaN values, <code><</code> implements a partial order. Types with a canonical partial order should implement <code><</code>, and types with a canonical total order should implement <code>isless</code>.</p><pre><code class="language-julia-repl">julia> 'a' < 'b'
|
||
true
|
||
|
||
julia> "abc" < "abd"
|
||
true
|
||
|
||
julia> 5 < 3
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L175-L193">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:<=" href="#Base.:<="><code>Base.:<=</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none"><=(x, y)
|
||
≤(x,y)</code></pre><p>Less-than-or-equals comparison operator.</p><pre><code class="language-julia-repl">julia> 'a' <= 'b'
|
||
true
|
||
|
||
julia> 7 ≤ 7 ≤ 9
|
||
true
|
||
|
||
julia> "abc" ≤ "abc"
|
||
true
|
||
|
||
julia> 5 <= 3
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L218-L237">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:>" href="#Base.:>"><code>Base.:></code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">>(x, y)</code></pre><p>Greater-than comparison operator. Generally, new types should implement <code><</code> instead of this function, and rely on the fallback definition <code>>(x, y) = y < x</code>.</p><pre><code class="language-julia-repl">julia> 'a' > 'b'
|
||
false
|
||
|
||
julia> 7 > 3 > 1
|
||
true
|
||
|
||
julia> "abc" > "abd"
|
||
false
|
||
|
||
julia> 5 > 3
|
||
true</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L196-L215">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:>=" href="#Base.:>="><code>Base.:>=</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">>=(x, y)
|
||
≥(x,y)</code></pre><p>Greater-than-or-equals comparison operator.</p><pre><code class="language-julia-repl">julia> 'a' >= 'b'
|
||
false
|
||
|
||
julia> 7 ≥ 7 ≥ 3
|
||
true
|
||
|
||
julia> "abc" ≥ "abc"
|
||
true
|
||
|
||
julia> 5 >= 3
|
||
true</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L241-L260">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.cmp" href="#Base.cmp"><code>Base.cmp</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cmp(x,y)</code></pre><p>Return -1, 0, or 1 depending on whether <code>x</code> is less than, equal to, or greater than <code>y</code>, respectively. Uses the total order implemented by <code>isless</code>. For floating-point numbers, uses <code><</code> but throws an error for unordered arguments.</p><pre><code class="language-julia-repl">julia> cmp(1, 2)
|
||
-1
|
||
|
||
julia> cmp(2, 1)
|
||
1
|
||
|
||
julia> cmp(2+im, 3-im)
|
||
ERROR: MethodError: no method matching isless(::Complex{Int64}, ::Complex{Int64})
|
||
[...]</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L284-L302">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:~" href="#Base.:~"><code>Base.:~</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">~(x)</code></pre><p>Bitwise not.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> ~4
|
||
-5
|
||
|
||
julia> ~10
|
||
-11
|
||
|
||
julia> ~true
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1275-L1291">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:&" href="#Base.:&"><code>Base.:&</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">&(x, y)</code></pre><p>Bitwise and.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> 4 & 10
|
||
0
|
||
|
||
julia> 4 & 12
|
||
4</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L639-L652">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:|" href="#Base.:|"><code>Base.:|</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">|(x, y)</code></pre><p>Bitwise or.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> 4 | 10
|
||
14
|
||
|
||
julia> 4 | 1
|
||
5</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L2584-L2597">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.xor" href="#Base.xor"><code>Base.xor</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">xor(x, y)
|
||
⊻(x, y)</code></pre><p>Bitwise exclusive or of <code>x</code> and <code>y</code>. The infix operation <code>a ⊻ b</code> is a synonym for <code>xor(a,b)</code>, and <code>⊻</code> can be typed by tab-completing <code>\xor</code> or <code>\veebar</code> in the Julia REPL.</p><pre><code class="language-julia-repl">julia> [true; true; false] .⊻ [true; false; false]
|
||
3-element BitArray{1}:
|
||
false
|
||
true
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/bool.jl#L44-L60">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.:!" href="#Base.:!"><code>Base.:!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">!(x)</code></pre><p>Boolean not.</p><pre><code class="language-julia-repl">julia> !true
|
||
false
|
||
|
||
julia> !false
|
||
true
|
||
|
||
julia> .![true false true]
|
||
1×3 BitArray{2}:
|
||
false true false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/bool.jl#L17-L33">source</a><br/><div><pre><code class="language-none">!f::Function</code></pre><p>Predicate function negation: when the argument of <code>!</code> is a function, it returns a function which computes the boolean negation of <code>f</code>. Example:</p><pre><code class="language-julia-repl">julia> str = "∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε"
|
||
"∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε"
|
||
|
||
julia> filter(isalpha, str)
|
||
"εδxyδfxfyε"
|
||
|
||
julia> filter(!isalpha, str)
|
||
"∀ > 0, ∃ > 0: |-| < ⇒ |()-()| < "</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L887-L903">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="&&" href="#&&"><code>&&</code></a> — <span class="docstring-category">Keyword</span>.</div><div><pre><code class="language-none">x && y</code></pre><p>Short-circuiting boolean AND.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/basedocs.jl#L543-L547">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="||" href="#||"><code>||</code></a> — <span class="docstring-category">Keyword</span>.</div><div><pre><code class="language-none">x || y</code></pre><p>Short-circuiting boolean OR.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/basedocs.jl#L550-L554">source</a><br/></section><h2><a class="nav-anchor" id="Mathematical-Functions-1" href="#Mathematical-Functions-1">Mathematical Functions</a></h2><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.isapprox" href="#Base.isapprox"><code>Base.isapprox</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">isapprox(x, y; rtol::Real=sqrt(eps), atol::Real=0, nans::Bool=false, norm::Function)</code></pre><p>Inexact equality comparison: <code>true</code> if <code>norm(x-y) <= atol + rtol*max(norm(x), norm(y))</code>. The default <code>atol</code> is zero and the default <code>rtol</code> depends on the types of <code>x</code> and <code>y</code>. The keyword argument <code>nans</code> determines whether or not NaN values are considered equal (defaults to false).</p><p>For real or complex floating-point values, <code>rtol</code> defaults to <code>sqrt(eps(typeof(real(x-y))))</code>. This corresponds to requiring equality of about half of the significand digits. For other types, <code>rtol</code> defaults to zero.</p><p><code>x</code> and <code>y</code> may also be arrays of numbers, in which case <code>norm</code> defaults to <code>vecnorm</code> but may be changed by passing a <code>norm::Function</code> keyword argument. (For numbers, <code>norm</code> is the same thing as <code>abs</code>.) When <code>x</code> and <code>y</code> are arrays, if <code>norm(x-y)</code> is not finite (i.e. <code>±Inf</code> or <code>NaN</code>), the comparison falls back to checking whether all elements of <code>x</code> and <code>y</code> are approximately equal component-wise.</p><p>The binary operator <code>≈</code> is equivalent to <code>isapprox</code> with the default arguments, and <code>x ≉ y</code> is equivalent to <code>!isapprox(x,y)</code>.</p><pre><code class="language-julia-repl">julia> 0.1 ≈ (0.1 - 1e-10)
|
||
true
|
||
|
||
julia> isapprox(10, 11; atol = 2)
|
||
true
|
||
|
||
julia> isapprox([10.0^9, 1.0], [10.0^9, 2.0])
|
||
true</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/floatfuncs.jl#L173-L203">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.sin" href="#Base.sin"><code>Base.sin</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sin(x)</code></pre><p>Compute sine of <code>x</code>, where <code>x</code> is in radians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L303-L307">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.cos" href="#Base.cos"><code>Base.cos</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cos(x)</code></pre><p>Compute cosine of <code>x</code>, where <code>x</code> is in radians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L310-L314">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.tan" href="#Base.tan"><code>Base.tan</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">tan(x)</code></pre><p>Compute tangent of <code>x</code>, where <code>x</code> is in radians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L317-L321">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.sind" href="#Base.Math.sind"><code>Base.Math.sind</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sind(x)</code></pre><p>Compute sine of <code>x</code>, where <code>x</code> is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L413-L415">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.cosd" href="#Base.Math.cosd"><code>Base.Math.cosd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cosd(x)</code></pre><p>Compute cosine of <code>x</code>, where <code>x</code> is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L413-L415">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.tand" href="#Base.Math.tand"><code>Base.Math.tand</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">tand(x)</code></pre><p>Compute tangent of <code>x</code>, where <code>x</code> is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L413-L415">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.sinpi" href="#Base.Math.sinpi"><code>Base.Math.sinpi</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sinpi(x)</code></pre><p>Compute <span>$\sin(\pi x)$</span> more accurately than <code>sin(pi*x)</code>, especially for large <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L101-L105">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.cospi" href="#Base.Math.cospi"><code>Base.Math.cospi</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cospi(x)</code></pre><p>Compute <span>$\cos(\pi x)$</span> more accurately than <code>cos(pi*x)</code>, especially for large <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L164-L168">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.sinh" href="#Base.sinh"><code>Base.sinh</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sinh(x)</code></pre><p>Compute hyperbolic sine of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L195-L199">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.cosh" href="#Base.cosh"><code>Base.cosh</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cosh(x)</code></pre><p>Compute hyperbolic cosine of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L202-L206">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.tanh" href="#Base.tanh"><code>Base.tanh</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">tanh(x)</code></pre><p>Compute hyperbolic tangent of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L209-L213">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.asin" href="#Base.asin"><code>Base.asin</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">asin(x)</code></pre><p>Compute the inverse sine of <code>x</code>, where the output is in radians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L324-L328">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.acos" href="#Base.acos"><code>Base.acos</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acos(x)</code></pre><p>Compute the inverse cosine of <code>x</code>, where the output is in radians</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L331-L335">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.atan" href="#Base.atan"><code>Base.atan</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">atan(x)</code></pre><p>Compute the inverse tangent of <code>x</code>, where the output is in radians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L216-L220">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.atan2" href="#Base.Math.atan2"><code>Base.Math.atan2</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">atan2(y, x)</code></pre><p>Compute the inverse tangent of <code>y/x</code>, using the signs of both <code>x</code> and <code>y</code> to determine the quadrant of the return value.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L488-L493">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.asind" href="#Base.Math.asind"><code>Base.Math.asind</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">asind(x)</code></pre><p>Compute the inverse sine of <code>x</code>, where the output is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L423-L426">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.acosd" href="#Base.Math.acosd"><code>Base.Math.acosd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acosd(x)</code></pre><p>Compute the inverse cosine of <code>x</code>, where the output is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L423-L426">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.atand" href="#Base.Math.atand"><code>Base.Math.atand</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">atand(x)</code></pre><p>Compute the inverse tangent of <code>x</code>, where the output is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L423-L426">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.sec" href="#Base.Math.sec"><code>Base.Math.sec</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sec(x)</code></pre><p>Compute the secant of <code>x</code>, where <code>x</code> is in radians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1895-L1899">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.csc" href="#Base.Math.csc"><code>Base.Math.csc</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">csc(x)</code></pre><p>Compute the cosecant of <code>x</code>, where <code>x</code> is in radians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1462-L1466">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.cot" href="#Base.Math.cot"><code>Base.Math.cot</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cot(x)</code></pre><p>Compute the cotangent of <code>x</code>, where <code>x</code> is in radians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1411-L1415">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.secd" href="#Base.Math.secd"><code>Base.Math.secd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">secd(x)</code></pre><p>Compute the secant of <code>x</code>, where <code>x</code> is in degrees.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1815-L1819">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.cscd" href="#Base.Math.cscd"><code>Base.Math.cscd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cscd(x)</code></pre><p>Compute the cosecant of <code>x</code>, where <code>x</code> is in degrees.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L2471-L2475">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.cotd" href="#Base.Math.cotd"><code>Base.Math.cotd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cotd(x)</code></pre><p>Compute the cotangent of <code>x</code>, where <code>x</code> is in degrees.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1537-L1541">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.asec" href="#Base.Math.asec"><code>Base.Math.asec</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">asec(x)</code></pre><p>Compute the inverse secant of <code>x</code>, where the output is in radians. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L323-L325">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.acsc" href="#Base.Math.acsc"><code>Base.Math.acsc</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acsc(x)</code></pre><p>Compute the inverse cosecant of <code>x</code>, where the output is in radians. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L323-L325">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.acot" href="#Base.Math.acot"><code>Base.Math.acot</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acot(x)</code></pre><p>Compute the inverse cotangent of <code>x</code>, where the output is in radians. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L323-L325">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.asecd" href="#Base.Math.asecd"><code>Base.Math.asecd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">asecd(x)</code></pre><p>Compute the inverse secant of <code>x</code>, where the output is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L423-L426">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.acscd" href="#Base.Math.acscd"><code>Base.Math.acscd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acscd(x)</code></pre><p>Compute the inverse cosecant of <code>x</code>, where the output is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L423-L426">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.acotd" href="#Base.Math.acotd"><code>Base.Math.acotd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acotd(x)</code></pre><p>Compute the inverse cotangent of <code>x</code>, where the output is in degrees. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L423-L426">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.sech" href="#Base.Math.sech"><code>Base.Math.sech</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sech(x)</code></pre><p>Compute the hyperbolic secant of <code>x</code></p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L190-L194">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.csch" href="#Base.Math.csch"><code>Base.Math.csch</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">csch(x)</code></pre><p>Compute the hyperbolic cosecant of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1888-L1892">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.coth" href="#Base.Math.coth"><code>Base.Math.coth</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">coth(x)</code></pre><p>Compute the hyperbolic cotangent of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L2112-L2116">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.asinh" href="#Base.asinh"><code>Base.asinh</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">asinh(x)</code></pre><p>Compute the inverse hyperbolic sine of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L223-L227">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.acosh" href="#Base.acosh"><code>Base.acosh</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acosh(x)</code></pre><p>Compute the inverse hyperbolic cosine of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L338-L342">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.atanh" href="#Base.atanh"><code>Base.atanh</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">atanh(x)</code></pre><p>Compute the inverse hyperbolic tangent of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L345-L349">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.asech" href="#Base.Math.asech"><code>Base.Math.asech</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">asech(x)</code></pre><p>Compute the inverse hyperbolic secant of <code>x</code>. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L326-L328">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.acsch" href="#Base.Math.acsch"><code>Base.Math.acsch</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acsch(x)</code></pre><p>Compute the inverse hyperbolic cosecant of <code>x</code>. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L326-L328">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.acoth" href="#Base.Math.acoth"><code>Base.Math.acoth</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">acoth(x)</code></pre><p>Compute the inverse hyperbolic cotangent of <code>x</code>. </p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L326-L328">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.sinc" href="#Base.Math.sinc"><code>Base.Math.sinc</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sinc(x)</code></pre><p>Compute <span>$\sin(\pi x) / (\pi x)$</span> if <span>$x \neq 0$</span>, and <span>$1$</span> if <span>$x = 0$</span>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L288-L292">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.cosc" href="#Base.Math.cosc"><code>Base.Math.cosc</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cosc(x)</code></pre><p>Compute <span>$\cos(\pi x) / x - \sin(\pi x) / (\pi x^2)$</span> if <span>$x \neq 0$</span>, and <span>$0$</span> if <span>$x = 0$</span>. This is the derivative of <code>sinc(x)</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/trig.jl#L298-L303">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.deg2rad" href="#Base.Math.deg2rad"><code>Base.Math.deg2rad</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">deg2rad(x)</code></pre><p>Convert <code>x</code> from degrees to radians.</p><pre><code class="language-julia-repl">julia> deg2rad(90)
|
||
1.5707963267948966</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L145-L154">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.rad2deg" href="#Base.Math.rad2deg"><code>Base.Math.rad2deg</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">rad2deg(x)</code></pre><p>Convert <code>x</code> from radians to degrees.</p><pre><code class="language-julia-repl">julia> rad2deg(pi)
|
||
180.0</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L133-L142">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.hypot" href="#Base.Math.hypot"><code>Base.Math.hypot</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">hypot(x, y)</code></pre><p>Compute the hypotenuse <span>$\sqrt{x^2+y^2}$</span> avoiding overflow and underflow.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> a = 10^10;
|
||
|
||
julia> hypot(a, a)
|
||
1.4142135623730951e10
|
||
|
||
julia> √(a^2 + a^2) # a^2 overflows
|
||
ERROR: DomainError:
|
||
sqrt will only return a complex result if called with a complex argument. Try sqrt(complex(x)).
|
||
Stacktrace:
|
||
[1] sqrt(::Int64) at ./math.jl:434</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L436-L454">source</a><br/><div><pre><code class="language-none">hypot(x...)</code></pre><p>Compute the hypotenuse <span>$\sqrt{\sum x_i^2}$</span> avoiding overflow and underflow.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L481-L485">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.log-Tuple{Any}" href="#Base.log-Tuple{Any}"><code>Base.log</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">log(x)</code></pre><p>Compute the natural logarithm of <code>x</code>. Throws <a href="base.html#Core.DomainError"><code>DomainError</code></a> for negative <a href="numbers.html#Core.Real"><code>Real</code></a> arguments. Use complex negative arguments to obtain complex results.</p><p>There is an experimental variant in the <code>Base.Math.JuliaLibm</code> module, which is typically faster and more accurate.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L352-L360">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.log-Tuple{Number,Number}" href="#Base.log-Tuple{Number,Number}"><code>Base.log</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">log(b,x)</code></pre><p>Compute the base <code>b</code> logarithm of <code>x</code>. Throws <a href="base.html#Core.DomainError"><code>DomainError</code></a> for negative <a href="numbers.html#Core.Real"><code>Real</code></a> arguments.</p><pre><code class="language-julia-repl">julia> log(4,8)
|
||
1.5
|
||
|
||
julia> log(4,2)
|
||
0.5</code></pre><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>If <code>b</code> is a power of 2 or 10, <a href="math.html#Base.log2"><code>log2</code></a> or <a href="math.html#Base.log10"><code>log10</code></a> should be used, as these will typically be faster and more accurate. For example,</p><pre><code class="language-julia-repl">julia> log(100,1000000)
|
||
2.9999999999999996
|
||
|
||
julia> log10(1000000)/2
|
||
3.0</code></pre></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L161-L186">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.log2" href="#Base.log2"><code>Base.log2</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">log2(x)</code></pre><p>Compute the logarithm of <code>x</code> to base 2. Throws <a href="base.html#Core.DomainError"><code>DomainError</code></a> for negative <a href="numbers.html#Core.Real"><code>Real</code></a> arguments.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> log2(4)
|
||
2.0
|
||
|
||
julia> log2(10)
|
||
3.321928094887362</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L363-L377">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.log10" href="#Base.log10"><code>Base.log10</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">log10(x)</code></pre><p>Compute the logarithm of <code>x</code> to base 10. Throws <a href="base.html#Core.DomainError"><code>DomainError</code></a> for negative <a href="numbers.html#Core.Real"><code>Real</code></a> arguments.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> log10(100)
|
||
2.0
|
||
|
||
julia> log10(2)
|
||
0.3010299956639812</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L380-L394">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.log1p" href="#Base.log1p"><code>Base.log1p</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">log1p(x)</code></pre><p>Accurate natural logarithm of <code>1+x</code>. Throws <a href="base.html#Core.DomainError"><code>DomainError</code></a> for <a href="numbers.html#Core.Real"><code>Real</code></a> arguments less than -1.</p><p>There is an experimental variant in the <code>Base.Math.JuliaLibm</code> module, which is typically faster and more accurate.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> log1p(-0.5)
|
||
-0.6931471805599453
|
||
|
||
julia> log1p(0)
|
||
0.0</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L397-L414">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.frexp" href="#Base.Math.frexp"><code>Base.Math.frexp</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">frexp(val)</code></pre><p>Return <code>(x,exp)</code> such that <code>x</code> has a magnitude in the interval <span>$[1/2, 1)$</span> or 0, and <code>val</code> is equal to <span>$x \times 2^{exp}$</span>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L614-L619">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.exp" href="#Base.exp"><code>Base.exp</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">exp(x)</code></pre><p>Compute the natural base exponential of <code>x</code>, in other words <span>$e^x$</span>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/exp.jl#L62-L66">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.exp2" href="#Base.exp2"><code>Base.exp2</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">exp2(x)</code></pre><p>Compute <span>$2^x$</span>.</p><pre><code class="language-julia-repl">julia> exp2(5)
|
||
32.0</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L262-L271">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.exp10" href="#Base.exp10"><code>Base.exp10</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">exp10(x)</code></pre><p>Compute <span>$10^x$</span>.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> exp10(2)
|
||
100.0
|
||
|
||
julia> exp10(0.2)
|
||
1.5848931924611136</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L623-L636">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.ldexp" href="#Base.Math.ldexp"><code>Base.Math.ldexp</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">ldexp(x, n)</code></pre><p>Compute <span>$x \times 2^n$</span>.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> ldexp(5., 2)
|
||
20.0</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L512-L522">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.modf" href="#Base.Math.modf"><code>Base.Math.modf</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">modf(x)</code></pre><p>Return a tuple (fpart,ipart) of the fractional and integral parts of a number. Both parts have the same sign as the argument.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> modf(3.5)
|
||
(0.5, 3.0)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L673-L684">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.expm1" href="#Base.expm1"><code>Base.expm1</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">expm1(x)</code></pre><p>Accurately compute <span>$e^x-1$</span>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L230-L234">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.round-Tuple{Type,Any}" href="#Base.round-Tuple{Type,Any}"><code>Base.round</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">round([T,] x, [digits, [base]], [r::RoundingMode])</code></pre><p>Rounds <code>x</code> to an integer value according to the provided <a href="math.html#Base.Rounding.RoundingMode"><code>RoundingMode</code></a>, returning a value of the same type as <code>x</code>. When not specifying a rounding mode the global mode will be used (see <a href="numbers.html#Base.Rounding.rounding"><code>rounding</code></a>), which by default is round to the nearest integer (<a href="math.html#Base.Rounding.RoundNearest"><code>RoundNearest</code></a> mode), with ties (fractional values of 0.5) being rounded to the nearest even integer.</p><pre><code class="language-julia-repl">julia> round(1.7)
|
||
2.0
|
||
|
||
julia> round(1.5)
|
||
2.0
|
||
|
||
julia> round(2.5)
|
||
2.0</code></pre><p>The optional <a href="math.html#Base.Rounding.RoundingMode"><code>RoundingMode</code></a> argument will change how the number gets rounded.</p><p><code>round(T, x, [r::RoundingMode])</code> converts the result to type <code>T</code>, throwing an <a href="base.html#Core.InexactError"><code>InexactError</code></a> if the value is not representable.</p><p><code>round(x, digits)</code> rounds to the specified number of digits after the decimal place (or before if negative). <code>round(x, digits, base)</code> rounds using a base other than 10.</p><pre><code class="language-julia-repl">julia> round(pi, 2)
|
||
3.14
|
||
|
||
julia> round(pi, 3, 2)
|
||
3.125</code></pre><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Rounding to specified digits in bases other than 2 can be inexact when operating on binary floating point numbers. For example, the <a href="numbers.html#Core.Float64"><code>Float64</code></a> value represented by <code>1.15</code> is actually <em>less</em> than 1.15, yet will be rounded to 1.2.</p><pre><code class="language-julia-repl">julia> x = 1.15
|
||
1.15
|
||
|
||
julia> @sprintf "%.20f" x
|
||
"1.14999999999999991118"
|
||
|
||
julia> x < 115//100
|
||
true
|
||
|
||
julia> round(x, 1)
|
||
1.2</code></pre></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/floatfuncs.jl#L42-L99">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Rounding.RoundingMode" href="#Base.Rounding.RoundingMode"><code>Base.Rounding.RoundingMode</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-none">RoundingMode</code></pre><p>A type used for controlling the rounding mode of floating point operations (via <a href="numbers.html#Base.Rounding.rounding"><code>rounding</code></a>/<a href="numbers.html#Base.Rounding.setrounding-Tuple{Type,Any}"><code>setrounding</code></a> functions), or as optional arguments for rounding to the nearest integer (via the <a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a> function).</p><p>Currently supported rounding modes are:</p><ul><li><p><a href="math.html#Base.Rounding.RoundNearest"><code>RoundNearest</code></a> (default)</p></li><li><p><a href="math.html#Base.Rounding.RoundNearestTiesAway"><code>RoundNearestTiesAway</code></a></p></li><li><p><a href="math.html#Base.Rounding.RoundNearestTiesUp"><code>RoundNearestTiesUp</code></a></p></li><li><p><a href="math.html#Base.Rounding.RoundToZero"><code>RoundToZero</code></a></p></li><li><p><code>RoundFromZero</code> (<a href="numbers.html#Base.MPFR.BigFloat"><code>BigFloat</code></a> only)</p></li><li><p><a href="math.html#Base.Rounding.RoundUp"><code>RoundUp</code></a></p></li><li><p><a href="math.html#Base.Rounding.RoundDown"><code>RoundDown</code></a></p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rounding.jl#L26-L43">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Rounding.RoundNearest" href="#Base.Rounding.RoundNearest"><code>Base.Rounding.RoundNearest</code></a> — <span class="docstring-category">Constant</span>.</div><div><pre><code class="language-none">RoundNearest</code></pre><p>The default rounding mode. Rounds to the nearest integer, with ties (fractional values of 0.5) being rounded to the nearest even integer.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rounding.jl#L46-L51">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Rounding.RoundNearestTiesAway" href="#Base.Rounding.RoundNearestTiesAway"><code>Base.Rounding.RoundNearestTiesAway</code></a> — <span class="docstring-category">Constant</span>.</div><div><pre><code class="language-none">RoundNearestTiesAway</code></pre><p>Rounds to nearest integer, with ties rounded away from zero (C/C++ <a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a> behaviour).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rounding.jl#L77-L82">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Rounding.RoundNearestTiesUp" href="#Base.Rounding.RoundNearestTiesUp"><code>Base.Rounding.RoundNearestTiesUp</code></a> — <span class="docstring-category">Constant</span>.</div><div><pre><code class="language-none">RoundNearestTiesUp</code></pre><p>Rounds to nearest integer, with ties rounded toward positive infinity (Java/JavaScript <a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a> behaviour).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rounding.jl#L85-L90">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Rounding.RoundToZero" href="#Base.Rounding.RoundToZero"><code>Base.Rounding.RoundToZero</code></a> — <span class="docstring-category">Constant</span>.</div><div><pre><code class="language-none">RoundToZero</code></pre><p><a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a> using this rounding mode is an alias for <a href="math.html#Base.trunc"><code>trunc</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rounding.jl#L54-L58">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Rounding.RoundUp" href="#Base.Rounding.RoundUp"><code>Base.Rounding.RoundUp</code></a> — <span class="docstring-category">Constant</span>.</div><div><pre><code class="language-none">RoundUp</code></pre><p><a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a> using this rounding mode is an alias for <a href="math.html#Base.ceil"><code>ceil</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rounding.jl#L61-L65">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Rounding.RoundDown" href="#Base.Rounding.RoundDown"><code>Base.Rounding.RoundDown</code></a> — <span class="docstring-category">Constant</span>.</div><div><pre><code class="language-none">RoundDown</code></pre><p><a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a> using this rounding mode is an alias for <a href="math.html#Base.floor"><code>floor</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/rounding.jl#L68-L72">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.round-Union{Tuple{Complex{T},RoundingMode{MR},RoundingMode{MI}}, Tuple{MI}, Tuple{MR}, Tuple{T}} where MI where MR where T<:AbstractFloat" href="#Base.round-Union{Tuple{Complex{T},RoundingMode{MR},RoundingMode{MI}}, Tuple{MI}, Tuple{MR}, Tuple{T}} where MI where MR where T<:AbstractFloat"><code>Base.round</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">round(z, RoundingModeReal, RoundingModeImaginary)</code></pre><p>Returns the nearest integral value of the same type as the complex-valued <code>z</code> to <code>z</code>, breaking ties using the specified <a href="math.html#Base.Rounding.RoundingMode"><code>RoundingMode</code></a>s. The first <a href="math.html#Base.Rounding.RoundingMode"><code>RoundingMode</code></a> is used for rounding the real components while the second is used for rounding the imaginary components.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/complex.jl#L876-L883">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.ceil" href="#Base.ceil"><code>Base.ceil</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">ceil([T,] x, [digits, [base]])</code></pre><p><code>ceil(x)</code> returns the nearest integral value of the same type as <code>x</code> that is greater than or equal to <code>x</code>.</p><p><code>ceil(T, x)</code> converts the result to type <code>T</code>, throwing an <code>InexactError</code> if the value is not representable.</p><p><code>digits</code> and <code>base</code> work as for <a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L364-L374">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.floor" href="#Base.floor"><code>Base.floor</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">floor([T,] x, [digits, [base]])</code></pre><p><code>floor(x)</code> returns the nearest integral value of the same type as <code>x</code> that is less than or equal to <code>x</code>.</p><p><code>floor(T, x)</code> converts the result to type <code>T</code>, throwing an <code>InexactError</code> if the value is not representable.</p><p><code>digits</code> and <code>base</code> work as for <a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L680-L690">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.trunc" href="#Base.trunc"><code>Base.trunc</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">trunc([T,] x, [digits, [base]])</code></pre><p><code>trunc(x)</code> returns the nearest integral value of the same type as <code>x</code> whose absolute value is less than or equal to <code>x</code>.</p><p><code>trunc(T, x)</code> converts the result to type <code>T</code>, throwing an <code>InexactError</code> if the value is not representable.</p><p><code>digits</code> and <code>base</code> work as for <a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1024-L1034">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.unsafe_trunc" href="#Base.unsafe_trunc"><code>Base.unsafe_trunc</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">unsafe_trunc(T, x)</code></pre><p><code>unsafe_trunc(T, x)</code> returns the nearest integral value of type <code>T</code> whose absolute value is less than or equal to <code>x</code>. If the value is not representable by <code>T</code>, an arbitrary value will be returned.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1789-L1795">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.signif" href="#Base.signif"><code>Base.signif</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">signif(x, digits, [base])</code></pre><p>Rounds (in the sense of <a href="dates.html#Base.round-Tuple{Base.Dates.TimeType,Base.Dates.Period,RoundingMode{:NearestTiesUp}}"><code>round</code></a>) <code>x</code> so that there are <code>digits</code> significant digits, under a base <code>base</code> representation, default 10. E.g., <code>signif(123.456, 2)</code> is <code>120.0</code>, and <code>signif(357.913, 4, 2)</code> is <code>352.0</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L2303-L2309">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.min" href="#Base.min"><code>Base.min</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">min(x, y, ...)</code></pre><p>Return the minimum of the arguments. See also the <a href="collections.html#Base.minimum-Tuple{Any}"><code>minimum</code></a> function to take the minimum element from a collection.</p><pre><code class="language-julia-repl">julia> min(2, 5, 1)
|
||
1</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L350-L360">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.max" href="#Base.max"><code>Base.max</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">max(x, y, ...)</code></pre><p>Return the maximum of the arguments. See also the <a href="collections.html#Base.maximum-Tuple{Any}"><code>maximum</code></a> function to take the maximum element from a collection.</p><pre><code class="language-julia-repl">julia> max(2, 5, 1)
|
||
5</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L337-L347">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.minmax" href="#Base.minmax"><code>Base.minmax</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">minmax(x, y)</code></pre><p>Return <code>(min(x,y), max(x,y))</code>. See also: <a href="collections.html#Base.extrema-Tuple{Any}"><code>extrema</code></a> that returns <code>(minimum(x), maximum(x))</code>.</p><pre><code class="language-julia-repl">julia> minmax('c','b')
|
||
('b', 'c')</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/operators.jl#L363-L372">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.clamp" href="#Base.Math.clamp"><code>Base.Math.clamp</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">clamp(x, lo, hi)</code></pre><p>Return <code>x</code> if <code>lo <= x <= hi</code>. If <code>x < lo</code>, return <code>lo</code>. If <code>x > hi</code>, return <code>hi</code>. Arguments are promoted to a common type.</p><pre><code class="language-julia-repl">julia> clamp.([pi, 1.0, big(10.)], 2., 9.)
|
||
3-element Array{BigFloat,1}:
|
||
3.141592653589793238462643383279502884197169399375105820974944592307816406286198
|
||
2.000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||
9.000000000000000000000000000000000000000000000000000000000000000000000000000000</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L42-L55">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.clamp!" href="#Base.Math.clamp!"><code>Base.Math.clamp!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">clamp!(array::AbstractArray, lo, hi)</code></pre><p>Restrict values in <code>array</code> to the specified range, in-place. See also <a href="math.html#Base.Math.clamp"><code>clamp</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L62-L67">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.abs" href="#Base.abs"><code>Base.abs</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">abs(x)</code></pre><p>The absolute value of <code>x</code>.</p><p>When <code>abs</code> is applied to signed integers, overflow may occur, resulting in the return of a negative value. This overflow occurs only when <code>abs</code> is applied to the minimum representable value of a signed integer. That is, when <code>x == typemin(typeof(x))</code>, <code>abs(x) == x < 0</code>, not <code>-x</code> as might be expected.</p><pre><code class="language-julia-repl">julia> abs(-3)
|
||
3
|
||
|
||
julia> abs(1 + im)
|
||
1.4142135623730951
|
||
|
||
julia> abs(typemin(Int64))
|
||
-9223372036854775808</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/int.jl#L87-L108">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_abs" href="#Base.Checked.checked_abs"><code>Base.Checked.checked_abs</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_abs(x)</code></pre><p>Calculates <code>abs(x)</code>, checking for overflow errors where applicable. For example, standard two's complement signed integers (e.g. <code>Int</code>) cannot represent <code>abs(typemin(Int))</code>, thus leading to an overflow.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L107-L115">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_neg" href="#Base.Checked.checked_neg"><code>Base.Checked.checked_neg</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_neg(x)</code></pre><p>Calculates <code>-x</code>, checking for overflow errors where applicable. For example, standard two's complement signed integers (e.g. <code>Int</code>) cannot represent <code>-typemin(Int)</code>, thus leading to an overflow.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L81-L89">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_add" href="#Base.Checked.checked_add"><code>Base.Checked.checked_add</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_add(x, y)</code></pre><p>Calculates <code>x+y</code>, checking for overflow errors where applicable.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L155-L161">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_sub" href="#Base.Checked.checked_sub"><code>Base.Checked.checked_sub</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_sub(x, y)</code></pre><p>Calculates <code>x-y</code>, checking for overflow errors where applicable.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L212-L218">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_mul" href="#Base.Checked.checked_mul"><code>Base.Checked.checked_mul</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_mul(x, y)</code></pre><p>Calculates <code>x*y</code>, checking for overflow errors where applicable.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L277-L283">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_div" href="#Base.Checked.checked_div"><code>Base.Checked.checked_div</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_div(x, y)</code></pre><p>Calculates <code>div(x,y)</code>, checking for overflow errors where applicable.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L306-L312">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_rem" href="#Base.Checked.checked_rem"><code>Base.Checked.checked_rem</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_rem(x, y)</code></pre><p>Calculates <code>x%y</code>, checking for overflow errors where applicable.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L315-L321">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_fld" href="#Base.Checked.checked_fld"><code>Base.Checked.checked_fld</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_fld(x, y)</code></pre><p>Calculates <code>fld(x,y)</code>, checking for overflow errors where applicable.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L324-L330">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_mod" href="#Base.Checked.checked_mod"><code>Base.Checked.checked_mod</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_mod(x, y)</code></pre><p>Calculates <code>mod(x,y)</code>, checking for overflow errors where applicable.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L333-L339">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.checked_cld" href="#Base.Checked.checked_cld"><code>Base.Checked.checked_cld</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.checked_cld(x, y)</code></pre><p>Calculates <code>cld(x,y)</code>, checking for overflow errors where applicable.</p><p>The overflow protection may impose a perceptible performance penalty.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L342-L348">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.add_with_overflow" href="#Base.Checked.add_with_overflow"><code>Base.Checked.add_with_overflow</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.add_with_overflow(x, y) -> (r, f)</code></pre><p>Calculates <code>r = x+y</code>, with the flag <code>f</code> indicating whether overflow has occurred.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L128-L132">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.sub_with_overflow" href="#Base.Checked.sub_with_overflow"><code>Base.Checked.sub_with_overflow</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.sub_with_overflow(x, y) -> (r, f)</code></pre><p>Calculates <code>r = x-y</code>, with the flag <code>f</code> indicating whether overflow has occurred.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L187-L191">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Checked.mul_with_overflow" href="#Base.Checked.mul_with_overflow"><code>Base.Checked.mul_with_overflow</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">Base.mul_with_overflow(x, y) -> (r, f)</code></pre><p>Calculates <code>r = x*y</code>, with the flag <code>f</code> indicating whether overflow has occurred.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/checked.jl#L227-L231">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.abs2" href="#Base.abs2"><code>Base.abs2</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">abs2(x)</code></pre><p>Squared absolute value of <code>x</code>.</p><pre><code class="language-julia-repl">julia> abs2(-3)
|
||
9</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/number.jl#L84-L93">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.copysign" href="#Base.copysign"><code>Base.copysign</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">copysign(x, y) -> z</code></pre><p>Return <code>z</code> which has the magnitude of <code>x</code> and the same sign as <code>y</code>.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> copysign(1, -2)
|
||
-1
|
||
|
||
julia> copysign(-1, 2)
|
||
1</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L799-L812">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.sign" href="#Base.sign"><code>Base.sign</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sign(x)</code></pre><p>Return zero if <code>x==0</code> and <span>$x/|x|$</span> otherwise (i.e., ±1 for real <code>x</code>).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/number.jl#L74-L78">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.signbit" href="#Base.signbit"><code>Base.signbit</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">signbit(x)</code></pre><p>Returns <code>true</code> if the value of the sign of <code>x</code> is negative, otherwise <code>false</code>.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> signbit(-4)
|
||
true
|
||
|
||
julia> signbit(5)
|
||
false
|
||
|
||
julia> signbit(5.5)
|
||
false
|
||
|
||
julia> signbit(-4.1)
|
||
true</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L2449-L2468">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.flipsign" href="#Base.flipsign"><code>Base.flipsign</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">flipsign(x, y)</code></pre><p>Return <code>x</code> with its sign flipped if <code>y</code> is negative. For example <code>abs(x) = flipsign(x,x)</code>.</p><pre><code class="language-julia-repl">julia> flipsign(5, 3)
|
||
5
|
||
|
||
julia> flipsign(5, -3)
|
||
-5</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/number.jl#L96-L108">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.sqrt" href="#Base.sqrt"><code>Base.sqrt</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">sqrt(x)</code></pre><p>Return <span>$\sqrt{x}$</span>. Throws <a href="base.html#Core.DomainError"><code>DomainError</code></a> for negative <a href="numbers.html#Core.Real"><code>Real</code></a> arguments. Use complex negative arguments instead. The prefix operator <code>√</code> is equivalent to <code>sqrt</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L428-L433">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.isqrt" href="#Base.isqrt"><code>Base.isqrt</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">isqrt(n::Integer)</code></pre><p>Integer square root: the largest integer <code>m</code> such that <code>m*m <= n</code>.</p><pre><code class="language-julia-repl">julia> isqrt(5)
|
||
2</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L745-L754">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.cbrt" href="#Base.Math.cbrt"><code>Base.Math.cbrt</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cbrt(x::Real)</code></pre><p>Return the cube root of <code>x</code>, i.e. <span>$x^{1/3}$</span>. Negative values are accepted (returning the negative real root when <span>$x < 0$</span>).</p><p>The prefix operator <code>∛</code> is equivalent to <code>cbrt</code>.</p><pre><code class="language-julia-repl">julia> cbrt(big(27))
|
||
3.000000000000000000000000000000000000000000000000000000000000000000000000000000</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L247-L259">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.real-Tuple{Complex}" href="#Base.real-Tuple{Complex}"><code>Base.real</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">real(z)</code></pre><p>Return the real part of the complex number <code>z</code>.</p><pre><code class="language-julia-repl">julia> real(1 + 3im)
|
||
1</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/complex.jl#L44-L53">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.imag" href="#Base.imag"><code>Base.imag</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">imag(z)</code></pre><p>Return the imaginary part of the complex number <code>z</code>.</p><pre><code class="language-julia-repl">julia> imag(1 + 3im)
|
||
3</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/complex.jl#L56-L65">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.reim" href="#Base.reim"><code>Base.reim</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">reim(z)</code></pre><p>Return both the real and imaginary parts of the complex number <code>z</code>.</p><pre><code class="language-julia-repl">julia> reim(1 + 3im)
|
||
(1, 3)</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/complex.jl#L70-L79">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.conj" href="#Base.conj"><code>Base.conj</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">conj(v::RowVector)</code></pre><p>Returns a <a href="linalg.html#Base.LinAlg.ConjArray"><code>ConjArray</code></a> lazy view of the input, where each element is conjugated.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> v = [1+im, 1-im].'
|
||
1×2 RowVector{Complex{Int64},Array{Complex{Int64},1}}:
|
||
1+1im 1-1im
|
||
|
||
julia> conj(v)
|
||
1×2 RowVector{Complex{Int64},ConjArray{Complex{Int64},1,Array{Complex{Int64},1}}}:
|
||
1-1im 1+1im</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/linalg/rowvector.jl#L88-L104">source</a><br/><div><pre><code class="language-none">conj(z)</code></pre><p>Compute the complex conjugate of a complex number <code>z</code>.</p><pre><code class="language-julia-repl">julia> conj(1 + 3im)
|
||
1 - 3im</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/complex.jl#L204-L213">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.angle" href="#Base.angle"><code>Base.angle</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">angle(z)</code></pre><p>Compute the phase angle in radians of a complex number <code>z</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/complex.jl#L444-L448">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.cis" href="#Base.cis"><code>Base.cis</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cis(z)</code></pre><p>Return <span>$\exp(iz)$</span>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/complex.jl#L434-L438">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.binomial" href="#Base.binomial"><code>Base.binomial</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">binomial(n, k)</code></pre><p>Number of ways to choose <code>k</code> out of <code>n</code> items.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> binomial(5, 3)
|
||
10
|
||
|
||
julia> factorial(5) ÷ (factorial(5-3) * factorial(3))
|
||
10</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L776-L789">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.factorial" href="#Base.factorial"><code>Base.factorial</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">factorial(n)</code></pre><p>Factorial of <code>n</code>. If <code>n</code> is an <a href="numbers.html#Core.Integer"><code>Integer</code></a>, the factorial is computed as an integer (promoted to at least 64 bits). Note that this may overflow if <code>n</code> is not small, but you can use <code>factorial(big(n))</code> to compute the result exactly in arbitrary precision. If <code>n</code> is not an <code>Integer</code>, <code>factorial(n)</code> is equivalent to <a href="math.html#Base.Math.gamma"><code>gamma(n+1)</code></a>.</p><pre><code class="language-julia-repl">julia> factorial(6)
|
||
720
|
||
|
||
julia> factorial(21)
|
||
ERROR: OverflowError()
|
||
[...]
|
||
|
||
julia> factorial(21.0)
|
||
5.109094217170944e19
|
||
|
||
julia> factorial(big(21))
|
||
51090942171709440000</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/number.jl#L216-L238">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.gcd" href="#Base.gcd"><code>Base.gcd</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gcd(x,y)</code></pre><p>Greatest common (positive) divisor (or zero if <code>x</code> and <code>y</code> are both zero).</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> gcd(6,9)
|
||
3
|
||
|
||
julia> gcd(6,-9)
|
||
3</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L5-L18">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.lcm" href="#Base.lcm"><code>Base.lcm</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">lcm(x,y)</code></pre><p>Least common (non-negative) multiple.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> lcm(2,3)
|
||
6
|
||
|
||
julia> lcm(-2,3)
|
||
6</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L51-L64">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.gcdx" href="#Base.gcdx"><code>Base.gcdx</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gcdx(x,y)</code></pre><p>Computes the greatest common (positive) divisor of <code>x</code> and <code>y</code> and their Bézout coefficients, i.e. the integer coefficients <code>u</code> and <code>v</code> that satisfy <span>$ux+vy = d = gcd(x,y)$</span>. <span>$gcdx(x,y)$</span> returns <span>$(d,u,v)$</span>.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> gcdx(12, 42)
|
||
(6, -3, 1)
|
||
|
||
julia> gcdx(240, 46)
|
||
(2, -9, 47)</code></pre><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Bézout coefficients are <em>not</em> uniquely defined. <code>gcdx</code> returns the minimal Bézout coefficients that are computed by the extended Euclidean algorithm. (Ref: D. Knuth, TAoCP, 2/e, p. 325, Algorithm X.) For signed integers, these coefficients <code>u</code> and <code>v</code> are minimal in the sense that <span>$|u| < |y/d|$</span> and <span>$|v| < |x/d|$</span>. Furthermore, the signs of <code>u</code> and <code>v</code> are chosen so that <code>d</code> is positive. For unsigned integers, the coefficients <code>u</code> and <code>v</code> might be near their <code>typemax</code>, and the identity then holds only via the unsigned integers' modulo arithmetic.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L85-L111">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.ispow2" href="#Base.ispow2"><code>Base.ispow2</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">ispow2(n::Integer) -> Bool</code></pre><p>Test whether <code>n</code> is a power of two.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> ispow2(4)
|
||
true
|
||
|
||
julia> ispow2(5)
|
||
false</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L311-L324">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.nextpow2" href="#Base.nextpow2"><code>Base.nextpow2</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">nextpow2(n::Integer)</code></pre><p>The smallest power of two not less than <code>n</code>. Returns 0 for <code>n==0</code>, and returns <code>-nextpow2(-n)</code> for negative arguments.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> nextpow2(16)
|
||
16
|
||
|
||
julia> nextpow2(17)
|
||
32</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L275-L289">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.prevpow2" href="#Base.prevpow2"><code>Base.prevpow2</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">prevpow2(n::Integer)</code></pre><p>The largest power of two not greater than <code>n</code>. Returns 0 for <code>n==0</code>, and returns <code>-prevpow2(-n)</code> for negative arguments.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> prevpow2(5)
|
||
4
|
||
|
||
julia> prevpow2(0)
|
||
0</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L293-L307">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.nextpow" href="#Base.nextpow"><code>Base.nextpow</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">nextpow(a, x)</code></pre><p>The smallest <code>a^n</code> not less than <code>x</code>, where <code>n</code> is a non-negative integer. <code>a</code> must be greater than 1, and <code>x</code> must be greater than 0.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> nextpow(2, 7)
|
||
8
|
||
|
||
julia> nextpow(2, 9)
|
||
16
|
||
|
||
julia> nextpow(5, 20)
|
||
25
|
||
|
||
julia> nextpow(4, 16)
|
||
16</code></pre><p>See also <a href="math.html#Base.prevpow"><code>prevpow</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L327-L349">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.prevpow" href="#Base.prevpow"><code>Base.prevpow</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">prevpow(a, x)</code></pre><p>The largest <code>a^n</code> not greater than <code>x</code>, where <code>n</code> is a non-negative integer. <code>a</code> must be greater than 1, and <code>x</code> must not be less than 1.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> prevpow(2, 7)
|
||
4
|
||
|
||
julia> prevpow(2, 9)
|
||
8
|
||
|
||
julia> prevpow(5, 20)
|
||
5
|
||
|
||
julia> prevpow(4, 16)
|
||
16</code></pre><p>See also <a href="math.html#Base.nextpow"><code>nextpow</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L359-L380">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.nextprod" href="#Base.nextprod"><code>Base.nextprod</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">nextprod([k_1, k_2,...], n)</code></pre><p>Next integer greater than or equal to <code>n</code> that can be written as <span>$\prod k_i^{p_i}$</span> for integers <span>$p_1$</span>, <span>$p_2$</span>, etc.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl">julia> nextprod([2, 3], 105)
|
||
108
|
||
|
||
julia> 2^2 * 3^3
|
||
108</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/combinatorics.jl#L234-L248">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.invmod" href="#Base.invmod"><code>Base.invmod</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">invmod(x,m)</code></pre><p>Take the inverse of <code>x</code> modulo <code>m</code>: <code>y</code> such that <span>$x y = 1 \pmod m$</span>, with <span>$div(x,y) = 0$</span>. This is undefined for <span>$m = 0$</span>, or if <span>$gcd(x,m) \neq 1$</span>.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> invmod(2,5)
|
||
3
|
||
|
||
julia> invmod(2,3)
|
||
2
|
||
|
||
julia> invmod(5,6)
|
||
5</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L129-L147">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.powermod" href="#Base.powermod"><code>Base.powermod</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">powermod(x::Integer, p::Integer, m)</code></pre><p>Compute <span>$x^p \pmod m$</span>.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> powermod(2, 6, 5)
|
||
4
|
||
|
||
julia> mod(2^6, 5)
|
||
4
|
||
|
||
julia> powermod(5, 2, 20)
|
||
5
|
||
|
||
julia> powermod(5, 2, 19)
|
||
6
|
||
|
||
julia> powermod(5, 3, 19)
|
||
11</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L226-L248">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.gamma" href="#Base.Math.gamma"><code>Base.Math.gamma</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">gamma(x)</code></pre><p>Compute the gamma function of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/gamma.jl#L6-L10">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.lgamma" href="#Base.Math.lgamma"><code>Base.Math.lgamma</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">lgamma(x)</code></pre><p>Compute the logarithm of the absolute value of <a href="math.html#Base.Math.gamma"><code>gamma</code></a> for <a href="numbers.html#Core.Real"><code>Real</code></a> <code>x</code>, while for <a href="numbers.html#Base.Complex"><code>Complex</code></a> <code>x</code> compute the principal branch cut of the logarithm of <code>gamma(x)</code> (defined for negative <code>real(x)</code> by analytic continuation from positive <code>real(x)</code>).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/gamma.jl#L36-L43">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.lfact" href="#Base.Math.lfact"><code>Base.Math.lfact</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">lfact(x)</code></pre><p>Compute the logarithmic factorial of a nonnegative integer <code>x</code>. Equivalent to <a href="math.html#Base.Math.lgamma"><code>lgamma</code></a> of <code>x + 1</code>, but <code>lgamma</code> extends this function to non-integer <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/gamma.jl#L27-L33">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.beta" href="#Base.Math.beta"><code>Base.Math.beta</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">beta(x, y)</code></pre><p>Euler integral of the first kind <span>$\operatorname{B}(x,y) = \Gamma(x)\Gamma(y)/\Gamma(x+y)$</span>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/gamma.jl#L139-L143">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.lbeta" href="#Base.Math.lbeta"><code>Base.Math.lbeta</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">lbeta(x, y)</code></pre><p>Natural logarithm of the absolute value of the <a href="math.html#Base.Math.beta"><code>beta</code></a> function <span>$\log(|\operatorname{B}(x,y)|)$</span>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/special/gamma.jl#L151-L156">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.ndigits" href="#Base.ndigits"><code>Base.ndigits</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">ndigits(n::Integer, b::Integer=10)</code></pre><p>Compute the number of digits in integer <code>n</code> written in base <code>b</code>. The base <code>b</code> must not be in <code>[-1, 0, 1]</code>.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> ndigits(12345)
|
||
5
|
||
|
||
julia> ndigits(1022, 16)
|
||
3
|
||
|
||
julia> base(16, 1022)
|
||
"3fe"</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/intfuncs.jl#L481-L498">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.widemul" href="#Base.widemul"><code>Base.widemul</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">widemul(x, y)</code></pre><p>Multiply <code>x</code> and <code>y</code>, giving the result as a larger type.</p><pre><code class="language-julia-repl">julia> widemul(Float32(3.), 4.)
|
||
1.200000000000000000000000000000000000000000000000000000000000000000000000000000e+01</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/number.jl#L118-L127">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.Math.@evalpoly" href="#Base.Math.@evalpoly"><code>Base.Math.@evalpoly</code></a> — <span class="docstring-category">Macro</span>.</div><div><pre><code class="language-none">@evalpoly(z, c...)</code></pre><p>Evaluate the polynomial <span>$\sum_k c[k] z^{k-1}$</span> for the coefficients <code>c[1]</code>, <code>c[2]</code>, ...; that is, the coefficients are given in ascending order by power of <code>z</code>. This macro expands to efficient inline code that uses either Horner's method or, for complex <code>z</code>, a more efficient Goertzel-like algorithm.</p><pre><code class="language-julia-repl">julia> @evalpoly(3, 1, 0, 1)
|
||
10
|
||
|
||
julia> @evalpoly(2, 1, 0, 1)
|
||
5
|
||
|
||
julia> @evalpoly(2, 1, 1, 1)
|
||
7</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/math.jl#L89-L107">source</a><br/></section><h2><a class="nav-anchor" id="Statistics-1" href="#Statistics-1">Statistics</a></h2><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.mean" href="#Base.mean"><code>Base.mean</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">mean(f::Function, v)</code></pre><p>Apply the function <code>f</code> to each element of <code>v</code> and take the mean.</p><pre><code class="language-julia-repl">julia> mean(√, [1, 2, 3])
|
||
1.3820881233139908
|
||
|
||
julia> mean([√1, √2, √3])
|
||
1.3820881233139908</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L5-L17">source</a><br/><div><pre><code class="language-none">mean(v[, region])</code></pre><p>Compute the mean of whole array <code>v</code>, or optionally along the dimensions in <code>region</code>.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Julia does not ignore <code>NaN</code> values in the computation. For applications requiring the handling of missing data, the <code>DataArrays.jl</code> package is recommended.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L48-L56">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.mean!" href="#Base.mean!"><code>Base.mean!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">mean!(r, v)</code></pre><p>Compute the mean of <code>v</code> over the singleton dimensions of <code>r</code>, and write results to <code>r</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/docs/helpdb/Base.jl#L1736-L1740">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.std" href="#Base.std"><code>Base.std</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">std(v[, region]; corrected::Bool=true, mean=nothing)</code></pre><p>Compute the sample standard deviation of a vector or array <code>v</code>, optionally along dimensions in <code>region</code>. The algorithm returns an estimator of the generative distribution's standard deviation under the assumption that each entry of <code>v</code> is an IID drawn from that generative distribution. This computation is equivalent to calculating <code>sqrt(sum((v - mean(v)).^2) / (length(v) - 1))</code>. A pre-computed <code>mean</code> may be provided. If <code>corrected</code> is <code>true</code>, then the sum is scaled with <code>n-1</code>, whereas the sum is scaled with <code>n</code> if <code>corrected</code> is <code>false</code> where <code>n = length(x)</code>.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Julia does not ignore <code>NaN</code> values in the computation. For applications requiring the handling of missing data, the <code>DataArrays.jl</code> package is recommended.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L249-L264">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.stdm" href="#Base.stdm"><code>Base.stdm</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">stdm(v, m::Number; corrected::Bool=true)</code></pre><p>Compute the sample standard deviation of a vector <code>v</code> with known mean <code>m</code>. If <code>corrected</code> is <code>true</code>, then the sum is scaled with <code>n-1</code>, whereas the sum is scaled with <code>n</code> if <code>corrected</code> is <code>false</code> where <code>n = length(x)</code>.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Julia does not ignore <code>NaN</code> values in the computation. For applications requiring the handling of missing data, the <code>DataArrays.jl</code> package is recommended.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L271-L283">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.var" href="#Base.var"><code>Base.var</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">var(v[, region]; corrected::Bool=true, mean=nothing)</code></pre><p>Compute the sample variance of a vector or array <code>v</code>, optionally along dimensions in <code>region</code>. The algorithm will return an estimator of the generative distribution's variance under the assumption that each entry of <code>v</code> is an IID drawn from that generative distribution. This computation is equivalent to calculating <code>sum(abs2, v - mean(v)) / (length(v) - 1)</code>. If <code>corrected</code> is <code>true</code>, then the sum is scaled with <code>n-1</code>, whereas the sum is scaled with <code>n</code> if <code>corrected</code> is <code>false</code> where <code>n = length(x)</code>. The mean <code>mean</code> over the region may be provided.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Julia does not ignore <code>NaN</code> values in the computation. For applications requiring the handling of missing data, the <code>DataArrays.jl</code> package is recommended.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L188-L203">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.varm" href="#Base.varm"><code>Base.varm</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">varm(v, m[, region]; corrected::Bool=true)</code></pre><p>Compute the sample variance of a collection <code>v</code> with known mean(s) <code>m</code>, optionally over <code>region</code>. <code>m</code> may contain means for each dimension of <code>v</code>. If <code>corrected</code> is <code>true</code>, then the sum is scaled with <code>n-1</code>, whereas the sum is scaled with <code>n</code> if <code>corrected</code> is <code>false</code> where <code>n = length(x)</code>.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Julia does not ignore <code>NaN</code> values in the computation. For applications requiring the handling of missing data, the <code>DataArrays.jl</code> package is recommended.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L167-L179">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.middle" href="#Base.middle"><code>Base.middle</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">middle(x)</code></pre><p>Compute the middle of a scalar value, which is equivalent to <code>x</code> itself, but of the type of <code>middle(x, x)</code> for consistency.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L533-L537">source</a><br/><div><pre><code class="language-none">middle(x, y)</code></pre><p>Compute the middle of two reals <code>x</code> and <code>y</code>, which is equivalent in both value and type to computing their mean (<code>(x + y) / 2</code>).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L543-L548">source</a><br/><div><pre><code class="language-none">middle(range)</code></pre><p>Compute the middle of a range, which consists of computing the mean of its extrema. Since a range is sorted, the mean is performed with the first and last element.</p><pre><code class="language-julia-repl">julia> middle(1:10)
|
||
5.5</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L551-L561">source</a><br/><div><pre><code class="language-none">middle(a)</code></pre><p>Compute the middle of an array <code>a</code>, which consists of finding its extrema and then computing their mean.</p><pre><code class="language-julia-repl">julia> a = [1,2,3.6,10.9]
|
||
4-element Array{Float64,1}:
|
||
1.0
|
||
2.0
|
||
3.6
|
||
10.9
|
||
|
||
julia> middle(a)
|
||
5.95</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L564-L581">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.median" href="#Base.median"><code>Base.median</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">median(v[, region])</code></pre><p>Compute the median of an entire array <code>v</code>, or, optionally, along the dimensions in <code>region</code>. For an even number of elements no exact median element exists, so the result is equivalent to calculating mean of two median elements.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Julia does not ignore <code>NaN</code> values in the computation. For applications requiring the handling of missing data, the <code>DataArrays.jl</code> package is recommended.</p></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L609-L620">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.median!" href="#Base.median!"><code>Base.median!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">median!(v)</code></pre><p>Like <a href="math.html#Base.median"><code>median</code></a>, but may overwrite the input vector.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L584-L588">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.quantile" href="#Base.quantile"><code>Base.quantile</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">quantile(v, p; sorted=false)</code></pre><p>Compute the quantile(s) of a vector <code>v</code> at a specified probability or vector <code>p</code>. The keyword argument <code>sorted</code> indicates whether <code>v</code> can be assumed to be sorted.</p><p>The <code>p</code> should be on the interval [0,1], and <code>v</code> should not have any <code>NaN</code> values.</p><p>Quantiles are computed via linear interpolation between the points <code>((k-1)/(n-1), v[k])</code>, for <code>k = 1:n</code> where <code>n = length(v)</code>. This corresponds to Definition 7 of Hyndman and Fan (1996), and is the same as the R default.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Julia does not ignore <code>NaN</code> values in the computation. For applications requiring the handling of missing data, the <code>DataArrays.jl</code> package is recommended. <code>quantile</code> will throw an <code>ArgumentError</code> in the presence of <code>NaN</code> values in the data array.</p></div></div><ul><li><p>Hyndman, R.J and Fan, Y. (1996) "Sample Quantiles in Statistical Packages", <em>The American Statistician</em>, Vol. 50, No. 4, pp. 361-365</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L719-L738">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.quantile!" href="#Base.quantile!"><code>Base.quantile!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">quantile!([q, ] v, p; sorted=false)</code></pre><p>Compute the quantile(s) of a vector <code>v</code> at the probabilities <code>p</code>, with optional output into array <code>q</code> (if not provided, a new output array is created). The keyword argument <code>sorted</code> indicates whether <code>v</code> can be assumed to be sorted; if <code>false</code> (the default), then the elements of <code>v</code> may be partially sorted.</p><p>The elements of <code>p</code> should be on the interval [0,1], and <code>v</code> should not have any <code>NaN</code> values.</p><p>Quantiles are computed via linear interpolation between the points <code>((k-1)/(n-1), v[k])</code>, for <code>k = 1:n</code> where <code>n = length(v)</code>. This corresponds to Definition 7 of Hyndman and Fan (1996), and is the same as the R default.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><p>Julia does not ignore <code>NaN</code> values in the computation. For applications requiring the handling of missing data, the <code>DataArrays.jl</code> package is recommended. <code>quantile!</code> will throw an <code>ArgumentError</code> in the presence of <code>NaN</code> values in the data array.</p></div></div><ul><li><p>Hyndman, R.J and Fan, Y. (1996) "Sample Quantiles in Statistical Packages", <em>The American Statistician</em>, Vol. 50, No. 4, pp. 361-365</p></li></ul></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L625-L647">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.cov" href="#Base.cov"><code>Base.cov</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cov(x[, corrected=true])</code></pre><p>Compute the variance of the vector <code>x</code>. If <code>corrected</code> is <code>true</code> (the default) then the sum is scaled with <code>n-1</code>, whereas the sum is scaled with <code>n</code> if <code>corrected</code> is <code>false</code> where <code>n = length(x)</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L342-L347">source</a><br/><div><pre><code class="language-none">cov(X[, vardim=1, corrected=true])</code></pre><p>Compute the covariance matrix of the matrix <code>X</code> along the dimension <code>vardim</code>. If <code>corrected</code> is <code>true</code> (the default) then the sum is scaled with <code>n-1</code>, whereas the sum is scaled with <code>n</code> if <code>corrected</code> is <code>false</code> where <code>n = size(X, vardim)</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L352-L358">source</a><br/><div><pre><code class="language-none">cov(x, y[, corrected=true])</code></pre><p>Compute the covariance between the vectors <code>x</code> and <code>y</code>. If <code>corrected</code> is <code>true</code> (the default), computes <span>$\frac{1}{n-1}\sum_{i=1}^n (x_i-\bar x) (y_i-\bar y)^*$</span> where <span>$*$</span> denotes the complex conjugate and <code>n = length(x) = length(y)</code>. If <code>corrected</code> is <code>false</code>, computes <span>$rac{1}{n}sum_{i=1}^n (x_i-\bar x) (y_i-\bar y)^*$</span>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L364-L371">source</a><br/><div><pre><code class="language-none">cov(X, Y[, vardim=1, corrected=true])</code></pre><p>Compute the covariance between the vectors or matrices <code>X</code> and <code>Y</code> along the dimension <code>vardim</code>. If <code>corrected</code> is <code>true</code> (the default) then the sum is scaled with <code>n-1</code>, whereas the sum is scaled with <code>n</code> if <code>corrected</code> is <code>false</code> where <code>n = size(X, vardim) = size(Y, vardim)</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L378-L384">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.cor" href="#Base.cor"><code>Base.cor</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">cor(x)</code></pre><p>Return the number one.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L494-L498">source</a><br/><div><pre><code class="language-none">cor(X[, vardim=1])</code></pre><p>Compute the Pearson correlation matrix of the matrix <code>X</code> along the dimension <code>vardim</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L502-L506">source</a><br/><div><pre><code class="language-none">cor(x, y)</code></pre><p>Compute the Pearson correlation between the vectors <code>x</code> and <code>y</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L511-L515">source</a><br/><div><pre><code class="language-none">cor(X, Y[, vardim=1])</code></pre><p>Compute the Pearson correlation between the vectors or matrices <code>X</code> and <code>Y</code> along the dimension <code>vardim</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/statistics.jl#L519-L523">source</a><br/></section><h2><a class="nav-anchor" id="Signal-Processing-1" href="#Signal-Processing-1">Signal Processing</a></h2><p>Fast Fourier transform (FFT) functions in Julia are implemented by calling functions from <a href="http://www.fftw.org">FFTW</a>.</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.fft" href="#Base.DFT.fft"><code>Base.DFT.fft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fft(A [, dims])</code></pre><p>Performs a multidimensional FFT of the array <code>A</code>. The optional <code>dims</code> argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. Most efficient if the size of <code>A</code> along the transformed dimensions is a product of small primes; see <code>nextprod()</code>. See also <code>plan_fft()</code> for even greater efficiency.</p><p>A one-dimensional FFT computes the one-dimensional discrete Fourier transform (DFT) as defined by</p><div>\[\operatorname{DFT}(A)[k] =
|
||
\sum_{n=1}^{\operatorname{length}(A)}
|
||
\exp\left(-i\frac{2\pi
|
||
(n-1)(k-1)}{\operatorname{length}(A)} \right) A[n].\]</div><p>A multidimensional FFT simply performs this operation along each transformed dimension of <code>A</code>.</p><div class="admonition note"><div class="admonition-title">Note</div><div class="admonition-text"><ul><li><p>Julia starts FFTW up with 1 thread by default. Higher performance is usually possible by increasing number of threads. Use <code>FFTW.set_num_threads(Sys.CPU_CORES)</code> to use as many threads as cores on your system.</p></li><li><p>This performs a multidimensional FFT by default. FFT libraries in other languages such as Python and Octave perform a one-dimensional FFT along the first non-singleton dimension of the array. This is worth noting while performing comparisons. For more details, refer to the <a href="../manual/noteworthy-differences.html#Noteworthy-Differences-from-other-Languages-1">Noteworthy Differences from other Languages</a> section of the manual.</p></li></ul></div></div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L401-L431">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.fft!" href="#Base.DFT.fft!"><code>Base.DFT.fft!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">fft!(A [, dims])</code></pre><p>Same as <a href="math.html#Base.DFT.fft"><code>fft</code></a>, but operates in-place on <code>A</code>, which must be an array of complex floating-point numbers.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L169-L174">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.ifft" href="#Base.DFT.ifft"><code>Base.DFT.ifft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">ifft(A [, dims])</code></pre><p>Multidimensional inverse FFT.</p><p>A one-dimensional inverse FFT computes</p><div>\[\operatorname{IDFT}(A)[k] = \frac{1}{\operatorname{length}(A)}
|
||
\sum_{n=1}^{\operatorname{length}(A)} \exp\left(+i\frac{2\pi (n-1)(k-1)}
|
||
{\operatorname{length}(A)} \right) A[n].\]</div><p>A multidimensional inverse FFT simply performs this operation along each transformed dimension of <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L152-L166">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.ifft!" href="#Base.DFT.ifft!"><code>Base.DFT.ifft!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">ifft!(A [, dims])</code></pre><p>Same as <a href="math.html#Base.DFT.ifft"><code>ifft</code></a>, but operates in-place on <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L145-L149">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.bfft" href="#Base.DFT.bfft"><code>Base.DFT.bfft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">bfft(A [, dims])</code></pre><p>Similar to <a href="math.html#Base.DFT.ifft"><code>ifft</code></a>, but computes an unnormalized inverse (backward) transform, which must be divided by the product of the sizes of the transformed dimensions in order to obtain the inverse. (This is slightly more efficient than <a href="math.html#Base.DFT.ifft"><code>ifft</code></a> because it omits a scaling step, which in some applications can be combined with other computational steps elsewhere.)</p><div>\[\operatorname{BDFT}(A)[k] = \operatorname{length}(A) \operatorname{IDFT}(A)[k]\]</div></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L177-L189">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.bfft!" href="#Base.DFT.bfft!"><code>Base.DFT.bfft!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">bfft!(A [, dims])</code></pre><p>Same as <a href="math.html#Base.DFT.bfft"><code>bfft</code></a>, but operates in-place on <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L192-L196">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_fft" href="#Base.DFT.plan_fft"><code>Base.DFT.plan_fft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_fft(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Pre-plan an optimized FFT along given dimensions (<code>dims</code>) of arrays matching the shape and type of <code>A</code>. (The first two arguments have the same meaning as for <a href="math.html#Base.DFT.fft"><code>fft</code></a>.) Returns an object <code>P</code> which represents the linear operator computed by the FFT, and which contains all of the information needed to compute <code>fft(A, dims)</code> quickly.</p><p>To apply <code>P</code> to an array <code>A</code>, use <code>P * A</code>; in general, the syntax for applying plans is much like that of matrices. (A plan can only be applied to arrays of the same size as the <code>A</code> for which the plan was created.) You can also apply a plan with a preallocated output array <code>Â</code> by calling <code>A_mul_B!(Â, plan, A)</code>. (For <code>A_mul_B!</code>, however, the input array <code>A</code> must be a complex floating-point array like the output <code>Â</code>.) You can compute the inverse-transform plan by <code>inv(P)</code> and apply the inverse plan with <code>P \ Â</code> (the inverse plan is cached and reused for subsequent calls to <code>inv</code> or <code>\</code>), and apply the inverse plan to a pre-allocated output array <code>A</code> with <code>A_ldiv_B!(A, P, Â)</code>.</p><p>The <code>flags</code> argument is a bitwise-or of FFTW planner flags, defaulting to <code>FFTW.ESTIMATE</code>. e.g. passing <code>FFTW.MEASURE</code> or <code>FFTW.PATIENT</code> will instead spend several seconds (or more) benchmarking different possible FFT algorithms and picking the fastest one; see the FFTW manual for more information on planner flags. The optional <code>timelimit</code> argument specifies a rough upper bound on the allowed planning time, in seconds. Passing <code>FFTW.MEASURE</code> or <code>FFTW.PATIENT</code> may cause the input array <code>A</code> to be overwritten with zeros during plan creation.</p><p><a href="math.html#Base.DFT.plan_fft!"><code>plan_fft!</code></a> is the same as <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a> but creates a plan that operates in-place on its argument (which must be an array of complex floating-point numbers). <a href="math.html#Base.DFT.plan_ifft"><code>plan_ifft</code></a> and so on are similar but produce plans that perform the equivalent of the inverse transforms <a href="math.html#Base.DFT.ifft"><code>ifft</code></a> and so on.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L92-L121">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_ifft" href="#Base.DFT.plan_ifft"><code>Base.DFT.plan_ifft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_ifft(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Same as <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a>, but produces a plan that performs inverse transforms <a href="math.html#Base.DFT.ifft"><code>ifft</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L62-L67">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_bfft" href="#Base.DFT.plan_bfft"><code>Base.DFT.plan_bfft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_bfft(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Same as <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a>, but produces a plan that performs an unnormalized backwards transform <a href="math.html#Base.DFT.bfft"><code>bfft</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L84-L89">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_fft!" href="#Base.DFT.plan_fft!"><code>Base.DFT.plan_fft!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_fft!(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Same as <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a>, but operates in-place on <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L124-L128">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_ifft!" href="#Base.DFT.plan_ifft!"><code>Base.DFT.plan_ifft!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_ifft!(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Same as <a href="math.html#Base.DFT.plan_ifft"><code>plan_ifft</code></a>, but operates in-place on <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L70-L74">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_bfft!" href="#Base.DFT.plan_bfft!"><code>Base.DFT.plan_bfft!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_bfft!(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Same as <a href="math.html#Base.DFT.plan_bfft"><code>plan_bfft</code></a>, but operates in-place on <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L77-L81">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.rfft" href="#Base.DFT.rfft"><code>Base.DFT.rfft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">rfft(A [, dims])</code></pre><p>Multidimensional FFT of a real array <code>A</code>, exploiting the fact that the transform has conjugate symmetry in order to save roughly half the computational time and storage costs compared with <a href="math.html#Base.DFT.fft"><code>fft</code></a>. If <code>A</code> has size <code>(n_1, ..., n_d)</code>, the result has size <code>(div(n_1,2)+1, ..., n_d)</code>.</p><p>The optional <code>dims</code> argument specifies an iterable subset of one or more dimensions of <code>A</code> to transform, similar to <a href="math.html#Base.DFT.fft"><code>fft</code></a>. Instead of (roughly) halving the first dimension of <code>A</code> in the result, the <code>dims[1]</code> dimension is (roughly) halved in the same way.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L131-L142">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.irfft" href="#Base.DFT.irfft"><code>Base.DFT.irfft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">irfft(A, d [, dims])</code></pre><p>Inverse of <a href="math.html#Base.DFT.rfft"><code>rfft</code></a>: for a complex array <code>A</code>, gives the corresponding real array whose FFT yields <code>A</code> in the first half. As for <a href="math.html#Base.DFT.rfft"><code>rfft</code></a>, <code>dims</code> is an optional subset of dimensions to transform, defaulting to <code>1:ndims(A)</code>.</p><p><code>d</code> is the length of the transformed real array along the <code>dims[1]</code> dimension, which must satisfy <code>div(d,2)+1 == size(A,dims[1])</code>. (This parameter cannot be inferred from <code>size(A)</code> since both <code>2*size(A,dims[1])-2</code> as well as <code>2*size(A,dims[1])-1</code> are valid sizes for the transformed real array.)</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L302-L313">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.brfft" href="#Base.DFT.brfft"><code>Base.DFT.brfft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">brfft(A, d [, dims])</code></pre><p>Similar to <a href="math.html#Base.DFT.irfft"><code>irfft</code></a> but computes an unnormalized inverse transform (similar to <a href="math.html#Base.DFT.bfft"><code>bfft</code></a>), which must be divided by the product of the sizes of the transformed dimensions (of the real output array) in order to obtain the inverse transform.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L316-L322">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_rfft" href="#Base.DFT.plan_rfft"><code>Base.DFT.plan_rfft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_rfft(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Pre-plan an optimized real-input FFT, similar to <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a> except for <a href="math.html#Base.DFT.rfft"><code>rfft</code></a> instead of <a href="math.html#Base.DFT.fft"><code>fft</code></a>. The first two arguments, and the size of the transformed result, are the same as for <a href="math.html#Base.DFT.rfft"><code>rfft</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L434-L440">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_brfft" href="#Base.DFT.plan_brfft"><code>Base.DFT.plan_brfft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_brfft(A, d [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Pre-plan an optimized real-input unnormalized transform, similar to <a href="math.html#Base.DFT.plan_rfft"><code>plan_rfft</code></a> except for <a href="math.html#Base.DFT.brfft"><code>brfft</code></a> instead of <a href="math.html#Base.DFT.rfft"><code>rfft</code></a>. The first two arguments and the size of the transformed result, are the same as for <a href="math.html#Base.DFT.brfft"><code>brfft</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L443-L450">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.plan_irfft" href="#Base.DFT.plan_irfft"><code>Base.DFT.plan_irfft</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_irfft(A, d [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf)</code></pre><p>Pre-plan an optimized inverse real-input FFT, similar to <a href="math.html#Base.DFT.plan_rfft"><code>plan_rfft</code></a> except for <a href="math.html#Base.DFT.irfft"><code>irfft</code></a> and <a href="math.html#Base.DFT.brfft"><code>brfft</code></a>, respectively. The first three arguments have the same meaning as for <a href="math.html#Base.DFT.irfft"><code>irfft</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L344-L350">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.dct" href="#Base.DFT.FFTW.dct"><code>Base.DFT.FFTW.dct</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">dct(A [, dims])</code></pre><p>Performs a multidimensional type-II discrete cosine transform (DCT) of the array <code>A</code>, using the unitary normalization of the DCT. The optional <code>dims</code> argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. Most efficient if the size of <code>A</code> along the transformed dimensions is a product of small primes; see <a href="math.html#Base.nextprod"><code>nextprod</code></a>. See also <a href="math.html#Base.DFT.FFTW.plan_dct"><code>plan_dct</code></a> for even greater efficiency.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L494-L503">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.dct!" href="#Base.DFT.FFTW.dct!"><code>Base.DFT.FFTW.dct!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">dct!(A [, dims])</code></pre><p>Same as <a href="math.html#Base.DFT.FFTW.dct!"><code>dct!</code></a>, except that it operates in-place on <code>A</code>, which must be an array of real or complex floating-point values.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L518-L523">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.idct" href="#Base.DFT.FFTW.idct"><code>Base.DFT.FFTW.idct</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">idct(A [, dims])</code></pre><p>Computes the multidimensional inverse discrete cosine transform (DCT) of the array <code>A</code> (technically, a type-III DCT with the unitary normalization). The optional <code>dims</code> argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. Most efficient if the size of <code>A</code> along the transformed dimensions is a product of small primes; see <a href="math.html#Base.nextprod"><code>nextprod</code></a>. See also <a href="math.html#Base.DFT.FFTW.plan_idct"><code>plan_idct</code></a> for even greater efficiency.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L506-L515">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.idct!" href="#Base.DFT.FFTW.idct!"><code>Base.DFT.FFTW.idct!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">idct!(A [, dims])</code></pre><p>Same as <a href="math.html#Base.DFT.FFTW.idct!"><code>idct!</code></a>, but operates in-place on <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L526-L530">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.plan_dct" href="#Base.DFT.FFTW.plan_dct"><code>Base.DFT.FFTW.plan_dct</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_dct(A [, dims [, flags [, timelimit]]])</code></pre><p>Pre-plan an optimized discrete cosine transform (DCT), similar to <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a> except producing a function that computes <a href="math.html#Base.DFT.FFTW.dct"><code>dct</code></a>. The first two arguments have the same meaning as for <a href="math.html#Base.DFT.FFTW.dct"><code>dct</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L477-L484">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.plan_dct!" href="#Base.DFT.FFTW.plan_dct!"><code>Base.DFT.FFTW.plan_dct!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_dct!(A [, dims [, flags [, timelimit]]])</code></pre><p>Same as <a href="math.html#Base.DFT.FFTW.plan_dct"><code>plan_dct</code></a>, but operates in-place on <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L460-L464">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.plan_idct" href="#Base.DFT.FFTW.plan_idct"><code>Base.DFT.FFTW.plan_idct</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_idct(A [, dims [, flags [, timelimit]]])</code></pre><p>Pre-plan an optimized inverse discrete cosine transform (DCT), similar to <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a> except producing a function that computes <a href="math.html#Base.DFT.FFTW.idct"><code>idct</code></a>. The first two arguments have the same meaning as for <a href="math.html#Base.DFT.FFTW.idct"><code>idct</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L467-L474">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.plan_idct!" href="#Base.DFT.FFTW.plan_idct!"><code>Base.DFT.FFTW.plan_idct!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_idct!(A [, dims [, flags [, timelimit]]])</code></pre><p>Same as <a href="math.html#Base.DFT.FFTW.plan_idct"><code>plan_idct</code></a>, but operates in-place on <code>A</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L487-L491">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.fftshift-Tuple{Any}" href="#Base.DFT.fftshift-Tuple{Any}"><code>Base.DFT.fftshift</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">fftshift(x)</code></pre><p>Swap the first and second halves of each dimension of <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L359-L363">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.fftshift-Tuple{Any,Any}" href="#Base.DFT.fftshift-Tuple{Any,Any}"><code>Base.DFT.fftshift</code></a> — <span class="docstring-category">Method</span>.</div><div><pre><code class="language-none">fftshift(x,dim)</code></pre><p>Swap the first and second halves of the given dimension or iterable of dimensions of array <code>x</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L374-L378">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.ifftshift" href="#Base.DFT.ifftshift"><code>Base.DFT.ifftshift</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">ifftshift(x, [dim])</code></pre><p>Undoes the effect of <code>fftshift</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L383-L387">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DSP.filt" href="#Base.DSP.filt"><code>Base.DSP.filt</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">filt(b, a, x, [si])</code></pre><p>Apply filter described by vectors <code>a</code> and <code>b</code> to vector <code>x</code>, with an optional initial filter state vector <code>si</code> (defaults to zeros).</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dsp.jl#L11-L16">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DSP.filt!" href="#Base.DSP.filt!"><code>Base.DSP.filt!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">filt!(out, b, a, x, [si])</code></pre><p>Same as <a href="math.html#Base.DSP.filt"><code>filt</code></a> but writes the result into the <code>out</code> argument, which may alias the input <code>x</code> to modify it in-place.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dsp.jl#L25-L30">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DSP.deconv" href="#Base.DSP.deconv"><code>Base.DSP.deconv</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">deconv(b,a) -> c</code></pre><p>Construct vector <code>c</code> such that <code>b = conv(a,c) + r</code>. Equivalent to polynomial division.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dsp.jl#L105-L110">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DSP.conv" href="#Base.DSP.conv"><code>Base.DSP.conv</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">conv(u,v)</code></pre><p>Convolution of two vectors. Uses FFT algorithm.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dsp.jl#L123-L127">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DSP.conv2" href="#Base.DSP.conv2"><code>Base.DSP.conv2</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">conv2(u,v,A)</code></pre><p>2-D convolution of the matrix <code>A</code> with the 2-D separable kernel generated by the vectors <code>u</code> and <code>v</code>. Uses 2-D FFT algorithm.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dsp.jl#L148-L154">source</a><br/><div><pre><code class="language-none">conv2(B,A)</code></pre><p>2-D convolution of the matrix <code>B</code> with the matrix <code>A</code>. Uses 2-D FFT algorithm.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dsp.jl#L169-L173">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DSP.xcorr" href="#Base.DSP.xcorr"><code>Base.DSP.xcorr</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">xcorr(u,v)</code></pre><p>Compute the cross-correlation of two vectors.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dsp.jl#L192-L196">source</a><br/></section><p>The following functions are defined within the <code>Base.FFTW</code> module.</p><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.r2r" href="#Base.DFT.FFTW.r2r"><code>Base.DFT.FFTW.r2r</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">r2r(A, kind [, dims])</code></pre><p>Performs a multidimensional real-input/real-output (r2r) transform of type <code>kind</code> of the array <code>A</code>, as defined in the FFTW manual. <code>kind</code> specifies either a discrete cosine transform of various types (<code>FFTW.REDFT00</code>, <code>FFTW.REDFT01</code>, <code>FFTW.REDFT10</code>, or <code>FFTW.REDFT11</code>), a discrete sine transform of various types (<code>FFTW.RODFT00</code>, <code>FFTW.RODFT01</code>, <code>FFTW.RODFT10</code>, or <code>FFTW.RODFT11</code>), a real-input DFT with halfcomplex-format output (<code>FFTW.R2HC</code> and its inverse <code>FFTW.HC2R</code>), or a discrete Hartley transform (<code>FFTW.DHT</code>). The <code>kind</code> argument may be an array or tuple in order to specify different transform types along the different dimensions of <code>A</code>; <code>kind[end]</code> is used for any unspecified dimensions. See the FFTW manual for precise definitions of these transform types, at http://www.fftw.org/doc.</p><p>The optional <code>dims</code> argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. <code>kind[i]</code> is then the transform type for <code>dims[i]</code>, with <code>kind[end]</code> being used for <code>i > length(kind)</code>.</p><p>See also <a href="math.html#Base.DFT.FFTW.plan_r2r"><code>plan_r2r</code></a> to pre-plan optimized r2r transforms.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L533-L556">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.r2r!" href="#Base.DFT.FFTW.r2r!"><code>Base.DFT.FFTW.r2r!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">r2r!(A, kind [, dims])</code></pre><p>Same as <a href="math.html#Base.DFT.FFTW.r2r"><code>r2r</code></a>, but operates in-place on <code>A</code>, which must be an array of real or complex floating-point numbers.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L559-L564">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.plan_r2r" href="#Base.DFT.FFTW.plan_r2r"><code>Base.DFT.FFTW.plan_r2r</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_r2r(A, kind [, dims [, flags [, timelimit]]])</code></pre><p>Pre-plan an optimized r2r transform, similar to <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a> except that the transforms (and the first three arguments) correspond to <a href="math.html#Base.DFT.FFTW.r2r"><code>r2r</code></a> and <a href="math.html#Base.DFT.FFTW.r2r!"><code>r2r!</code></a>, respectively.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L574-L580">source</a><br/></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="Base.DFT.FFTW.plan_r2r!" href="#Base.DFT.FFTW.plan_r2r!"><code>Base.DFT.FFTW.plan_r2r!</code></a> — <span class="docstring-category">Function</span>.</div><div><pre><code class="language-none">plan_r2r!(A, kind [, dims [, flags [, timelimit]]])</code></pre><p>Similar to <a href="math.html#Base.DFT.plan_fft"><code>plan_fft</code></a>, but corresponds to <a href="math.html#Base.DFT.FFTW.r2r!"><code>r2r!</code></a>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaLang/julia/tree/d386e40c17d43b79fc89d3e579fc04547241787c/base/dft.jl#L567-L571">source</a><br/></section><footer><hr/><a class="previous" href="collections.html"><span class="direction">Previous</span><span class="title">Collections and Data Structures</span></a><a class="next" href="numbers.html"><span class="direction">Next</span><span class="title">Numbers</span></a></footer></article></body></html>
|