Solve set of equations with all unique values in sage

asked 2019-12-06 15:59:13 +0200

drdenjef gravatar image

updated 2019-12-16 15:15:53 +0200

Iguananaut gravatar image

0

I have defined a set of 20 equations, consisting of 22 variables.

Now I want to implement that each variable needs to have a unique value.

I've tried via assumptions: assume(A!=B) assume(B!=C)...and so on. But this does not seam to solve the equation. I've also tried to add these unequalities to the set of equations, which also still have 2 parameters in my solutionset.

ps. I also know that each value is an integer. And that the difference between the highest and the lowest value is smaller than a certain number (e.g. 40). But I believe I have implemented this correctly via:

assume(A, 'integer')

assume(B, 'integer')

assume(C, 'integer')

... and

assume((max_symbolic(A,B,C,...)-min_symbolic(A,B,C,...)) < 40)

0

I have defined a set of 20 equations, consisting of 22 variables.

Now I want to implement that each variable needs to have a unique value.

I've tried via assumptions: assume(A!=B) assume(B!=C)...and so on. But this does not seam to solve the equation. I've also tried to add these unequalities to the set of equations, which also still have 2 parameters in my solutionset.

ps. I also know that each value is an integer. And that the difference between the highest and the lowest value is smaller than a certain number (e.g. 40). But I believe I have implemented this correctly via:

assume(A, 'integer')

assume(B, 'integer')

assume(C, 'integer')

... and

assume((max_symbolic(A,B,C,...)-min_symbolic(A,B,C,...)) < 40)

edit retag flag offensive close merge delete

Comments

Can you add the set of equations? Select your code and press the '101010' button to format it correctly.

rburing gravatar imagerburing ( 2019-12-06 22:51:39 +0200 )edit

You probably should use a SMT solver like z3.

ablmf gravatar imageablmf ( 2019-12-11 23:21:21 +0200 )edit