Revision history [back]

inequalities in sagemath

var('x y M a b c d A B C D t u v S T U V')
eq1 = 3*(((2*3367-3*y+1)/24)+3*x*(x+1)/2)+1-V == 0
eq2 = -3367+3*x*(x+1)/2-3*y*(y-1)/2+(3*x+1)*(3*x+2)/2 == 0
eq3 = 3*(((2*V-3*v+1)/24)+3*x*(x+1)/2)+1-U == 0
eq4 = V+3*v*(v-1)/2-12*x*(x+1)/2-1 == 0
eq5 = 3*(((2*U-3*u+1)/24)+3*x*(x+1)/2)+1-T == 0
eq6 = U+3*u*(u-1)/2-12*x*(x+1)/2-1 == 0
eq7 = 3*(((2*T-3*t+1)/24)+3*x*(x+1)/2)+1-S == 0
eq8 = T+3*t*(t-1)/2-12*x*(x+1)/2-1 == 0
eq9 = 3*(((2*S-3*1+1)/24)+3*x*(x+1)/2)+1-S == 0

eq18 = -M+9*((2*3367 - 3*y + 1)/24+(y-1)*(y+1)/8)+1 == 0
eq19 = 3*((2*M - 3*(x+1) + 1)/24 + (3*x*(x + 1))/2) + 1 - A == 0
eq20 = -M + (3*x*(x + 1))/2 - (3*x*(x + 1))/2 + ((3*x + 1)*(3*x + 2))/2 == 0
eq21 = 3*((2*A - 3*a + 1)/24 + (3*x*(x + 1))/2) + 1 - B == 0
eq22 = A + (3*a*(a - 1))/2 - (12*x*(x + 1))/2 - 1 == 0
eq23 = 3*((2*B - 3*b + 1)/24 + (3*x*(x + 1))/2) + 1 - C == 0
eq24 = B + (3*b*(b - 1))/2 - (12*x*(x + 1))/2 - 1 == 0
eq25 = 3*((2*C - 3*c + 1)/24 + (3*x*(x + 1))/2) + 1 - D == 0
eq26 = C + (3*c*(c - 1))/2 - (12*x*(x + 1))/2 - 1 == 0
eq26 = 3*((2*D - 3*d + 1)/24 + (3*x*(x + 1))/2) + 1 - S == 0
eq27 = D + (3*d*(d - 1))/2 - (12*x*(x + 1))/2 - 1 == 0
eq28 = 3*((2*S - 3*1 + 1)/24 + (3*x*(x + 1))/2) + 1 - S == 0
eq29 = x-24 == 0

assume(x-1 >= 0 , y-1 >= 0 , A-M > 0 , B-A > 0 , C-B > 0 , D-C > 0 , S-D >0 , V-3367 > 0 , U-V > 0 , T-U > 0 , S-T > 0)

solutions = solve([eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq18,eq19,eq20,eq21,eq22,eq23,eq24,eq25,eq26,eq27,eq28,eq29],x,y,M,a,b,c,d,A,B,C,D,t,u,v,S,T,U,V)
sol0 = solutions[0]
print(sol0[0])
print(sol0[1])
print(sol0[2])
print(sol0[3])
print(sol0[4])
print(sol0[5])
print(sol0[6])
print(sol0[7])
print(sol0[8])
print(sol0[9])
print(sol0[10])
print(sol0[11])
print(sol0[12])
print(sol0[13])
print(sol0[14])
print(sol0[15])
print(sol0[16])
print(sol0[17])


output

(x, y, M, a, b, c, d, A, B, C, D, t, u, v, S, T, U, V)
x == 24
y == 13
M == 2701
a == -12
b == (13/2)
c == (-149/16)
d == 1
A == 3367
B == (28379/8)
C == (114737/32)
D == 3601
t == -1
u == -3
v == 7
S == 3601
T == 3598
U == 3583
V == 3538


Error D==S but assume(.... , S-D > 0 , .....)

How do you use assumes () well?

 2 retagged vdelecroix 7157 ●16 ●78 ●156 http://www.labri.fr/pe...

