Skip to content

Instantly share code, notes, and snippets.

@certik
Created October 5, 2010 17:13
Show Gist options
  • Save certik/611924 to your computer and use it in GitHub Desktop.
Save certik/611924 to your computer and use it in GitHub Desktop.
from sympy import Symbol, integrate
print "Start"
x1 = Symbol('x1')
x2 = Symbol('x2')
x3 = Symbol('x3')
x4 = Symbol('x4')
x5 = Symbol('x5')
x6 = Symbol('x6')
x7 = Symbol('x7')
x8 = Symbol('x8')
y1 = Symbol('y1')
y2 = Symbol('y2')
y3 = Symbol('y3')
y4 = Symbol('y4')
y5 = Symbol('y5')
y6 = Symbol('y6')
y7 = Symbol('y7')
y8 = Symbol('y8')
z1 = Symbol('z1')
z2 = Symbol('z2')
z3 = Symbol('z3')
z4 = Symbol('z4')
z5 = Symbol('z5')
z6 = Symbol('z6')
z7 = Symbol('z7')
z8 = Symbol('z8')
r = Symbol('r')
s = Symbol('s')
w = Symbol('w')
print "Point 1"
LargePoly = (((y3*(1 - w)*(0.125 + 0.125*r) + y4*(1 - w)*(0.125 -
0.125*r) + y7*(1 + w)*(0.125 + 0.125*r) + y8*(1 + w)*(0.125 - 0.125*r)
- y1*(1 - w)*(0.125 - 0.125*r) - y2*(1 - w)*(0.125 + 0.125*r) - y5*(1
+ w)*(0.125 - 0.125*r) - y6*(1 + w)*(0.125 + 0.125*r))*(z5*(1 -
s)*(0.125 - 0.125*r) + z6*(1 - s)*(0.125 + 0.125*r) + z7*(1 +
s)*(0.125 + 0.125*r) + z8*(1 + s)*(0.125 - 0.125*r) - z1*(1 -
s)*(0.125 - 0.125*r) - z2*(1 - s)*(0.125 + 0.125*r) - z3*(1 +
s)*(0.125 + 0.125*r) - z4*(1 + s)*(0.125 - 0.125*r)) - (z3*(1 -
w)*(0.125 + 0.125*r) + z4*(1 - w)*(0.125 - 0.125*r) + z7*(1 +
w)*(0.125 + 0.125*r) + z8*(1 + w)*(0.125 - 0.125*r) - z1*(1 -
w)*(0.125 - 0.125*r) - z2*(1 - w)*(0.125 + 0.125*r) - z5*(1 +
w)*(0.125 - 0.125*r) - z6*(1 + w)*(0.125 + 0.125*r))*(y5*(1 -
s)*(0.125 - 0.125*r) + y6*(1 - s)*(0.125 + 0.125*r) + y7*(1 +
s)*(0.125 + 0.125*r) + y8*(1 + s)*(0.125 - 0.125*r) - y1*(1 -
s)*(0.125 - 0.125*r) - y2*(1 - s)*(0.125 + 0.125*r) - y3*(1 +
s)*(0.125 + 0.125*r) - y4*(1 + s)*(0.125 - 0.125*r)))*(0.125*x2*(1 -
s)*(1 - w) + 0.125*x3*(1 + s)*(1 - w) + 0.125*x6*(1 + w)*(1 - s) +
0.125*x7*(1 + s)*(1 + w) - 0.125*x1*(1 - s)*(1 - w) - 0.125*x4*(1 +
s)*(1 - w) - 0.125*x5*(1 + w)*(1 - s) - 0.125*x8*(1 + s)*(1 + w)) +
((x3*(1 - w)*(0.125 + 0.125*r) + x4*(1 - w)*(0.125 - 0.125*r) + x7*(1
+ w)*(0.125 + 0.125*r) + x8*(1 + w)*(0.125 - 0.125*r) - x1*(1 -
w)*(0.125 - 0.125*r) - x2*(1 - w)*(0.125 + 0.125*r) - x5*(1 +
w)*(0.125 - 0.125*r) - x6*(1 + w)*(0.125 + 0.125*r))*(y5*(1 -
s)*(0.125 - 0.125*r) + y6*(1 - s)*(0.125 + 0.125*r) + y7*(1 +
s)*(0.125 + 0.125*r) + y8*(1 + s)*(0.125 - 0.125*r) - y1*(1 -
s)*(0.125 - 0.125*r) - y2*(1 - s)*(0.125 + 0.125*r) - y3*(1 +
s)*(0.125 + 0.125*r) - y4*(1 + s)*(0.125 - 0.125*r)) - (y3*(1 -
w)*(0.125 + 0.125*r) + y4*(1 - w)*(0.125 - 0.125*r) + y7*(1 +
w)*(0.125 + 0.125*r) + y8*(1 + w)*(0.125 - 0.125*r) - y1*(1 -
w)*(0.125 - 0.125*r) - y2*(1 - w)*(0.125 + 0.125*r) - y5*(1 +
w)*(0.125 - 0.125*r) - y6*(1 + w)*(0.125 + 0.125*r))*(x5*(1 -
s)*(0.125 - 0.125*r) + x6*(1 - s)*(0.125 + 0.125*r) + x7*(1 +
s)*(0.125 + 0.125*r) + x8*(1 + s)*(0.125 - 0.125*r) - x1*(1 -
s)*(0.125 - 0.125*r) - x2*(1 - s)*(0.125 + 0.125*r) - x3*(1 +
s)*(0.125 + 0.125*r) - x4*(1 + s)*(0.125 - 0.125*r)))*(0.125*z2*(1 -
s)*(1 - w) + 0.125*z3*(1 + s)*(1 - w) + 0.125*z6*(1 + w)*(1 - s) +
0.125*z7*(1 + s)*(1 + w) - 0.125*z1*(1 - s)*(1 - w) - 0.125*z4*(1 +
s)*(1 - w) - 0.125*z5*(1 + w)*(1 - s) - 0.125*z8*(1 + s)*(1 + w)) -
((z5*(1 - s)*(0.125 - 0.125*r) + z6*(1 - s)*(0.125 + 0.125*r) + z7*(1
+ s)*(0.125 + 0.125*r) + z8*(1 + s)*(0.125 - 0.125*r) - z1*(1 -
s)*(0.125 - 0.125*r) - z2*(1 - s)*(0.125 + 0.125*r) - z3*(1 +
s)*(0.125 + 0.125*r) - z4*(1 + s)*(0.125 - 0.125*r))*(x3*(1 -
w)*(0.125 + 0.125*r) + x4*(1 - w)*(0.125 - 0.125*r) + x7*(1 +
w)*(0.125 + 0.125*r) + x8*(1 + w)*(0.125 - 0.125*r) - x1*(1 -
w)*(0.125 - 0.125*r) - x2*(1 - w)*(0.125 + 0.125*r) - x5*(1 +
w)*(0.125 - 0.125*r) - x6*(1 + w)*(0.125 + 0.125*r)) - (z3*(1 -
w)*(0.125 + 0.125*r) + z4*(1 - w)*(0.125 - 0.125*r) + z7*(1 +
w)*(0.125 + 0.125*r) + z8*(1 + w)*(0.125 - 0.125*r) - z1*(1 -
w)*(0.125 - 0.125*r) - z2*(1 - w)*(0.125 + 0.125*r) - z5*(1 +
w)*(0.125 - 0.125*r) - z6*(1 + w)*(0.125 + 0.125*r))*(x5*(1 -
s)*(0.125 - 0.125*r) + x6*(1 - s)*(0.125 + 0.125*r) + x7*(1 +
s)*(0.125 + 0.125*r) + x8*(1 + s)*(0.125 - 0.125*r) - x1*(1 -
s)*(0.125 - 0.125*r) - x2*(1 - s)*(0.125 + 0.125*r) - x3*(1 +
s)*(0.125 + 0.125*r) - x4*(1 + s)*(0.125 - 0.125*r)))*(0.125*y2*(1 -
s)*(1 - w) + 0.125*y3*(1 + s)*(1 - w) + 0.125*y6*(1 + w)*(1 - s) +
0.125*y7*(1 + s)*(1 + w) - 0.125*y1*(1 - s)*(1 - w) - 0.125*y4*(1 +
s)*(1 - w) - 0.125*y5*(1 + w)*(1 - s) - 0.125*y8*(1 + s)*(1 +
w)))*(x1*(1 - s)*(1 - w)*(0.125 - 0.125*r) + x2*(1 - s)*(1 - w)*(0.125
+ 0.125*r) + x3*(1 + s)*(1 - w)*(0.125 + 0.125*r) + x4*(1 + s)*(1 -
w)*(0.125 - 0.125*r) + x5*(1 + w)*(1 - s)*(0.125 - 0.125*r) + x6*(1 +
w)*(1 - s)*(0.125 + 0.125*r) + x7*(1 + s)*(1 + w)*(0.125 + 0.125*r) +
x8*(1 + s)*(1 + w)*(0.125 - 0.125*r))
print "expand"
print type(LargePoly)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment