Skip to main content

A simple solver for trigonometric equations.

Project description

triangles is a package for easily solving simple trigonometric equations. It contains only a single function which takes the name of the sought side length, an angle in degrees and a side length as seen from that angle. It returns the length of the sought side.

The sought side must be a member of ["adjacent", "opposite", "hypotenuse"].

The solve function returns either the the value the solved equation would return, or the equation required to solve the problem given the provided data or, if the solve flag is set to False.


>>> from triangles import solve
>>> solve("adjacent", 60, hypotenuse=1000)
>>> solve("adjacent", 60, hypotenuse=1000, solve=False)
'hypotenuse * math.cos(angle)'
>>> solve("opposite", 53, adjacent=7)
>>> solve("opposite", 53, adjacent=7, solve=False)
'adjacent * math.tan(angle)'
>>> solve("hypotenuse", 68, opposite=70)
>>> solve("hypotenuse", 68, opposite=70, solve=False)
'opposite / math.sin(angle)'

triangles is maintained by Daniel Lee and is released under the GNU Greater Public License. If you’re interested in contributing, fork the project on Github! Please let me know if you use it for anything especially interesting.

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
triangles-0.2.1.tar.gz (2.2 kB) Copy SHA256 hash SHA256 Source None Aug 6, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page