Today we look at a few summation formulas and properties.
Given a sequence a1, a2, ... of numbers, the finite sum a1 + a2 + ... +an where n is a positive number
This sum can be written as n(n+1)/2 when the terms are consecutive n numbers and its terms can be added in any order. This is called the arithmetic series and has an order of n^2. If the series is infinite and a limit exists then it is said to converge otherwise it is said to diverge. We can rearrange the terms of an absolutely convergent series.
For any real number c and any finite sequences a1, a2 ... am and b1, b2 ... bn
Sum c.ak + bk where k can range from 1 to n is equivalent to writing
c.Sum ak + Sum bk and this is said to be the linearity property.
The linearity property is also obeyed by infinite convergent series.
Summation of squares and cubes also have well defined sums.
For example Sum of squares of consecutive 1 to n numbers is n(n+1)(2n+1)/6
and the sum of cubes of consecutive 1 to n numbers is n^2(n+1)^2 / 4
A series is said to be geometric or exponential when the terms are increasing in power such as 1 + x + x^2 + x^3 ... +x^n and x is not equal to 1.
The sum of this series has the value (x^(n+1) - 1)/(x-1)
When the summation is infinite and the absolute value of x is less than 1, then we have the sum as 1 / (1-x)
A Harmonic series is one where the nth harmonic number is the sum of the consecutive fractions 1 + 1/2 + 1/3 + ... + 1/n which we calculate as ln n + a constant
Additional formulas can be obtained by integrating and differentiating the series above.
Telescopic series is one where for any sequence a0, a1, ..., an,
Sum for k = 1 to n (ak - ak-1) = an - a0
since each of the terms a1, a2, ..., an-1 is added in exactly once and subtracted out exactly once. Hence the term telescopes.
Given a sequence a1, a2, ... of numbers, the finite sum a1 + a2 + ... +an where n is a positive number
This sum can be written as n(n+1)/2 when the terms are consecutive n numbers and its terms can be added in any order. This is called the arithmetic series and has an order of n^2. If the series is infinite and a limit exists then it is said to converge otherwise it is said to diverge. We can rearrange the terms of an absolutely convergent series.
For any real number c and any finite sequences a1, a2 ... am and b1, b2 ... bn
Sum c.ak + bk where k can range from 1 to n is equivalent to writing
c.Sum ak + Sum bk and this is said to be the linearity property.
The linearity property is also obeyed by infinite convergent series.
Summation of squares and cubes also have well defined sums.
For example Sum of squares of consecutive 1 to n numbers is n(n+1)(2n+1)/6
and the sum of cubes of consecutive 1 to n numbers is n^2(n+1)^2 / 4
A series is said to be geometric or exponential when the terms are increasing in power such as 1 + x + x^2 + x^3 ... +x^n and x is not equal to 1.
The sum of this series has the value (x^(n+1) - 1)/(x-1)
When the summation is infinite and the absolute value of x is less than 1, then we have the sum as 1 / (1-x)
A Harmonic series is one where the nth harmonic number is the sum of the consecutive fractions 1 + 1/2 + 1/3 + ... + 1/n which we calculate as ln n + a constant
Additional formulas can be obtained by integrating and differentiating the series above.
Telescopic series is one where for any sequence a0, a1, ..., an,
Sum for k = 1 to n (ak - ak-1) = an - a0
since each of the terms a1, a2, ..., an-1 is added in exactly once and subtracted out exactly once. Hence the term telescopes.
#codingexericse
Given a representation of all distinct digits in an alien system, Generate an increasing sequence from 1 to 9
For example given 01 and 0F8 as the alien number system
0 = 0 0 F, 8, F0, FF, F8, 80, 8F, 88, F00, F0F
1 = 1 F
2 = 10 8
3 = 11 F0
4 = 100 FF
5 = 101 F8
6 = 110 80
7 = 111 8F
8 = 1000 88
9 = 1001 F00
10 = 1010 F0F
F08
FF0
FFF
FF8
F80
F8F
F88
888
F000
void GenSequence(String pattern, int number)
{
char[] array = pattern.ToCharArray();
int len = array.Length;
String prefix = string.empty;
while (number)
{
int rem = number%len;
prefix += array[rem];
number = number / len;
}
Console.WriteLine(prefix.reverse());
}
No comments:
Post a Comment