Sunday, September 7, 2014

Barycentric Coordinates -- from Wolfram MathWorld

Barycentric Coordinates

Barycentric coordinates are triples of numbers (t_1,t_2,t_3) corresponding to masses placed at the vertices of a reference triangle DeltaA_1A_2A_3. These masses then determine a point P, which is the geometric centroid of the three masses and is identified with coordinates (t_1,t_2,t_3). The vertices of the triangle are given by (1,0,0), (0,1,0), and (0,0,1). Barycentric coordinates were discovered by Möbius in 1827 (Coxeter 1969, p. 217; Fauvel et al. 1993).

Barycentric

To find the barycentric coordinates for an arbitrary point P, find t_2 and t_3 from the point Q at the intersection of the line A_1P with the side A_2A_3, and then determine t_1 as the mass at A_1 that will balance a mass t_2+t_3 at Q, thus making P the centroid (left figure). Furthermore, the areas of the triangles DeltaA_1A_2P, DeltaA_1A_3P, and DeltaA_2A_3P are proportional to the barycentric coordinates t_3, t_2, and t_1 of P (right figure; Coxeter 1969, p. 217).

Barycentric coordinates are homogeneous, so

 (t_1,t_2,t_3)=(mut_1,mut_2,mut_3)
(1)

for mu!=0.

Barycentric coordinates normalized so that they become the actual areas of the subtriangles are called homogeneous barycentric coordinates. Barycentric coordinates normalized so that

 t_1+t_2+t_3=1,
(2)

so that the coordinates give the areas of the subtriangles normalized by the area of the original triangle are called areal coordinates (Coxeter 1969, p. 218). Barycentric and areal coordinates can provide particularly elegant proofs of geometric theorems such as Routh's theorem, Ceva's theorem, and Menelaus' theorem (Coxeter 1969, pp. 219-221).


Read full article from Barycentric Coordinates -- from Wolfram MathWorld

Pigeonhole(Drawer) Principle

http://en.wikipedia.org/wiki/Pigeonhole_principle
In mathematics, the pigeonhole principle states that if n items are put into m containers, with n > m, then at least one container must contain more than one item.

In a more quantified generalization: fornatural numbers k and m, if n = km + 1 objects are distributed among m sets, then the pigeonhole principle asserts that one of the sets will contain at least k + 1 objects.[2] For arbitrary n and m this generalizes to k + 1 = ⌊(n - 1)/m⌋ + 1, where ⌊...⌋ is the floor function.
Though the most straightforward application is to finite sets (such as pigeons and boxes), it is also used with infinite sets that cannot be put into one-to-one correspondence. To do so requires the formal statement of the pigeonhole principle, which is "there does not exist an injective function on finite sets whosecodomain is smaller than its domain". Advanced mathematical proofs like Siegel's lemma build upon this more general concept.

下面再给出Ramsey定理的简单形式:
设p,q是正整数,p,q>= 2,则存在最小的正整数R(p,q),使得当n>=R(p,q)时,用红蓝两色涂色Kn的边,则或者存在一个蓝色的完全p边形,或者存在一个红色的完全q边形 。

Wednesday, September 3, 2014

Fast modular exponentiation | Modular arithmetic | Khan Academy

Using modular multiplication rules:
i.e. A^2 mod C = (A * A) mod C = ((A mod C) * (A mod C)) mod C
We can use this to calculate 7^256 mod 13 quickly
7^1 mod 13 = 7
7^2 mod 13 = (7^1 *7^1) mod 13 = (7^1 mod 13 * 7^1 mod 13) mod 13

How can we calculate A^B mod C quickly for any B ?

Step 1: Divide B into powers of 2 by writing it in binary

Start at the rightmost digit, let k=0 and for each digit:
  • If the digit is 1, we need a part for 2^k, otherwise we do not
  • Add 1 to k, and move left to the next digit

Step 2: Calculate mod C of the powers of two ≤ B

5^1 mod 19 = 5
5^2 mod 19 = (5^1 * 5^1) mod 19 = (5^1 mod 19 * 5^1 mod 19) mod 19
5^2 mod 19 = (5 * 5) mod 19 = 25 mod 19
5^2 mod 19 = 6
5^4 mod 19 = (5^2 * 5^2) mod 19 = (5^2 mod 19 * 5^2 mod 19) mod 19
5^4 mod 19 = (6 * 6) mod 19 = 36 mod 19
5^4 mod 19 = 17
5^8 mod 19 = (5^4 * 5^4) mod 19 = (5^4 mod 19 * 5^4 mod 19) mod 19
5^8 mod 19 = (17 * 17) mod 19 = 289 mod 19
5^8 mod 19 = 4
5^16 mod 19 = (5^8 * 5^8) mod 19 = (5^8 mod 19 * 5^8 mod 19) mod 19
5^16 mod 19 = (4 * 4) mod 19 = 16 mod 19
5^16 mod 19 = 16
5^32 mod 19 = (5^16 * 5^16) mod 19 = (5^16 mod 19 * 5^16 mod 19) mod 19
5^32 mod 19 = (16 * 16) mod 19 = 256 mod 19
5^32 mod 19 = 9
5^64 mod 19 = (5^32 * 5^32) mod 19 = (5^32 mod 19 * 5^32 mod 19) mod 19
5^64 mod 19 = (9 * 9) mod 19 = 81 mod 19
5^64 mod 19 = 5

