Skip to main content

Trigonometric functions generalized for parabolas and polygons

Project description

Generalized Trigonometry
By Katherine Rose, Alexander Joseph and Joshua Piety

Generalized Trigonometry

Generalized Trigonometry is a python extension that provides trigonometric functions for systems other than a circle. For example, the following function draws a square:

A parametric equation square of t where x is equal to polygonal cosine 4 of t and y is equal to polygonal sine 4 of t

Functions

import gentrig as gt

Parabolic

gt.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.

Linear

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:

linear sine of x is equal to polygonal sine 2 of x

However, due to implementation details the sinl(x) function in this library is much faster than sinpoly(x,2).

Polygonal

# 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:

A parametric equation where x is equal to polygonal cosine n of t and y is equal to polygonal sine n of t

Installing gentrig...

From PyPI

gentrig has been released on PyPI! You can install it with pip install gentrig and use it like any other python library!

From source

  1. Clone this repo: git clone https://github.com/KiARC/gentrig.git
  2. Move into the repository's directory: cd gentrig
  3. Build and install with pip: pip install .

gentrig can now be imported within whichever environment's pip was used to install it.

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

gentrig-0.1.1.tar.gz (8.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: gentrig-0.1.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for gentrig-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2483998681c604c20f3a2f504ca94967d3c55d8fabb8ba6aaf1347081710598c
MD5 198e0a2aece7fe38714ab557999e08f9
BLAKE2b-256 1149f49e425efdd94bee65e8cc24ca6b6b57bea83f39babd7b966cd435ce8b00

See more details on using hashes here.

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