1. Coordinates
△ABC
= ADEC - △ADB - △BEC
= 1/2(x1y2 + x2y3 + x3y1 - x2y1 - x3y2 - x1y3)
=
2. Heron's Formula
△= sqrt(s(s-a)(s-b)(s-c))
x = 1/2 (a+b+c)
Ref.:
http://en.wikipedia.org/wiki/Triangle
http://euler.tn.edu.tw/area.pdf
Monday, 28 April 2014
Wednesday, 23 April 2014
Systems of Linear Equation in 2 Variable
How many can systems of linear equation have?
1. 1 Solution
2. Infinite Solutions
3. No Solution
C)
If (a1 / a2 == b1 / b2 != c1 / c2), lines are parallel.
-- Situation 3
[Cramer's Rule]
to solve:http://zerojudge.tw/ShowProblem?problemid=a410
Code:
Ref. http://en.wikipedia.org/wiki/Cramer%27s_rule
1. 1 Solution
2. Infinite Solutions
3. No Solution
A)
If (a1 / a2 != b1 / b2), it involves lines that intersect exactly 1 time.
-- Situation 1
B)
If (a1 / a2 == b1 / b2 == c1 / c2), it's a same line.
-- Situation 2
C)
If (a1 / a2 == b1 / b2 != c1 / c2), lines are parallel.
-- Situation 3
[Cramer's Rule]
where is the matrix formed by replacing the ith column of by the column vector .
to solve:http://zerojudge.tw/ShowProblem?problemid=a410
Code:
Ref. http://en.wikipedia.org/wiki/Cramer%27s_rule
Labels:
Math
Tuesday, 22 April 2014
[C++] Pointers
Noted down the important concepts:
1. Reference Operator (&)
ex.
ex.
3. Pointers & Arrays
It collects so many ways to get address from an array and set value to an array.
4. Pointers and Const
5. Pointers to Pointers
6. Pointers and Functions
7. Arrow
Same description below:
Ref. http://www.cplusplus.com/doc/tutorial/pointers/
1. Reference Operator (&)
ex.
myvar = 25; foo = &myvar; bar = myvar;2. Dereference Operator (*)
ex.
baz = *foo;
3. Pointers & Arrays
It collects so many ways to get address from an array and set value to an array.
#include <iostream> using namespace std; int main () { int numbers[5]; int * p; p = numbers; *p = 10; p++; *p = 20; p = &numbers[2]; *p = 30; p = numbers + 3; *p = 40; p = numbers; *(p+4) = 50; for (int n=0; n<5; n++) cout << numbers[n] << ", "; return 0;Output:
10, 20, 30, 40, 50,
4. Pointers and Const
int x; int * p1 = &x; // non-const pointer to non-const int const int * p2 = &x; // non-const pointer to const int int const * p3 = &x; // also non-const pointer to const int int * const p4 = &x; // const pointer to non-const int const int * const p5 = &x; // const pointer to const int
5. Pointers to Pointers
char a; char * b; char ** c; a = 'z'; b = &a; c = &b;
#include <iostream> using namespace std; int addition (int a, int b) { return (a+b); } int subtraction (int a, int b) { return (a-b); } int operation (int x, int y, int (*functocall)(int,int)) { int g; g = (*functocall)(x,y); return (g); } int main () { int m,n; int (*minus)(int,int) = subtraction; m = operation (7, 5, addition); n = operation (20, m, minus);Output:cout << n; return 0; }
8Mostly, we use function point in sqort().
7. Arrow
Same description below:
(*p).foo; p->foo;
Ref. http://www.cplusplus.com/doc/tutorial/pointers/
Labels:
CPP
Friday, 18 April 2014
Tuesday, 15 April 2014
Subscribe to:
Posts (Atom)