Skip to main content
Typo
Source Link
pbx
  • 842
  • 4
  • 11

General problem

Given a set of logical expressions I need to find numbers with a margin between pairs that obey the logical rules.

Example

For the expression $m=n=o,p=q$ with a margin of 10 the following (m,n,o,p,q)-tuples would be valid:

(7,7,7,17,17)

(1,1,1,20,20)

as thethey obey all the rules and have at least 10 between tuples of identical items. For completeness the following tuples wouldn't be valid:

(1,2,2,20,20)

(1,1,1,9,9)

In the first one a logical expression is violated, in the second case the margin is too small.

Details and started minimal example

Assume we have many logical expressions of completely analytical form as in

((n == n && i == m) || (n == m && i == n)) && ((o == n && 
 i == i) || (o == i && i == n)).

I am absolutely aware of the fact that some of those expressions do not contain information (e.g., as in $n=n$). To eliminate those and to expand the expression to get individual cases I use LogicalExpand wrapped around such that

LogicalExpand[((n == n && i == m) || (n == m && i == n)) && ((o == n &&
   i == i) || (o == i && i == n))]
(* Out: (m == i && o == n) || (m == i && n == i && o == i) || (n == i && 
n == m && o == i) || (n == i && n == m && o == n)*).

For each of the Or-Arguments I need to find a specific tuple matching all criteria. The only way I can currently imagine is (not in code but paraphrased here) to choose the first letter in the alphabet in an Equal and to replace via ReplaceAll. But this seems error-prone and cumbersome. Is there a more elegant way?

General problem

Given a set of logical expressions I need to find numbers with a margin between pairs that obey the logical rules.

Example

For the expression $m=n=o,p=q$ with a margin of 10 the following (m,n,o,p,q)-tuples would be valid:

(7,7,7,17,17)

(1,1,1,20,20)

as the obey the rules and have at least 10 between tuples of identical items. For completeness the following tuples wouldn't be valid:

(1,2,2,20,20)

(1,1,1,9,9)

In the first one a logical expression is violated, in the second case the margin is too small.

Details and started minimal example

Assume we have many logical expressions of completely analytical form as in

((n == n && i == m) || (n == m && i == n)) && ((o == n && 
 i == i) || (o == i && i == n)).

I am absolutely aware of the fact that some of those expressions do not contain information (e.g., as in $n=n$). To eliminate those and to expand the expression to get individual cases I use LogicalExpand wrapped around such that

LogicalExpand[((n == n && i == m) || (n == m && i == n)) && ((o == n &&
   i == i) || (o == i && i == n))]
(* Out: (m == i && o == n) || (m == i && n == i && o == i) || (n == i && 
n == m && o == i) || (n == i && n == m && o == n)*).

For each of the Or-Arguments I need to find a specific tuple matching all criteria. The only way I can currently imagine is (not in code but paraphrased here) to choose the first letter in the alphabet in an Equal and to replace via ReplaceAll. But this seems error-prone and cumbersome. Is there a more elegant way?

General problem

Given a set of logical expressions I need to find numbers with a margin between pairs that obey the logical rules.

Example

For the expression $m=n=o,p=q$ with a margin of 10 the following (m,n,o,p,q)-tuples would be valid:

(7,7,7,17,17)

(1,1,1,20,20)

as they obey all the rules and have at least 10 between tuples of identical items. For completeness the following tuples wouldn't be valid:

(1,2,2,20,20)

(1,1,1,9,9)

In the first one a logical expression is violated, in the second case the margin is too small.

Details and started minimal example

Assume we have many logical expressions of completely analytical form as in

((n == n && i == m) || (n == m && i == n)) && ((o == n && 
 i == i) || (o == i && i == n)).

I am absolutely aware of the fact that some of those expressions do not contain information (e.g., as in $n=n$). To eliminate those and to expand the expression to get individual cases I use LogicalExpand wrapped around such that

LogicalExpand[((n == n && i == m) || (n == m && i == n)) && ((o == n &&
   i == i) || (o == i && i == n))]
(* Out: (m == i && o == n) || (m == i && n == i && o == i) || (n == i && 
n == m && o == i) || (n == i && n == m && o == n)*).

For each of the Or-Arguments I need to find a specific tuple matching all criteria. The only way I can currently imagine is (not in code but paraphrased here) to choose the first letter in the alphabet in an Equal and to replace via ReplaceAll. But this seems error-prone and cumbersome. Is there a more elegant way?

Source Link
pbx
  • 842
  • 4
  • 11

Choose numerical values according to given rules

General problem

Given a set of logical expressions I need to find numbers with a margin between pairs that obey the logical rules.

Example

For the expression $m=n=o,p=q$ with a margin of 10 the following (m,n,o,p,q)-tuples would be valid:

(7,7,7,17,17)

(1,1,1,20,20)

as the obey the rules and have at least 10 between tuples of identical items. For completeness the following tuples wouldn't be valid:

(1,2,2,20,20)

(1,1,1,9,9)

In the first one a logical expression is violated, in the second case the margin is too small.

Details and started minimal example

Assume we have many logical expressions of completely analytical form as in

((n == n && i == m) || (n == m && i == n)) && ((o == n && 
 i == i) || (o == i && i == n)).

I am absolutely aware of the fact that some of those expressions do not contain information (e.g., as in $n=n$). To eliminate those and to expand the expression to get individual cases I use LogicalExpand wrapped around such that

LogicalExpand[((n == n && i == m) || (n == m && i == n)) && ((o == n &&
   i == i) || (o == i && i == n))]
(* Out: (m == i && o == n) || (m == i && n == i && o == i) || (n == i && 
n == m && o == i) || (n == i && n == m && o == n)*).

For each of the Or-Arguments I need to find a specific tuple matching all criteria. The only way I can currently imagine is (not in code but paraphrased here) to choose the first letter in the alphabet in an Equal and to replace via ReplaceAll. But this seems error-prone and cumbersome. Is there a more elegant way?