| Generalized Trigonometry |
|---|
| By Katherine Rose, Alexander Joseph and Joshua Piety |
Generalized Trigonometry is a python extension that provides trigonometric functions for systems other than a circle. For example, the following function draws a square:
import gentrig as gtgt.sinp(x)
gt.cosp(x)
gt.tanp(x)
gt.cscp(x)
gt.secp(x)
gt.cotp(x)Self-explanatory: Parabolic trig is similar to hyperbolic trig, but applied to a parabola instead of a hyperbola.
gt.sinl(x)
gt.cosl(x)
gt.tanl(x)
gt.cscl(x)
gt.secl(x)
gt.cotl(x)Trigonometry applied to a line. This is actually equivalent to polygonal trig with 2 sides. For example:
However, due to implementation details the sinl(x) function in this library is much faster than sinpoly(x,2).
# Where n is the number of sides
gt.sinpoly(x,n)
gt.cospoly(x,n)
gt.tanpoly(x,n)
gt.cscpoly(x,n)
gt.secpoly(x,n)
gt.cotpoly(x,n)Polygonal trig is fun! You can draw regular polygons of "radius" 1 (unit polygons, perhaps) with arbitrary numbers of sides using just sinpoly and cospoly! The library won't stop you from using sinpoly(x,n) with when n is less than one or not an integer, but behavior in those cases is undefined. It's also worth noting that as n approaches infinity sinpoly(x,n) approaches sin(x), which is pretty intuitive if you think of a circle as an infinite-sided polygon. You can plot this to get a unit polygon with n sides:
gentrig has been released on PyPI! You can install it with pip install gentrig and use it like any other python library!
- Clone this repo:
git clone https://github.com/KiARC/gentrig.git - Move into the repository's directory:
cd gentrig - Build and install with
pip:pip install .
gentrig can now be imported within whichever environment's pip was used to install it.