triangles
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
.
Usage:
>>> from triangles import solve >>> solve("adjacent", 60, hypotenuse=1000) 500.0000000000001 >>> solve("adjacent", 60, hypotenuse=1000, solve=False) 'hypotenuse * math.cos(angle)' >>> solve("opposite", 53, adjacent=7) 9.289313751342869 >>> solve("opposite", 53, adjacent=7, solve=False) 'adjacent * math.tan(angle)' >>> solve("hypotenuse", 68, opposite=70) 75.49743198743084 >>> 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.