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 log for math

Returns the logarithm for an arbitrary base.

Signature

> math log {flags} (base) ...rest

Parameters

  • base: Base for which the logarithm should be computed.
  • ...rest: The cell-paths/columns to operate on.

Input/output types:

inputoutput
numberfloat
list<number>list<float>
rangelist<number>
recordrecord

Examples

Get the logarithm of 100 to the base 10.

> 100 | math log 10
2.0

Get the log2 of a list of values.

> [16 8 4] | math log 2
╭───┬──────╮
│ 0 │ 4.00 │
│ 1 │ 3.00 │
│ 2 │ 2.00 │
╰───┴──────╯

Compute the log base 10 of list-valued columns in a record.

> {alice: [1 10 100], bob: [1000 10000]} | math log 10
╭───────┬──────────────╮
│       │ ╭───┬──────╮ │
│ alice │ │ 0 │ 0.00 │ │
│       │ │ 1 │ 1.00 │ │
│       │ │ 2 │ 2.00 │ │
│       │ ╰───┴──────╯ │
│       │ ╭───┬──────╮ │
│ bob   │ │ 0 │ 3.00 │ │
│       │ │ 1 │ 4.00 │ │
│       │ ╰───┴──────╯ │
╰───────┴──────────────╯

Compute the log base 10 of a single column using a cell path.

> {alice: [1 10 100], bob: [1000 10000]} | math log 10 alice
╭───────┬───────────────╮
│       │ ╭───┬──────╮  │
│ alice │ │ 0 │ 0.00 │  │
│       │ │ 1 │ 1.00 │  │
│       │ │ 2 │ 2.00 │  │
│       │ ╰───┴──────╯  │
│       │ ╭───┬───────╮ │
│ bob   │ │ 0 │  1000 │ │
│       │ │ 1 │ 10000 │ │
│       │ ╰───┴───────╯ │
╰───────┴───────────────╯