Calculator and StdDev Tool 1.0
Python-based calculator with GUI and standard deviation functionality
Loading...
Searching...
No Matches
mathlib.MathLib Class Reference

Static Public Member Functions

float add (float x, float y)
 A simple math library providing basic arithmetic operations and advanced functions.
 
float div (float x, float y)
 Divides two numbers and returns the result as a float.
 
int fact (int x)
 Calculates factorial of a non-negative integer.
 
float log (float x)
 Calculates the natural logarithm of a number.
 
float mul (float x, float y)
 Multiplies two numbers and returns the result as a float.
 
float nthrt (float x, float y)
 Calculates the nth root of a number.
 
float pow (float x, int y)
 Raises a number to the power of an integer exponent.
 
float sub (float x, float y)
 Subtracts two numbers and returns the result as a float.
 

Member Function Documentation

◆ add()

float mathlib.MathLib.add ( float  x,
float  y 
)
static

A simple math library providing basic arithmetic operations and advanced functions.

Adds two numbers and returns the result as a float.

Parameters
xFirst number
ySecond number
Returns
: Sum of x and y
Exceptions
TypeErrorIf inputs are not float

◆ div()

float mathlib.MathLib.div ( float  x,
float  y 
)
static

Divides two numbers and returns the result as a float.

Parameters
xDividend
yDivisor
Returns
: Quotient of x and y
Exceptions
TypeErrorIf inputs are not float
ZeroDivisionErrorIf y is zero

◆ fact()

int mathlib.MathLib.fact ( int  x)
static

Calculates factorial of a non-negative integer.

Parameters
xInteger input
Returns
: Factorial of x
Exceptions
TypeErrorIf input is not int
ValueErrorIf input is negative int

◆ log()

float mathlib.MathLib.log ( float  x)
static

Calculates the natural logarithm of a number.

Parameters
xInput number
Returns
: Natural logarithm of x
Exceptions
TypeErrorIf input is not float
ValueErrorIf input is less than or equal to zero

◆ mul()

float mathlib.MathLib.mul ( float  x,
float  y 
)
static

Multiplies two numbers and returns the result as a float.

Parameters
xFirst number
ySecond number
Returns
: Product of x and y
Exceptions
TypeErrorIf inputs are not float

◆ nthrt()

float mathlib.MathLib.nthrt ( float  x,
float  y 
)
static

Calculates the nth root of a number.

Parameters
xRadicand
yDegree of the root
Returns
: y-th root of x as float
Exceptions
TypeErrorIf inputs are not float
ValueErrorIf y <= 0, or even root of negative number

◆ pow()

float mathlib.MathLib.pow ( float  x,
int  y 
)
static

Raises a number to the power of an integer exponent.

Parameters
xBase
yExponent
Returns
: x raised to the power y
Exceptions
TypeErrorIf inputs are not int or float
ValueErrorIf exponent is not a whole number

◆ sub()

float mathlib.MathLib.sub ( float  x,
float  y 
)
static

Subtracts two numbers and returns the result as a float.

Parameters
xFirst number
ySecond number
Returns
: Difference of x and y
Exceptions
TypeErrorIf inputs are not float

The documentation for this class was generated from the following file: