Public beta — not for production use. Data may be wiped at any time. Questions? Contact us.
A
Axiom
/Marketplace/axiom-official/simple-math
Sign in

axiom-official/simple-math

v0.1.0Python

The simple-math package provides a set of basic mathematical operations including addition, subtraction, multiplication, and division. It is primarily used for performing fundamental arithmetic calculations in Python applications.

matharithmeticadditionsubtractionmultiplicationdivision

Use cases

  • Perform basic calculations in a calculator application
  • Automate arithmetic operations in data processing scripts
  • Integrate simple math functions into educational software

Nodes (4)

Addunary
AddInput·MathOutput

The Add node performs the addition of two numerical inputs and returns the resulting sum as output.

View source
from gen.messages_pb2 import AddInput, MathOutput
from gen.axiom_logger import AxiomLogger, AxiomSecrets


def add(log: AxiomLogger, secrets: AxiomSecrets, input: AddInput) -> MathOutput:
    """Adds two numbers together and returns the sum."""
    try:
        log.info(f"Adding {input.a} + {input.b}")
        result = input.a + input.b
        log.info(f"Result: {result}")
        return MathOutput(result=result)
    except Exception as e:
        log.error(f"Error adding numbers: {e}")
        return MathOutput(result=0.0)
Divideunary
DivideInput·MathOutput

The Divide node performs division of two numbers, returning the quotient of the first number divided by the second. It handles division by zero by raising an error.

View source
from gen.messages_pb2 import DivideInput, MathOutput
from gen.axiom_logger import AxiomLogger, AxiomSecrets


def divide(log: AxiomLogger, secrets: AxiomSecrets, input: DivideInput) -> MathOutput:
    """Divides the first number by the second and returns the quotient."""
    try:
        log.info(f"Dividing {input.a} by {input.b}")
        
        if input.b == 0:
            log.error("Division by zero attempted")
            raise ValueError("Cannot divide by zero")
        
        result = input.a / input.b
        log.info(f"Division result: {result}")
        
        return MathOutput(result=result)
    
    except Exception as e:
        log.error(f"Error during division: {str(e)}")
        raise
Multiplyunary
MultiplyInput·MathOutput

The Multiply node takes two numerical inputs and computes their product, returning the result as output.

View source
from gen.messages_pb2 import MultiplyInput, MathOutput
from gen.axiom_logger import AxiomLogger, AxiomSecrets


def multiply(log: AxiomLogger, secrets: AxiomSecrets, input: MultiplyInput) -> MathOutput:
    """Multiplies two numbers together and returns the product."""
    try:
        log.info(f"Multiplying {input.a} and {input.b}")
        result = input.a * input.b
        log.info(f"Result: {result}")
        return MathOutput(result=result)
    except Exception as e:
        log.error(f"Error during multiplication: {str(e)}")
        raise
Subtractunary
SubtractInput·MathOutput

The Subtract node performs a subtraction operation by taking two input numbers and returning the difference between them.

View source
from gen.messages_pb2 import SubtractInput, MathOutput
from gen.axiom_logger import AxiomLogger, AxiomSecrets


def subtract(log: AxiomLogger, secrets: AxiomSecrets, input: SubtractInput) -> MathOutput:
    """Subtracts the second number from the first and returns the difference."""
    try:
        log.info(f"Subtracting {input.b} from {input.a}")
        result = input.a - input.b
        log.info(f"Subtraction result: {result}")
        return MathOutput(result=result)
    except Exception as e:
        log.error(f"Error during subtraction: {str(e)}")
        raise

Messages (5)

Download .proto
AddInput
a:double

The first number to be added.

b:double

The second number to be added.

DivideInput
a:double

The numerator, the first number to be divided.

b:double

The denominator, the second number by which the first number is divided.

MathOutput
result:double

The sum of the two input numbers.

MultiplyInput
a:double

The first number to be multiplied.

b:double

The second number to be multiplied.

SubtractInput
a:double

The first number from which the second number will be subtracted.

b:double

The second number that will be subtracted from the first number.

Use this package

Sign in to import axiom-official/simple-math into the graph editor — drop it into a flow and hit run. Or call it directly via the API Reference with your API key.

Sign in to useOpen editor

Thin client

A single self-contained file — no dependencies, no ZIP. Drop it in your project and call nodes with your API key.

Or via the CLI: axiom client axiom-official/simple-math@0.1.0 --lang python

Generate client

Download a typed API client generated from this package's OpenAPI spec. Drop it in your project and call the node with full type safety.

Stats

Error rate (1h)0.0%
Back to marketplace