Compare commits
No commits in common. "77e7cdf760ca1e158cfba7a6ab67b01f5c96ef89" and "7d58412a4581a35bfd0db36e1b146031192cb9bf" have entirely different histories.
77e7cdf760
...
7d58412a45
@ -1,33 +0,0 @@
|
||||
To solve for a double or half angle identity:
|
||||
1. Draw a triangle
|
||||
2. Choose an identity to use
|
||||
3. Substitute into formula
|
||||
# Double Angle Identities
|
||||
Sine:
|
||||
$$ \sin(2\theta) = 2\sin\theta\cos\theta $$
|
||||
Cosine:
|
||||
$$
|
||||
\begin{matrix}
|
||||
\cos(2\theta) = \cos^2\theta - \sin^2\theta\\
|
||||
= 1 - 2sin^2\theta\\
|
||||
= 2cos^2\theta - 1\\
|
||||
\end{matrix}
|
||||
$$
|
||||
|
||||
Tan:
|
||||
$$ \tan(2\theta) = \dfrac{2\tan\theta}{1-\tan^2\theta}$$
|
||||
|
||||
## Half Angle Identities
|
||||
Whether the output is positive or negative depends on what quadrant the output is in.
|
||||
Sine:
|
||||
$$ \sin(\frac{\theta}{2}) = \pm\sqrt{\frac{1-\cos\theta}{2}} $$
|
||||
Cosine:
|
||||
$$ \cos(\frac{\theta}{2}) = \pm \sqrt{\frac{1 + \cos\theta}{2}} $$
|
||||
Tangent:
|
||||
$$
|
||||
\begin{matrix}
|
||||
\tan(\dfrac{\theta}{2}) = \pm\sqrt{\dfrac{1-\cos\theta}{1 + \cos\theta}}\\
|
||||
= \dfrac{\sin\theta}{1 + \cos\theta}\\
|
||||
= \dfrac{1 - cos\theta}{\sin\theta}
|
||||
\end{matrix}
|
||||
$$
|
@ -52,17 +52,7 @@ int arr_size = sizeof(arr) / sizeof(arr[0]);
|
||||
`&` gives you the address of a variable
|
||||
`*` gives you the value in memory that an address points to.
|
||||
|
||||
To update the value a pointer points at, you can dereference on the left hand side of the assignment operator:
|
||||
```c
|
||||
// Update the value `p` points at to be 7
|
||||
*p = 7;
|
||||
```
|
||||
|
||||
Because of how operator precedence works, parentheses should be placed around the dereference operator and the variable
|
||||
```c
|
||||
// Increment the value pointed to by `p`
|
||||
(*p)++;
|
||||
```
|
||||
# Formatting specifiers
|
||||
# Standard library
|
||||
## Formatting specifiers
|
||||
|
@ -23,12 +23,3 @@ middle = low + (high - low) / 2;
|
||||
The following expressions are illegal because of mismatched types:
|
||||
- (a) `p == a[0]` - Comparison between `int *` and `int`
|
||||
The rest of the expressions are true.
|
||||
|
||||
8. Rewrite the following function to use pointer arithmetic...
|
||||
```c
|
||||
void store_zeros(int *a, int n) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
*(a + i) = 0;
|
||||
}
|
||||
}
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user