maTH
  • 👋Welcome!
  • 🗿Installation
  • Reference
    • 😱Mathematical operations
      • add
      • pascal
      • factorial
      • factorialL
      • GCD
      • LCM
      • pow
      • permutations
      • combinations
      • combinationsWithRep
      • subtract
      • multiply
      • divide
      • sin
      • cos
      • ln
      • log
      • radToDeg
      • degToRad
      • mod
      • abs
      • floor
      • ceil
      • root
      • exp
      • tan
      • arcsin
      • arccos
      • arctan
      • sinh
      • cosh
      • round
    • 🥶Statistics
      • Binomial
      • Poisson
      • Geometric
      • Pascal
      • Hypergeometric
      • Exponential
      • Uniform
    • 🥵Data structures
      • Stack
      • Queue
      • LinkedList
    • 🤓Algorithms
      • Bubble sort
      • Insertion sort
      • Selection sort
      • Merge sort
      • Quicksort
      • Heap sort
      • Count sort
      • Bucket sort
      • Radix sort
    • 😳Constants
Powered by GitBook
On this page
  1. Reference

Mathematical operations

maTH library started as a library of mathematical operations made from scratch. Here's a list of all operations the library supports:

Function
Description
Source

int factorial(int n)

Find the factorial of n

factorial

long long factorialL(int n)

Find the factorial of n

factorialL

std::vector<int> pascal(int n)

Return the nth row of pascal triangle

pascal

int combinations(int n, int k)

How many unique combinations are there with a population of n, whilst selecting k items.

combinations

int combinationsWithRep(int n, int k)

How many combinations are there with a population of n, whilst selecting k items (items have repetition).

combinationsWithRep

int permutations(int n, int k)

Permutate k items in population size n.

permutations

int pow(int a, int n)

Raise a to the power of n

pow

double pow(double a, int n)

Raise a to the power of n

pow

double pow(int a, double n)

Raise a to the power of n

pow

double pow(double a, double n)

Raise a to the power of n

pow

int GCD(int a, int b)

Find GCD of two numbers

GCD

int LCM(int a, int b)

Find LCM of two numbers

LCM

add<return_type>(a, b)

Add two numbers

add

subtract<return_type>(a, b)

Subtract two numbers

subtract

multiply<return_type>(a, b)

Multiply two numbers

multiply

divide<return_type>(a, b)

Divide two numbers

divide

sin(x)

Compute sine

sin

cos(x)

Compute cosine

cos

ln<return_type>(x)

Find the natural logarithm of a number

ln

log<return_type>(base, argument)

Find the logarithm of argument with a given base

log

radToDeg<return_type>(rad)

Convert radians to degrees

radToDeg

degToRad<return_type>(deg)

Convert degrees to radians

degToRad

mod<return_type>(dividend, divisor)

Remainder of a quotient

mod

abs<return_type>(val)

Absolute value of number

abs

int floor(x)

Round value down

floor

int ceil(x)

Round value up

ceil

root<return_type>(n, a)

Find the nth root of a number

root

exp<return_type>(x)

Exponential function

exp

tan(x)

Compute tangent

tan

arcsin(x)

Compute arcsine

arcsin

arccos(x)

Compute arccosine

arccos

arctan(x)

Compute arctangent

arctan

sinh(x)

Compute hyberbolic sine

sinh

cosh(x)

Compute hyperbolic cosine

cosh

int round(x)

Rounds a number up/down

round

If the argument data type is defined, eg. int round(x), it means x can be whatever data type. func_name<return_type> specifies, that you can specifically say, in which data type you want your result to be in.

PreviousInstallationNextadd

Last updated 9 months ago

😱