MathPlugin Class
Description: MathPlugin provides a set of functions to make Math calculations.
Usage: kernel.add_plugin(MathPlugin(), plugin_name="math")
Constructor
MathPlugin()
Examples
{{math.Add}} => Returns the sum of input and amount (provided in the KernelArguments) {{math.Subtract}} => Returns the difference of input and amount (provided in the KernelArguments)
Methods
| add |
Returns the Addition result of the values provided. |
| add_or_subtract |
Helper function to perform addition or subtraction based on the add flag. |
| subtract |
Returns the difference of numbers provided. |
add
Returns the Addition result of the values provided.
add(input: Annotated[int, 'the first number to add'], amount: Annotated[int, 'the second number to add']) -> Annotated[int, 'the output is a number']
Parameters
| Name | Description |
|---|---|
|
input
Required
|
|
|
amount
Required
|
|
add_or_subtract
Helper function to perform addition or subtraction based on the add flag.
static add_or_subtract(input: int, amount: int, add: bool) -> int
Parameters
| Name | Description |
|---|---|
|
input
Required
|
|
|
amount
Required
|
|
|
add
Required
|
|
subtract
Returns the difference of numbers provided.
subtract(input: Annotated[int, 'the first number'], amount: Annotated[int, 'the number to subtract']) -> int
Parameters
| Name | Description |
|---|---|
|
input
Required
|
|
|
amount
Required
|
|