JoelSjogren

heptic area

Mar 8th, 2019
520
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.04 KB | None | 0 0
  1. # sagemath script
  2.  
  3. # setting poly_x0 = -1, poly_x1 = 1 (without loss of generality) we will want to reduce the open logical formula "∃ cops. ∀ p. the areas are proportional with coefficient λ" to a single equation in only λ. it is therefore important that lam comes last in the following declaration:
  4.  
  5. R.<p0, p1, p2, p3, p4, p5, p6, p7, x, poly_x0, poly_x1, cops_x0, cops_x1, cops_x2, cops_x3, lam> = PolynomialRing(QQ, order='lex')
  6.  
  7. y = p0 + p1*x + p2*x^2 + p3*x^3 + p4*x^4 + p5*x^5 + p6*x^6 + p7*x^7
  8.  
  9. cops_y0 = y(x=cops_x0)
  10. cops_y1 = y(x=cops_x1)
  11. cops_y2 = y(x=cops_x2)
  12. cops_y3 = y(x=cops_x3)
  13.  
  14. # sum of two triangles
  15. cops_area = (1/2) * ((-cops_x0+cops_x1)*(-cops_y0+cops_y2) - (-cops_y0+cops_y1)*(-cops_x0+cops_x2)) + (1/2) * ((-cops_x0+cops_x2)*(-cops_y0+cops_y3) - (-cops_y0+cops_y2)*(-cops_x0+cops_x3))
  16.  
  17. poly_y0 = y(x=poly_x0)
  18. poly_y1 = y(x=poly_x1)
  19.  
  20. # doing this the orthodox way
  21. poly_area = -integral(y, x)(x=poly_x0) + integral(y, x)(x=poly_x1) - (1/2) * (-poly_x0 + poly_x1) * (poly_y0 + poly_y1)
  22.  
  23. I = ideal(
  24.     # "∀ p. " is expressed in a mildly hacky way
  25.     diff(lam*cops_area-poly_area, p0),
  26.     diff(lam*cops_area-poly_area, p1),
  27.     diff(lam*cops_area-poly_area, p2),
  28.     diff(lam*cops_area-poly_area, p3),
  29.     diff(lam*cops_area-poly_area, p4),
  30.     diff(lam*cops_area-poly_area, p5),
  31.     diff(lam*cops_area-poly_area, p6),
  32.     diff(lam*cops_area-poly_area, p7)
  33. )
  34.  
  35. # convenient coordinate system
  36. J = I.subs(poly_x0=-1, poly_x1=1)
  37.  
  38. G = J.groebner_basis()
  39. for i in G:
  40.     print(str(i) + '\n')
  41.  
  42. """
  43. cops_x0 - 108/175*cops_x3^3*lam^2 + 35/18*cops_x3^3 + 8748/30625*cops_x3^2*lam^3 - 9/5*cops_x3^2*lam + 648/875*cops_x3*lam^2 - 11/6*cops_x3 - 26244/153125*lam^3 + 27/25*lam
  44.  
  45. cops_x1 + 216/175*cops_x3^3*lam^2 - 35/9*cops_x3^3 - 1296/875*cops_x3*lam^2 + 14/3*cops_x3
  46.  
  47. cops_x2 - 108/175*cops_x3^3*lam^2 + 35/18*cops_x3^3 - 8748/30625*cops_x3^2*lam^3 + 9/5*cops_x3^2*lam + 648/875*cops_x3*lam^2 - 11/6*cops_x3 + 26244/153125*lam^3 - 27/25*lam
  48.  
  49. cops_x3^4 - 6/5*cops_x3^2 + 27/175
  50.  
  51. lam^4 - 6125/972*lam^2 + 5359375/944784
  52. """
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment