# Mathematical Functions

In this document, mathematical functions are demonstrated with examples.

To view this example for all mathematical functions in the library, see (<https://openbrim.org/platform/?application=inc&author=ParamML_Examples_OpenBrIM+Platform&folder=Functions&obj=objiddgs5s0zubysq7d1t93detq>)

**abs (Number)**

The function returns the absolute value of the specified number.

```xml
<O N="MF1" T="Group">
        <P N="Num1" V="-5" />
        <P N="AbsoluteValue" V="abs(Num1)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-090732.png?api=v2) **acos (Number)**

It is a function that returns the arccosine of a given number in radians. The angle is given in radians between 0 and PI.

```xml
<O N="MF2" T="Group">
        <P N="x" V="0.5" />
        <P N="arccos" V="acos(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-092044.png?api=v2) **asin (Number)**

It is a function that returns the arcsine of a given number in radians. The angle is given in radians between 0 and PI.

```xml
<O N="MF3" T="Group">
        <P N="x" V="0.5" />
        <P N="arcsin" V="asin(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-110146.png?api=v2) **atan (Number)**

It is a function that returns the arctangent of a given number in radians. The angle is given in radians between 0 and PI.

```xml
<O N="MF4" T="Group">
        <P N="x" V="0.5" />
        <P N="arctan1" V="atan(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-110633.png?api=v2) **atan2 (Number)**

The function calculates the arctangent or inverse tangent of the given x and y coordinates. It determines the angle, in radians, between the x-axis and a line connecting the origin (0,0) to the specified x,y point. The resulting angle will be in the range of 0 to PI.

```xml
<O N="MF5" T="Group">
        <P N="a" V="1" />
        <P N="b" V="1" />
        <P N="arctan2" V="atan2(a,b)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-111105.png?api=v2) **ceil (Number)**

The function rounds the specified number to the nearest integer that is greater than that number.

```xml
<O N="MF6" T="Group">
        <P N="x" V="23.6" />
        <P N="y" V="ceil(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-111645.png?api=v2) **cos (Angle)**

This function calculates the cosine of a specified number in radians. The input value must be within the range of 0 and PI.

```xml
<O N="MF7" T="Group">
        <P N="x" V="0" />
        <P N="y" V="cos(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-111956.png?api=v2) **exp (Number)**

This function calculates the power of e (approximately equal to 2.7183) raised to the specified number. It returns the result of e^x, where x is the input number.

```xml
<O N="MF8" T="Group">
        <P N="x" V="1" />
        <P N="y" V="exp(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-112352.png?api=v2) **floor (Number)**

The function rounds the specified number down to the nearest integer.

```xml
<O N="MF9" T="Group">
        <P N="x" V="23.6" />
        <P N="y" V="floor(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-112643.png?api=v2) **log (Number)**

This function calculates the natural logarithm, with base "e" (approximately equal to 2.7183), of the specified number. It returns the result of the logarithm calculation.

```xml
<O N="MF10" T="Group">
        <P N="x" V="30" />
        <P N="y" V="log(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-112906.png?api=v2) **max (Number1, Number2, ..)**

The function returns the maximum value among the specified numbers. It compares all of the input numbers and returns the largest one as the result.

```xml
<O N="MF11" T="Group">
        <P N="A" V="max(50,32,11,76)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-113334.png?api=v2) **min (Number1, Number2, ..)**

The function returns the minimum value among the specified numbers. It compares all of the input numbers and returns the lowest one as the result.

```xml
<O N="MF12" T="Group">
        <P N="A" V="min(50,32,11,76)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-113536.png?api=v2) **pow (Number1, Number2)**

This function calculates the result of raising the first specified number (number1) to the power of the second specified number (number2). The result will be number1number2.

```xml
<O N="MF13" T="Group">
        <P N="a" V="6" />
        <P N="b" V="3" />
        <P N="x" V="pow(a,b)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-114643.png?api=v2) **random ( )**

The function returns a random decimal number between 0 and 1 inclusive. The result will be a pseudo-random value generated by the system.

```xml
<O N="MF14" T="Group">
        <P N="x" V="random()" />
        <P N="y" V="random()" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-114909.png?api=v2) **round (Number)**

The function rounds the specified number to the nearest integer.

```xml
<O N="MF15" T="Group">
        <P N="x" V="11.5" />
        <P N="y" V="13.4" />
        <P N="a" V="round(x)" />
        <P N="b" V="round(y)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-115501.png?api=v2) **sin (Angle)**

This function calculates the sine of a specified number in radians. The input value must be within the range of 0 and PI.

```xml
<O N="MF16" T="Group">
        <P N="x" V="PI/2" />
        <P N="y" V="sin(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-120155.png?api=v2) **sqrt (Number)**

The function calculates the square root of the specified number. It returns the result of the square root calculation.

```xml
<O N="MF17" T="Group">
        <P N="x" V="49" />
        <P N="y" V="sqrt(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-120724.png?api=v2) **tan (Angle)**

This function calculates the tangent of a specified number in radians. The input value must be within the range of 0 and PI.

```xml
<O N="MF18" T="Group">
        <P N="x" V="PI/4" />
        <P N="y" V="tan(x)" />
    </O>
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2161868869/image-20230213-120546.png?api=v2)
