Compare commits
9 Commits
7d58412a45
...
77e7cdf760
Author | SHA1 | Date | |
---|---|---|---|
![]() |
77e7cdf760 | ||
![]() |
21dd78dedc | ||
![]() |
c7e04c17fb | ||
![]() |
5325bb45e2 | ||
![]() |
a18e3fa00d | ||
![]() |
6bb610f896 | ||
![]() |
75074fe98d | ||
![]() |
56a41f58c6 | ||
![]() |
cae09887da |
@ -0,0 +1,33 @@
|
|||||||
|
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,7 +52,17 @@ int arr_size = sizeof(arr) / sizeof(arr[0]);
|
|||||||
`&` gives you the address of a variable
|
`&` gives you the address of a variable
|
||||||
`*` gives you the value in memory that an address points to.
|
`*` 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
|
# Formatting specifiers
|
||||||
# Standard library
|
# Standard library
|
||||||
## Formatting specifiers
|
## Formatting specifiers
|
||||||
|
@ -23,3 +23,12 @@ middle = low + (high - low) / 2;
|
|||||||
The following expressions are illegal because of mismatched types:
|
The following expressions are illegal because of mismatched types:
|
||||||
- (a) `p == a[0]` - Comparison between `int *` and `int`
|
- (a) `p == a[0]` - Comparison between `int *` and `int`
|
||||||
The rest of the expressions are true.
|
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