Power sum in Ruby $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…

30 Trigonemetric Problems and Equations $1. \; \sqrt{ 1 + \sin x } + \sqrt{ 1 - \sin x} = 1 + \cos x \\ 2. \; \sin \alpha = \dfrac{1}{4} \; and \; \alpha \in [ 0 ; \pi / 4 ] . \; Find \; \tan 2 \alpha \\ 3. \; \tan 5x = \sin^2 x \cdot \tan 5x \\ 4. \; \sin x + \sin 2x + \sin 3x = 1 + \cos x + \cos 2x \\ 5. \; \sin x \cdot \sin 3x + \sin 4x \cdot \sin 8x = 0 \\ 6. \; \sin 3x + \sin 5x = \sin 4x \\ 7. \; \cos 3x \cdot \cos x - \cos 5x \cdot \cos 7x = 0 \\ 8. \; \sin 3x \cdot \sin 5x + 2 \sin^2 x = 1 \\ 9. \; \sin 2x \cdot \sin 6x = \cos x \cdot \cos 3x \\ 10. \; \cos^4 x + \sin^4 x = \sin 2x - 0.5 \\ 11. \; \cos 2x = \cos x - \sin x \\ 12. \; \sin^6 x + \cos^6 x = \dfrac{1}{4} \cdot \sin^2 2x \\ 13. \; \cos 7x + \sin 8x = \cos 3x - \sin 2x \\ 14. \; 1 + \cos x + \cos 2x = 0 \\ 15. \; \cos 2x - 5 \sin x - 3 = 0 \\ 16. \; 4 \cdot \sin x \cdot \sin 2x \cdot \sin 3x = \sin 4x \\ 17. \; \sin 2x = \cos^4 \dfrac{x}{2} - \sin^4 \frac{x}{2} \\ 18. \; 2 \cos x + \sin x + 2 = 0 \\ 19. \; \sin x + \sin 3x = 4 \cos^3 x \\ 20. \; \sin^3 x \cdot \cos x - \cos^3 x \cdot \sin x = \dfrac{ \sqrt{2} }{8} \\ 21. \; 1 - \sin 2x = \cos x - \sin x \\ 22. \; 3 \cdot \tan 3x - 4 \cdot \tan 2x = \tan^2 2x \cdot \tan 3x \\ 23. \; 3 \cdot ( 1 - \sin x ) = 1 + \cos 2x \\ 24. \; \tan \dfrac{3x}{5} \cdot \cot \dfrac{5x}{3} = 1 - \sec \dfrac{3x}{5} \cdot \csc \dfrac{5x}{3} \\ 25. \; \sin ( x + 25^\circ ) \cdot \sin ( x - 20^\circ ) = \sin ( 70^\circ + x ) \cdot \sin ( 65^\circ - x ) \\ 26. \; \sin 2x + \cos 2x + \sin x + \cos x + 1 = 0 \\ 27. \; \sin 3x = \cos x - \sin x \\ 28. \; Find \; \sin ( 5 \arcsin x ) . \\ 29. \; \cos 7x + \sin^2 2x = \cos^2 2x - \cos x \\ 30. \; \sin x + \sin 2x + \sin 3x + \sin 4x = 0 \\$

Categories: Trigonometry

In quadrilateral ABCD with diagonals BD and CA, $\angle ABD = 40^{ \circ } , \; \angle CBD = 70^{ \circ } , \; \angle ABD = 40^{ \circ } , \; \angle CDB = 50^{ \circ } , \; \angle ADB = 80^{ \circ } . \; Find \; \angle CAD .$ Read more…

Fibonacci  $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

Fuzzy Logic Calculator and Graph

Categories: Software

Triangle problem – finding height with given area and angles.

If the area of triangle ABC is ${\cal S}$ and angles $\angle A= \alpha$ and $\angle B= \beta$ then find a altitude of triangle which drawn from C to AB.

Categories: Triangles Tags: , , ,

Accents and Symbols  $\b{o}$     \b{o} $\o$            \o $\ae$         \ae $\AA$       \AA $\AE$       \AE Read more…