Advertisement
JoelSjogren

main.sage

Oct 19th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. R.<t, u_,v_,w_, u,v,w, x,y,z> = QQ[]
  2.  
  3. # aim: verify automatically that x^2 + y^2 - z^2 = -1 is composed of lines.
  4.  
  5. p = x^2 + y^2 - z^2 + 1
  6.  
  7. line = vector((x, y, z)) + t*vector((u, v, w))
  8.  
  9. # for all x,y,z if p(x,y,z) = 0 then
  10. # there are u,v,w not all zero such that
  11. # for all t, p(line) = 0
  12.  
  13. p_line = p(x=line[0], y=line[1], z=line[2])
  14. line_included = forall_t_p_line = p_line.polynomial(t).coefficients()
  15.  
  16. uvw_nonzero = u*u_ + v*v_ + w*w_ + 1
  17. uvw_condition = ideal(line_included + [uvw_nonzero])
  18.  
  19. there_are_uvw = uvw_condition.elimination_ideal([u,v,w,u_,v_,w_])
  20.  
  21. assert there_are_uvw == ideal(p), "p does not appear to be composed of lines!"
  22.  
  23. print('OK')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement