Skip to main content

A dynamic Python math library containing numerous mathematical functions implemented from scratch.

Project description

AxiomX

AxiomX is a lightweight, pure-Python mathematical library built from first principles - designed for accuracy, learning, and mathematical exploration.


📦 Contents

𝛑 AxiomX.constants - Constants module

AxiomX.constants is the constants module of AxiomX. It has a wide variety of constants. Here are the constants we provide:

  • 𝛑 (pi)
  • e (Euler's number)
  • ϖ (lemniscate constant)
  • Square roots of 2, 3 and 5
  • Metallic ratio
  • Bernoulli Numbers - NEW
  • Stieltjes Numbers - NEW
  • Harmonic Numbers - NEW

∫ AxiomX.calculus - Calculus module

AxiomX.calculus is the calculus module of AxiomX. It provides three functions:

  • integrate(function, lowlim, uplim)
  • summation(lowlim, uplim, function)
  • converges(function)

Usage

from AxiomX.calculus import *
import math  # just for demo. We will show you our function later. 

print(integrate(lambda x: 1 / math.cosh(x), -100, 100)) # prints 3.141592...
print(summation(1, float("inf"), lambda x: 1 / x**2)) # prints 1.64493...

⚙️ AxiomX.functions - Arithmetic functions module

AxiomX.functions is the module of AxiomX which contains all kinds of arithmetic functions. These are the functions the module provides:

  • absolute(x)
  • gamma(x)
  • sqrt(n)
  • cbrt(n)
  • factorial(n)
  • zeta(n)
  • beta(n)
  • bc(n, k)
  • pascal(row)

Usage

from AxiomX.functions import *

print(gamma(0.5)) # prints 1.7724...
print(zeta(3)) # prints 1.20205...
print(beta(2)) # prints 0.91596...

📈 AxiomX.exp - Exponential and Logarithmic functions

The AxiomX.exp module contains exponential and logarithmic functions. These are the functions we provide:

  • exp(n)
  • ln(x)
  • log10(x)
  • log2(x)
  • log(x,b)

Usage

from AxiomX.exp import *

print(exp(2)) # prints 7.389...
print(ln(2)) # prints 0.693...
print(log10(2)) # prints 0.301...

🔥 AxiomX.hyperbolic - Hyperbolic functions

The AxiomX.hyperbolic module deals with hyperbolic functions and their inverses. These are the functions provided:

  • sinh(x), cosh(x), tanh(x), coth(x), sech(x), cosech(x)
  • their inverses.

Usage

from AxiomX.hyperbolic import *

print(sinh(1)) # returns 1.17520...
print(sech(1)) # returns 0.64805...

📐 AxiomX.trig - Trigonometric functions

The AxiomX.trig module deals with trigonometric functions, their inverses and also angle conversion from degrees to radians and vice-versa. Here are the functions provided:

  • sin(x), cos(x), tan(x), cot(x), sec(x), cosec(x)
  • their inverses
  • radians(deg) - degrees to radians
  • degrees(rad) - radians to degrees

Usage

from AxiomX.trig import *
from AxiomX.constants import *

print(radians(180)) # prints 3.141592...
print(sin(pi / 2)) # prints 1.0
print(arctan(1)) # prints 0.785398...

🔢 AxiomX.matrix - Matrix operations

The AxiomX.matrix module has been introduced since version 0.1.2. It has a class Matrix which has all sorts of operations.

Features supported

  • Matrix creation and indexing
  • Addition, subtraction, multiplication
  • Scalar multiplication
  • Determinant (recursive expansion)
  • Matrix inverse (adjoint method)
  • Rank (Gaussian elimination)
  • Transpose
  • Identity and zero matrix generation

Example

from AxiomX.matrix import Matrix

A = Matrix.from_list([[1,2],[3,4]])
B = Matrix.from_list([[5,6],[7,8]])

print(A + B)
print(A**2)

📊 AxiomX.graph - plotting graphs for functions

AxiomX.graph is one of the latest additions of AxiomX, added on from version 0.1.3. This graph has now enhanced a lot. Look at our features.

Features

  • Plot one or multiple functions
  • Smooth zoom (PageUp / PageDown)
  • Pan using arrow keys
  • Infinite-style grid rendering
  • Dynamic tick spacing (auto-adjusts with zoom)
  • Real-time mouse coordinate tracking

Example Usage

Single Function
from AxiomX.trig import *
from AxiomX.graph import plot

plot(sin,-10,10) # plots the sine curve
Multiple Functions
from AxiomX.trig import *
from AxiomX.graph import plot

plot([lambda x: sin(x)**2, lambda y: cos(y)**2, lambda z: 1]) # explanation for sin²x + cos²x = 1

🎮 Graph Controls

⌨️ Keyboard
  • PgUp - zooming out
  • PgDn - zooming in
  • Arrow keys - for panning around the graph
🖱️ Mouse
  • shows realtime graph coordinates.
🖥️ GUI Buttons
  • There are GUI buttons at the bottom with commands.

🚀 Installation

You can directly install via pip. Go to your terminal and type: pip install AxiomX. Or rather install with the wheel file or the gzipped package.


🛣️ Roadway

  • PNG exporter for graph
  • Mouse panning
  • Function accepting GUI

🤝 Contributions

If you have any suggestions or if you see bugs, just email at AxiomX.python@gmail.com. Thanks for acknowledging AxiomX.

🪪 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

axiomx-0.1.4.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axiomx-0.1.4-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file axiomx-0.1.4.tar.gz.

File metadata

  • Download URL: axiomx-0.1.4.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for axiomx-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2673fe8fc805054e1fb83477b23ee9d2b801ce49950981d552063dd221d7cb7c
MD5 e4f4856ce23ddff83e1b42ac508a55de
BLAKE2b-256 7ad1a85161f192197589fa40b210d069db1b3b943fcede524488e9c125044649

See more details on using hashes here.

File details

Details for the file axiomx-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: axiomx-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for axiomx-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1b09f7a83e20cc4440047f98191705522f7eccc3acc34fba1e29ed1699c4d859
MD5 be240588ff520d7236ef373319defc03
BLAKE2b-256 4afd233d4f0dacb180723441bb26458b0835de3a0bfd6206e1ec9fe8ca438ee5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page