Step 3: Use modular multiplication properties to combine the calculated mod C values

5^117 mod 19 = ( 5^1 * 5^4 * 5^16 * 5^32 * 5^64) mod 19
5^117 mod 19 = ( 5^1 mod 19 * 5^4 mod 19 * 5^16 mod 19 * 5^32 mod 19 * 5^64 mod 19) mod 19
5^117 mod 19 = ( 5 * 17 * 16 * 9 * 5 ) mod 19
5^117 mod 19 = 61200 mod 19 = 1
5^117 mod 19 = 1

Notes:

More optimization techniques exist, but are outside the scope of this article. It should be noted that when we perform modular exponentiation in cryptography, it is not unusual to use exponents for B > 1000 bits.
Read full article from Fast modular exponentiation | Modular arithmetic | Khan Academy

How to find number of prime numbers between two integers - Mathematics Stack Exchange

Let π(x)=#{p≤x∣p is prime} be the prime counting function. The Prime Number Theorem tells us that

π(x)∼xlogx.
(That is limx→∞π(x)x/logx=1.) So, roughly speaking, around a large x, the probability that an integer is a prime is 1/logx. Thus, naively, one may expect that the number of primes in an interval (x,y], for large x is about (y−x)/logx, and in a heuristic formula,
π(y)−π(x)∼(y−x)logx=hlogx.(∗)
Here h=y−x is the length of the interval. This heuristic makes senses only for h which is much bigger than logx.

From the Prime Number Theorem (∗) holds if h∼λx, where λ>0 is fixed. From Riemann Hypothesis (∗) holds for h∼x1/2+ϵ for any fixed ϵ>0. (Because the RH gives the error term in the PNT.) There are unconditional results by Huxley and Heath-Brown showing (∗) for h roughly being x7/12.

If h=logxloglogx⋅loglogloglogxlogloglogx, then (∗) fails for a sequence xn→∞. To deal with `small' intervals Selberg worked with almost all x. Namely he considered (∗) for all x∈R+∖S, where |S∩(0,x]|=o(x). In this sense (∗) holds if h/log2x→0 conditionally on RH and for h=x19/77+ϵ unconditionally.

There are also works on the case h∼λlogx. There the distribution of the number of primes on intervals of this size is Poission with parameter λ, conditionally on the Hardy-Littlewood prime tuple conjecture. I think this is due to Gallagher.


Read full article from How to find number of prime numbers between two integers - Mathematics Stack Exchange

Prime Factorization

Prime Factorization
"Prime Factorization" is finding which prime numbers multiply together to make the original number.

Example 1: What are the prime factors of 12 ?

12 = 2 × 2 × 3
As you can see, every factor is a prime number, so the answer must be right.

Factor Tree
And a "Factor Tree" can help: find any factors of the number, then the factors of those numbers, etc, until we can't factor any more.

http://en.wikipedia.org/wiki/Prime_factor
Perfect square numbers can be recognized by the fact that all of their prime factors have even multiplicities. For example, the number 144 (the square of 12) has the prime factors
 144 = 2 \times 2 \times 2 \times 2 \times 3 \times 3 = 2^4 \times 3^2.
These can be rearranged to make the pattern more visible:
 144 = 2 \times 2 \times 2 \times 2 \times 3 \times 3 = (2 \times 2 \times 3) \times (2 \times 2 \times 3) = (2 \times 2 \times 3)^2 = (12)^2.
Because every prime factor appears an even number of times, the original number can be expressed as the square of some smaller number. In the same way, perfect cube numbers will have prime factors whose multiplicities are multiples of three, and so on.
Why find Prime Factors?
A prime number can only be divided by 1 or itself, so it cannot be factored any further!
Every other whole number can be broken down into prime number factors.
2 and 2 and 3
It is like the Prime Numbers are the basic building blocks of all numbers.
This can be very useful when working with big numbers, such as in Cryptography.
Cryptography
Cryptography is the study of secret codes. Prime Factorization is very important to people who try to make (or break) secret codes based on numbers.
That is because factoring very large numbers is very hard, and can take computers a long time to do.
If you want to know more, the subject is "encryption" or "cryptography".
Unique
And here is another thing:
There is only one (unique!) set of prime factors for any number.
Example The prime factors of 330 are 2, 3, 5 and 11:
330 = 2 × 3 × 5 × 11
There is no other possible set of prime numbers that can be multiplied to make 330.
In fact this idea is so important it is called the Fundamental Theorem of Arithmetic.
Read full article from Prime Factorization

Labels

Popular Posts