View on GitHub

rat-trig

📐 Rational Trigonometry in Python

Project generated with PyScaffold Documentation Status Coverage Status

📐 rat-trig

Rational Trigonometry - A Python implementation of Wildberger’s Rational Trigonometry

What is Rational Trigonometry?

Rational Trigonometry is a revolutionary approach to classical trigonometry, developed by Norman Wildberger. It replaces the traditional notions of distance and angle with quadrance (squared distance) and spread (squared sine of angle), allowing for:

Installation

pip install rat-trig

For development:

git clone https://github.com/luk036/rat-trig.git
cd rat-trig
pip install -e .

Quick Start

from fractions import Fraction
from rat_trig import archimedes, spread, quad

# Calculate quadrance (squared distance)
vector = [3, 4]
print(f"Quadrance: {quad(vector)}")  # Output: 25

# Calculate spread between two vectors
v1 = [1, 2]
v2 = [3, 4]
print(f"Spread: {spread(v1, v2)}")  # Output: 4/125

# Apply Archimedes' formula to a triangle
q1, q2, q3 = Fraction(1, 2), Fraction(1, 4), Fraction(1, 6)
A = archimedes(q1, q2, q3)
print(f"Quadrea: {A}")  # Output: 23/144

Core Functions

Geometric Operations

Trigonometric Operations

Features

Documentation

Full documentation is available at https://rat-trig.readthedocs.io.

Testing

Run tests:

pytest

With coverage:

pytest --cov rat_trig

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

Acknowledgments

This project was developed using PyScaffold and is based on Norman Wildberger’s work on Rational Trigonometry.