Skip to main content

MathToolkit

A class representing a toolkit for mathematical operations. This class provides methods for basic mathematical operations such as addition, subtraction, multiplication, division, and rounding.

math_add

Adds two numbers. Parameters:
  • a (float): The first number to be added.
  • b (float): The second number to be added.
Returns: float: The sum of the two numbers.

math_subtract

Do subtraction between two numbers. Parameters:
  • a (float): The minuend in subtraction.
  • b (float): The subtrahend in subtraction.
Returns: float: The result of subtracting :obj:b from :obj:a.

math_multiply

Multiplies two numbers. Parameters:
  • a (float): The multiplier in the multiplication.
  • b (float): The multiplicand in the multiplication.
  • decimal_places (int, optional): The number of decimal places to round to. Defaults to 2.
Returns: float: The product of the two numbers.

math_divide

Divides two numbers. Parameters:
  • a (float): The dividend in the division.
  • b (float): The divisor in the division.
  • decimal_places (int, optional): The number of decimal places to round to. Defaults to 2.
Returns: float: The result of dividing :obj:a by :obj:b.

math_round

Rounds a number to a specified number of decimal places. Parameters:
  • a (float): The number to be rounded.
  • decimal_places (int, optional): The number of decimal places to round to. Defaults to 0.
Returns: float: The rounded number.

get_tools

Returns: List[FunctionTool]: A list of FunctionTool objects representing the functions in the toolkit.

add

Deprecated: Use math_add instead.

sub

Deprecated: Use math_subtract instead.

multiply

Deprecated: Use math_multiply instead.

divide

Deprecated: Use math_divide instead.

round

Deprecated: Use math_round instead. Note: This was shadowing Python’s built-in round().