Triangle geometry - 2 fixed points, one side changing length [closed] - geometry

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
Let's consider the triangle ABC, where the distances AB and AC are constant. A and C and immobile; B can move.
The triangle can have two states:
1) There is a right angle between AB and BC, B has the same x coordinate as A
A
|
|
|
|
B --- C
2) B has the same y coordinate as A, and the distance BC is double what is was before
B-----A
\
\
\
\
C
How can I calculate the position of C, in respect to A if I know the distances AB and BC?

1) known |BC| = t, |A.X - C.X| = t
2) known |AB| = f, |BC| = 2*t
unknown g = |A.Y - C.Y|
(f+t)^2 + g^2 = (2*t)^2 //grandpa Pythagoras' theorem
g = Sqrt(4*t^2 - (f+t)^2)

Related

How to compare two products based on their ratings? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 months ago.
Improve this question
I am interested in knowing how to calculate a ranking score from ratings of a product. E.g., take the apple appstore. There are two products A and B. Both have same average rating but 100 reviewers have rated A whereas 1000 reviewers have rated B. Intuitively it seems B should be ranked higher than A (it has lower standard error in the mean). Is there an established formula to compare two items and determine which is better based on their ratings?
I write some python code so you can run it easily.
def score(nn):
""" nn = [0, n1, n2, n3, n4, n5] """
if len(nn)==5:
nn = [0, *nn] # add 0
N = sum(nn)
K = 5
kk = [1,2,3,4,5]
z = 1.65 # alpha = 0.1 mean 95% confidence
avg = sum(k*(nn[k]+1)/(N+K) for k in kk)
diff = sum(k**2 * (nn[k]+1)/(N+K) for k in kk) \
- sum(k * (nn[k]+1)/(N+K) for k in kk) ** 2
dev = z * sqrt(diff / (N+K+1))
return avg - dev
You can just call it
score([5, 5, 14, 48, 223]) # 4.517059350728805

Formula to check a condition [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Please find the condition below:
Col A Col B Col C Col D
235 A B Formula result
235 B
235 C
236 X
236 Y
236 Z
237 P
240 Q
I need a formula in col D to check that if Col A is 235 then Col C should have any value from A,B or C mentioned in the list in col B. if Col A is 236 then col D should give me an error if values are not between X,Y or Z.
Thanks
Enter this formula in D1: =IF(A1=235,IF(C1=B1,"Okay!","Error"),IF(OR(C1="X",C1="Y",C1="Z"),"Okay!","Error"))

Pumping Lemma, Condition 1 [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Let B be the language {0n1n | n >= 0} i.e. 0 and 1 has to have the same length
Let s in B be the string 0p1p
Assume B is regular so s must be divisible to s = xyz where xyiz i>=0 is still in B (Condition 1 of three conditions of pumping lemma).
Consider the case xyiz where i = 2 so xyyz:
Pump y with all 0s
xyyz has more 0s and 1s so it cannot be in B. Therefore, B is not regular.
I am having a hard time understanding that if y is all 0s in xyyz, then # of 0s > # of 1s
Why can't |xyy| = |z| which then it would have the same # of 0s and 1s?
'Pump y with all 0s' isn't terribly clear, but an example of how this works out is as follows:
Pick some value for y: let's say y = '0'.
Pick some value for i: i = 1
Then s = xyz. We will assume this holds true for the moment.
Now, since we assume B is regular, we know that - for any value of i - the string formed by xyiz should also be in B! Let's try xyyz, like you suggest.
...Uh-oh. You see the problem? We have to hold y constant, but doing so means we just made a string that has one more 0 than s, but doesn't have an extra 1 to go with it! We just showed that y can't be 0. Well, darn.
Now consider: is there any value of y for which this won't hold true? Adding 0s to y will only make the issue worse!
This is a very informal walkthrough of the proof, but hopefully it helps understand why it works.

Spreadsheet Formula (math) [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
This is purely a math question!
I simply can't get my head around this formula. It is so simple, but I can't get it to work in general.
I have 2 columns of numbers.
Columns A+B is the full number of apples (100%).
Column A: is the number of apples that I have eaten.
Column B: is the number of apples that are left.
I need column C to be the percentage of apples that are left out of the full number.
For example.
A B C
0 3 100%
5 0 0%
2 2 50%
Can anybody wrap their heads around this?
Total = A + B
Left out apples = B
Percentage of left out apples = (B / Total) * 100
Consequently, here's the formula:
Column C = ((Column B) / (Column A + Column B) * 100)
Here's what you should type-in in Excel:
=(B1/(A1+B1))*100
A = No. of apples eaten, B = No. of apples left . A+B = total no of apples. So Total no. of apples left out of the full amount are (A+B)-A/100.

multiplicative inverse? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I know that an affine cipher substitutes BD with SG. I need to find the encryption formula, in the form y = a x + b, where a and b are coefficients.
From the information above I end up having to equations:
a+b=18 and
3a+b=6
So I am working like this:
a+b=18 and 3a + b = 6-> 3a+18-a=6->  2a= 6-18 -> 2a=14 (as it is mod 26)
b=18-a
2a=? 
So, O want to multiply by the multiplicative inverse of 2 mod 26
I can't find a multiplicative inverse of number 2 with 26 (y = ax + b mod 26)
Can anyone please help me find a and b?
That's because 2 doesn't have a multiplicative inverse mod 26: since 13*2=0, there does not exist K such that K * a = 1. Your modulus must be prime. Try looking up the Chinese Remainder Theorem for more information.
To be more specific, integers mod 26 is not a field (a mathematical set where every element, except 0, has a multiplicative inverse). Any ring in which a * b = 0, for some a!=0 and b!=0, is not a field.
In fact, a field will always have p^n elements, where p is a prime number and n is a positive integer. The simplest fields are just integers mod a prime number, but for prime powers you need to construct a more elaborate system. So, in short, use a different modulus like 29.
Does a = 7 work? 2*7 = 14. Thus, b = 11.
Let's check the 2 equations to see if that works:
7+11 = 18 (check for the first equation).
3*7+11=21+11 = 32 = 6.
What is wrong with the above?
EDIT: Ok, now I see what could go wrong with trying to do a division by 2 in a non-prime modulus as it is similar to a division by 0. You could take ribond's suggestion of using the Chinese Remainder Theorem and split the equations into another pair of pairs:
mod 13: a+b=5, 3a+b=6. (2a = 1 = 14 => a=7. b = 18-7 = 11.)
mod 2: a+b=0. 3a+b=0 (Note this is the same equation and has a pair of possible solutions where a and b are either 0 or 1.)
Thus there is the unique solution for your problem I think.
Other posters are right in that there is no inverse of 2 modulo 26, so you can't solve 2a=14 mod 26 by multiplying through by the inverse of 2. But that doesn't mean that 2a=14 mod 26 isn't solvable.
Consider the general equation cx = d mod n (c=2,d=14,n=26 in your case). Let g = gcd(c,n). The equation cx=d has a solution if an only if g divides d. If g divides d, then there are in fact multiple solutions (g of them). The equation (c/g)x = d/g mod n/g has a unique solution (call it x_0) because c/g is relatively prime to n/g and therefore has an inverse. The solutions to the original equation are x_0, x_0 + n/g, ..., x_0 + (g-1)n/g.
In your case c=2,d=14,n=26, and g=2. g divides d, so first solve the equation (2/2)x = (14/2) mod (26/2) which gives 7. So both 7 and 7+13=20 solve your original equation.
Note that this means you haven't uniquely determined your affine transformation, two possibilities still exist. You need another data point...

Resources