Skip to content

Compute hyperbolic tangent

Source code

Description

Compute hyperbolic tangent

Usage

<Expr>$tanh()

Value

Expr

Examples

library("polars")

pl$DataFrame(a = c(-1, atanh(0.5), 0, 1, NA_real_))$
  with_columns(tanh = pl$col("a")$tanh())
#> shape: (5, 2)
#> ┌──────────┬───────────┐
#> │ a        ┆ tanh      │
#> │ ---      ┆ ---       │
#> │ f64      ┆ f64       │
#> ╞══════════╪═══════════╡
#> │ -1.0     ┆ -0.761594 │
#> │ 0.549306 ┆ 0.5       │
#> │ 0.0      ┆ 0.0       │
#> │ 1.0      ┆ 0.761594  │
#> │ null     ┆ null      │
#> └──────────┴───────────┘