🧮 CalCulus
CalCulus* is a fast, lightweight scientific computing library written in C++ and exposed to Python using pybind11.
Github Project
✨ Features
- ⚡ High-performance C++ backend
- 🧮 Scalar & vector mathematics
- 📐 Numerical integration (Simpson’s Rule)
- 🧱 Clean object-oriented API
- 🔗 Python bindings via pybind11
- 🧪 Ideal for robotics & simulation
- 📦 Easy
pip install .workflow
🔬 NumPy vs CalCulus Comparison
| Feature | NumPy | CalCulus |
|---|---|---|
| Core Language | C + Python | Pure C++ (pybind11) |
| Focus | Array-based numerical computing | Scientific math, physics & robotics |
| Scalar Operations | numpy.float64 |
Scalar C++ class |
| Trigonometric Functions | ✔ Vectorized | ✔ High-precision scalar |
| Vector Algebra | Limited (manual) | ✔ Built-in Vec3
|
| Dot Product | ✔ | ✔ |
| Cross Product | ✔ (via np.cross) |
✔ Native |
| Numerical Integration | Limited | ✔ Simpson’s Rule |
| Physical Constants | Partial | ✔ Built-in |
| Robotics Use | Medium | ✔ High |
| Physics Simulations | Medium | ✔ High |
| C++ Performance | ❌ | ✔ |
| SIMD / Low-level Control | ❌ | ✔ |
| Learning Curve | Easy | Moderate |
| Best Use Case | Data science, ML | Robotics, physics engines |
| Python Dependency | Heavy | Minimal |
| Custom Math Engine | ❌ | ✔ |
| Real-Time Applications | ❌ | ✔ |
📝 When to Use Which?
-
Use NumPy when:
- Working with large datasets
- Doing machine learning or statistics
- Needing array broadcasting
-
Use CalCulus when:
- Building robotics or physics engines
- Needing C++-level performance
- Working with vectors, forces, motion, integration
🧮 API Overview
🔢 Scalar
The Scalar class represents a single numerical value with advanced scientific operations.
| Method / Operator | Description |
|---|---|
+ - * / |
Arithmetic operations |
sin() |
Sine |
cos() |
Cosine |
tan() |
Tangent |
asin() |
Inverse sine |
acos() |
Inverse cosine |
atan() |
Inverse tangent |
sinh() |
Hyperbolic sine |
cosh() |
Hyperbolic cosine |
tanh() |
Hyperbolic tangent |
exp() |
Exponential |
log() |
Natural logarithm |
log10() |
Base-10 logarithm |
pow(n) |
Power |
sqrt() |
Square root |
cbrt() |
Cube root |
abs() |
Absolute value |
📐 Vec3 (3D Vector)
The Vec3 class is designed for physics, robotics, and linear algebra.
| Method | Description |
|---|---|
+ - |
Vector addition / subtraction |
* |
Scalar multiplication |
dot(v) |
Dot product |
cross(v) |
Cross product |
magnitude() |
Vector length |
normalize() |
Unit vector |
🧠 Solver
Numerical calculus utilities.
| Method | Description |
|---|---|
integrate(func, a, b, n) |
Simpson’s Rule integration |
🌌 Constants
Physical and mathematical constants.
| Constant | Description |
|---|---|
pi |
π |
e |
Euler’s number |
c |
Speed of light |
h |
Planck constant |
k |
Boltzmann constant |
g |
Gravity |
Top comments (0)