Archive

Archive for the ‘Maths & Geometry’ Category

Power sum in Ruby

March 18, 2013 Leave a comment
The logo, selected as winner of the Ruby Logo ...

The logo, selected as winner of the Ruby Logo Contest (Photo credit: Wikipedia)

1^m + 2^m + \ldots + n^m = ?

It is not easy to calculate if n is 50, nad m is 9. Here Ruby comes for help. If you had already installed Ruby 1.8 or Ruby 1.9, open terminal (in Linux) type irb and press enter. Then type following (don’t type > sign) :

>sum(n,m)
>return 1 if n == 1
>sum(n-1,m) + n^m if n > 1
>end

It is all, now type sum(50,9) and you will get the answer…

 

 

Advertisements

30 Trigonemetric Problems and Equations

March 18, 2013 Leave a comment

Quadrilateral Problem

January 7, 2013 Leave a comment

Fibonacci

January 7, 2013 Leave a comment

fibonacci_avatar

F_{1} =F_{2} =1; \; F_{n+2} = F_{n+1} + F_{n} ; \; \lim \limits_{ n \rightarrow \infty } \frac{ F_{n+1} }{ F_{n} } = \Phi \approxeq 1.61803... ;

F_{n} = \frac{1}{ \sqrt{5} } \cdot ( { \Phi }^n - ( 1- \Phi )^n ) ;

\sum \limits_{i=1}^{n} F_{i} = F_{n+2} - 1 ; \; \sum \limits_{i=1}^{n} { F_{i} }^2 = F_{n} \cdot F_{n+1} ;

F_{n+k} = F_{k} \cdot F_{n+1} + F_{k-1} \cdot F_{n} \; \; \; F_{2n} = F_{n} \cdot F_{n+1} + F_{n-1} \cdot F_{n}

Ruby code for Fibonacci numbers:

def fibo(n)
phi = ( Math.sqrt(5) + 1 )/2
pho = 1 - phi
if n > -1
Integer( ( phi**n - pho**n )/( Math.sqrt(5) ) )
else
Integer( ( (-1)**(n+1) )*fibo(-n) )
end
end

to be continued

Triangle problem – finding height with given area and angles.

January 4, 2013 Leave a comment
Categories: Triangles Tags: , , ,

Range – General Information

December 19, 2011 Leave a comment

The range of a set of data is the difference between the highest and lowest values in the set. For example : 21, 55, 12, 84, 32, 64. Range = 84 – 12 = 72.

The range, in the sense of the difference between the highest and lowest scores, is also called the crude range. When a new scale for measurement is developed, then a potential maximum or minimum will emanate from this scale. This is called the potential (crude) range. Of course this range should not be chosen too small, in order to avoid a ceiling effect. When the measurement is obtained, the resulting smallest or greatest observation, will provide the observed (crude) range.

Median – General Information

December 19, 2011 Leave a comment
English: Comparison of mean, median and mode o...

Image via Wikipedia

Median is numerical value separating the higher half of a sample from the lower half. The median of some variable x is denoted either as \tilde{x} or as \mu_{1/2}(x)\,\!.

An example for median:

To find median of 5, 9, 2, 6, 7 firstly sort by value: 2, 5, 6, 7, 9. The middlest value is median = 6. Other method to find median = [(n+1)/2]th value. (n is the number of values. median=(5+1)/2=3. 3rd value is 6.

If number of values even:

5, 9, 2, 6, 7, 1.  Sort by value: 1, 2, 5, 6, 7, 9. Median is the mean of middlest values: (5+6)/2=5.5 . Other method to find median = [(n+1)/2]th value. (n is the number of values. (6+1)/2=3.5 median is 3rd value + 0.5*|difference between 3rd and 4th value| = 5 + 0.5*(6-5) = 5.5 .

Read more…

%d bloggers like this: