Sidebar

Home



Expressions V4


Tutorials

How-To

Reference

  Lexical basics
  Type system
  Variables and assignment
  Operators
  Expression rules
  Control flow
  Functions
  Built-in functions
   None and NaN
   Arithmetic
   Algebra
   Logarithmic and Exponential
   Trigonometric
   Rounding and Centering
   Strings
   Output, Formatting, Clipboard, and Errors
   Dialog Functions
   Platform and Paths
  Methods and properties
  Built-in methods
   Common Value Methods
   Number Methods
   String Basic Methods
   String Slice Methods
   String Parsing Methods
   String Formatting Methods
   String Regex Methods
   String Trim and Case Methods
  Objects
  Built-in objects
   Global objects
    settings
    controller
    session
    python
   Collections
    array
    map
    bytes
   File Format I/O
    image_data
    image_stream
   Utils
    crypto
    timer
   Comm
    serial
   Dialogs
    file_open
    file_save
    msg_ok
    msg_ok_cancel
    msg_yes_no
    msg_password
   GUI objects
    window
    panel
    group
    splitpanel
    label
    textbutton
    drawablebutton
    togglebutton
    togglegroup
    textinput
    textedit
    numinput
    slider
    combobox
    listbox
    progressbar
    led
    separator
    menu
    image
    snake
  Classes and user-defined objects
  Include system
  Error model
  Execution model and sessions
  Host integration
  Limits and performance
  Formal reference
  Glossary

Cookbook

exprv4:reference:functions:trigonometric



Trigonometric Functions

Trigonometric functions use radians unless the function name says otherwise.

acos(x)

Returns the arc cosine of `x`.

Argument Type Description
`x` number Input value. Must be between `-1` and `1`.

Returns: angle in radians.

Example:

rad2deg(acos(0));     // 90

acosh(x)

Returns the inverse hyperbolic cosine of `x`.

Argument Type Description
`x` number Input value. Must be greater than or equal to `1`.

Returns: number.

Example:

acosh(1);             // 0

asin(x)

Returns the arc sine of `x`.

Argument Type Description
`x` number Input value. Must be between `-1` and `1`.

Returns: angle in radians.

Example:

rad2deg(asin(1));     // 90

asinh(x)

Returns the inverse hyperbolic sine of `x`.

Argument Type Description
`x` number Input value.

Returns: number.

Example:

asinh(0);             // 0

atan(x)

Returns the arc tangent of `x`.

Argument Type Description
`x` number Input value.

Returns: angle in radians.

Example:

rad2deg(atan(1));     // 45

atan2(y, x)

Returns the arc tangent using `y` and `x`.

Argument Type Description
`y` number Y component.
`x` number X component.

Returns: angle in radians.

The pair `0, 0` is undefined and raises an error.

Example:

rad2deg(atan2(1, 0)); // 90

atanh(x)

Returns the inverse hyperbolic tangent of `x`.

Argument Type Description
`x` number Input value. Must be between `-1` and `1`.

Returns: number.

Example:

atanh(0);             // 0

cos(x)

Returns the cosine of angle `x`.

Argument Type Description
`x` number Angle in radians.

Returns: number.

Example:

cos(0);               // 1

cosh(x)

Returns the hyperbolic cosine of `x`.

Argument Type Description
`x` number Input value.

Returns: number.

Example:

cosh(0);              // 1

cot(x)

Returns the cotangent of angle `x`.

Argument Type Description
`x` number Angle in radians.

Returns: number.

Example:

cot(deg2rad(45));

csc(x)

Returns the cosecant of angle `x`.

Argument Type Description
`x` number Angle in radians.

Returns: number.

Example:

csc(deg2rad(90));

deg2rad(degrees)

Converts degrees to radians.

Argument Type Description
`degrees` number Angle in degrees.

Returns: angle in radians.

Example:

deg2rad(180);         // pi radians

hypot(x, y)

Returns the length of a 2D vector.

Argument Type Description
`x` number X component.
`y` number Y component.

Returns: number.

Example:

hypot(3, 4);          // 5

pi()

Returns the pi constant.

Argument Type Description
none No arguments.

Returns: number.

Example:

rad2deg(pi());        // 180

rad2deg(radians)

Converts radians to degrees.

Argument Type Description
`radians` number Angle in radians.

Returns: angle in degrees.

Example:

rad2deg(pi());        // 180

sec(x)

Returns the secant of angle `x`.

Argument Type Description
`x` number Angle in radians.

Returns: number.

Example:

sec(0);               // 1

sin(x)

Returns the sine of angle `x`.

Argument Type Description
`x` number Angle in radians.

Returns: number.

Example:

sin(deg2rad(90));     // 1

sinh(x)

Returns the hyperbolic sine of `x`.

Argument Type Description
`x` number Input value.

Returns: number.

Example:

sinh(0);              // 0

tan(x)

Returns the tangent of angle `x`.

Argument Type Description
`x` number Angle in radians.

Returns: number.

Example:

tan(deg2rad(45));     // 1

tanh(x)

Returns the hyperbolic tangent of `x`.

Argument Type Description
`x` number Input value.

Returns: number.

Example:

tanh(0);              // 0

Previous: Logarithmic and Exponential

Next: Rounding and Centering

exprv4/reference/functions/trigonometric.txt · Last modified: by andrej

Page Tools