Skip to main content

Find all the sides and angles of a triangle, if you know some of the sides and/or angles. (Uses the Law of Sines and Law of Cosines.)

Project description

Written by Steven Byrnes, http://sjbyrnes.com/

Download: https://pypi.python.org/pypi/trianglesolver/ Source code repository: https://github.com/sbyrnes321/trianglesolver

This little package applies the law of sines or cosines to find all the sides and angles of a triangle, if you know some of the sides and/or angles.

The main function defined by this package is solve(…). Simple example:

from math import pi
from trianglesolver import solve
a,b,c,A,B,C = solve(b=7.6, c=8.3, A=pi/3)

Following the usual convention, lower-case letters are side lengths and capital letters are angles. Corresponding letters are opposite each other, e.g. side b is opposite angle B.

All angles are in radians! However, you can use the degree constant to convert:

from trianglesolver import solve, degree
a,b,c,A,B,C = solve(b=7, A=5*degree, B=70*degree)
print(C / degree)

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

trianglesolver-1.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file trianglesolver-1.0.tar.gz.

File metadata

  • Download URL: trianglesolver-1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for trianglesolver-1.0.tar.gz
Algorithm Hash digest
SHA256 7e3f05db59d14becd8c7d9fd9ceee69d9d1ffbf6a9d0471054c5fa100bd1928f
MD5 c47d722931710c941e7f246cb1c08147
BLAKE2b-256 ee648c6495fd1b9bddf9236d56ff9d59bbac4181afc93a0783a135a94cebff76

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page