> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphext.com/llms.txt
> Use this file to discover all available pages before exploring further.

# math_func

> Applies a mathematical function to the values of a (single) numeric column. 

See [numpy's documentation](https://numpy.org/doc/stable/reference/routines.math.html) for further details
about the supported functions.

## Usage

The following examples show how the step can be used in a recipe.

<Accordion title="Examples" icon="code" defaultOpen="true">
  <Tabs>
    <Tab title="Example 1">
      To calculate the logarithm of a column's values:

      ```stan theme={null}
      math_func(ds.input, {"func": "log"}) -> (ds.output)
      ```
    </Tab>

    <Tab title="Example 2">
      Or to calculate the absolute (distance from 0, |x|) of a column's values:

      ```stan theme={null}
      math_func(ds.input, {"func": "absolute"}) -> (ds.output)
      ```
    </Tab>

    <Tab title="Signature">
      General syntax for using the step in a recipe. Shows the inputs and outputs the step is expected to receive and will produce respectively. For futher details see sections below.

      ```stan theme={null}
      math_func(input: number, {
          "param": value,
          ...
      }) -> (output: number)
      ```
    </Tab>
  </Tabs>
</Accordion>

## Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally
columns (`ds.first_name`), datasets (`ds` or `ds[["first_name", "last_name"]]`) or models (referenced
by name e.g. `"churn-clf"`).

<Accordion title="Inputs" icon="right-to-bracket">
  <ParamField path="input" type="column[number]" required>
    Numeric input column to aplply function to.
  </ParamField>
</Accordion>

<Accordion title="Outputs" icon="right-from-bracket">
  <ParamField path="output" type="column[number]" required>
    The result of calling the specified function on the input data.
  </ParamField>
</Accordion>

## Configuration

The following parameters can be used to configure the behaviour of the step by including them in
a json object as the last "input" to the step, i.e. `step(..., {"param": "value", ...}) -> (output)`.

<Accordion title="Parameters" defaultOpen="true" icon="sliders">
  <ParamField path="func" type="string" required>
    The name of the mathematical function to apply.

    Values must be one of the following:

    `absolute` `angle` `arccos` `arccosh` `arcsin` `arcsinh` `arctan` `arctanh` `around` `cbrt` `ceil` `conj` `conjugate` `cos` `cosh` `cumprod` `cumsum` `deg2rad` `degrees` `exp` `exp2` `expm1` `fabs` `fix` `floor` `gradient` `i0` `imag` `log` `log10` `log1p` `log2` `nan_to_num` `nancumprod` `nancumsum` `nanprod` `nansum` `negative` `positive` `prod` `rad2deg` `radians` `real` `real_if_close` `reciprocal` `rint` `round` `round_` `sign` `sin` `sinc` `sinh` `sqrt` `square` `sum` `tan` `tanh` `trunc`
  </ParamField>
</Accordion>
