Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

math cos for math

Returns the cosine of the number.

Signature

> math cos {flags}

Flags

  • --degrees, -d: Use degrees instead of radians

Input/output types:

inputoutput
numberfloat
list<number>list<float>

Examples

Apply the cosine to π

> 3.141592 | math cos | math round --precision 4
-1

Apply the cosine to a list of angles in degrees

> [0 90 180 270 360] | math cos --degrees
╭───┬───────╮
│ 0 │  1.00 │
│ 1 │  0.00 │
│ 2 │ -1.00 │
│ 3 │  0.00 │
│ 4 │  1.00 │
╰───┴───────╯