Skip to content

API

Multiply a value by a given factor.

This is a simple example function intended for use in documentation generated by mkdocstrings.

Parameters:

Name Type Description Default
value float

The number to be multiplied.

required
factor float

The factor to multiply value by. Defaults to 2.0.

2.0

Returns:

Type Description
float

The product of value and factor.

Examples:

>>> multiply(3, 4)
12
>>> multiply(5)
10.0

Add two numbers together.

This function is documented in a way that mkdocstrings can automatically extract and render.

Parameters:

Name Type Description Default
a float

float The first number to add.

required
b float

float The second number to add.

required

Returns:

Type Description
float

float The sum of a and b.

Examples:

>>> add(2, 3)
5
>>> add(-1.5, 0.5)
-1.0

multiply3(a, b, c)

Multiply three numbers together.

This function is documented in a way that mkdocstrings can automatically extract and render.

Parameters:

Name Type Description Default
a float

float The first number to multiply.

required
b float

float The second number to multiply.

required
c float

float The third number to multiply.

required

Returns:

Type Description
float

float The product of a, b, and c.

Examples:

>>> multiply3(2, 3, 4)
24
>>> multiply3(-1.5, 0.5, 2)
-3.0

pctformat(value, decimals=2)

Format a number as a percentage string with specified decimal places.

Parameters: value (float): The numeric value to format. decimals (int): The number of decimal places to include.

Returns: str: The formatted percentage string.

Multiply 2 numbers and divide by a third.

This is a simple example function intended for use in documentation generated by mkdocstrings.

Parameters:

Name Type Description Default
m1 float

The first number to be multiplied.

required
m2 float

The second number to be multiplied.

required
d1 float

The number to divide the product of m1 and m2 by.

required

Returns:

Type Description
float

The product of m1 and m2 divided by d1.

Examples:

>>> multiplydivide(3, 4, 2)
6.0
>>> multiplydivide(5, 2, 1)
10.0

Calculate the n-th root of a number.

This function is documented in a way that mkdocstrings can automatically extract and render.

Parameters:

Name Type Description Default
a float

The number to find the root of (the radicand).

required
b float

The degree of the root (the index).

required

Returns:

Type Description
float

The b-th root of a.

Examples:

>>> get_root(25, 2)
5.0
>>> get_root(8, 3)
2.0