Skip to content

Instantly share code, notes, and snippets.

@loren-osborn
Last active February 26, 2016 19:29
Show Gist options
  • Save loren-osborn/035797cd057b0debf3d6 to your computer and use it in GitHub Desktop.
Save loren-osborn/035797cd057b0debf3d6 to your computer and use it in GitHub Desktop.
#!/opt/local/bin/python
from sympy import *
g, r, m, j = symbols('g r m j')
c, f, d, h = symbols('c f d h ')
# Eq((c+m)/j, g / d)
# Eq((c+m)/j, r / f)
# Eq((g+h)/j,c/d)
# Eq(((g+h)/j)**2, (f**2 + r**2)/(f**2))
# Eq(c**2, g**2 + d**2)
# Eq((g+h)**2,(c+m)**2 + j**2)
# I think I'm using the wrong type of solver here...
# After slamming the CPU for a long time this throws a PolynomialError("Piecewise generators do not make sense")
solve([
((c+m)/j) - (g/d),
((c+m)/j) - (r/f),
((g+h)/j) - (c/d),
(((g+h)/j)**2) - ((f**2 + r**2)/(f**2)),
(c**2) - (d**2 + g**2),
((g+h)**2) - ((c+m)**2 + j**2)
], c, f, d, h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment