Does this equation have a name?

  • Thread starter gamow99
  • Start date
In summary, the number of comparisons needed to check for contradictions in a logic calculator with n sentences can be calculated using the formula (n^2-n)/2, which can also be written as n choose 2. This is analogous to finding the number of lines between a given number of points, and can be generalized for any number of variables. This formula can help make the process more efficient by avoiding redundant comparisons.
  • #1
gamow99
71
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
  • #2
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".
 
  • #3
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: 507
  • 4case.png
    4case.png
    4.2 KB · Views: 483
Last edited:
  • #4
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:
  • #5


There isn't a specific name for this equation, as it is a basic mathematical representation of the number of combinations that need to be checked. However, it can be rewritten as the sum of the first n-1 integers, which is equal to n(n-1)/2. So for your example of four sentences, the equation would be 4(4-1)/2 = 6 combinations to check. For six sentences, it would be 6(6-1)/2 = 15 combinations. This is known as the "triangular number" formula.
 

1. What is the name of this equation?

This equation is known as the [insert name of equation].

2. Why do equations have names?

Equations are given names to help scientists and mathematicians easily identify and refer to them, especially when there are many similar equations.

3. How are equations named?

Equations are often named after the scientist or mathematician who first discovered or developed them, or after a key concept or variable in the equation.

4. Are all equations given names?

No, not all equations are given names. Some equations may be too simple or common to warrant a specific name, and may just be referred to by their variables or symbols.

5. Can equations have multiple names?

Yes, some equations may have multiple names depending on the field or context in which they are used. Some equations may also have different names in different languages.

Similar threads

  • General Math
Replies
2
Views
1K
Replies
3
Views
2K
Replies
55
Views
3K
Replies
9
Views
1K
Replies
6
Views
909
Replies
3
Views
576
Replies
11
Views
755
  • General Math
Replies
4
Views
1K
Replies
27
Views
650
Back
Top