Перейти к содержимому
Madiyar92

Мадияр Айтбаев

@Madiyar92

На сайте с 24 декабря 2010 г.Казахстан, Талды-Курган

Пользователь пока ничего не рассказал о себе.

рейтинг

100

постов

7

комменты

5

подписчика

3

подписки

3

Area of Triangles

Let's learn about the area of Triangle. Let's start with the basics.

1. Right triangle and Triangle with a height.

Area of both triangles equals: A = h * c / 2

Let's prove for the second triangle (the first one can be proved similarly):

Area(ADC) = h*(d+c)/2, which is half area of rectangle with sides d+c and h

Area(ADB) = h*d/2, which is half area of rectangle with sides d and h

Area(ABC) = Area(ADC) - Area(ADB) = h*(d+c)/2 - h*d/2 = h*c/2

Thus, Area(ABC) = h*c/2

2. Triangle with two sides and angle

A = b*c*sin(A)/2

Let's prove it:

Draw a height,

A = b * c * sin(A)/2

sin(A) = opposite/hypotenuse = h / b

thus,

A = b * c * (h/b) /2

which  can be simplified to:

A = c * h / 2 and this formula we've proved above.

The End.

1
0
307

Quadratic Equation: a*x^2+b*x+c = 0

We all know about quadratic equation. We had solved it many many times in school. Let's recall about quadratic equation. Quadratic Equation is a second-order polynomial equation in a single variable: Solutions for x is: x1 =(-b + sqrt(b^2-4*a*c))/(2*a) x2 =(-b - sqrt(b^2-4*a*c))/(2*a) What if we've forgotten the formula ? Let's try to reinvent this formula by ourselves. 1. Subtract left and right part of the equation by c. We will get: 2. Divide both parts by a. 3. (x+y)^2 = x^2 + 2*x*y + y^2. Let's try to transform left part to (x+y)^2. To be able to do that, add b/(2*a) to both parts of the equation: 4. Open the brackets. 5. Simplify left part to a form (x+y)^2, and make denominators of the right part of the equation the same. 6. Right part can be simplified to: 7. Take the square root…

1
0
399

Pythagorean theorem: a^2+b^2=c^2

tl;dr; If you aren't eager to learn proof of the pythagorean theorem, you can stop reading. I hope, almost everybody knows or has heard about pythagorean theorem. I am not aware in which year of school it is taught, but it is definitely in school syllabus. In this post, I am going to write proof of it. Let's recall pythagorean theorem. If we have right triangle(triangle with a 90-degree angle) ABC , then this equation is true: a^2 + b^2 = c^2 or in other denotations: |BC|^2 + |AC|^2 = |AB|^2 1. Proof by area We want to proof that a^2+b^2=c^2. Area of the outside rectangle is equal to (a+b)^2. But, there is a other way to calculate outside area, we can sum up area of the inside rectangle and four right triangles, which are located on the corners. (a+b)^2 = c^2 + (a*b)/2 * 4 if we open the…

2
4
540

ProjectEuler 144: Investigating multiple reflections of a laser beam

tl;dr; you can stop reading, if you aren't interested in programming or math. In this post, I want to show you importance of programming in math field. For a year I was afraid to solve one geometrical problem. So today decided to overcome my fear. I don't want to make you afraid of this post. So let's start with something simple. 1. Draw an ellipse We are given an ellipse with the equation: 4*x^2+y^2 = 100 So we want to visualise the ellipse. In the end, we want to plot ellipse as shown in the following picture: There is a great python plotting library for that: matplotlib. Firstly, notice that x needs to be between -5..5 inclusive, otherwise 4*x^2 + y^2 will be greater that 100. If we know x, then y = sqrt(100-4*x^2) or y = -sqrt(100-4*x^2) Let's take 5 points from [-5..5] and draw line…

2
0
782

Go as a first language

In my previous post I described Go in a general view. In this post I am going to write, so far as possible in a practical view. First of all, in my point of view, Go is a perfect language as a teaching language. If someone started to dive into programming world from a different background, it is very important their first impression about programming language they are going to learn. Before knowing Go, I thought Python suits perfectly as a first learning language. But now I am not sure, because spaces/tabs adding some meanings to the code may be very confusing. 1. A + B package main import "fmt" func main() { var a, b int fmt.Scanf("%d%d", &a, &b) fmt.Print(a + b) } Isn't it looks like C/C++? By the way, in my opinion, C++ is not good as a first language, because C++ is difficult…

4
0
439

Testing Golang

This post is just for myself. I am learning english, so in my opinion to learn something you need to practice a lot. Shortly, sometimes I am going to write posts in english here, forgive me for my bad english grammar :). In the past, I wanted to change my life a little bit, so decided to learn new programming language :D. In a result, picked young language Go/Golang. GoLang is very tiny language, even all language specifications can fit into one single page. Of course, I didn't mention about size of the single page :). Language Specification What I like in Go: 1. Great tools, great decisions. Especially to compile&run, you just need to type "go run main.go". Also great tool "gofmt" - it formats everything for you, i.e adds tabs/spaces, etc... I think "gofmt" is useful for beginners, f…

2
4
473

C++: Tricky codes

This are my collections of c++ codes which are very tricky. Some of them I found by making mistakes, so recorded them to avoid making the same bug twice. Try to guess the output just by reading, please don't use any compiler or IDE. Do you know other tricky codes? 1: A - B #include <iostream> using namespace std; int main() { int a = 020; short b = 2; cout << a - b << endl; return 0; } 2. Condition #include <iostream> using namespace std; int main() { bool ok = true; // Try to guess with if condition \ if (!ok && true) cout << "I am ok" << endl; return 0; } 3. Comparison #include <iostream> using namespace std; int main() { unsigned a = 0; int b = 2; if (a + b >= -2) cout << a + b << ">=" << -2 << endl; else c…

3
3
632