So I am migrating from Mathematica to Sage since my license ran out. In mathematica we can time limit our simplify to get intermediate results doing things like val = Simplify[val, TimeConstraint -> 20]
I was wondering if Sage has something similar.
Here is my very very long running Sage Code that I am ok with an intermediate result:
from sage.all import *
var('x y z')
var('ax ay az')
var('bx by bz')
var('R r')
P = vector([x,y,z])
torusA = vector([ax, ay, az])
torusB = vector([bx, by, bz])
Q = torusB - torusA
DirSignA = (floor(Q[0]/(abs(Q[0]) + 1)) - floor(-Q[0]/(abs(Q[0]) + 1))) + 0.5
DirSignB = (floor(Q[1]/(abs(Q[1]) + 1)) - floor(-Q[1]/(abs(Q[1]) + 1))) + 0.5
DirSignC = (floor(Q[2]/(abs(Q[2]) + 1)) - floor(-Q[2]/(abs(Q[2]) + 1))) + 0.5
CopySignA = (floor(DirSignA/(abs(DirSignA) + 1)) - floor(-DirSignA/(abs(DirSignA) + 1)))
CopySignB = (floor(DirSignB/(abs(DirSignB) + 1)) - floor(-DirSignB/(abs(DirSignB) + 1)))
CopySignC = (floor(DirSignC/(abs(DirSignC) + 1)) - floor(-DirSignC/(abs(DirSignC) + 1)))
w = vector([Q[2]*CopySignA,Q[2]*CopySignB,-((abs(Q[0]) + abs(Q[1]))*CopySignC)])
v = w.cross_product(Q)
torusCenter = (torusB + torusA) / 2.0
wNorm = (1/ (sqrt(w.dot_product(w))))*w
vNorm = (1/ (sqrt(v.dot_product(v))))*v
pointOffset = P - torusCenter
planarExtentA = pointOffset.dot_product(vNorm)
planarExtentB = pointOffset.dot_product(wNorm)
lval = (((pointOffset[0]^2.0) + (pointOffset[1]^2.0) + (pointOffset[2]^2.0) + R^2.0 - r^2.0)*((pointOffset[0]^2.0) + (pointOffset[1]^2.0) + (pointOffset[2]^2.0) + R^2.0 - r^2.0))
rval = 4.0* R^2.0 *(planarExtentA^2.0 + planarExtentB^2.0)
res = (lval == rval)
res.simplify_full()