inequalities in sagemath

var('x y M a b c d A B C D t u v S T U V')
eq1 = 3*(((2*3367-3*y+1)/24)+3*x*(x+1)/2)+1-V == 0
eq2 = -3367+3*x*(x+1)/2-3*y*(y-1)/2+(3*x+1)*(3*x+2)/2 == 0
eq3 = 3*(((2*V-3*v+1)/24)+3*x*(x+1)/2)+1-U == 0
eq4 = V+3*v*(v-1)/2-12*x*(x+1)/2-1 == 0
eq5 = 3*(((2*U-3*u+1)/24)+3*x*(x+1)/2)+1-T == 0
eq6 = U+3*u*(u-1)/2-12*x*(x+1)/2-1 == 0
eq7 = 3*(((2*T-3*t+1)/24)+3*x*(x+1)/2)+1-S == 0
eq8 = T+3*t*(t-1)/2-12*x*(x+1)/2-1 == 0
eq9 = 3*(((2*S-3*1+1)/24)+3*x*(x+1)/2)+1-S == 0

eq18 = -M+9*((2*3367 - 3*y + 1)/24+(y-1)*(y+1)/8)+1 == 0
eq19 = 3*((2*M - 3*(x+1) + 1)/24 + (3*x*(x + 1))/2) + 1 - A == 0
eq20 = -M + (3*x*(x + 1))/2 - (3*x*(x + 1))/2 + ((3*x + 1)*(3*x + 2))/2 == 0
eq21 = 3*((2*A - 3*a + 1)/24 + (3*x*(x + 1))/2) + 1 - B == 0
eq22 = A + (3*a*(a - 1))/2 - (12*x*(x + 1))/2 - 1 == 0
eq23 = 3*((2*B - 3*b + 1)/24 + (3*x*(x + 1))/2) + 1 - C == 0
eq24 = B + (3*b*(b - 1))/2 - (12*x*(x + 1))/2 - 1 == 0
eq25 = 3*((2*C - 3*c + 1)/24 + (3*x*(x + 1))/2) + 1 - D == 0
eq26 = C + (3*c*(c - 1))/2 - (12*x*(x + 1))/2 - 1 == 0
eq26 = 3*((2*D - 3*d + 1)/24 + (3*x*(x + 1))/2) + 1 - S == 0
eq27 = D + (3*d*(d - 1))/2 - (12*x*(x + 1))/2 - 1 == 0
eq28 = 3*((2*S - 3*1 + 1)/24 + (3*x*(x + 1))/2) + 1 - S == 0
eq29 = x-24 == 0

assume(x-1 >= 0 , y-1 >= 0 , A-M > 0 , B-A > 0 , C-B > 0 , D-C > 0 , S-D >0 , V-3367 > 0 , U-V > 0 , T-U > 0 , S-T > 0)

solutions = solve([eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq18,eq19,eq20,eq21,eq22,eq23,eq24,eq25,eq26,eq27,eq28,eq29],x,y,M,a,b,c,d,A,B,C,D,t,u,v,S,T,U,V)
sol0 = solutions[0]
print(sol0[0])
print(sol0[1])
print(sol0[2])
print(sol0[3])
print(sol0[4])
print(sol0[5])
print(sol0[6])
print(sol0[7])
print(sol0[8])
print(sol0[9])
print(sol0[10])
print(sol0[11])
print(sol0[12])
print(sol0[13])
print(sol0[14])
print(sol0[15])
print(sol0[16])
print(sol0[17])


output

(x, y, M, a, b, c, d, A, B, C, D, t, u, v, S, T, U, V)
x == 24
y == 13
M == 2701
a == -12
b == (13/2)
c == (-149/16)
d == 1
A == 3367
B == (28379/8)
C == (114737/32)
D == 3601
t == -1
u == -3
v == 7
S == 3601
T == 3598
U == 3583
V == 3538


Error D==S but assume(.... , S-D > 0 , .....)

How do you use assumes () well?