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, about


# 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

bigcalc.about — Get About this Library

This module provides a function to retrieve information about the bigcalc library, including version, author, and description.

Function Description
about.name() Returns the name of lib
about.version() Returns the current version of bigcalc
about.author() Returns the author's name and contact information
about.author_email() Returns the author's email address
about.description() Returns a brief description of bigcalc
about.python_requires() Returns the minimum required Python version

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.5.tar.gz (9.3 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.5-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bigcalc-0.1.5.tar.gz
  • Upload date:
  • Size: 9.3 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.5.tar.gz
Algorithm Hash digest
SHA256 741df75c44dca731fc7f56d9cbddcace1277546af2369cfb21d02a53398081a4
MD5 e3ef440ea0775c6fefb3806510f65274
BLAKE2b-256 9c9e9f540317c9136970c544a88954fef57971425ba1bccd472356b84f3af5be

See more details on using hashes here.

Provenance

The following attestation bundles were made for bigcalc-0.1.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: bigcalc-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c72b3adf95565949b6609e5c1973879258f912dfe9bcbd67ab0a6675ac4a5d06
MD5 a00ee0a530e76e4196da193584a3d6f5
BLAKE2b-256 9ed2c5d7d660ed7d4647fb5026d9c8ddd709dcfaf3301a641943d3a094835a6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bigcalc-0.1.5-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