commit
f4a58a972e
|
@ -1,7 +1,7 @@
|
|||
// Helper styles for inline icons used with the "icon" shortcode
|
||||
.article--content {
|
||||
.inline {
|
||||
margin: 0 .2rem;
|
||||
margin: 0 .15rem;
|
||||
&.middle:before { vertical-align: middle; }
|
||||
&.xsmall:before { font-size: .8rem; }
|
||||
&.small:before { font-size: .9rem; }
|
||||
|
@ -10,7 +10,7 @@
|
|||
&.add-btn-round {
|
||||
font-family: "icomoon";
|
||||
color:#fff;
|
||||
background:#22adf6;
|
||||
background:#7a65f2;
|
||||
border-radius:50%;
|
||||
margin:0 .25rem;
|
||||
display: inline-block;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
@font-face {
|
||||
font-family: 'icomoon';
|
||||
src: url('fonts/icomoon.eot?9ofj87');
|
||||
src: url('fonts/icomoon.eot?9ofj87#iefix') format('embedded-opentype'),
|
||||
url('fonts/icomoon.ttf?9ofj87') format('truetype'),
|
||||
url('fonts/icomoon.woff?9ofj87') format('woff'),
|
||||
url('fonts/icomoon.svg?9ofj87#icomoon') format('svg');
|
||||
src: url('fonts/icomoon.eot?s76ef');
|
||||
src: url('fonts/icomoon.eot?s76ef#iefix') format('embedded-opentype'),
|
||||
url('fonts/icomoon.ttf?s76ef') format('truetype'),
|
||||
url('fonts/icomoon.woff?s76ef') format('woff'),
|
||||
url('fonts/icomoon.svg?s76ef#icomoon') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -87,12 +87,15 @@
|
|||
.icon-ui-search:before {
|
||||
content: "\e933";
|
||||
}
|
||||
.icon-ui-triangle:before {
|
||||
.icon-ui-trash:before {
|
||||
content: "\e935";
|
||||
}
|
||||
.icon-ui-wrench:before {
|
||||
.icon-ui-triangle:before {
|
||||
content: "\e936";
|
||||
}
|
||||
.icon-ui-wrench-2:before {
|
||||
content: "\e939";
|
||||
}
|
||||
.icon-moon1:before {
|
||||
content: "\e904";
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ draft: true
|
|||
"v2.0/tags": [influxdb]
|
||||
---
|
||||
|
||||
This is a paragraph. Lorem ipsum dolor ({{< icon "wrench" >}}) sit amet, consectetur adipiscing elit. Nunc rutrum, metus id scelerisque euismod, erat ante suscipit nibh, ac congue enim risus id est. Etiam tristique nisi et tristique auctor. Morbi eu bibendum erat. Sed ullamcorper, dui id lobortis efficitur, mauris odio pharetra neque, vel tempor odio dolor blandit justo.
|
||||
This is a paragraph. Lorem ipsum dolor ({{< icon "trash" >}}) sit amet, consectetur adipiscing elit. Nunc rutrum, metus id scelerisque euismod, erat ante suscipit nibh, ac congue enim risus id est. Etiam tristique nisi et tristique auctor. Morbi eu bibendum erat. Sed ullamcorper, dui id lobortis efficitur, mauris odio pharetra neque, vel tempor odio dolor blandit justo.
|
||||
|
||||
{{< nav-icon "dashboards" >}}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ This article describes how to get started with InfluxDB OSS. To get started with
|
|||
### Download and install InfluxDB v2.0 alpha
|
||||
Download InfluxDB v2.0 alpha for macOS.
|
||||
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.6_darwin_amd64.tar.gz" download>InfluxDB v2.0 alpha (macOS)</a>
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.7_darwin_amd64.tar.gz" download>InfluxDB v2.0 alpha (macOS)</a>
|
||||
|
||||
### Place the executables in your $PATH
|
||||
Unpackage the downloaded archive and place the `influx` and `influxd` executables in your system `$PATH`.
|
||||
|
@ -36,10 +36,10 @@ _**Note:** The following commands are examples. Adjust the file paths to your ow
|
|||
|
||||
```sh
|
||||
# Unpackage contents to the current working directory
|
||||
gunzip -c ~/Downloads/influxdb_2.0.0-alpha.6_darwin_amd64.tar.gz | tar xopf -
|
||||
gunzip -c ~/Downloads/influxdb_2.0.0-alpha.7_darwin_amd64.tar.gz | tar xopf -
|
||||
|
||||
# Copy the influx and influxd binary to your $PATH
|
||||
sudo cp influxdb_2.0.0-alpha.6_darwin_amd64/{influx,influxd} /usr/local/bin/
|
||||
sudo cp influxdb_2.0.0-alpha.7_darwin_amd64/{influx,influxd} /usr/local/bin/
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
|
@ -84,8 +84,8 @@ influxd --reporting-disabled
|
|||
### Download and install InfluxDB v2.0 alpha
|
||||
Download the InfluxDB v2.0 alpha package appropriate for your chipset.
|
||||
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.6_linux_amd64.tar.gz" download >InfluxDB v2.0 alpha (amd64)</a>
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.6_linux_arm64.tar.gz" download >InfluxDB v2.0 alpha (arm)</a>
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.7_linux_amd64.tar.gz" download >InfluxDB v2.0 alpha (amd64)</a>
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-alpha.7_linux_arm64.tar.gz" download >InfluxDB v2.0 alpha (arm)</a>
|
||||
|
||||
### Place the executables in your $PATH
|
||||
Unpackage the downloaded archive and place the `influx` and `influxd` executables in your system `$PATH`.
|
||||
|
@ -94,10 +94,10 @@ _**Note:** The following commands are examples. Adjust the file names, paths, an
|
|||
|
||||
```sh
|
||||
# Unpackage contents to the current working directory
|
||||
tar xvzf path/to/influxdb_2.0.0-alpha.6_linux_amd64.tar.gz
|
||||
tar xvzf path/to/influxdb_2.0.0-alpha.7_linux_amd64.tar.gz
|
||||
|
||||
# Copy the influx and influxd binary to your $PATH
|
||||
sudo cp influxdb_2.0.0-alpha.6_linux_amd64/{influx,influxd} /usr/local/bin/
|
||||
sudo cp influxdb_2.0.0-alpha.7_linux_amd64/{influx,influxd} /usr/local/bin/
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
|
|
|
@ -34,7 +34,7 @@ The InfluxDB UI provides multiple ways to create a task:
|
|||
for detailed information about each option.
|
||||
5. Click **Save as Task**.
|
||||
|
||||
{{< img-hd src="/img/data-explorer-save-as-task.png" title="Add a task from the Data Explorer"/>}}
|
||||
{{< img-hd src="/img/2-0-data-explorer-save-as-task.png" title="Add a task from the Data Explorer"/>}}
|
||||
|
||||
### Create a task in the Task UI
|
||||
1. Click on the **Tasks** icon in the left navigation menu.
|
||||
|
@ -47,16 +47,25 @@ The InfluxDB UI provides multiple ways to create a task:
|
|||
4. In the right panel, enter your task script.
|
||||
5. Click **Save** in the upper right.
|
||||
|
||||
{{< img-hd src="/img/tasks-create-edit.png" title="Create a task" />}}
|
||||
{{< img-hd src="/img/2-0-tasks-create-edit.png" title="Create a task" />}}
|
||||
|
||||
### Import a task
|
||||
1. Click on the **Tasks** icon in the left navigation menu.
|
||||
|
||||
{{< nav-icon "tasks" >}}
|
||||
|
||||
2. Click **Import** in the upper right.
|
||||
|
||||
2. Click **+ Create Task** in the upper right.
|
||||
3. Select **Import Task**.
|
||||
3. Drag and drop or select a file to upload.
|
||||
4. Click **Upload Task**.
|
||||
4. Click **Import JSON as Task**.
|
||||
|
||||
### Clone a task
|
||||
1. Click on the **Tasks** icon in the left navigation menu.
|
||||
|
||||
{{< nav-icon "tasks" >}}
|
||||
|
||||
2. Hover over the task you would like to clone and click the **{{< icon "duplicate" >}}** that appears.
|
||||
4. Click **Clone**.
|
||||
|
||||
## Create a task using the influx CLI
|
||||
Use `influx task create` command to create a new task.
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0:
|
||||
name: Delete a task
|
||||
parent: Manage tasks
|
||||
weight: 204
|
||||
weight: 205
|
||||
---
|
||||
|
||||
## Delete a task in the InfluxDB UI
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: Export a task
|
||||
seotitle: Export an InfluxDB task
|
||||
description: How to export a data processing task from InfluxDB using the InfluxDB user interface.
|
||||
menu:
|
||||
v2_0:
|
||||
name: Export a task
|
||||
parent: Manage tasks
|
||||
weight: 204
|
||||
---
|
||||
|
||||
InfluxDB allows you to export tasks from the InfluxDB user interface (UI).
|
||||
Tasks are exported as downloadable JSON files.
|
||||
|
||||
To export a task:
|
||||
|
||||
## Delete a task in the InfluxDB UI
|
||||
1. Click the **Tasks** icon in the left navigation menu.
|
||||
|
||||
{{< nav-icon "tasks" >}}
|
||||
|
||||
2. In the list of tasks, hover over the task you would like to export and click
|
||||
the **{{< icon "gear" >}}** that appears.
|
||||
3. Select **Export**.
|
||||
4. There are multiple options for downloading or saving the task export file:
|
||||
- Click **Download JSON** to download the exported JSON file.
|
||||
- Click **Save as template** to save the export file as a task template.
|
||||
- Click **Copy to Clipboard** to copy the raw JSON content to your machine's clipboard.
|
|
@ -22,7 +22,7 @@ To view your tasks, click the **Tasks** icon in the left navigation menu.
|
|||
3. In the right panel, modify the task script.
|
||||
4. Click **Save** in the upper right.
|
||||
|
||||
{{< img-hd src="/img/tasks-create-edit.png" alt="Update a task" />}}
|
||||
{{< img-hd src="/img/2-0-tasks-create-edit.png" alt="Update a task" />}}
|
||||
|
||||
#### Update the status of a task
|
||||
In the list of tasks, click the toggle in the **Active** column of the task you
|
||||
|
|
|
@ -21,7 +21,7 @@ This guide covers the different options:
|
|||
## Data Explorer
|
||||
Queries can be built, executed, and visualized in InfluxDB UI's Data Explorer.
|
||||
|
||||

|
||||

|
||||
|
||||
## Influx REPL
|
||||
The [`influx repl` command](/v2.0/reference/cli/influx/repl) starts an interactive
|
||||
|
|
|
@ -12,7 +12,7 @@ weight: 209
|
|||
|
||||
[Flux](/v2.0/reference/flux), InfluxData's data scripting and query language,
|
||||
supports mathematic expressions in data transformations.
|
||||
This article describes how to use [Flux arithmetic operators](/v2.0/reference/flux/language/operators/#arithmetic-operator)
|
||||
This article describes how to use [Flux arithmetic operators](/v2.0/reference/flux/language/operators/#arithmetic-operators)
|
||||
to "map" over data and transform values using mathematic operations.
|
||||
|
||||
##### Basic mathematic operations
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
title: Flux functions
|
||||
description: Flux functions allows you to retrieve, transform, process, and output data easily.
|
||||
v2.0/tags: [flux, functions]
|
||||
title: Flux packages and functions
|
||||
description: Flux packages and functions allows you to retrieve, transform, process, and output data easily.
|
||||
v2.0/tags: [flux, functions, package]
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Flux functions
|
||||
name: Flux packages and functions
|
||||
parent: Flux query language
|
||||
weight: 101
|
||||
weight: 102
|
||||
---
|
||||
|
||||
Flux's functional syntax allows you to retrieve, transform, process, and output data easily.
|
||||
There is a large library of built-in and importable functions:
|
||||
There is a large library of built-in functions and importable packages:
|
||||
|
||||
{{< children >}}
|
||||
|
|
|
@ -4,7 +4,7 @@ description: View the full library of documented Flux functions.
|
|||
menu:
|
||||
v2_0_ref:
|
||||
name: View all functions
|
||||
parent: Flux functions
|
||||
parent: Flux packages and functions
|
||||
weight: 299
|
||||
---
|
||||
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
title: Flux built-in functions
|
||||
list_title: Built-in functions
|
||||
description: >
|
||||
Built-in functions provide a necessary foundation for working with data using Flux.
|
||||
Built-in functions provide a foundation for working with data using Flux.
|
||||
They do not require an import statement and are usable without any extra setup.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Built-in
|
||||
parent: Flux functions
|
||||
parent: Flux packages and functions
|
||||
weight: 201
|
||||
v2.0/tags: [built-in, functions]
|
||||
v2.0/tags: [built-in, functions, package]
|
||||
---
|
||||
|
||||
Built-in functions provide a necessary foundation for working with data using Flux.
|
||||
Built-in functions provide a foundation for working with data using Flux.
|
||||
Because these functions are "built-in," they do not require an `import` statement and are usable without any extra setup.
|
||||
|
||||
Built-in functions are grouped into the following categories:
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
---
|
||||
title: reduce() function
|
||||
description: >
|
||||
The `reduce()` function aggregates records in each table according to the reducer,
|
||||
`fn`, providing a way to create custom table aggregations.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: reduce
|
||||
parent: built-in-aggregates
|
||||
weight: 501
|
||||
---
|
||||
|
||||
The `reduce()` function aggregates records in each table according to the reducer,
|
||||
`fn`, providing a way to create custom aggregations.
|
||||
The output for each table is the group key of the table with columns corresponding
|
||||
to each field in the reducer object.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
|
||||
```js
|
||||
reduce(
|
||||
fn: (r, accumulator) => ({ sum: r._value + accumulator.sum }),
|
||||
identity: {sum: 0.0}
|
||||
)
|
||||
```
|
||||
|
||||
If the reducer record contains a column with the same name as a group key column,
|
||||
the group key column's value is overwritten and the resulting record is regrouped
|
||||
into the appropriate table.
|
||||
|
||||
## Parameters
|
||||
|
||||
### fn
|
||||
Function to apply to each record with a reducer object ([`identity`](#identity)).
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
###### fn syntax
|
||||
```js
|
||||
// Pattern
|
||||
fn: (r, accumulator) => ({ identityKey: r.column + accumulator.identityKey })
|
||||
|
||||
// Example
|
||||
fn: (r, accumulator) => ({ sum: r._value + accumulator.sum })
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
#### Matching output object keys and types
|
||||
The output object from `fn` must have the same key names and value types as the [`identity`](#identity).
|
||||
After operating on a record, the output object is given back to `fn` as the input accumulator.
|
||||
If the output object keys and value types do not match the `identity` keys and value types,
|
||||
it will return a type error.
|
||||
{{% /note %}}
|
||||
|
||||
#### r
|
||||
Object representing each row or record.
|
||||
|
||||
#### accumulator
|
||||
Reducer object defined by [`identity`](#identity).
|
||||
|
||||
### identity
|
||||
Defines the reducer object and provides initial values to use when creating a reducer.
|
||||
May be used more than once in asynchronous processing use cases.
|
||||
_The data type of values in the `identity` object determine the data type of output values._
|
||||
|
||||
_**Data type:** Object_
|
||||
|
||||
###### identity object syntax
|
||||
```js
|
||||
// Pattern
|
||||
identity: {identityKey1: value1, identityKey2: value2}
|
||||
|
||||
// Example
|
||||
identity: {sum: 0.0, count: 0.0}
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
##### Compute the sum of the value column
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> filter(fn: (r) =>
|
||||
r._measurement == "cpu" and
|
||||
r._field == "usage_system" and
|
||||
r.service == "app-server"
|
||||
)
|
||||
|> range(start:-12h)
|
||||
|> reduce(
|
||||
fn: (r, accumulator) => ({
|
||||
sum: r._value + accumulator.sum
|
||||
}),
|
||||
identity: {sum: 0.0}
|
||||
)
|
||||
```
|
||||
|
||||
##### Compute the sum and count in a single reducer
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> filter(fn: (r) =>
|
||||
r._measurement == "cpu" and
|
||||
r._field == "usage_system" and
|
||||
r.service == "app-server"
|
||||
)
|
||||
|> range(start:-12h)
|
||||
|> reduce(
|
||||
fn: (r, accumulator) => ({
|
||||
sum: r._value + accumulator.sum,
|
||||
count: accumulator.count + 1.0
|
||||
}),
|
||||
identity: {sum: 0.0, count: 0.0}
|
||||
)
|
||||
```
|
||||
|
||||
##### Compute the product of all values
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> filter(fn: (r) =>
|
||||
r._measurement == "cpu" and
|
||||
r._field == "usage_system" and
|
||||
r.service == "app-server")
|
||||
|> range(start:-12h)
|
||||
|> reduce(
|
||||
fn: (r, accumulator) => ({
|
||||
prod: r._value * accumulator.prod
|
||||
}),
|
||||
identity: {prod: 1.0}
|
||||
)
|
||||
```
|
|
@ -1,50 +0,0 @@
|
|||
---
|
||||
title: shift() function
|
||||
description: The `shift()` function adds a fixed duration to time columns.
|
||||
aliases:
|
||||
- /v2.0/reference/flux/functions/transformations/shift
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: shift
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
---
|
||||
|
||||
The `shift()` function adds a fixed duration to time columns.
|
||||
The output table schema is the same as the input table.
|
||||
If the time is `null`, the time will continue to be `null`.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
_**Output data type:** Object_
|
||||
|
||||
```js
|
||||
shift(shift: 10h, columns: ["_start", "_stop", "_time"])
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### shift
|
||||
The amount of time to add to each time value. The shift may be a negative duration.
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
### columns
|
||||
The list of all columns to be shifted. Defaults to `["_start", "_stop", "_time"]`.
|
||||
|
||||
_**Data type:** Array of strings_
|
||||
|
||||
## Examples
|
||||
|
||||
###### Shift forward in time
|
||||
```js
|
||||
from(bucket: "telegraf/autogen")
|
||||
|> range(start: -5m)
|
||||
|> shift(shift: 12h)
|
||||
```
|
||||
|
||||
###### Shift backward in time
|
||||
```js
|
||||
from(bucket: "telegraf/autogen")
|
||||
|> range(start: -5m)
|
||||
|> shift(shift: -12h)
|
||||
```
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
title: timeShift() function
|
||||
description: The `timeShift()` function adds a fixed duration to time columns.
|
||||
aliases:
|
||||
- /v2.0/reference/flux/functions/transformations/shift
|
||||
- /v2.0/reference/flux/functions/built-in/transformations/shift
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: timeShift
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
---
|
||||
|
||||
The `timeShift()` function adds a fixed duration to time columns.
|
||||
The output table schema is the same as the input table.
|
||||
If the time is `null`, the time will continue to be `null`.
|
||||
|
||||
_**Function type:** Transformation_
|
||||
|
||||
```js
|
||||
timeShift(duration: 10h, columns: ["_start", "_stop", "_time"])
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### duration
|
||||
The amount of time to add to each time value.
|
||||
May be a negative duration.
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
### columns
|
||||
The list of all columns to be shifted.
|
||||
Defaults to `["_start", "_stop", "_time"]`.
|
||||
|
||||
_**Data type:** Array of strings_
|
||||
|
||||
## Examples
|
||||
|
||||
###### Shift forward in time
|
||||
```js
|
||||
from(bucket: "telegraf/autogen")
|
||||
|> range(start: -5m)
|
||||
|> timeShift(duration: 12h)
|
||||
```
|
||||
|
||||
###### Shift backward in time
|
||||
```js
|
||||
from(bucket: "telegraf/autogen")
|
||||
|> range(start: -5m)
|
||||
|> timeShift(duration: -12h)
|
||||
```
|
|
@ -1,21 +1,21 @@
|
|||
---
|
||||
title: Flux InfluxDB v1 functions
|
||||
list_title: InfluxDB v1 functions
|
||||
title: Flux InfluxDB v1 package
|
||||
list_title: InfluxDB v1 package
|
||||
description: >
|
||||
InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x
|
||||
The Flux InfluxDB v1 package provides functions for managing data from an InfluxDB v1.x
|
||||
database or structured using the InfluxDB v1 data structure.
|
||||
To use them, import the `influxdata/influxdb/v1` package.
|
||||
Import the `influxdata/influxdb/v1` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: InfluxDB v1
|
||||
parent: Flux functions
|
||||
weight: 202
|
||||
v2.0/tags: [functions, influxdb-v1]
|
||||
parent: Flux packages and functions
|
||||
weight: 203
|
||||
v2.0/tags: [functions, influxdb-v1, package]
|
||||
---
|
||||
|
||||
InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x
|
||||
database or structured using the InfluxDB v1 data structure.
|
||||
To use them, import the `influxdata/influxdb/v1` package:
|
||||
Import the `influxdata/influxdb/v1` package:
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
title: Flux math package
|
||||
list_title: Math package
|
||||
description: >
|
||||
The Flux math package provides basic constants and mathematical functions.
|
||||
Import the `math` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Math
|
||||
parent: Flux packages and functions
|
||||
weight: 202
|
||||
v2.0/tags: [math, functions]
|
||||
---
|
||||
|
||||
The Flux math package provides basic constants and mathematical functions.
|
||||
Import the `math` package.
|
||||
|
||||
```js
|
||||
import "math"
|
||||
```
|
||||
|
||||
## Mathematical constants
|
||||
That `math` package includes the following mathematical constants.
|
||||
|
||||
```js
|
||||
math.e = 2.71828182845904523536028747135266249775724709369995957496696763 // https ://oeis.org/A001113
|
||||
math.pi = 3.14159265358979323846264338327950288419716939937510582097494459 // https ://oeis.org/A000796
|
||||
math.phi = 1.61803398874989484820458683436563811772030917980576286213544862 // https ://oeis.org/A001622
|
||||
|
||||
math.sqrt2 = 1.41421356237309504880168872420969807856967187537694807317667974 // https ://oeis.org/A002193
|
||||
math.sqrte = 1.64872127070012814684865078781416357165377610071014801157507931 // https ://oeis.org/A019774
|
||||
math.sqrtpi = 1.77245385090551602729816748334114518279754945612238712821380779 // https ://oeis.org/A002161
|
||||
math.sqrtphi = 1.27201964951406896425242246173749149171560804184009624861664038 // https ://oeis.org/A139339
|
||||
|
||||
math.ln2 = 0.693147180559945309417232121458176568075500134360255254120680009 // https://oeis.org/A002162
|
||||
math.log2e = 1 ÷ math.ln2
|
||||
math.ln10 = 2.30258509299404568401799145468436420760110148862877297603332790 // https ://oeis.org/A002392
|
||||
math.log10e = 1 ÷ math.ln10
|
||||
|
||||
math.maxfloat = 1.797693134862315708145274237317043567981e+308 // 2**1023 * (2**53 - 1) / 2**52
|
||||
math.maxint = 1<<63 - 1
|
||||
math.minint = -1 << 63
|
||||
math.maxuint = 1<<64 - 1
|
||||
```
|
||||
|
||||
## Mathematical functions
|
||||
{{< children type="functions" show="pages" >}}
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.abs() function
|
||||
description: The math.abs() function returns the absolute value of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.abs
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.abs()` function returns the absolute value of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.abs(x: -1.22)
|
||||
|
||||
// Returns 1.22
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.abs(x: ±Inf) // Returns +Inf
|
||||
math.abs(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.acos() function
|
||||
description: The math.acos() function returns the arccosine of `x` in radians.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.acos
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.acos()` function returns the arccosine of `x` in radians.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.acos(x: 0.22)
|
||||
|
||||
// Returns 1.3489818562981022
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
`x` should be greater than -1 and less than 1.
|
||||
Otherwise, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.acos(x: <-1) // Returns NaN
|
||||
math.acos(x: >1) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.acosh() function
|
||||
description: The math.acosh() function returns the inverse hyperbolic cosine of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.acosh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.acosh()` function returns the inverse hyperbolic cosine of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.acosh(x: 1.22)
|
||||
|
||||
// Returns 0.6517292837263385
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
`x` should be greater than 1.
|
||||
If less than 1, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.acosh(x: +Inf) // Returns +Inf
|
||||
math.acosh(x: <1) // Returns NaN
|
||||
math.acosh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.asin() function
|
||||
description: The math.asin() function returns the arcsine of `x` in radians.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.asin
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.asin()` function returns the arcsine of `x` in radians.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.asin(x: 0.22)
|
||||
|
||||
// Returns 0.22181447049679442
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
`x` should be greater than -1 and less than 1.
|
||||
Otherwise, the function will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.asin(x: ±0) // Returns ±0
|
||||
math.asin(x: <-1) // Returns NaN
|
||||
math.asin(x: >1) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.asinh() function
|
||||
description: The math.asinh() function returns the inverse hyperbolic sine of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.asinh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.asinh()` function returns the inverse hyperbolic sine of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.asinh(x: 3.14)
|
||||
|
||||
// Returns 1.8618125572133835
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.asinh(x: ±0) // Returns ±0
|
||||
math.asinh(x: ±Inf) // Returns ±Inf
|
||||
math.asinh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.atan() function
|
||||
description: The math.atan() function returns the arctangent of `x` in radians.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.atan
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.atan()` function returns the arctangent of `x` in radians.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.atan(x: 3.14)
|
||||
|
||||
// Returns 1.262480664599468
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.atan(x: ±0) // Returns ±0
|
||||
math.atan(x: ±Inf) // Returns ±Pi/2
|
||||
```
|
|
@ -0,0 +1,57 @@
|
|||
---
|
||||
title: math.atan2() function
|
||||
description: >
|
||||
The math.atan2() function returns the arc tangent of `y`/`x`, using the signs of
|
||||
the parameters to determine the quadrant of the return value.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.atan2
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.atan2()` function returns the arc tangent of `y`/`x`, using the signs
|
||||
of the two to determine the quadrant of the return value.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.atan2(y: 1.22, x: 3.14)
|
||||
|
||||
// Returns 0.3705838802763881
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### y
|
||||
The y coordinate used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### x
|
||||
The x coordinate used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.atan2(y:y, x:NaN) // Returns NaN
|
||||
math.atan2(y: NaN, x:x) // Returns NaN
|
||||
math.atan2(y: +0, x: >=0) // Returns +0
|
||||
math.atan2(y: -0, x: >=0) // Returns -0
|
||||
math.atan2(y: +0, x: <=-0) // Returns +Pi
|
||||
math.atan2(y: -0, x: <=-0) // Returns -Pi
|
||||
math.atan2(y: >0, x: 0) // Returns +Pi/2
|
||||
math.atan2(y: <0, x: 0) // Returns -Pi/2
|
||||
math.atan2(y: +Inf, x: +Inf) // Returns +Pi/4
|
||||
math.atan2(y: -Inf, x: +Inf) // Returns -Pi/4
|
||||
math.atan2(y: +Inf, x: -Inf) // Returns 3Pi/4
|
||||
math.atan2(y: -Inf, x: -Inf) // Returns -3Pi/4
|
||||
math.atan2(y:y, x: +Inf) // Returns 0
|
||||
math.atan2(y: >0, x: -Inf) // Returns +Pi
|
||||
math.atan2(y: <0, x: -Inf) // Returns -Pi
|
||||
math.atan2(y: +Inf, x:x) // Returns +Pi/2
|
||||
math.atan2(y: -Inf, x:x) // Returns -Pi/2
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.atanh() function
|
||||
description: The math.atanh() function returns the inverse hyperbolic tangent of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.atanh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.atanh()` function returns the inverse hyperbolic tangent of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.atanh(x: 0.22)
|
||||
|
||||
// Returns 0.22365610902183242
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
`x` should be greater than -1 and less than 1.
|
||||
Otherwise, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.atanh(x: 1) // Returns +Inf
|
||||
math.atanh(x: ±0) // Returns ±0
|
||||
math.atanh(x: -1) // Returns -Inf
|
||||
math.atanh(x: <-1) // Returns NaN
|
||||
math.atanh(x: >1) // Returns NaN
|
||||
math.atanh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.cbrt() function
|
||||
description: The math.cbrt() function returns the cube root of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.cbrt
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.cbrt()` function returns the cube root of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.cbrt(x: 1728.0)
|
||||
|
||||
// Returns 12.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.cbrt(±0) // Returns ±0
|
||||
math.cbrt(±Inf) // Returns ±Inf
|
||||
math.cbrt(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.ceil() function
|
||||
description: The math.ceil() function returns the least integer value greater than or equal to `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.ceil
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.ceil()` function returns the least integer value greater than or equal to `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.ceil(x: 3.14)
|
||||
|
||||
// Returns 4.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.ceil(±0) // Returns ±0
|
||||
math.ceil(±Inf) // Returns ±Inf
|
||||
math.ceil(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
title: math.copysign() function
|
||||
description: The math.copysign() function returns a value with the magnitude of `x` and the sign of `y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.copysign
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.copysign()` function returns a value with the magnitude of `x` and the sign of `y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.copysign(x: 1.0, y: 2.0)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The magnitude used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The sign used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.cos() function
|
||||
description: The math.cos() function returns the cosine of the radian argument `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.cos
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.cos()` function returns the cosine of the radian argument `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.cos(x: 3.14)
|
||||
|
||||
// Returns -0.9999987317275396
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.cos(±Inf) // Returns NaN
|
||||
math.cos(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.cosh() function
|
||||
description: The math.cosh() function returns the hyperbolic cosine of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.cosh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.cosh()` function returns the hyperbolic cosine of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.cosh(x: 1.22)
|
||||
|
||||
// Returns 1.8412089502726743
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.cosh(±0) // Returns 1
|
||||
math.cosh(±Inf) // Returns +Inf
|
||||
math.cosh(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
title: math.dim() function
|
||||
description: The math.dim() function returns the maximum of `x`-`y` or 0.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.dim
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.dim()` function returns the maximum of `x - y` or 0.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.dim(x: 12.2, y: 8.1)
|
||||
|
||||
// Returns 4.1
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.dim(x: +Inf, y: +Inf) // Returns NaN
|
||||
math.dim(x: -Inf, y: -Inf) // Returns NaN
|
||||
math.dim(x:x, y : NaN) // Returns NaN
|
||||
math.dim(x: NaN, y :y) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.erf() function
|
||||
description: The math.erf() function returns the error function of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.erf
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.erf()` function returns the error function of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.erf(x: 22.6)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.erf(+Inf) // Returns 1
|
||||
math.erf(-Inf) // Returns -1
|
||||
math.erf(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.erfc() function
|
||||
description: The math.erfc() function returns the complementary error function of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.erfc
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.erfc()` function returns the complementary error function of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.erfc(x: 22.6)
|
||||
|
||||
// Returns 3.7726189138490583e-224
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.erfc(+Inf) // Returns 0
|
||||
math.erfc(-Inf) // Returns 2
|
||||
math.erfc(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: math.erfcinv() function
|
||||
description: The math.erfcinv() function returns the inverse of `math.erfc()`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.erfcinv
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.erfcinv()` function returns the inverse of `math.erfc()`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.erfcinv(x: 0.42345)
|
||||
|
||||
// Returns 0.5660037715858239
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
`x` should be greater than 0 and less than 2.
|
||||
Otherwise, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.erfcinv(x: 0) // Returns +Inf
|
||||
math.erfcinv(x: 2) // Returns -Inf
|
||||
math.erfcinv(x: <0) // Returns NaN
|
||||
math.erfcinv(x: >2) // Returns NaN
|
||||
math.erfcinv(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: math.erfinv() function
|
||||
description: The math.erfinv() function returns the inverse error function of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.erfinv
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.erfinv()` function returns the inverse error function of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.erfinv(x: 0.22)
|
||||
|
||||
// Returns 0.19750838337227364
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
`x` should be greater than -1 and less than 1.
|
||||
Otherwise, the operation will return `NaN`.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.erfinv(x: 1) // Returns +Inf
|
||||
math.erfinv(x: -1) // Returns -Inf
|
||||
math.erfinv(x: <-1) // Returns NaN
|
||||
math.erfinv(x: > 1) // Returns NaN
|
||||
math.erfinv(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.exp() function
|
||||
description: The math.exp() function returns `e**x`, the base-e exponential of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.exp
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.exp()` function returns `e**x`, the base-e exponential of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.exp(x: 21.0)
|
||||
|
||||
// Returns 1.3188157344832146e+09
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.exp(x: +Inf) // Returns +Inf
|
||||
math.exp(x: NaN) // Returns NaN
|
||||
```
|
||||
|
||||
Very large values overflow to 0 or +Inf. Very small values underflow to 1.
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.exp2() function
|
||||
description: The math.exp2() function returns `2**x`, the base-2 exponential of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.exp2
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.exp2()` function returns `2**x`, the base-2 exponential of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.exp2(x: 21.0)
|
||||
|
||||
// Returns 2.097152e+06
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.exp2(x: +Inf) // Returns +Inf
|
||||
math.exp2(x: NaN) // Returns NaN
|
||||
```
|
||||
|
||||
Very large values overflow to 0 or +Inf. Very small values underflow to 1.
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.expm1() function
|
||||
description: >
|
||||
The math.expm1() function returns `e**x - 1`, the base-e exponential of `x` minus 1.
|
||||
It is more accurate than `math.exp(x:x) - 1` when `x` is near zero.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.expm1
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.expm1()` function returns `e**x - 1`, the base-e exponential of `x` minus 1.
|
||||
It is more accurate than `math.exp(x:x) - 1` when `x` is near zero.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.expm1(x: 1.22)
|
||||
|
||||
// Returns 2.3871877336213343
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.expm1(+Inf) // Returns +Inf
|
||||
math.expm1(-Inf) // Returns -1
|
||||
math.expm1(NaN) // Returns NaN
|
||||
```
|
||||
|
||||
Very large values overflow to -1 or +Inf.
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: math.float64bits() function
|
||||
description: The math.float64bits() function returns the IEEE 754 binary representation of `f`, with the sign bit of `f` and the result in the same bit position.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.float64bits
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.float64bits()` function returns the IEEE 754 binary representation of `f`, with the sign bit of `f` and the result in the same bit position.
|
||||
|
||||
_**Output data type:** UInteger_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.float64bits(f: 1234.56)
|
||||
|
||||
// Returns 4653144467747100426
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### f
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.floor() function
|
||||
description: The math.floor() function returns the greatest integer value less than or equal to `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.floor
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.floor()` function returns the greatest integer value less than or equal to `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.floor(x: 1.22)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.floor(±0) // Returns ±0
|
||||
math.floor(±Inf) // Returns ±Inf
|
||||
math.floor(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.frexp() function
|
||||
description: >
|
||||
The math.frexp() function breaks `f` into a normalized fraction and an integral power of two.
|
||||
It returns `frac` and `exp` satisfying `f == frac × 2**exp`, with the absolute
|
||||
value of `frac` in the interval [½, 1).
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.frexp
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.frexp()` function breaks `f` into a normalized fraction and an integral power of two.
|
||||
It returns `frac` and `exp` satisfying `f == frac × 2**exp`, with the absolute value
|
||||
of `frac` in the interval `[½, 1)`.
|
||||
|
||||
_**Output data type:** Object_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.frexp(f: 22.0)
|
||||
|
||||
// Returns {frac: 0.6875, exp: 5}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### f
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.frexp(f: ±0) // Returns {frac: ±0, exp: 0}
|
||||
math.frexp(f: ±Inf) // Returns {frac: ±Inf, exp: 0}
|
||||
math.frexp(f: NaN) // Returns {frac: NaN, exp: 0}
|
||||
```
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: math.gamma() function
|
||||
description: The math.gamma() function returns the Gamma function of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.gamma
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.gamma()` function returns the Gamma function of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.gamma(x: 2.12)
|
||||
|
||||
// Returns 1.056821007887572
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.gamma(x: +Inf) = +Inf
|
||||
math.gamma(x: +0) = +Inf
|
||||
math.gamma(x: -0) = -Inf
|
||||
math.gamma(x: <0) = NaN for integer x < 0
|
||||
math.gamma(x: -Inf) = NaN
|
||||
math.gamma(x: NaN) = NaN
|
||||
```
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
title: math.hypot() function
|
||||
description: >
|
||||
The math.hypot() function returns the square root of `p*p + q*q`,
|
||||
taking care to avoid unnecessary overflow and underflow.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.hypot
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.hypot()` function returns the square root of `p*p + q*q`,
|
||||
taking care to avoid overflow and underflow.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.hypot(p: 2.0, q: 5.0)
|
||||
|
||||
// Returns 5.385164807134505
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### p
|
||||
The p value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### q
|
||||
The q value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.hypot(p: ±Inf, q:q) // Returns +Inf
|
||||
math.hypot(p:p, q: ±Inf) // Returns +Inf
|
||||
math.hypot(p: NaN, q:q) // Returns NaN
|
||||
math.hypot(p:p, q: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.ilogb() function
|
||||
description: The math.ilogb() function returns the binary exponent of `x` as an integer.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.ilogb
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.ilogb()` function returns the binary exponent of `x` as an integer.
|
||||
|
||||
_**Output data type:** Integer_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.ilogb(x: 123.45)
|
||||
|
||||
// Returns 6.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.ilogb(x: ±Inf) // Returns MaxInt32
|
||||
math.ilogb(x: 0) // Returns MinInt32
|
||||
math.ilogb(x: NaN) // Returns MaxInt32
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.isInf() function
|
||||
description: The math.isInf() function reports whether `f` is an infinity, according to `sign`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.isInf
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.isInf()` function reports whether `f` is an infinity, according to sign.
|
||||
|
||||
_**Output data type:** Boolean_
|
||||
|
||||
- If `sign > 0`, `math.isInf` reports whether `f` is positive infinity.
|
||||
- If `sign < 0`, `math.isInf` reports whether `f` is negative infinity.
|
||||
- If `sign == 0`, `math.isInf` reports whether `f` is either infinity.
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.isInf(f: 2.12, sign: 3)
|
||||
|
||||
// Returns false
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### f
|
||||
The value used in the evaluation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### sign
|
||||
The sign used in the evaluation.
|
||||
|
||||
_**Data type:** Integer_
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
title: math.isNaN() function
|
||||
description: The math.isNaN() function reports whether `f` is an IEEE 754 “not-a-number” value.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.isNaN
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.isNaN()` function reports whether `f` is an IEEE 754 “not-a-number” value.
|
||||
|
||||
_**Output data type:** Boolean_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.isNaN(f: 12.345)
|
||||
|
||||
// Returns false
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### f
|
||||
The value used in the evaluation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.j0() function
|
||||
description: The math.j0() function returns the order-zero Bessel function of the first kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.j0
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.j0()` function returns the order-zero Bessel function of the first kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.j0(x: 1.23)
|
||||
|
||||
// Returns 0.656070571706025
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.j0(x: ±Inf) // Returns 0
|
||||
math.j0(x: 0) // Returns 1
|
||||
math.j0(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.j1() function
|
||||
description: The math.j1() function returns the order-one Bessel function of the first kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.j1
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.j1()` function returns the order-one Bessel function of the first kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.j1(x: 1.23)
|
||||
|
||||
// Returns 0.5058005726280961
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.j1(±Inf) // Returns 0
|
||||
math.j1(NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: math.jn() function
|
||||
description: The math.jn() function returns the order-n Bessel function of the first kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.jn
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.jn()` function returns the order-n Bessel function of the first kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.jn(n: 2, x: 1.23)
|
||||
|
||||
// Returns 0.16636938378681407
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### n
|
||||
The order number.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.jn(n:n, x: ±Inf) // Returns 0
|
||||
math.jn(n:n, x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
title: math.ldexp() function
|
||||
description: The math.ldexp() function is the inverse of `math.frexp()`. It returns `frac × 2**exp`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.ldexp
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.ldexp()` function is the inverse of [`math.frexp()`](/v2.0/reference/flux/functions/math/frexp).
|
||||
It returns `frac × 2**exp`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.ldexp(frac: 0.5, exp: 6)
|
||||
|
||||
// Returns 32.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### frac
|
||||
The fraction used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### exp
|
||||
The exponent used in the operation.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.ldexp(frac: ±0, exp:exp) // Returns ±0
|
||||
math.ldexp(frac: ±Inf, exp:exp) // Returns ±Inf
|
||||
math.ldexp(frac: NaN, exp:exp) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.lgamma() function
|
||||
description: The math.lgamma() function returns the natural logarithm and sign (-1 or +1) of `math.gamma(x:x)`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.lgamma
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.lgamma()` function returns the natural logarithm and sign (-1 or +1) of `math.gamma(x:x)`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.lgamma(x: 3.14)
|
||||
|
||||
// Returns {lgamma: 0.8261387047770286, sign: 1}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.lgamma(x: +Inf) // Returns +Inf
|
||||
math.lgamma(x: 0) // Returns +Inf
|
||||
math.lgamma(x: -integer) // Returns +Inf
|
||||
math.lgamma(x: -Inf) // Returns -Inf
|
||||
math.lgamma(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.log() function
|
||||
description: The math.log() function returns the natural logarithm of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.log
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.log()` function returns the natural logarithm of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.log(x: 3.14)
|
||||
|
||||
// Returns 1.144222799920162
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.log(x: +Inf) // Returns +Inf
|
||||
math.log(x: 0) // Returns -Inf
|
||||
math.log(x: <0) // Returns NaN
|
||||
math.log(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.log10() function
|
||||
description: The math.log10() function returns the decimal logarithm of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.log10
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.log10()` function returns the decimal logarithm of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.log10(x: 3.14)
|
||||
|
||||
// Returns 0.4969296480732149
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.log10(x: +Inf) // Returns +Inf
|
||||
math.log10(x: 0) // Returns -Inf
|
||||
math.log10(x: <0) // Returns NaN
|
||||
math.log10(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.log1p() function
|
||||
description: >
|
||||
The math.log1p() function returns the natural logarithm of 1 plus its argument `x`.
|
||||
It is more accurate than `math.log(x: 1 + x)` when `x` is near zero.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.log1p
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.log1p()` function returns the natural logarithm of 1 plus its argument `x`.
|
||||
It is more accurate than `math.log(x: 1 + x)` when `x` is near zero.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.log1p(x: 0.56)
|
||||
|
||||
// Returns 0.44468582126144574
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.log1p(x: +Inf) // Returns +Inf
|
||||
math.log1p(x: ±0) // Returns ±0
|
||||
math.log1p(x: -1) // Returns -Inf
|
||||
math.log1p(x: <-1) // Returns NaN
|
||||
math.log1p(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.log2() function
|
||||
description: The math.log2() function returns the binary logarithm of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.log2
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.log2()` function returns the binary logarithm of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.log2(x: 3.14)
|
||||
|
||||
// Returns 1.6507645591169022
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.log2(x: +Inf) // Returns +Inf
|
||||
math.log2(x: 0) // Returns -Inf
|
||||
math.log2(x: <0) // Returns NaN
|
||||
math.log2(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.logb() function
|
||||
description: The math.logb() function returns the binary exponent of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.logb
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.logb()` function returns the binary exponent of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.logb(x: 3.14)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.logb(x: ±Inf) // Returns +Inf
|
||||
math.logb(x: 0) // Returns -Inf
|
||||
math.logb(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
title: math.m_inf() function
|
||||
description: The math.m_inf() function returns positive infinity if `sign >= 0`, negative infinity if `sign < 0`.
|
||||
|
||||
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.m_inf
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.m_inf()` function returns positive infinity if `sign >= 0`, negative infinity if `sign < 0`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.m_inf(sign: 1)
|
||||
|
||||
// Returns +Inf
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### sign
|
||||
The sign value used in the operation.
|
||||
|
||||
_**Data type:** Integer_
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
title: math.m_max() function
|
||||
description: The math.m_max() function returns the larger of `x` or `y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.m_max
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.m_max()` function returns the larger of `x` or `y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.m_max(x: 1.23, y: 4.56)
|
||||
|
||||
// Returns 4.56
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.m_max(x:x, y:+Inf) // Returns +Inf
|
||||
math.m_max(x: +Inf, y:y) // Returns +Inf
|
||||
math.m_max(x:x, y: NaN) // Returns NaN
|
||||
math.m_max(x: NaN, y:y) // Returns NaN
|
||||
math.m_max(x: +0, y: ±0) // Returns +0
|
||||
math.m_max(x: ±0, y: +0) // Returns +0
|
||||
math.m_max(x: -0, y: -0) // Returns -0
|
||||
```
|
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
title: math.m_min() function
|
||||
description: The math.m_min() function returns the smaller of `x` or `y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.m_min
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.m_min()` function returns the smaller of `x` or `y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.m_min(x: 1.23, y: 4.56)
|
||||
|
||||
// Returns 1.23
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
Min(x:x, y: -Inf) // Returns -Inf
|
||||
Min(x: -Inf, y:y) // Returns -Inf
|
||||
Min(x:x, y: NaN) // Returns NaN
|
||||
Min(x: NaN, y:y) // Returns NaN
|
||||
Min(x: -0, y: ±0) // Returns -0
|
||||
Min(x: ±0, y: -0) // Returns -0
|
||||
```
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
title: math.mod() function
|
||||
description: >
|
||||
The math.mod() function returns the floating-point remainder of `x`/`y`.
|
||||
The magnitude of the result is less than `y` and its sign agrees with that of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.mod
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.mod()` function returns the floating-point remainder of `x`/`y`.
|
||||
The magnitude of the result is less than `y` and its sign agrees with that of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.mod(x: 1.23, y: 4.56)
|
||||
|
||||
// Returns 1.23
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.mod(x: ±Inf, y:y) // Returns NaN
|
||||
math.mod(x: NaN, y:y) // Returns NaN
|
||||
math.mod(x:x, y: 0) // Returns NaN
|
||||
math.mod(x:x, y: ±Inf) // Returns x
|
||||
math.mod(x:x, y: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.modf() function
|
||||
description: >
|
||||
The math.modf() function returns integer and fractional floating-point numbers that sum to `f`.
|
||||
Both values have the same sign as `f`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.modf
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.modf()` function returns integer and fractional floating-point numbers that sum to `f`.
|
||||
Both values have the same sign as `f`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.modf(x: 3.14)
|
||||
|
||||
// Returns {int: 3, frac: 0.14000000000000012}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.modf(x: ±Inf) // Returns {int: ±Inf, frac: NaN}
|
||||
math.modf(x: NaN) // Returns {int: NaN, frac: NaN}
|
||||
```
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: math.NaN() function
|
||||
description: The math.NaN() function returns an IEEE 754 “not-a-number” value.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.NaN
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.NaN()` function returns an IEEE 754 “not-a-number” value.
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.NaN()
|
||||
|
||||
// Returns NaN
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: math.nextafter() function
|
||||
description: The math.nextafter() function returns the next representable float value after `x` towards `y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.nextafter
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.nextafter()` function returns the next representable float value after `x` towards `y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.nextafter(x: 1.23, y: 4.56)
|
||||
|
||||
// Returns 1.2300000000000002
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.nextafter(x:x, y:x) // Returns x
|
||||
math.nextafter(x: NaN, y:y) // Returns NaN
|
||||
math.nextafter(x:x, y:NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
title: math.pow() function
|
||||
description: The math.pow() function returns `x**y`, the base-x exponential of y.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.pow
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.pow()` function returns `x**y`, the base-x exponential of y.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.pow(x: 2.0, y: 3.0)
|
||||
|
||||
// Returns 8.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The X value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### y
|
||||
The Y value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
// In order of priority
|
||||
math.pow(x:x, y:±0) // Returns 1 for any x
|
||||
math.pow(x:1, y:y) // Returns 1 for any y
|
||||
math.pow(x:X, y:1) // Returns x for any x
|
||||
math.pow(x:NaN, y:y) // Returns NaN
|
||||
math.pow(x:x, y:NaN) // Returns NaN
|
||||
math.pow(x:±0, y:y) // Returns ±Inf for y an odd integer < 0
|
||||
math.pow(x:±0, y:-Inf) // Returns +Inf
|
||||
math.pow(x:±0, y:+Inf) // Returns +0
|
||||
math.pow(x:±0, y:y) // Returns +Inf for finite y < 0 and not an odd integer
|
||||
math.pow(x:±0, y:y) // Returns ±0 for y an odd integer > 0
|
||||
math.pow(x:±0, y:y) // Returns +0 for finite y > 0 and not an odd integer
|
||||
math.pow(x:-1, y:±Inf) // Returns 1
|
||||
math.pow(x:x, y:+Inf) // Returns +Inf for |x| > 1
|
||||
math.pow(x:x, y:-Inf) // Returns +0 for |x| > 1
|
||||
math.pow(x:x, y:+Inf) // Returns +0 for |x| < 1
|
||||
math.pow(x:x, y:-Inf) // Returns +Inf for |x| < 1
|
||||
math.pow(x:+Inf, y:y) // Returns +Inf for y > 0
|
||||
math.pow(x:+Inf, y:y) // Returns +0 for y < 0
|
||||
math.pow(x:-Inf, y:y) // Returns math.pow(-0, -y)
|
||||
math.pow(x:x, y:y) // Returns NaN for finite x < 0 and finite non-integer y
|
||||
```
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: math.pow10() function
|
||||
description: The math.pow10() function returns `10**n`, the base-10 exponential of `n`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.pow10
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.pow10()` function returns `10**n`, the base-10 exponential of `n`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.pow10(n: 3)
|
||||
|
||||
// Returns 1000
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### n
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.pow10(n: <-323) // Returns 0
|
||||
math.pow10(n: >308) // Returns +Inf
|
||||
```
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: math.remainder() function
|
||||
description: The math.remainder() function returns the IEEE 754 floating-point remainder of `x / y`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.remainder
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.remainder()` function returns the IEEE 754 floating-point remainder of `x / y`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.remainder(x: 21.0, y: 4.0)
|
||||
|
||||
// Returns 1.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The numerator used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
### x
|
||||
The denominator used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.remainder(x: ±Inf, y:y) // Returns NaN
|
||||
math.remainder(x: NaN, y:y) // Returns NaN
|
||||
math.remainder(x:x, y: 0) // Returns NaN
|
||||
math.remainder(x:x, y: ±Inf) // Returns x
|
||||
math.remainder(x:x, y: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.round() function
|
||||
description: The math.round() function returns the nearest integer, rounding half away from zero.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.round
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.round()` function returns the nearest integer, rounding half away from zero.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.round(x: 2.12)
|
||||
|
||||
// Returns 2.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.round(x: ±0) // Returns ±0
|
||||
math.round(x: ±Inf) // Returns ±Inf
|
||||
math.round(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: math.roundtoeven() function
|
||||
description: The math.roundtoeven() function returns the nearest integer, rounding ties to even.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.roundtoeven
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.roundtoeven()` function returns the nearest integer, rounding ties to even.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.roundtoeven(x: 3.14)
|
||||
// Returns 3.0
|
||||
|
||||
math.roundtoeven(x: 3.5)
|
||||
// Returns 4.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.roundtoeven(x: ±0) // Returns ±0
|
||||
math.roundtoeven(x: ±Inf) // Returns ±Inf
|
||||
math.roundtoeven(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: math.signbit() function
|
||||
description: The math.signbit() function reports whether `x` is negative or negative zero.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.signbit
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.signbit()` function reports whether `x` is negative or negative zero.
|
||||
|
||||
_**Output data type:** Boolean_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.signbit(x: -1.2)
|
||||
|
||||
// Returns true
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.sin() function
|
||||
description: The math.sin() function returns the sine of the radian argument `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.sin
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.sin()` function returns the sine of the radian argument `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.sin(x: 3.14)
|
||||
|
||||
// Returns 0.0015926529164868282
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The radian value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.sin(x: ±0) // Returns ±0
|
||||
math.sin(x: ±Inf) // Returns NaN
|
||||
math.sin(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.sincos() function
|
||||
description: The math.sincos() function returns the values of `math.sin(x:x)` and `math.cos(x:x)`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.sincos
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.sincos()` function returns the values of `math.sin(x:x)` and `math.cos(x:x)`.
|
||||
|
||||
_**Output data format:** Object_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.sincos(x: 1.23)
|
||||
|
||||
// Returns {sin: 0.9424888019316975, cos: 0.3342377271245026}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.sincos(x: ±0) // Returns {sin: ±0, cos: 1}
|
||||
math.sincos(x: ±Inf) // Returns {sin: NaN, cos: NaN}
|
||||
math.sincos(x: NaN) // Returns {sin: NaN, cos: NaN}
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.sinh() function
|
||||
description: The math.sinh() function returns the hyperbolic sine of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.sinh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.sinh()` function returns the hyperbolic sine of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.sinh(x: 1.23)
|
||||
|
||||
// Returns 1.564468479304407
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.sinh(x: ±0) // Returns ±0
|
||||
math.sinh(x: ±Inf) // Returns ±Inf
|
||||
math.sinh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.sqrt() function
|
||||
description: The math.sqrt() function returns the square root of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.sqrt
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.sqrt()` function returns the square root of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.sqrt(x: 4.0)
|
||||
|
||||
// Returns 2.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.sqrt(x: +Inf) // Returns +Inf
|
||||
math.sqrt(x: ±0) // Returns ±0
|
||||
math.sqrt(x: <0) // Returns NaN
|
||||
math.sqrt(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.tan() function
|
||||
description: The math.tan() function returns the tangent of the radian argument `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.tan
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.tan()` function returns the tangent of the radian argument `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.tan(x: 3.14)
|
||||
|
||||
// Returns -0.001592654936407223
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.tan(x: ±0) // Returns ±0
|
||||
math.tan(x: ±Inf) // Returns NaN
|
||||
math.tan(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.tanh() function
|
||||
description: The math.tanh() function returns the hyperbolic tangent of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.tanh
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.tanh()` function returns the hyperbolic tangent of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.tanh(x: 1.23)
|
||||
|
||||
// Returns 0.8425793256589296
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.tanh(x: ±0) // Returns ±0
|
||||
math.tanh(x: ±Inf) // Returns ±1
|
||||
math.tanh(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: math.trunc() function
|
||||
description: The math.trunc() function returns the integer value of `x`.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.trunc
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.trunc()` function returns the integer value of `x`.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.trunc(x: 3.14)
|
||||
|
||||
// Returns 3.0
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.trunc(x: ±0) // Returns ±0
|
||||
math.trunc(x: ±Inf) // Returns ±Inf
|
||||
math.trunc(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.y0() function
|
||||
description: The math.y0() function returns the order-zero Bessel function of the second kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.y0
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.y0()` function returns the order-zero Bessel function of the second kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.y0(x: 3.14)
|
||||
|
||||
// Returns 0.3289375969127807
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.y0(x: +Inf) // Returns 0
|
||||
math.y0(x: 0) // Returns -Inf
|
||||
math.y0(x: <0) // Returns NaN
|
||||
math.y0(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: math.y1() function
|
||||
description: The math.y1() function returns the order-one Bessel function of the second kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.y1
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.y1()` function returns the order-one Bessel function of the second kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.y1(x: 3.14)
|
||||
|
||||
// Returns 0.35853138083924085
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.y1(x: +Inf) // Returns 0
|
||||
math.y1(x: 0) // Returns -Inf
|
||||
math.y1(x: <0) // Returns NaN
|
||||
math.y1(x: NaN) // Returns NaN
|
||||
```
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: math.yn() function
|
||||
description: The math.yn() function returns the order-n Bessel function of the second kind.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: math.yn
|
||||
parent: Math
|
||||
weight: 301
|
||||
---
|
||||
|
||||
The `math.yn()` function returns the order-n Bessel function of the second kind.
|
||||
|
||||
_**Output data type:** Float_
|
||||
|
||||
```js
|
||||
import "math"
|
||||
|
||||
math.yn(n: 3, x: 3.14)
|
||||
|
||||
// Returns -0.4866506930335083
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### n
|
||||
The order number used in the operation.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
### x
|
||||
The value used in the operation.
|
||||
|
||||
_**Data type:** Float_
|
||||
|
||||
## Special cases
|
||||
```js
|
||||
math.yn(n:n, x: +Inf) // Returns 0
|
||||
math.yn(n: ≥0, x: 0) // Returns -Inf
|
||||
math.yn(n: <0, x: 0) // Returns +Inf if n is odd, -Inf if n is even
|
||||
math.yn(n:n, x: <0) // Returns NaN
|
||||
math.yn(n:n, x:NaN) // Returns NaN
|
||||
```
|
|
@ -1,19 +1,19 @@
|
|||
---
|
||||
title: Flux string functions
|
||||
list_title: String functions
|
||||
title: Flux string package
|
||||
list_title: String package
|
||||
description: >
|
||||
String functions provide tools for manipulating strings in Flux.
|
||||
To use them, import the `strings` package.
|
||||
The Flux string package provides functions to manipulate UTF-8 encoded strings.
|
||||
Import the `strings` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Strings
|
||||
parent: Flux functions
|
||||
weight: 203
|
||||
v2.0/tags: [strings, functions]
|
||||
parent: Flux packages and functions
|
||||
weight: 204
|
||||
v2.0/tags: [strings, functions, package]
|
||||
---
|
||||
|
||||
String functions provide tools for manipulating strings in Flux.
|
||||
To use them, import the `strings` package:
|
||||
The Flux string package provides functions to manipulate UTF-8 encoded strings.
|
||||
Import the `strings` package:
|
||||
|
||||
```js
|
||||
import "strings"
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
---
|
||||
title: Flux testing functions
|
||||
list_title: Testing functions
|
||||
title: Flux testing package
|
||||
list_title: Testing package
|
||||
description: >
|
||||
Flux testing functions test piped-forward data in specific ways and return errors if the tests fail.
|
||||
To use them, import the `testing` package.
|
||||
The Flux testing package provides functions that test piped-forward data in specific ways.
|
||||
Import the `testing` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Testing
|
||||
parent: Flux functions
|
||||
weight: 204
|
||||
v2.0/tags: [testing, functions]
|
||||
parent: Flux packages and functions
|
||||
weight: 205
|
||||
v2.0/tags: [testing, functions, package]
|
||||
---
|
||||
|
||||
Flux testing functions test piped-forward data in specific ways and return errors if the tests fail.
|
||||
To use them, import the `testing` package:
|
||||
Import the `testing` package:
|
||||
|
||||
```js
|
||||
import "testing"
|
||||
|
|
|
@ -7,7 +7,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: Flux specification
|
||||
parent: Flux query language
|
||||
weight: 102
|
||||
weight: 103
|
||||
v2.0/tags: [flux]
|
||||
---
|
||||
|
||||
|
|
|
@ -0,0 +1,341 @@
|
|||
---
|
||||
title: Flux release notes
|
||||
description: Important changes and notes introduced in each version of Flux.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
parent: Flux query language
|
||||
name: Flux release notes
|
||||
weight: 101
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
_The latest release of InfluxDB v2.0 alpha includes **Flux v0.23.0**.
|
||||
Any newer versions of Flux will not be available until the next InfluxDB release._
|
||||
{{% /note %}}
|
||||
|
||||
## v0.23.0 [2019-03-26]
|
||||
|
||||
### Breaking changes
|
||||
- Remove unused statistics from the struct.
|
||||
|
||||
### Features
|
||||
- Define comparison operators between time types.
|
||||
- Parse signed duration.
|
||||
- Added `reduce()` function and supporting go API for implementation.
|
||||
- Fix for recognizing locally scoped objects and arrays in a row function.
|
||||
|
||||
### Bug fixes
|
||||
- Columns in percentile signature and more strict param checking.
|
||||
- Report the error received when parsing a bad regex literal.
|
||||
- Remove unused statistics from the struct.
|
||||
|
||||
---
|
||||
|
||||
## v0.22.0 [2019-03-18]
|
||||
|
||||
### Features
|
||||
- Added a math package and ported all 64 bit go math library functions.
|
||||
|
||||
### Bug fixes
|
||||
- Make read-like access patterns for objects thread-safe.
|
||||
|
||||
---
|
||||
|
||||
## v0.21.4 [2019-03-06]
|
||||
|
||||
### Bug fixes
|
||||
- Test union.flux correctly uses sort.
|
||||
- Pivot orders rowKey and columnKey by the input parameters, rather than the table column order.
|
||||
- Deterministic sorting of input tables in join.
|
||||
- Group key comparison works regardless of column ordering.
|
||||
|
||||
---
|
||||
|
||||
## v0.21.3 [2019-03-05]
|
||||
|
||||
### Bug fixes
|
||||
- Fix test to pass in InfluxDB.
|
||||
- Write table and result name in each row of CSV output.
|
||||
- Make time() function accept any format that parser accepts.
|
||||
- Return errors when evaluating functions.
|
||||
- Prevent a deadlock in the array expression parser.
|
||||
|
||||
---
|
||||
|
||||
## v0.21.2 [2019-03-01]
|
||||
|
||||
### Bug fixes
|
||||
- Add AST compiler to mappings.
|
||||
|
||||
---
|
||||
|
||||
## v0.21.1 [2019-03-01]
|
||||
|
||||
### Bug fixes
|
||||
- Make ASTCompiler marshalable.
|
||||
- Fix a controller test to be less flaky.
|
||||
- `from()` must send deep table copies to its downstream transformations.
|
||||
|
||||
---
|
||||
|
||||
## v0.21.0 [2019-02-25]
|
||||
|
||||
### Breaking changes
|
||||
- Support attaching arbitrary query metadata from the executor.
|
||||
|
||||
### Features
|
||||
- Support attaching arbitrary query metadata from the executor.
|
||||
- Socket source.
|
||||
|
||||
### Bug fixes
|
||||
- Add locks to make diff threadsafe.
|
||||
|
||||
---
|
||||
|
||||
## v0.20.0 [2019-02-20]
|
||||
|
||||
### Features
|
||||
- AST match.
|
||||
- Generate ASTs from Flux test files for external consumption.
|
||||
- Add compile subcommand that compiles Flux to spec.
|
||||
|
||||
### Bug fixes
|
||||
- Change loadStorage and loadMem to be options so that they are modifiable.
|
||||
- Generate skipped tests; skip in test driver.
|
||||
|
||||
---
|
||||
|
||||
## v0.19.0 [2019-02-11]
|
||||
|
||||
### Breaking changes
|
||||
- Make `window()` parameters match SPEC.
|
||||
- Split FromProcedureSpec into logical and physical specs.
|
||||
|
||||
### Features
|
||||
- Add `contains()` function to check for membership in lists.
|
||||
- `test` keyword.
|
||||
|
||||
### Bug fixes
|
||||
- Raw query test case.
|
||||
|
||||
---
|
||||
|
||||
## v0.18.0 [2019-02-07]
|
||||
|
||||
### Features
|
||||
- Add strings package with functions to trim/change string case.
|
||||
- Make duration conversion public.
|
||||
- Add assertEmpty method and use it with testing.test.
|
||||
- Expose literal parsers used within the parser.
|
||||
- Add testing.diff function.
|
||||
- Execute command.
|
||||
|
||||
### Bug fixes
|
||||
- Refactor the controller to remove data races.
|
||||
- Member expressions using a string literal use the incorrect end bracket.
|
||||
- Skip lambda evaluation when referencing nulls.
|
||||
- Options editor should use ast.Expression.
|
||||
- Fix decoder bug where a default table ID is given when none is required.
|
||||
- Add close to SourceIterator.
|
||||
|
||||
---
|
||||
|
||||
## v0.17.0 [2019-01-22]
|
||||
|
||||
### Features
|
||||
- Checks for option dependencies.
|
||||
- Add query success and error metrics.
|
||||
- Track nested blocks in the parser.
|
||||
- Update `aggregateWindow()` to include `createEmpty` as parameter to allow for null results.
|
||||
- Add query function count metrics.
|
||||
|
||||
### Bug fixes
|
||||
- Multiplicative operators are above additive operators in precedence.
|
||||
- Fix panic when copying lambda.
|
||||
- Only print a package's public exports.
|
||||
- Cannot access imports of imports.
|
||||
- Check for schema collision when appending columns to a table.
|
||||
- Process test helper had bad logic to check for errors.
|
||||
- Handle rune errors correctly when decoding an illegal token.
|
||||
|
||||
---
|
||||
|
||||
## v0.16.1 [2019-01-17]
|
||||
|
||||
### Bug fixes
|
||||
- Copy packages for importer copy.
|
||||
|
||||
---
|
||||
|
||||
##v0.16.0 [2019-01-17]
|
||||
|
||||
### Features
|
||||
- Adds various v1 meta queries helper functions
|
||||
|
||||
### Bug fixes
|
||||
- Fixes various UX issues.
|
||||
- Object polytype.
|
||||
- Fix edge case panic in `assertEquals`.
|
||||
- Check for equality in time columns correctly.
|
||||
- Fix bug where `assertEquals` did not check tables without a match in both streams.
|
||||
- Clear return for each REPL command.
|
||||
|
||||
---
|
||||
|
||||
## v0.15.0 [2019-01-16]
|
||||
|
||||
### Features
|
||||
- Add rule to remove filter true nodes.
|
||||
- Checks for variable reassignment and option declarations below package block.
|
||||
|
||||
### Bug fixes
|
||||
- Move a test file into the testing/testdata folder.
|
||||
|
||||
---
|
||||
|
||||
## v0.14.0 [2019-01-14]
|
||||
|
||||
### Breaking changes
|
||||
- Implement and require builtin statements.
|
||||
- Fix keys to output group key.
|
||||
- Organizes builtin code into Flux packages.
|
||||
- Change flux command to be a REPL.
|
||||
|
||||
### Features
|
||||
- Implement and require builtin statements.
|
||||
- Added a new utility library for generating test data.
|
||||
- `columns()` function.
|
||||
- Add fill function to set a default value for null values in a column.
|
||||
- Organizes built-in code into Flux packages.
|
||||
- Change flux command to be a REPL.
|
||||
- Refactored the table builder interfaces to support null value creation.
|
||||
- Aggregates process empty/all-null tables by creating a null row.
|
||||
- Show nulls in REPL as empty string.
|
||||
- Add ability to define built-in packages.
|
||||
- Treat omitted values with no defaults as nil in CSV.
|
||||
- Build arrow columns with null values.
|
||||
- Converting limit to use arrow arrays.
|
||||
- TableBuilder interface and ColListTableBuilder implementation support creation of nil values.
|
||||
|
||||
### Bug fixes
|
||||
- Count nulls in the count aggregate.
|
||||
- Fix keys to output group key.
|
||||
- Adding test for type mismatch in group.
|
||||
- Nest extern blocks for each level in scope.
|
||||
- Memory leak in limit when slicing.
|
||||
- Prettier formatting for package.
|
||||
- Change Package.Path to be json omitempty.
|
||||
|
||||
---
|
||||
|
||||
## v0.13.0 [2019-01-07]
|
||||
|
||||
### Breaking changes
|
||||
- Add File and Package nodes to the AST.
|
||||
|
||||
### Features
|
||||
- Embed errors into the ast from the parser.
|
||||
- Add no-points optimization for `from() |> keys()`.
|
||||
- Add File and Package nodes to the AST.
|
||||
- Add a function for checking for errors within the AST.
|
||||
|
||||
### Bug fixes
|
||||
- Remove unneeded use of memory allocator.
|
||||
- Allow the memory allocator to be nil for arrow arrays.
|
||||
- Fix several bugs in copy methods add tests.
|
||||
- Fix a flaky test in the controller shutdown.
|
||||
|
||||
---
|
||||
|
||||
## v0.12.0 [2019-01-02]
|
||||
|
||||
### Features
|
||||
- Slice utils.
|
||||
- Parse string literal object keys.
|
||||
- Add tests for multi-line and escaped strings.
|
||||
- Arrow helper method.
|
||||
- Converting all aggregates to use arrow arrays.
|
||||
|
||||
### Bug fixes
|
||||
- Embed plan.DefaultCost in input and output functions.
|
||||
- Side effect statements are now copied between related interpreter scopes.
|
||||
|
||||
---
|
||||
|
||||
## v0.11.0 [2018-12-18]
|
||||
|
||||
### Features
|
||||
- Add utility methods for converting a slice into an arrow array buffer.
|
||||
|
||||
### Bug fixes
|
||||
- Do not panic with unbalanced parenthesis.
|
||||
- Respect positive timeout for toHTTP.
|
||||
|
||||
---
|
||||
|
||||
## v0.10.0 [2018-12-17]
|
||||
|
||||
### Breaking changes
|
||||
- Change "label" to "column" for state tracking functions.
|
||||
|
||||
### Features
|
||||
- Plan validation.
|
||||
- Testing framework no longer checks output.
|
||||
- Integrate arrow arrays into the table builder.
|
||||
- Support packages and imports.
|
||||
|
||||
### Bug fixes
|
||||
- Cancel all queries after timeout elapses.
|
||||
- `makefile` for generating the scanner after clean was incorrect.
|
||||
|
||||
---
|
||||
|
||||
## v0.9.0 [2018-12-11]
|
||||
|
||||
### Features
|
||||
- Option Editor.
|
||||
|
||||
### Bug fixes
|
||||
- Return the source attribute in the location correctly.
|
||||
|
||||
---
|
||||
|
||||
## v0.8.0 [2018-12-11]
|
||||
|
||||
### Features
|
||||
- Rule to chain group operations.
|
||||
- Add package and import support to the semantic graph.
|
||||
- Add `assertEquals` function to transformations.
|
||||
- Parse import and package statements
|
||||
- Walk pattern for AST.
|
||||
- AST formatting.
|
||||
- Switch over to the new parser.
|
||||
|
||||
### Bug fixes
|
||||
- Make controller return planner failures.
|
||||
- Collision between external and fresh type vars.
|
||||
- fmt for import and package.
|
||||
- Add import/package nodes to ast.Walk.
|
||||
- Improve panic message when the wrong column type is used.
|
||||
- Check nil results when computing stats.
|
||||
- Suppress group push down for \_time and \_value.
|
||||
- Terminal output functions must produce results.
|
||||
- Fix race in interpreter.doCall.
|
||||
- Fix ast.Walk for Assignemnt rename.
|
||||
- Improve error message for missing object properties.
|
||||
- Add unary logical expression to the parser.
|
||||
- Variable declarator node needs to duplicate the location information.
|
||||
|
||||
---
|
||||
|
||||
## v0.7.4 (2018-12-04)
|
||||
|
||||
### Bug Fixes
|
||||
- Add missing comparison operators.
|
||||
|
||||
---
|
||||
|
||||
## v0.7.3 (2018-12-04)
|
||||
|
||||
### Bug Fixes
|
||||
- Fix the ident statement to use expression suffix.
|
|
@ -7,6 +7,41 @@ menu:
|
|||
weight: 1
|
||||
---
|
||||
|
||||
## v2.0.0-alpha.7 [2019-03-28]
|
||||
|
||||
### Features
|
||||
|
||||
* Insert Flux function near cursor in Flux Editor.
|
||||
* Enable the use of variables in the Data Explorer and Cell Editor Overlay.
|
||||
* Add a variable control bar to dashboards to select values for variables.
|
||||
* Add ability to add variable to script from the side menu.
|
||||
* Use time range for meta queries in Data Explorer and Cell Editor Overlay.
|
||||
* Fix screen tearing bug in raw data view.
|
||||
* Add copy to clipboard button to export overlays.
|
||||
* Enable copying error messages to the clipboard from dashboard cells.
|
||||
* Add the ability to update token's status in token list.
|
||||
* Allow variables to be re-ordered within control bar on a dashboard.
|
||||
* Add the ability to delete a template.
|
||||
* Save user preference for variable control bar visibility and default to visible.
|
||||
* Add the ability to clone a template
|
||||
* Add the ability to import a variable.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fix mismatch in bucket row and header.
|
||||
* Allows user to edit note on cell.
|
||||
* Fix empty state styles in scrapers in org view.
|
||||
* Fix bucket creation error when changing rentention rules types.
|
||||
* Fix task creation error when switching schedule types.
|
||||
* Fix hidden horizontal scrollbars in flux raw data view.
|
||||
* Fix screen tearing bug in raw data View.
|
||||
* Fix routing loop.
|
||||
|
||||
### UI Improvements
|
||||
* Move bucket selection in the query builder to the first card in the list.
|
||||
* Ensure editor is automatically focused in Note Editor.
|
||||
* Add ability to edit a template's name.
|
||||
|
||||
## v2.0.0-alpha.6 [2019-03-15]
|
||||
|
||||
### Release Notes
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
title: Manage InfluxDB dashboards
|
||||
description: Create, edit, and manage custom dashboards in the InfluxDB user interface (UI).
|
||||
v2.0/tags: [dashboards]
|
||||
menu:
|
||||
v2_0:
|
||||
name: Manage dashboards
|
||||
parent: Visualize data
|
||||
weight: 101
|
||||
---
|
||||
|
||||
Create, edit, and manage dashboards from the **Dashboards** tab in the left navigation.
|
||||
|
||||
{{< children >}}
|
|
@ -1,28 +1,49 @@
|
|||
---
|
||||
title: Manage InfluxDB dashboards
|
||||
description: Create, edit, and manage custom dashboards in the InfluxDB user interface (UI).
|
||||
title: Create a dashboard
|
||||
seotitle: Create an InfluxDB dashboard
|
||||
description: >
|
||||
Create a new dashboard or import an existing dashboard in the
|
||||
InfluxDB user interface (UI).
|
||||
v2.0/tags: [dashboards]
|
||||
menu:
|
||||
v2_0:
|
||||
name: Manage dashboards
|
||||
parent: Visualize data
|
||||
weight: 101
|
||||
name: Create a dashboard
|
||||
parent: Manage dashboards
|
||||
weight: 201
|
||||
---
|
||||
|
||||
Create, edit, and manage dashboards from the **Dashboards** tab in the left navigation.
|
||||
|
||||
|
||||
## Create a dashboard
|
||||
|
||||
**To create a dashboard**:
|
||||
**To create a new dashboard**:
|
||||
|
||||
1. Click the **Dashboards** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "dashboards" >}}
|
||||
|
||||
2. Click the **+Create Dashboard** button in the upper right.
|
||||
2. Click the **+Create Dashboard** menu in the upper right and select **New Dashboard**.
|
||||
3. Enter a name for your dashboard in the **Name this dashboard** field in the upper left.
|
||||
|
||||
**To import an existing dashboard**:
|
||||
|
||||
1. Click the **Dashboards** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "dashboards" >}}
|
||||
|
||||
2. Click the **Create Dashboard** menu in the upper right and select **Import Dashboard**.
|
||||
3. In the window that appears:
|
||||
* Select **Upload File** to drag-and-drop or select a file.
|
||||
* Select **Paste JSON** to paste in JSON.
|
||||
4. Select an organization from the **Destination Organization** dropdown.
|
||||
5. Click **Import JSON as Dashboard**.
|
||||
|
||||
## Clone a dashboard
|
||||
|
||||
1. Hover over the dashboard name in the list of dashboard to show options.
|
||||
2. Click **Clone**. The cloned dashboard opens.
|
||||
|
||||

|
||||
|
||||
|
||||
#### Add data to your dashboard
|
||||
|
||||
1. From your dashboard, click **Add Cell** (**{{< icon "add-cell" >}}**) in the upper right. The Data Explorer overlay opens.
|
||||
|
@ -36,19 +57,3 @@ You can also send data to your dashboard directly from the Data Explorer. For de
|
|||
2. Enter your note in the window that appears. You can use Markdown syntax to format your note.
|
||||
3. To preview your Markdown formatting, click the **Preview** option.
|
||||
4. Click **Save**.
|
||||
|
||||
|
||||
## Modify a dashboard
|
||||
|
||||
#### Delete a dashboard
|
||||
1. Hover over the dashboard name in the list of dashboards to show options.
|
||||
2. Click **Delete**.
|
||||
3. Click **Confirm** to continue deleting your dashboard.
|
||||
|
||||

|
||||
|
||||
#### Clone a dashboard
|
||||
1. Hover over the dashbaord name in the list of dashboard to show options.
|
||||
2. Click **Clone**. The cloned dashboard opens.
|
||||
|
||||

|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
title: Delete a dashboard
|
||||
seotitle: Delete an InfluxDB dashboard
|
||||
description: Delete a dashboard from the InfluxDB user interface (UI).
|
||||
v2.0/tags: [dashboards]
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Manage dashboards
|
||||
weight: 204
|
||||
---
|
||||
|
||||
To delete a dashboard from the InfluxDB user interface (UI):
|
||||
|
||||
1. Hover over the dashboard name in the list of dashboards to show options.
|
||||
2. Click **{{< icon "trash" >}}**.
|
||||
3. Click **Confirm** to delete your dashboard.
|
||||
|
||||

|
||||
|
||||
{{% warn %}}
|
||||
Deleting a dashboard cannot be undone.
|
||||
{{% /warn %}}
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: Export a dashboard
|
||||
seotitle: Export an InfluxDB dashboard
|
||||
description: >
|
||||
Export a dashboard using the InfluxDB user interface (UI).
|
||||
v2.0/tags: [dashboards]
|
||||
menu:
|
||||
v2_0:
|
||||
name: Export a dashboard
|
||||
parent: Manage dashboards
|
||||
weight: 203
|
||||
---
|
||||
|
||||
InfluxDB lets you export dashboards from the InfluxDB user interface (UI).
|
||||
|
||||
## Export a dashboard
|
||||
|
||||
1. Click the **Dashboards** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "dashboards" >}}
|
||||
|
||||
2. Hover over a dashboard in the list, then click the gear icon ({{< icon "gear" >}}) and select **Export**.
|
||||
3. Review the JSON in the window that appears.
|
||||
4. Select one of the following options:
|
||||
* **Download JSON**: Download the dashboard as a JSON file.
|
||||
* **Save as template**: Save the JSON as a dashboard template.
|
||||
* **Copy to Clipboard**: Copy the JSON to your clipboard.
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
title: Update a dashboard
|
||||
seotitle: Update an InfluxDB dashboard
|
||||
description: Update an InfluxDB dashboard in the InfluxDB user interface (UI).
|
||||
v2.0/tags: [dashboards]
|
||||
menu:
|
||||
v2_0:
|
||||
name: Update a dashboard
|
||||
parent: Manage dashboards
|
||||
weight: 202
|
||||
draft: true
|
||||
---
|
||||
|
||||
**Notes:**
|
||||
|
||||
- Dashboard name
|
||||
- Dashboard description
|
||||
- Labels
|
||||
- Dashboard cells
|
||||
- etc.
|
|
@ -45,7 +45,7 @@ Select from available [visualization types](/v2.0/visualize-data/visualization-t
|
|||
|
||||
1. Select a visualization type from the dropdown menu in the upper-left.
|
||||
|
||||
{{< img-hd src="/img/visualization-dropdown.png" title="Visualization dropdown" />}}
|
||||
{{< img-hd src="/img/2-0-visualization-dropdown.png" title="Visualization dropdown" />}}
|
||||
|
||||
2. Select the **Visualization** tab at the bottom of the **Data Explorer**.
|
||||
For details about all of the available visualization options, see
|
||||
|
|
|
@ -14,7 +14,7 @@ weight: 101
|
|||
Labels are a way to add visual metadata to dashboards, tasks, and other items in the InfluxDB UI.
|
||||
To manage labels, click the **Configuration** icon in the navigation bar and select **Labels**.
|
||||
|
||||
{{< img-hd src="/img/labels-nav-link.png" title="Labels configuration" />}}
|
||||
{{< img-hd src="/img/2-0-labels-nav-link.png" title="Labels configuration" />}}
|
||||
|
||||
#### Create a label
|
||||
1. Click **+ Create Label**.
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
title: Use and manage variables
|
||||
seotitle: Use and manage dashboard variables
|
||||
description: >
|
||||
Dashboard variables allow you to alter specific components of cells' queries
|
||||
without having to edit the queries, making it easy to interact with your dashboard cells and explore your data.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Visualize data
|
||||
weight: 101
|
||||
"v2.0/tags": [variables]
|
||||
---
|
||||
|
||||
Dashboard variables allow you to alter specific components of cells' queries
|
||||
without having to edit the queries, making it easy to interact with your dashboard cells and explore your data.
|
||||
|
||||
Variables are scoped by organization.
|
||||
|
||||
## Use dashboard variables
|
||||
Both [custom dashboard variables](#manage-custom-variables) and [predefined dashboard variables](#predefined-dashboard-variables)
|
||||
are stored in a `v` object associated with each dashboard.
|
||||
Reference each variable using dot-notation (e.g. `v.variableName`).
|
||||
|
||||
```js
|
||||
from(bucket: v.bucket)
|
||||
|> range(start: v.timeRangeStart, stop: v.timeRangeStart)
|
||||
|> filter(fn (r) => r._measurement == v.measurement and r._field == v.field)
|
||||
|> aggregateWindow(every: v.windowPeriod, fn: mean)
|
||||
```
|
||||
|
||||
When building Flux queries for dashboard cells, view available dashboard variables
|
||||
in the **Variables** tab next to the Functions tab.
|
||||
|
||||
{{< img-hd src="/img/2-0-variables-data-explorer-view.png" />}}
|
||||
|
||||
Click on a variable name to add it to your query and select a value from the **Value** dropdown.
|
||||
|
||||
## Predefined dashboard variables
|
||||
The InfluxDB provides the following predefined dashboard variables:
|
||||
|
||||
#### v.timeRangeStart
|
||||
Specifies the beginning of the queried time range.
|
||||
This variable is typically used to define the [`start` parameter](/v2.0/reference/flux/functions/built-in/transformations/range#start)
|
||||
of the `range()` function.
|
||||
|
||||
The **Time Range** selector defines the value of this variable.
|
||||
|
||||
#### v.timeRangeStop
|
||||
Specifies the end of the queried time range.
|
||||
This variable is typically used to define the [`stop` parameter](/v2.0/reference/flux/functions/built-in/transformations/range#stop)
|
||||
of the `range()` function.
|
||||
|
||||
The **Time Range** selector defines the value of this variable.
|
||||
It defaults to `now`.
|
||||
|
||||
#### v.windowPeriod
|
||||
Specifies the period of windowed data.
|
||||
This variable is typically used to define the `every` or `period` parameter of the
|
||||
[`window()` function](/v2.0/reference/flux/functions/built-in/transformations/window)
|
||||
in data aggregation operations.
|
||||
|
||||
The value of this variable is calculated by dividing the total time within the displayed
|
||||
time range by the dashboard refresh interval (defined by the **Refresh** dropdown).
|
||||
|
||||
## Custom dashboard variables
|
||||
Create, manage, and use custom dashboard variables in the InfluxDB user interface (UI).
|
||||
|
||||
{{< children >}}
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: Common variable queries
|
||||
description: Useful queries to use to populate values in common dashboard variable use cases.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Use and manage variables
|
||||
name: Common variable queries
|
||||
weight: 208
|
||||
"v2.0/tags": [variables]
|
||||
---
|
||||
|
||||
### List buckets
|
||||
List all buckets in the current organization.
|
||||
```js
|
||||
buckets()
|
||||
|> rename(columns: {"name": "_value"})
|
||||
|> keep(columns: ["_value"])
|
||||
```
|
||||
|
||||
### List measurements
|
||||
List all measurements in a specified bucket.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
v1.measurements(bucket: "bucket-name")
|
||||
```
|
||||
|
||||
### List hosts
|
||||
List all `host` tag values in a specified bucket.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
v1.tagValues(bucket: "bucket-name", tag: "host")
|
||||
```
|
||||
|
||||
### List fields in a measurement
|
||||
List all fields in a specified bucket and measurement.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
v1.measurementTagValues(
|
||||
bucket: "bucket-name",
|
||||
measurement: "measurment-name",
|
||||
tag: "_field"
|
||||
)
|
||||
```
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
title: Create a variable
|
||||
seotitle: Create a dashboard variable
|
||||
description: Create dashboard variables in the Data Explorer, from the Organization page, or import a variable.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Use and manage variables
|
||||
weight: 201
|
||||
"v2.0/tags": [variables]
|
||||
---
|
||||
|
||||
Create dashboard variables in the Data Explorer, from the Organization page, or import a variable.
|
||||
|
||||
_For information about variable types, see [Variable types](/v2.0/visualize-data/variables/variable-types/)._
|
||||
|
||||
### Create a variable in the Data Explorer
|
||||
|
||||
1. Click the **Data Explorer** icon in the sidebar.
|
||||
|
||||
{{< nav-icon "data-explorer" >}}
|
||||
|
||||
2. Click **Script Editor** on the lower right.
|
||||
3. Build the query for your variable using the [Table visualization type](v2.0/visualize-data/visualization-types/#table) or enable the **View Raw Data** option.
|
||||
4. Click **Save As** in the upper right.
|
||||
5. In the window that appears, select **Variable**.
|
||||
6. Enter a name for your variable in the **Name** field.
|
||||
7. Click **Create**.
|
||||
|
||||
### Create a variable in the Organizations page
|
||||
|
||||
1. Click the **Organizations** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "orgs" >}}
|
||||
|
||||
2. Select an organization from the list.
|
||||
3. Select the **Variables** tab.
|
||||
4. Click **+Create Variable**.
|
||||
5. Enter a name for your variable.
|
||||
6. Enter your variable.
|
||||
7. Click **Create**.
|
||||
|
||||
## Import a variable
|
||||
|
||||
1. Click the **Organizations** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "orgs" >}}
|
||||
|
||||
2. Select an organization from the list.
|
||||
3. Select the **Variables** tab.
|
||||
4. Click the **+Create Variable** dropdown menu and select **Import Variable**.
|
||||
3. In the window that appears:
|
||||
* Select **Upload File** to drag-and-drop or select a file.
|
||||
* Select **Paste JSON** to paste in JSON.
|
||||
4. Select an organization from the **Destination Organization** dropdown.
|
||||
5. Click **Import JSON as Variable**.
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
title: Delete a variable
|
||||
seotitle: Delete a dashboard variable
|
||||
description: Delete a dashboard variable in the InfluxDB user interface.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Use and manage variables
|
||||
weight: 205
|
||||
"v2.0/tags": [variables]
|
||||
---
|
||||
Delete an existing variable in the InfluxDB user interface (UI).
|
||||
|
||||
### Delete a variable
|
||||
|
||||
1. Click in the **Organizations** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "orgs" >}}
|
||||
|
||||
2. Select an organization from the list.
|
||||
3. Select the **Variables** tab.
|
||||
4. Hover over a variable and click the trash can icon.
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: Export a variable
|
||||
seotitle: Export a dashboard variable
|
||||
description: Export a dashboard variable in the InfluxDB user interface.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Use and manage variables
|
||||
weight: 204
|
||||
"v2.0/tags": [variables]
|
||||
---
|
||||
Export dashboard variables from the InfluxDB user interface (UI).
|
||||
Variables are exported as downloadable JSON files.
|
||||
|
||||
### Export a variable
|
||||
|
||||
1. Click the **Organizations** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "orgs" >}}
|
||||
|
||||
2. Select an organization from the list.
|
||||
3. Select the **Variables** tab.
|
||||
4. Hover over a variable in the list, then click the gear icon ({{< icon "gear" >}}) and select **Export**.
|
||||
3. Review the JSON in the window that appears.
|
||||
4. Select one of the following options:
|
||||
* **Download JSON**: Download the dashboard as a JSON file.
|
||||
* **Save as template**: Save the JSON as a dashboard template.
|
||||
* **Copy to Clipboard**: Copy the JSON to your clipboard.
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
title: Update a variable
|
||||
seotitle: Update a dashboard variable
|
||||
description: Update a dashboard variable in the InfluxDB user interface.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Use and manage variables
|
||||
weight: 203
|
||||
"v2.0/tags": [variables]
|
||||
---
|
||||
|
||||
Update an existing dashboard variable's name or JSON content in the InfluxDB user interface (UI).
|
||||
|
||||
### Update a variable
|
||||
|
||||
1. Click the **Organizations** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "orgs" >}}
|
||||
|
||||
2. Select an organization from the list.
|
||||
3. Select the **Variables** tab.
|
||||
4. Click on a variable's name from the list.
|
||||
5. Update the variable's name and query.
|
||||
6. Click **Submit**.
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: Variable types
|
||||
seotitle: Dashboard variable types
|
||||
description: Overview of the types of dashboard variables available in InfluxDB
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Use and manage variables
|
||||
weight: 207
|
||||
"v2.0/tags": [variables]
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
In the current version of InfluxDB v2.0 alpha, only [query-populated variables](#query) are available.
|
||||
{{% /note %}}
|
||||
|
||||
Variable types determine how the list of possible values is populated.
|
||||
|
||||
## Query
|
||||
Variable values are populated using the results of a Flux query.
|
||||
All values in the `_value` column are possible values for the variable.
|
||||
|
||||
##### Variable query example
|
||||
```js
|
||||
// List all buckets
|
||||
buckets()
|
||||
|> rename(columns: {"name": "_value"})
|
||||
|> keep(columns: ["_value"])
|
||||
```
|
||||
|
||||
_For examples of dashboard variable queries, see [Common variable queries](/v2.0/visualize-data/variables/common-variables)._
|
||||
|
||||
|
||||
#### Important things to note about variable queries
|
||||
- The variable will only use values from the `_value` column.
|
||||
If the data you’re looking for is in a column other than `_value`, use the
|
||||
[`rename()`](/v2.0/reference/flux/functions/built-in/transformations/rename/) or
|
||||
[`map()`](/v2.0/reference/flux/functions/built-in/transformations/map/) functions
|
||||
to change the name of that column to `_value`.
|
||||
- The variable will only use the first table in the output stream.
|
||||
Use the [`group()` function](/v2.0/reference/flux/functions/built-in/transformations/group)
|
||||
to group everything into a single table.
|
||||
- Do not use any [predefined dashboard variables](/v2.0/visualize-data/variables/#predefined-dashboard-variables) in variable queries.
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
title: View variables
|
||||
seotitle: View dashboard variables
|
||||
description: View dashboard variables in the InfluxDB user interface.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Use and manage variables
|
||||
weight: 203
|
||||
"v2.0/tags": [variables]
|
||||
---
|
||||
|
||||
View a list of dashboard variables in the InfluxDB user interface (UI) from an organization or from the Data Explorer.
|
||||
|
||||
## View variables in the organization
|
||||
|
||||
1. Click the **Organizations** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "orgs" >}}
|
||||
|
||||
2. Select an organization from the list.
|
||||
3. Select the **Variables** tab.
|
||||
|
||||
## View variables in the Data Explorer
|
||||
|
||||
1. Click the **Data Explorer** icon in the navigation bar.
|
||||
|
||||
{{< nav-icon "data-explorer" >}}
|
||||
|
||||
2. Switch to **Script Editor**.
|
||||
3. Click the **Variables** tab to the right of the script editor.
|
||||
|
||||
{{< img-hd src="/img/2-0-variables-data-explorer-view.png" />}}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue