Wikipedia:Reference desk/Archives/Mathematics/2010 June 24
Mathematics desk | ||
---|---|---|
< June 23 | << May | June | Jul >> | June 25 > |
Welcome to the Wikipedia Mathematics Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
June 24
[edit]Constrained solutions of a linear equation
[edit]Hello...My today's question is as follows. Consider the 4 variable equation v + x + y - z = 4. If I desire to find solutions to it, I can easily do it by assigning arbitary values to x, y and z and solving for v. But what I wish for, is to find solutions where the variables all belong to the set {1,2,3}. How to do that systematically? Also if I generalize the problem, keep my equation as v + x + y - z = b, b any positive even integer and search for solutions within {1,2,...,n} is there a systematic way to do that. Thanks. - Shahab (talk) 06:26, 24 June 2010 (UTC)
- There's a fairly obvious simple systematic way to do that: three nested loops for each of x, y and z in 1…n, solve for v = b - x - y + z, output x, y, z, v if v is in [1,n]. That scales as n3, so should be perfectly feasible for values of n up to several hundreds or thousands on modern CPUs when implemented in any decent programming language or numerical computing environment, and you could do it with pencil and a single sheet of paper for n = 3 (<small(>19 solutions i reckon when b=4. Ok i admit i used a computer even for that). I'm sure that simple algorithm can be made at least a bit more efficient, but with modern computing power it's probably not worth the extra mental and programming effort unless you're interested in larger values of n. Qwfp (talk) 09:50, 24 June 2010 (UTC)
- (edit conflict) If your variables are constrained to be members of a finite set, then a brute force solution is to create all the tuples of the appropriate size that can be formed from that set, and test each one of them in turn to see if it is a solution. So if v, x, y and z have to come from the set {1,2,...,n} then you construct each of the n4 4-tuples (p, q, r, s) with members drawn from this set, and then check to see if p + q + r - s = b. If you want a more efficient algorithm, then you can reduce the size of the search space by exploiting the symmetries of your equation - the result for (p, q, r, s) is the same as the result for (q, p, r, s), (r, p, q, s) etc. - or the properties of your candidate set - if solutions have to come from {1,2,...,n} then p + q + r must lie between b + 1 and b + n, so max(p, q, r) ≥ (b + 1)/3 and min(p, q, r) ≤ (b + n)/3. Gandalf61 (talk) 10:04, 24 June 2010 (UTC)
- Also 3 ≤ p+q+r ≤ 3n. Bo Jacoby (talk) 14:28, 24 June 2010 (UTC).
Simple formula
[edit]Not a homework question. If 0.82(s1-p)=0.72(s2-p) then s2/s1= what? I have not been able to work out a solution. I'd be interested in how a solution is obtained as well as the answer. S1, s2 and p must all be greater than zero, and s1>p and s2>p. Thanks. 92.24.186.235 (talk) 09:33, 24 June 2010 (UTC)
- Simplify the equation to 41s1 − 36s2 − 5p = 0.
- The inequality s1>p implies that 0 = 41s1 − 36s2 − 5p > 41s1 − 36s2 − 5s1 = 36s1 − 36s2.
- The inequality p>0 implies that 41s1 − 36s2 > 0.
- So 1 < s2/s1 < 41/36.
- I hope it is correct now. Bo Jacoby (talk) 13:18, 24 June 2010 (UTC).
Probability Distributions
[edit]Hello. If the probability of a computer chip failing quality-control testing is 0.015, then what is the probability that one of the first three chips off the line will fail? Do I use a geometric or binomial distribution? Thanks in advance. --Albert (talk) 17:27, 24 June 2010 (UTC)
- You can use either if you use it correctly. But it's best not to consider distributions at all, but just basic probability: The probability of a chip to pass is 0.985. If they're independent, the probability they all pass is , so the probability that at least one fails is .
- Unless you meant the probability that exactly one fails, in which case use binomial. -- Meni Rosenfeld (talk) 18:24, 24 June 2010 (UTC)