Does this equation have a name?

  • Context: Undergrad 
  • Thread starter Thread starter gamow99
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the mathematical formulation for determining the number of unique combinations of sentences to check for contradictions in a logic calculator. Participants explore different equations and concepts related to combinations and their applications in programming and logic.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant proposes an initial equation for counting combinations of sentences, but expresses uncertainty about its adequacy and clarity.
  • Another participant suggests using the concept of "4 choose 2" from probability, indicating that it provides a clearer way to express the number of unique combinations.
  • A computer scientist introduces a formula related to associative expressions in boolean logic, stating that it can be generalized to n variables and relates to counting lines between points.
  • A later reply provides the general equation for combinations, detailing how it simplifies to a specific case for choosing 2 items from n, and illustrates it with an example involving 4 sentences.

Areas of Agreement / Disagreement

Participants present multiple approaches and equations without reaching a consensus on a single definitive formula. The discussion reflects varying perspectives on how to best express the problem.

Contextual Notes

Some participants note the importance of ensuring that combinations are not repeated in the logic calculator's loops, indicating a potential limitation in the implementation of the proposed formulas.

gamow99
Messages
71
Reaction score
2
I'm trying to figure out how many times my computer will have to loop through an array. I'm building a logic calculator so it's checking contradictions. If there are four sentences, a b c d, then one has to check the following combinations to see if there is a contradiction

ab
ac
ad
bc
bd
cd

The equation seems to be, let n = the number of sentences:

(n - 1) + (n - 2) + (n - 3)

But that's not a good equation because it does not inform us how many things to add together.

If there are six sentences then the equation would be

(n - 1) + (n - 2) + (n - 3) + (n - 4) + (n - 5)

There has to be a better way to write that equation.
 
Mathematics news on Phys.org
In probability, it looks like it would be written as 4 choose 2, meaning that you have 4 sentences and choose 2 of them. The equation gives the number of unique results (ab is the same as ba). Google "Combination".
 
Hey, computer scientist here. Cool project you're working on. I stumbled across this pattern while messing around with tabular K-map simplification (boolean logic):

You have 4 variables (but this can be generalized to n variables) and are trying to find the total number of associative expressions such that AB = BA. (Looping through for A AND B as well as B AND A would be inefficient)

This problem is analogous to finding the number of lines between a given number of points (see below). The formula is
$$
\frac{n^2-n}{2}
$$

Send me a PM: I'd like to take a closer look at your logic calculator.

attachment.php?attachmentid=72797&stc=1&d=1410029342.png


attachment.php?attachmentid=72798&stc=1&d=1410029342.png

*plus sign changed to minus sign as per jz92's post
 

Attachments

  • 3case.png
    3case.png
    2.9 KB · Views: 593
  • 4case.png
    4case.png
    4.2 KB · Views: 550
Last edited:
The general equation for evaluating the number of unique combinations when you select k items from a set of n items is:

$$
\frac{n!}{(n-k)!*k!}
$$

n choose 2 is
$$
\frac{n!}{(n-2)!*2!}
$$
Simplified, it is:
$$
\frac{n^2-n}{2}
$$

Comparing each combination of 2, where there are 4 sentences, comes out to a total of (16-4)/2, or 6 comparisons. This, of course, requires that the loops are set up in a way that you never test the same combination twice.
 
Last edited:

Similar threads

  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
7
Views
2K
  • · Replies 55 ·
2
Replies
55
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
3
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
8
Views
5K