Skip to main content

Advanced mathematical python library

Project description

bigcalc

bigcalc is an advanced mathematical Python library built without any external dependencies. It provides accurate implementations of trigonometric functions, matrix operations, and unit conversions — all computed from scratch using mathematical series and algorithms.

PyPI version Python License: MIT


Features

  • Trigonometry — sin, cos, tan, cot, sec, csc and all inverse functions, computed via Taylor series with configurable accuracy
  • Matrix Operations — addition, subtraction, multiplication, transpose, determinant, inverse, power, trace, and more
  • Unit Conversion — 13 categories including length, weight, temperature, time, area, volume, speed, pressure, energy, power, storage, angle, and frequency
  • Zero dependencies — pure Python, no NumPy or external packages required
  • Structured error handling — every function returns a descriptive error dict on invalid input instead of raising exceptions

Installation

pip install bigcalc

Quick Start

from bigcalc import trig, mat, convert

# Trigonometry
print(trig.sin(30))           # sin(30°) → ~0.5
print(trig.cos(0))            # cos(0°)  → 1.0
print(trig.arctan(1))         # arctan(1) in radians → ~0.785

# Matrix operations
A = [[1, 2], [3, 4]]
B = [[5, 6], [7, 8]]
print(mat.add(A, B))          # [[6, 8], [10, 12]]
print(mat.determinant(A))     # -2
print(mat.inverse(A))         # [[-2.0, 1.0], [1.5, -0.5]]

# Unit conversion
print(convert.length(1, "mile", "km"))        # 1.60934
print(convert.temperature(100, "C", "F"))     # 212.0
print(convert.storage(1, "GB", "MB"))         # 1024.0

Modules

bigcalc.trig — Trigonometry

All functions accept angles in degrees ("deg") or radians ("rad"). The accuracy parameter controls Taylor series terms (default: 10).

Function Description
sin(angle, unit, accuracy) Sine
cos(angle, unit, accuracy) Cosine
tan(angle, unit, accuracy) Tangent
cot(angle, unit, accuracy) Cotangent
sec(angle, unit, accuracy) Secant
csc(angle, unit, accuracy) Cosecant
arcsin(x, accuracy) Inverse sine, input ∈ [-1, 1]
arccos(x, accuracy) Inverse cosine, input ∈ [-1, 1]
arctan(x, accuracy) Inverse tangent
arccot(x, accuracy) Inverse cotangent, x ≠ 0
arcsec(x, accuracy) Inverse secant, |x| ≥ 1
arccsc(x, accuracy) Inverse cosecant, |x| ≥ 1

bigcalc.mat — Matrix Operations

Matrices are represented as lists of lists, e.g. [[1, 2], [3, 4]].

Function Description
add(a, b) Element-wise addition
sub(a, b) Element-wise subtraction
multiply(a, b) Matrix multiplication
scalar_multiply(a, k) Multiply all elements by scalar k
divide(a, k) Divide all elements by scalar k
transpose(a) Transpose rows and columns
determinant(a) Determinant (square matrices only)
inverse(a) Matrix inverse (square, non-singular)
power(a, n) Matrix raised to integer power n
trace(a) Sum of diagonal elements
identity_matrix(n) Returns an n×n identity matrix

bigcalc.convert — Unit Conversion

All conversion functions follow the signature: convert.<category>(value, from_unit, to_unit)

Category Function Supported Units
Length convert.length() mm, cm, m, km, inch, ft, yard, mile
Weight convert.weight() mg, g, kg, ton, oz, lb
Temperature convert.temperature() C, F, K
Time convert.time() sec, min, hour, day, week, month, year
Area convert.area() mm2, cm2, m2, km2, acre, hectare
Volume convert.volume() mL, L, m3, gallon, cup
Speed convert.speed() m/s, km/h, mph
Pressure convert.pressure() Pa, kPa, bar, atm
Energy convert.energy() J, kJ, cal, kcal
Power convert.power() W, kW, hp
Storage convert.storage() bit, byte, KB, MB, GB, TB
Angle convert.angle() deg, rad
Frequency convert.frequency() Hz, kHz, MHz, GHz
Force convert.force() N, dyne

Error Handling

Instead of raising exceptions, bigcalc returns a structured error dict when inputs are invalid:

result = trig.sin("hello")
# → {"error_code": "TRIG00001", "message": "Input angle must be a number"}

result = convert.length(10, "m", "lightyear")
# → {"error_code": "CONV00003", "message": "To unit is invalid"}

result = mat.inverse([[1, 2], [2, 4]])
# → {"error_code": "MAT00011", "message": "Inverse does not exist (determinant is 0)"}

You can check for errors like this:

result = trig.tan(90)
if isinstance(result, dict) and "error_code" in result:
    print("Error:", result["message"])
else:
    print("Result:", result)

Requirements

  • Python 3.7+
  • No external dependencies

Author

Ashwin Jainashwinjain825@gmail.com


Links

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

bigcalc-0.1.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

bigcalc-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file bigcalc-0.1.1.tar.gz.

File metadata

  • Download URL: bigcalc-0.1.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bigcalc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ef481b8ab0f42614abd8e727171a07822479f11ba252efa336ebc740cd84f8bf
MD5 7d22dfa9d06e86f77f32284754fc232d
BLAKE2b-256 da98e206a83e66306ce0bf52066edb76fbc379dccb532d1f2f62e2abad1d6ac7

See more details on using hashes here.

Provenance

The following attestation bundles were made for bigcalc-0.1.1.tar.gz:

Publisher: publish.yml on ashwinjain825/bigcalc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bigcalc-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bigcalc-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bigcalc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 806247bedd004a7a6849747a58650cc527d18c57d2beb6a28cf03b12ea81b123
MD5 f5c718bd97305ccaead53076d8cb33df
BLAKE2b-256 c7c54438bdb12590da548d2baf2e92cd4bb5be5024715b24755df8a8635a2259

See more details on using hashes here.

Provenance

The following attestation bundles were made for bigcalc-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ashwinjain825/bigcalc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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