20180716 MARTES
Mathematics
基本公式
\[sin(\theta )=\frac{对边}{斜边}, cos(\theta )=\frac{邻边}{斜边}, tan(\theta )=\frac{对边}{邻边}\]
定义
\[csc(x)=\frac{1}{sin(x)}, sec(x)=\frac{1}{cos(x)}, cot(x)=\frac{1}{tan(x)}\]
0 | \(\frac{\pi}{6}\) | \(\frac{\pi}{4}\) | \(\frac{\pi}{3}\) | \(\frac{\pi}{2}\) | |
---|---|---|---|---|---|
sin |
0 |
\(\frac{1}{2}\) |
\(\frac{1}{\sqrt{2}}\) |
\(\frac{\sqrt{3}}{2}\) |
1 |
cos |
1 |
\(\frac{\sqrt{3}}{2}\) |
\(\frac{1}{\sqrt{2}}\) |
\(\frac{1}{2}\) |
0 |
tan |
0 |
\(\frac{1}{\sqrt{3}}\) |
1 |
\(\sqrt{3}\) |
⭐️ |
\(sin(x)\)、\(tan(x)\)、\(cot(x)\) 及 \(csc(x)\) 都是 \(x\) 的奇函数。\(cos(x)\) 和 \(sec(x)\) 都是 \(x\) 的偶函数。
三角恒等式
\[\begin{align}
tan(x)=\frac{sin(x)}{cos(x)} & , cot(x)=\frac{cos(x)}{sin(x)}
\\
cos^{2}(x) + sin^{2}(x) & = 1
\\
1+tan^{2}(x) & = sec^{2}(x)
\\
cot^{2}(x)+1 & = csc^{2}(x)
\\
sin(x) = cos(\frac{\pi}{2}-x), tan(x) & = cot(\frac{\pi}{2}-x), sec(x) = csc(\frac{\pi}{2}-x)
\end{align}\]
公式
\[\begin{align}
sin(A+B) & = sin(A)cos(B)+cos(A)sin(B) \\
cos(A+B) & = cos(A)cos(B)-sin(A)sin(B) \\
sin(A-B) & = sin(A)cos(B)-cos(A)sin(B) \\
cos(A-B) & = cos(A)cos(B)+sin(A)sin(B) \\
sin(2x) & = 2sin(x)cos(x) \\
cos(2x) & = 2cos^{2}(x) - 1 = 1 - 2sin^{2}(x)
\end{align}\]
Algorithm
3Sum - LeetCode
Unresolved include directive in modules/ROOT/pages/20180716.adoc - include::https://raw.githubusercontent.com/diguage/leetcode/master/src/main/java/com/diguage/algorithm/leetcode/ThreeSum.java[]
Remove Duplicates from Sorted Array - LeetCode
Unresolved include directive in modules/ROOT/pages/20180716.adoc - include::https://raw.githubusercontent.com/diguage/leetcode/master/src/main/java/com/diguage/algorithm/leetcode/RemoveDuplicatesFromSortedArray.java[]
Remove Element - LeetCode
Unresolved include directive in modules/ROOT/pages/20180716.adoc - include::https://raw.githubusercontent.com/diguage/leetcode/master/src/main/java/com/diguage/algorithm/leetcode/RemoveElement.java[]
Review
I read Does your team write good code? on Saturday. I wrote my thoughts.