chore: use 1a/1b
This commit is contained in:
246
docs/1a/ece105.md
Normal file
246
docs/1a/ece105.md
Normal file
@@ -0,0 +1,246 @@
|
||||
# ECE 105: Classical Mechanics
|
||||
|
||||
## Motion
|
||||
|
||||
Please see [SL Physics 1#2.1 - Motion](/g11/sph3u7/#21-motion) for more information.
|
||||
|
||||
## Kinematics
|
||||
|
||||
Please see [SL Physics 1#Kinematic equations](/g11/sph3u7/#kinematic-equations) for more information.
|
||||
|
||||
## Projectile motion
|
||||
|
||||
Please see [SL Physics 1#Projectile motion](/g11/sph3u7/#projectile-motion) for more information.
|
||||
|
||||
## Uniform circular motion
|
||||
|
||||
Please see [SL Physics 1#6.1 - Circular motion](/g11/sph3u7/#61-circular-motion) for more information.
|
||||
|
||||
## Forces
|
||||
|
||||
Please see [SL Physics 1#2.2 - Forces](/g11/sph3u7/#22-forces) for more information.
|
||||
|
||||
## Work
|
||||
|
||||
Please see [SL Physics 1#2.3 - Work, energy, and power](/g11/sph3u7/#23-work-energy-and-power) for more information.
|
||||
|
||||
## Momentum and impulse
|
||||
|
||||
Please see [SL Physics 1#2.4 - Momentum and impulse](/g11/sph3u7/#24-momentum-and-impulse) for more information.
|
||||
|
||||
The change of momentum with respect to time is equal to the average force **so long as mass is constant**.
|
||||
|
||||
$$\frac{dp}{dt} = \frac{mdv}{dt} + \frac{vdm}{dt}$$
|
||||
|
||||
Impulse is actually the change of momentum over time.
|
||||
|
||||
$$\vec J = \int^{p_f}_{p_i}d\vec p$$
|
||||
|
||||
## Centre of mass
|
||||
|
||||
The centre of mass $x$ of a system is equal to the average of the centre of masses of its components relative to a defined origin.
|
||||
|
||||
$$x_{cm} = \frac{m_1x_1 + m_2x_2 + ... + m_nx_n}{m_1 + m_2 + ... + m_n}$$
|
||||
|
||||
To determine the centre of mass of a system with a hole, the hole should be treated as negative mass. If the geometry of the system is **symmetrical**, the centre of mass is also symmetrical in the x and y dimensions.
|
||||
|
||||
For each mass, its surface density $\sigma$ is equal to:
|
||||
|
||||
$$
|
||||
\sigma = \frac{m}{A} \\
|
||||
m = \sigma A
|
||||
$$
|
||||
|
||||
Holes have negative mass, i.e., $m = -\sigma A$.
|
||||
|
||||
For a **one-dimensional** hole, the linear mass density uses a similar formula:
|
||||
|
||||
$$
|
||||
\lambda =\frac{m}{L} \\
|
||||
\lambda = \frac{dm}{dx}
|
||||
$$
|
||||
|
||||
This means that a hole in a rod can use a different formula:
|
||||
$$x_{cm} = \frac{1}{M}\int^M_0 x\cdot dm$$
|
||||
|
||||
For a solid object, the centre of mass can be expressed as a Riemann sum and thus an integral:
|
||||
|
||||
$$r_{cm} = \frac{1}{M}\int_0^M r\cdot dm$$
|
||||
|
||||
In an **isolated system**, it is guaranteed that the centre of mass of the whole system never changes so long as only rigid bodies are involved.
|
||||
|
||||
## Rotational motion
|
||||
|
||||
### Moment of inertia
|
||||
|
||||
The moment of inertia of an object represents its ability to resist rotation, effectively the rotational equivalent of mass. It is equal to the sum of each point and distance from the axis of rotation.
|
||||
|
||||
$$I=\sum(mr)^2$$
|
||||
|
||||
For more complex objects where the distance often changes:
|
||||
|
||||
$$I=\int^M_0 R^2 dm$$
|
||||
|
||||
#### Common moment shapes
|
||||
|
||||
- Solid cylinder or disc symmetrical to axis: $I = \frac{1}{2}MR^2$
|
||||
- Hoop about symmetrical axis: $I=MR^2$
|
||||
- Solid sphere: $\frac{2}{5}MR^2$
|
||||
- Thin spherical shell: $I=\frac{2}{3}MR^2$
|
||||
- Solid cylinder about the central diameter: $I=\frac{1}{4}MR^2 + \frac{1}{12}ML^2$
|
||||
- Hoop about diameter: $I=\frac{1}{2}MR^2$
|
||||
- Rod about center: $I=\frac{1}{12}ML^2$
|
||||
- Rod about end: $I=\frac{1}{3}ML^2$
|
||||
- Thin rectangular plate about perpendicular axis through center: $I=\frac{1}{3}ML^2$
|
||||
|
||||
### Rotational-translational equivalence
|
||||
|
||||
Most translational variables have a rotational equivalent.
|
||||
|
||||
Although the below should be represented as cross products, this course only deals with rotation perpendicular to the axis, so the following are always true.
|
||||
|
||||
Angular acceleration is related to acceleration:
|
||||
|
||||
$$\alpha = \frac{a}{r}$$
|
||||
|
||||
Angular velocity is related to velocity:
|
||||
|
||||
$$\omega = \frac{v}{r}$$
|
||||
|
||||
The direction of the tangential values can be determined via the right hand rule. Where $r$ is the vector from the **origin to the mass**:
|
||||
|
||||
$$
|
||||
\vec v = r\times\omega \\
|
||||
\vec a = r\times\alpha
|
||||
$$
|
||||
|
||||
And all kinematic equations have their rotational equivalents.
|
||||
|
||||
- $\theta = \frac{1}{2}(\omega_f + \omega_i)t$
|
||||
- $\omega_f = \omega_i + \alpha t$
|
||||
- $\theta = \omega_i t + \frac{1}{2}\alpha t^2$
|
||||
- $\omega_f^2 + \omega_i^2 + 2\alpha\theta$
|
||||
|
||||
Most translational equations also have rotational equivalents.
|
||||
|
||||
$$E_\text{k rot} = \frac{1}{2}I\omega^2$$
|
||||
|
||||
## Torque
|
||||
|
||||
Torque is the rotational equivalent of force.
|
||||
|
||||
$$\vec\tau=I\vec\alpha$$
|
||||
$$\vec\tau=\vec r\times\vec F$$
|
||||
$$|\vec\tau=|r||F|\sin\theta$$
|
||||
|
||||
In the general case, especially when the force is variable, the work done is equal to the integral of force over displacement.
|
||||
|
||||
$$W=\int^{x_f}_{x_i}F_xdx$$
|
||||
|
||||
Work is also related to torque:
|
||||
|
||||
$$W=\tau\Delta\theta$$
|
||||
$$W=F\Delta S$$
|
||||
|
||||
The total net work from torque from external forces is equivalent to:
|
||||
|
||||
$$W=\Delta E_k = \int^{\theta_f}_{\theta_i}\tau d\theta$$
|
||||
|
||||
### Angular momentum
|
||||
|
||||
This is the same as linear momentum.
|
||||
|
||||
$$\vec L = \vec r\times\vec p$$
|
||||
$$\vec L = I\vec\omega$$
|
||||
$$\vec L =\vec\tau t$$
|
||||
|
||||
## Rolling motion
|
||||
|
||||
!!! definition
|
||||
- **Slipping** is sliding faster than spinning.
|
||||
- **Skidding** is spinning faster than sliding.
|
||||
|
||||
Pure rolling motion is **only true if** the tangential velocity of the centre of mass is equal to its rotational velocity.
|
||||
|
||||
$$v_{cm}=R\omega$$
|
||||
|
||||
In pure rolling motion, the point at the top is moving at two times the velocity while the point at the bottom has no tangential velocity.
|
||||
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/8/8d/Velocitats_Roda.svg" width=500>(Source: Wikimedia Commons)</img>
|
||||
|
||||
For any point in the mass:
|
||||
|
||||
$$
|
||||
v_{net} = v_{trans} + v_{rot} \\
|
||||
v_{net} = v_{cm} + \vec R \times\vec\omega \\
|
||||
E_{k roll} = E_{k trans} + E_{k rot}
|
||||
$$
|
||||
|
||||
Alternatively, the rolling can be considered as a rotation about the pivot point between the disk and the ground, allowing rolling motion to be represented as rotational motion around the pivot point. The **parallel axis theorem** can be used to return it back to the original point.
|
||||
|
||||
$$\sum\tau_b=I_b\alpha$$
|
||||
|
||||
At least one external torque and one external force is required to initiate pure rolling motion because the two components are separate.
|
||||
|
||||
If an object is purely rolling and then it moves to:
|
||||
|
||||
- a flat, frictionless surface, it continues purely rolling
|
||||
- an inclined, frictionless surface, external torque is needed to maintain pure rolling motion
|
||||
- an inclined surface with friction, it continues purely rolling
|
||||
|
||||
Where $c$ is the coefficient to the moment of inertia ($I=cMR^2$), while rolling down an incline:
|
||||
|
||||
$$
|
||||
v_{cm} = \sqrt{\frac{2}{1+c}gh} \\
|
||||
a_{cm} = \frac{g\sin\theta}{1+c}
|
||||
$$
|
||||
|
||||
## Statics
|
||||
|
||||
An object at **static equilibrium** has no rotational or translational velocity with zero net force and torque.
|
||||
|
||||
An object at **dynamic equilibrium** has a constant rotational and translational velocity with zero net force and torque.
|
||||
|
||||
$$
|
||||
\sum\vec F = 0 \\
|
||||
\sum\vec\tau = 0
|
||||
$$
|
||||
|
||||
Whether an object *stays* at static equilibrium depends on the
|
||||
|
||||
- It is at **unstable equilibrium** if the object moves away and does not return to equilibrium
|
||||
- It is at **stable equilibrium** if the object returns to its original position and equilibrium
|
||||
- It is **neutral** if the object does not move
|
||||
|
||||
## Simple harmonic motion
|
||||
|
||||
!!! definition
|
||||
- The **amplitude** $A$ of a wave is always greater than zero and is equal to the height of the wave above the axis.
|
||||
- The **angular frequency** $\omega$ is the angular velocity, which is dependent only on the restorative force.
|
||||
- The **phase constant** $\phi$ is the offset from equilibrium at $t=0$.
|
||||
|
||||
Please see [SL Physics 1#Simple harmonic motion](/g11/sph3u7/#simple-harmonic-motion) for more information.
|
||||
|
||||
The position of any periodic motion can be represented as a sine or cosine function (adjust phase as needed).
|
||||
|
||||
$$x(t)=A\cos(\omega t+\phi)$$
|
||||
|
||||
This means that the velocity function has a phase shift of $\frac{\pi}{2}$ and the acceleration function has a phase shift of $\pi$ along with other changes.
|
||||
|
||||
SHM is linked to uniform circular motion:
|
||||
|
||||
- $\phi$ is the angle from the standard axis
|
||||
- $A$ is the radius
|
||||
|
||||
The restorative force can be modelled by substituting in $a(t)$ into $F=ma$
|
||||
|
||||
$$F=-m\omega^2x(t)$$
|
||||
|
||||
Because restoring force is proportional to the negative position for **smaller displacements**, $F=-Cx(t)$.
|
||||
|
||||
Torque is also linear: $\tau=-k\theta$
|
||||
|
||||
!!! warning
|
||||
For small angles, $\sin\theta = \theta$.
|
||||
|
||||
$$\omega=\sqrt{\frac{C}{m}}$$
|
654
docs/1a/ece150.md
Normal file
654
docs/1a/ece150.md
Normal file
@@ -0,0 +1,654 @@
|
||||
# ECE 150: C++
|
||||
|
||||
## Non-decimal numbers
|
||||
|
||||
Binary numbers are prefixed with `0b`.
|
||||
|
||||
!!! example
|
||||
The following two snippets are equivalent:
|
||||
|
||||
```cpp
|
||||
int a{0b110001};
|
||||
```
|
||||
|
||||
```cpp
|
||||
int a{25};
|
||||
```
|
||||
|
||||
To convert from **binary to decimal**, each digit should be treated as a power of two much like in the base 10 system.
|
||||
|
||||
!!! example
|
||||
$$0
|
||||
\text{0b1011}=1\times2^3 + 0\times2^2+1\times2^1+1\times2^0=11
|
||||
$$
|
||||
|
||||
Binary addition is the same as decimal addition except $1+1=10$ and $1+1+1=11$.
|
||||
|
||||
To convert from **decimal to binary**, the number should be repeatedly divided by 2 and the binary number taken from the remainders from bottom to top.
|
||||
|
||||
!!! example
|
||||
$$
|
||||
\begin{align*}
|
||||
13 &= 2\times6 + 1 \\
|
||||
6 &= 2\times3 + 0 \\
|
||||
3 &= 2\times1 + 1 \\
|
||||
1 &= 2\times0 + 1
|
||||
\\
|
||||
&\therefore 13 = \text{0b1101}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
To convert from **binary to hexadecimal**, each group of four digits beginning from the right should be converted to their hexadecimal representation.
|
||||
|
||||
To convert from **hexadecimal to binary**, each hexadecimal digit should be expanded into its four-digit binary representation.
|
||||
|
||||
To convert from **decimal to hexadecimal**, the number should be repeatedly divided by 16 and the hex number taken from the remainders from bottom to top.
|
||||
|
||||
!!! example
|
||||
$$
|
||||
\begin{align*}
|
||||
37 &= 16\times2 + 5 \\
|
||||
2 &= 16\times0 + 2
|
||||
\\
|
||||
&\therefore 37 = \text{0x25}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
## Numbers
|
||||
|
||||
### Integers
|
||||
|
||||
!!! definition
|
||||
- A **carry** occurs if an overflow or underflow happens in an unsigned number.
|
||||
|
||||
The $k$th bit of a number is as known as its **coefficient** because it can be expressed in the form $n\times 2^k$ in binary or $n\times 16^k$ in hexadecimal.
|
||||
|
||||
| Type | Bits | Can store |
|
||||
| --- | --- | --- |
|
||||
| `short` | 16 | $\pm2^{15}-1$ |
|
||||
| `int` | 32 | $\pm2^{31}-1$ |
|
||||
| `long` | 64 | $\pm2^{63}-1$ |
|
||||
| `char` | 8 | N/A |
|
||||
| `unsigned short` | 16 | $2^{16}-1$ |
|
||||
| `unsigned int` | 32 | $2^{32}-1$ |
|
||||
| `unsigned long` | 64 | $2^{64}-1$ |
|
||||
| `unsigned char` | 8 | N/A |
|
||||
|
||||
The `sizeof()` operator evaluates the size the type takes in memory at compile time.
|
||||
|
||||
Signed numbers use the first bit to represent positive or negative numbers. A negative number is equal to the **two's complement** of its positive form. This allows subtraction to be done by taking the two's complement of the subtracter.
|
||||
|
||||
!!! definition
|
||||
The two's complement form of a number flips all bits **but the rightmost digit equal to one**.
|
||||
|
||||
### Floating point numbers
|
||||
|
||||
| Type | Bits | Digits of precision |
|
||||
| --- | --- | --- |
|
||||
| `float` | 32 | ~7 |
|
||||
| `double` | 64 | ~16 |
|
||||
|
||||
Floating point numbers let a computer work with numbers of arbitrary precision. However, the limited digits of precision mean that a small number added to a large number can result in the number not changing. This results in odd scenarios such as:
|
||||
|
||||
$$
|
||||
x+(y+z)\neq(x+y)+z
|
||||
$$
|
||||
|
||||
## References
|
||||
|
||||
The ampersand (&) represents a reference variable and an argument passed into a parameter with an ampersand must be a valid lvalue.
|
||||
|
||||
Effectively, it is a pointer, letting you do weird shit such as:
|
||||
|
||||
```cpp
|
||||
void inc(int &n) {
|
||||
n++;
|
||||
}
|
||||
```
|
||||
|
||||
where the variable passed into `inc` will actually increase in the caller function.
|
||||
|
||||
This can also be used in variable declarations to not create a second local variable:
|
||||
|
||||
```cpp
|
||||
#include <climits>
|
||||
|
||||
double const &pi{M_PI}; // pi links back to M_PI
|
||||
```
|
||||
|
||||
## Arrays
|
||||
|
||||
```cpp
|
||||
// typename identifier[n]{};
|
||||
int array[5]{};
|
||||
int partial[3]{2};
|
||||
int filled[3]{1, 2, 3};
|
||||
```
|
||||
|
||||
Arrays are contiguous in memory and default to 0 when initialised. If field initialised with values, the array will fill the first values as those values and set the rest to 0.
|
||||
|
||||
Because arrays do not check bounds, `array[n+10]` or `array[-5]` will go to the memory address directed without complaint and ruin your day.
|
||||
|
||||
| Pros | Cons |
|
||||
| --- | --- |
|
||||
| Random access is $O(1)$ | $O(n)$ push front |
|
||||
| | Fixed size and unused allocated memory |
|
||||
| | Concatenation is slow |
|
||||
|
||||
### Local arrays
|
||||
|
||||
Local arrays cannot be assigned to nor returned from a function. If an array is marked `const`, its entries cannot be modified.
|
||||
|
||||
Arrays can be passed to functions by reference (via pointer to the first entry).
|
||||
|
||||
## Memory
|
||||
|
||||
!!! definition
|
||||
- **Volatile** memory is erased after the memory is powered off.
|
||||
- **Byte-addressable** memory is memory that has an address for each byte, such that to change a single bit the whole byte must be rewritten.
|
||||
|
||||
Main memory (random access memory, RAM) is volatile and any location in the memory has the same access speed.
|
||||
|
||||
An **address bus** with $n$ lines allows the CPU to update $n/8$ bytes at once (one address bit per line). The number of total memory addresses is limited by the number of lanes in the address bus.
|
||||
|
||||
When a program is run, the operating system (OS) allocates a block of memory for it such that the largest address is at the bottom of the memory block for the program.
|
||||
|
||||
- Instructions (the **code segment**) are stored at the **top** of the block
|
||||
- Constants (the **data segment**, including string literals) are stored **after** the instructions
|
||||
- Local variables (the **call stack**) are stored beginning from the **bottom** of the block
|
||||
|
||||
Dynamically allocated variables and static variables are stored between the call stack and the data segment.
|
||||
|
||||
### Call stack
|
||||
|
||||
The call stack represents memory and variables are allocated space from bottom to top.
|
||||
|
||||
At the moment a function is run, its parameters are allocated space at the bottom, followed by all local variables that **may or may not** be defined.
|
||||
|
||||
The return value of the function overwrites whatever is at the bottom of the function-allocated block such that the caller can simply reach up to get return data.
|
||||
|
||||
!!! warning
|
||||
Arrays are allocated **top-down** such that indexing is made easy.
|
||||
|
||||
## C-style strings
|
||||
|
||||
C-style strings are char arrays that end with a **null terminator** (`\0`). By default, char arrays are initialised with this character.
|
||||
|
||||
If there is not a null terminator, attempting to access a string continues to go down the call stack until a zero byte is found.
|
||||
|
||||
## Dynamic allocation
|
||||
|
||||
Compared to static memory allocation, which is done by the compiler, dynamic memory is managed by the developer, and is stored between the call stack and data segment in the **heap**.
|
||||
|
||||
The `new` operator attempts to allocate its type operand, optionally initialising the variable and returning its memory address.
|
||||
|
||||
```cpp
|
||||
char *c{new char{'i'}};
|
||||
```
|
||||
|
||||
If the operating system cannot allocate that much memory, `std::bad_alloc` is raised, but passing in `nothrow` can return a `nullptr` instead if allocation fails.
|
||||
|
||||
```cpp
|
||||
char *c{new(nothrow) char{`i`}};
|
||||
|
||||
if (c == nullptr) {
|
||||
}
|
||||
```
|
||||
|
||||
The `delete` operator tells the OS that the memory address passed is no longer needed. Generally, it is a good idea to set the deleted pointer afterward to a null pointer.
|
||||
|
||||
```cpp
|
||||
delete c;
|
||||
c = nullptr;
|
||||
```
|
||||
|
||||
If deleting arrays, `delete[]` should be used instead.
|
||||
|
||||
!!! warning
|
||||
Statically allocated memory **cannot be deallocated** manually as it is done so by the compiler, so differentiating the two is generally a good idea.
|
||||
|
||||
### Vectors at home
|
||||
|
||||
Dynamic allocation can be used to mimick an `std::vector` by creating a new array whenever an element would be full and doubling its size, copying all elements over.
|
||||
|
||||
!!! example
|
||||
Sample implementation:
|
||||
|
||||
```cpp
|
||||
std::size_t capacity{10};
|
||||
double *data{new double[capacity]};
|
||||
std::size_t els{0};
|
||||
|
||||
while (true) {
|
||||
double x{};
|
||||
std::cin >> x;
|
||||
|
||||
++els;
|
||||
if (els == capacity) {
|
||||
std::size_t old_capacity{capacity};
|
||||
double *old_data{data};
|
||||
capacity *= 2;
|
||||
data = new double[capacity];
|
||||
|
||||
for (int i{}; i < old_capacity; ++i) {
|
||||
data[i] = old_data[i];
|
||||
}
|
||||
|
||||
delete[] old_data;
|
||||
old_data = nullptr;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Wild pointers
|
||||
|
||||
A wild pointer is any uninitialised pointer. Its behaviour is undefined. Accessing unallocated memory results in a **segmentation fault**, causing the OS to terminate the program.
|
||||
|
||||
!!! warning
|
||||
Occasionally, the OS does not prevent program access to deallocated memory for some time, which may allow the program to reuse garbage pointers, allowing the pointer to work. This causes inconsistent crashing.
|
||||
|
||||
To avoid wild pointers, pointers should always be initialised and set to `nullptr` if not needed even if they would go out of scope.
|
||||
|
||||
### Dangling pointers
|
||||
|
||||
A dangling pointer is one that has been deallocated, which has the same issues as a wild pointer, especially if two pointers have the same address.
|
||||
|
||||
!!! example
|
||||
`p_2` is dangling.
|
||||
|
||||
```cpp
|
||||
int* p_1{};
|
||||
int* p_2{p_1};
|
||||
|
||||
delete p_1;
|
||||
```
|
||||
|
||||
To avoid dangling pointers, pointers should be immediately set to `nullptr` after deleting them. Deleting a `nullptr` is **guaranteed to be safe**.
|
||||
|
||||
### Memory leaks
|
||||
|
||||
A memory leak occurs when a pointer is not freed, such as via an early return or setting a pointer to another pointer. This causes memory usage to grow until the program is terminated.
|
||||
|
||||
!!! example
|
||||
The `new int[20]` has leaked and is no longer accessible to the program but remains allocated memory.
|
||||
```cpp
|
||||
int* p{new int[20]};
|
||||
p = new int[10];
|
||||
```
|
||||
|
||||
## Pointers
|
||||
|
||||
!!! definition
|
||||
- A **pointer** is a variable that stores a memory address.
|
||||
|
||||
The asterisk `*` indicates that the variable is a pointer address and can be **dereferenced**. `&` can convert an identifier to a pointer.
|
||||
|
||||
```cpp
|
||||
int array[10];
|
||||
int *p_array{array};
|
||||
|
||||
int num{2};
|
||||
int *p_num{&num};
|
||||
```
|
||||
|
||||
!!! warning
|
||||
Only **addresses** should be passed when assigning pointer variables — this means that primitive types must be converted first to a reference with `&`.
|
||||
|
||||
The default size of a pointer (the address size) can be found by taking the `sizeof` of any pointer.
|
||||
|
||||
```cpp
|
||||
sizeof(int*);`
|
||||
```
|
||||
|
||||
The memory at the location of the pointer can be accessed by setting the pointer as the lvalue:
|
||||
|
||||
```cpp
|
||||
*var = 100;
|
||||
```
|
||||
|
||||
The `const` modifier only makes constant the value immediately after `const`, meaning that the expression after it cannot be used as an lvalue.
|
||||
|
||||
!!! example
|
||||
```cpp
|
||||
int* const p_x{&x};
|
||||
|
||||
p_x = &y; // not allowed
|
||||
*p_x = y; // allowed
|
||||
```
|
||||
|
||||
```cpp
|
||||
int const *p_x{&x};
|
||||
|
||||
p_x = &y; // allowed
|
||||
*p_x = y; // not allowed
|
||||
```
|
||||
|
||||
```cpp
|
||||
int const * const p_x{&x};
|
||||
|
||||
p_x = &y; // not allowed
|
||||
*p_x = y; // not allowed
|
||||
```
|
||||
|
||||
Pointers to `const` values must also be `const`.
|
||||
|
||||
!!! example
|
||||
BAD:
|
||||
```cpp
|
||||
const int x = 2;
|
||||
int *p_x{&x};
|
||||
```
|
||||
|
||||
GOOD:
|
||||
```cpp
|
||||
const int x = 2;
|
||||
int const *p_x{&x};
|
||||
```
|
||||
|
||||
## Sorting algorithms
|
||||
|
||||
### Selection sort
|
||||
|
||||
Selection sort takes the largest item in the array each time and adds it to the end.
|
||||
|
||||
```rust
|
||||
fn selection_sort(array: &mut [i32]) {
|
||||
for i in (0..array.len()).rev() {
|
||||
let mut max_index = 0;
|
||||
for j in 0..i + 1 {
|
||||
if array[j] > array[max_index] {
|
||||
max_index = j;
|
||||
}
|
||||
}
|
||||
let _ = &array.swap(i, max_index);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Insertion sort
|
||||
|
||||
Insertion sort assumes the first element of the array is sorted and expands that partition by moving each element afterward to the correct spot.
|
||||
|
||||
```rust
|
||||
fn insertion_sort(array: &mut [i32]) {
|
||||
for i in 1..array.len() {
|
||||
let mut temp = array[0];
|
||||
for j in 0..i {
|
||||
if array[j] < array[i] {
|
||||
temp = array[i];
|
||||
for k in (j..i).rev() {
|
||||
array[k + 1] = array[k]
|
||||
}
|
||||
array[j] = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Recursion
|
||||
|
||||
### Merge sort
|
||||
|
||||
Merge sort is a recursive sorting algorithm with the following pseudocode:
|
||||
|
||||
- If the array length is one or less, do not modify the array
|
||||
- Otherwise, split the array into two halves and call merge sort on both halves
|
||||
- Merge the split arrays together in sorted order (adding each in sequence such that it is sorted)
|
||||
|
||||
```cpp
|
||||
void merge_sort( double array[], std::size_t capacity ) {
|
||||
if ( capacity <= 1 ) {
|
||||
return;
|
||||
} else {
|
||||
std::size_t capacity_1{ capacity/2 };
|
||||
std::size_t capacity_2{ capacity - capacity_1 };
|
||||
|
||||
merge_sort( array, capacity_1 );
|
||||
merge_sort( array + capacity_1, capacity_2 );
|
||||
|
||||
merge( array, capacity_1, capacity_2 );
|
||||
}
|
||||
}
|
||||
|
||||
void merge( double array[], std::size_t cap_1,
|
||||
std::size_t cap_2 ) {
|
||||
double tmp_array[cap_1 + cap_2];
|
||||
|
||||
std::size_t k1{0};
|
||||
std::size_t k2{cap_1};
|
||||
std::size_t kt{0};
|
||||
|
||||
// As long as not everything in each half is not
|
||||
// copied over, copy the next smallest entry into the
|
||||
// temporary array.
|
||||
while ( (k1 < cap_1) && (k2 < cap_1 + cap_2 ) ) {
|
||||
if ( array[k1] <= array[k2] ) {
|
||||
tmp_array[kt] = array[k1];
|
||||
++k1;
|
||||
} else {
|
||||
tmp_array[kt] = array[k2];
|
||||
++k2;
|
||||
}
|
||||
|
||||
++kt;
|
||||
}
|
||||
|
||||
// Copy all entries left from the left half (if any)
|
||||
// to the temporary array.
|
||||
while ( k1 < cap_1 ) {
|
||||
tmp_array[kt] = array[k1];
|
||||
++k1;
|
||||
++kt;
|
||||
}
|
||||
|
||||
// Copy all entries left from the right half (if any)
|
||||
// to the temporary array.
|
||||
while ( k2 < cap_1 + cap_2 ) {
|
||||
tmp_array[kt] = array[k2];
|
||||
++k2;
|
||||
++kt;
|
||||
}
|
||||
|
||||
// Copy all the entries back to the original array.
|
||||
for ( std::size_t k{0}; k < (cap_1 + cap_2); ++k ) {
|
||||
array[k] = tmp_array[k];
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Classes
|
||||
|
||||
By convention, class member variables are suffixed with an underscore.
|
||||
|
||||
Classes inherently have two default constructors — one if passed another version of itself and one if the user does not define one, using the list of `public` variables.
|
||||
|
||||
!!! example
|
||||
the following initialisers both do the same thing — they both copy `earth` into a new variable (not by reference).
|
||||
|
||||
```cpp
|
||||
Body earth{};
|
||||
|
||||
Body tmp{earth};
|
||||
Body tmp2 = earth;
|
||||
```
|
||||
|
||||
### Namespaces
|
||||
|
||||
Namespaces allow definitions to be scoped, such as `std`.
|
||||
|
||||
```cpp
|
||||
namespace eggy {
|
||||
std::string name{"eggy"};
|
||||
std::string get_name() {
|
||||
return eggy::name;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Namespaces can also be nested within namespaces.
|
||||
|
||||
!!! warning
|
||||
`std::cout` does weird shenanigans that passes itself to every function afterward, such as `std::endl`.
|
||||
|
||||
This means that `std::cout << std::endl;` is equivalent to `std::endl(std::cout);`.
|
||||
|
||||
### Operator overloading
|
||||
|
||||
Operators can be overloaded for various classes.
|
||||
|
||||
!!! example
|
||||
Overloading for displaying to `cout`:
|
||||
|
||||
```cpp
|
||||
std::ostream operator<<(std::ostream &out, ClassName const &p) {
|
||||
out << "text here";
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
### Constructors
|
||||
|
||||
Constructors can be defined with default values after a colon and before the function body:
|
||||
|
||||
```cpp
|
||||
Rational::Rational():
|
||||
numer_{0},
|
||||
denom_{0} {
|
||||
}
|
||||
```
|
||||
|
||||
Subsequent members can even use the values of previous ones.
|
||||
|
||||
Constructors can also contain parameters with default values, but default values must also be present in the class declaration.
|
||||
|
||||
### Member functions
|
||||
|
||||
A `const` after a member function forbids the modification of any member variables within that function.
|
||||
|
||||
```cpp
|
||||
int get_val() const {
|
||||
}
|
||||
```
|
||||
|
||||
## Exceptions
|
||||
|
||||
`#define NDEBUG` turns off assertions.
|
||||
|
||||
`static_cast<double>(var)` performs the typical implicit conversion explicitly during compile time.
|
||||
|
||||
Exceptions are expensive error handlers that **do not protect** from program termination (e.g., attempt to access invalid memory).
|
||||
|
||||
The following are all exception classes in `std`:
|
||||
|
||||
- `domain_error`
|
||||
- `runtime_error`
|
||||
- `range_error`
|
||||
- `overflow_error`
|
||||
- `underflow_error`
|
||||
- `logic_error`
|
||||
- `length_error`
|
||||
- `out_of_range`
|
||||
|
||||
`...` is a catch-all exception.
|
||||
|
||||
!!! example
|
||||
```cpp
|
||||
try {
|
||||
throw std::domain_error{"cannot compute stupidity"};
|
||||
} catch (std::domain_error &e) {
|
||||
std::cerr << e->what();
|
||||
} catch (...) {
|
||||
}
|
||||
```
|
||||
|
||||
## Copies and moves
|
||||
|
||||
The copy constructor by default copies **the value** of every public and private field, including pointers, both from field initialisation or assignment.
|
||||
|
||||
```cpp
|
||||
MyClass n{};
|
||||
MyClass m{n}; // copy
|
||||
MyClass p = n; // copy
|
||||
```
|
||||
|
||||
The move constructor copies every field from the other object and resets the original object to no longer point to that data, typically called only via `std::move`.
|
||||
|
||||
```cpp
|
||||
MyClass a{};
|
||||
MyClass b{std::move(a)};
|
||||
```
|
||||
|
||||
It is an excellent idea to blank out the two constructors to do nothing so that unexpected behaviour does not occur.
|
||||
|
||||
```cpp
|
||||
class MyClass {
|
||||
public:
|
||||
MyClass(MyClass const &rhs) = delete;
|
||||
MyClass(MyClass &&rhs) = delete;
|
||||
MyClass &operator=(MyClass const &rhs) = delete;
|
||||
MyClass &operator=(MyClass &&rhs) = delete;
|
||||
}
|
||||
```
|
||||
|
||||
If a move occurs and the compiler determines that the original object is no longer needed, its destructor is automatically called immediately after the constructor / assignment finishes.
|
||||
|
||||
During construction, default initialisation picks the one with the fewest parameters if ambiguous. Parameters passed by value are **copied** by reference via the copy constructor.
|
||||
|
||||
Much like statically allocated arrays, dynamically allocated arrays also automatically dereference when accessed by index.
|
||||
|
||||
## Linked lists
|
||||
|
||||
Dynamic memory allocation for many objects instead of one like arrays is slow.
|
||||
|
||||
## Inheritance
|
||||
|
||||
All member functions and the destructor must be `virtual` functions if they can be inherited.
|
||||
|
||||
```cpp
|
||||
class Base {
|
||||
public:
|
||||
Base();
|
||||
virtual ~Base();
|
||||
virtual Base get_base() const;
|
||||
virtual void set_base();
|
||||
virtual void do_base() const;
|
||||
```
|
||||
|
||||
A class that inherits another should contain `public <Base>` after the name of the class. Overriden functions must have `override` if they should have the same type signature. Otherwise, they reference the base function.
|
||||
|
||||
```cpp
|
||||
class ExtendedBase: public Base {
|
||||
public:
|
||||
ExtendedBase();
|
||||
Base get_base() const override;
|
||||
void set_base() override;
|
||||
virtual void do_base() override;
|
||||
}
|
||||
```
|
||||
|
||||
Functions can be overriden completely ignoring the function signature by excluding the `override` keyword.
|
||||
|
||||
The base class's functions implicitly refer to the current class, so they can be directly called:
|
||||
|
||||
```cpp
|
||||
void set_base() override {
|
||||
Base::set_base();
|
||||
}
|
||||
```
|
||||
|
||||
### protected
|
||||
|
||||
The `protected` access keyword only allows the original class as well as classes that extend the original one to access it.
|
||||
|
||||
### Extending exceptions
|
||||
|
||||
Exceptions should have two constructors: one for a char array pointer and another a string for the exception message, as well as any additional parameters as desired. The base exception constructor (not `std::exception` because that can't be instantiated`) should be called to do all of the base constructor things.
|
||||
|
||||
In addition, a `what()` function with the following signature should always be defined that cannot throw an exception, returning a C-style array.
|
||||
|
||||
```cpp
|
||||
char const *error::what() const noexcept;
|
||||
```
|
1076
docs/1a/math115.md
Normal file
1076
docs/1a/math115.md
Normal file
File diff suppressed because it is too large
Load Diff
754
docs/1a/math117.md
Normal file
754
docs/1a/math117.md
Normal file
@@ -0,0 +1,754 @@
|
||||
# MATH 117: Calculus 1
|
||||
|
||||
## Functions
|
||||
|
||||
A **function** is a rule where each input has exactly one output, which can be determined by the **vertical line test**.
|
||||
|
||||
!!! definition
|
||||
- The **domain** is the set of allowable independent values.
|
||||
- The **range** is the set of allowable dependent values.
|
||||
|
||||
Functions can be **composed** to apply the result of one function to another.
|
||||
$$
|
||||
(f\circ g)(x) = f(g(x))
|
||||
$$
|
||||
|
||||
!!! warning
|
||||
Composition is not commutative: $f\circ g \neq g\circ f$.
|
||||
|
||||
## Inverse functions
|
||||
|
||||
The inverse of a function swaps the domain and range of the original function: $f^{-1}(x)$ is the inverse of $f(x)$.. It can be determined by solving for the other variable:
|
||||
$$
|
||||
\begin{align*}
|
||||
y&=mx+b \\
|
||||
y-b&=mx \\
|
||||
x&=\frac{y-b}{m}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
Because the domain and range are simply swapped, the inverse function is just the original function reflected across the line $y=x$.
|
||||
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/1/11/Inverse_Function_Graph.png" width=300>(Source: Wikimedia Commons, public domain)</img>
|
||||
|
||||
If the inverse of a function is applied to the original function, the original value is returned.
|
||||
$$f^{-1}(f(x)) = x$$
|
||||
|
||||
A function is **invertible** only if it is "**one-to-one**": each output must have exactly one input. This can be tested via a horizontal line test of the original function.
|
||||
|
||||
If a function is not invertible, restricting the domain may allow a **partial inverse** to be defined.
|
||||
|
||||
!!! example
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/7/70/Inverse_square_graph.svg">(Source: Wikimedia Commons, public domain)</img>
|
||||
By restricting the domain to $[0,\inf]$, the **multivalued inverse function** $y=\pm\sqrt{x}$ is reduced to just the partial inverse $y=\sqrt{x}$.
|
||||
|
||||
## Symmetry
|
||||
An **even function** satisfies the property that $f(x)=f(-x)$, indicating that it is unchanged by a reflection across the y-axis.
|
||||
|
||||
An **odd function** satisfies the property that $-f(x)=f(-x)$, indicating that it is unchanged by a 180° rotation about the origin.
|
||||
|
||||
The following properties are always true for even and odd functions:
|
||||
|
||||
- even × even = even
|
||||
- odd × odd = even
|
||||
- even × odd = odd
|
||||
|
||||
Functions that are symmetric (that is, both $f(x)$ and $f(-x)$ exist) can be split into an even and odd component. Where $g(x)$ is the even component and $h(x)$ is the odd component:
|
||||
$$
|
||||
\begin{align*}
|
||||
f(x) &= g(x) + h(x) \\
|
||||
g(x) &= \frac{1}{2}(f(x) + f(-x)) \\
|
||||
h(x) &= \frac{1}{2}(f(x) - f(-x))
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
!!! note
|
||||
The hyperbolic sine and cosine are the even and odd components of $f(x)=e^x$.
|
||||
$$
|
||||
\cosh x = \frac{1}{2}(e^x + e^{-x}) \\
|
||||
\sinh x = \frac{1}{2}(e^x - e^{-x})
|
||||
$$
|
||||
|
||||
## Piecewise functions
|
||||
|
||||
A piecewise function is one that changes formulae at certain intervals. To solve piecewise functions, each of one's intervals should be considered.
|
||||
|
||||
### Absolute value function
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
|x| = \begin{cases}
|
||||
x &\text{ if } x\geq 0 \\
|
||||
-x &\text{ if } x < 0
|
||||
\end{cases}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
### Signum function
|
||||
|
||||
The signum function returns the sign of its argument.
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
\text{sgn}(x)=\begin{cases}
|
||||
-1 &\text{ if } x < 0 \\
|
||||
0 &\text{ if } x = 0 \\
|
||||
1 &\text{ if } x > 0
|
||||
\end{cases}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
### Ramp function
|
||||
|
||||
The ramp function makes a ramp through the origin that suddenly flatlines at 0. Where $c$ is a constant:
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
r(t)=\begin{cases}
|
||||
0 &\text{ if } x \leq 0 \\
|
||||
ct &\text{ if } x > 0
|
||||
\end{cases}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/c/c9/Ramp_function.svg" width=700>(Source: Wikimedia Commons, public domain)</img>
|
||||
|
||||
### Floor and ceiling functions
|
||||
|
||||
The floor function rounds down.
|
||||
$$\lfloor x\rfloor$$
|
||||
|
||||
The ceiling function rounds up.
|
||||
$$\lceil x \rceil$$
|
||||
|
||||
### Fractional part function
|
||||
|
||||
In a nutshell, the fractional part function:
|
||||
|
||||
- returns the part **after the decimal point** if the number is positive
|
||||
- returns 1 - **the part after the decimal point** if the number is negative
|
||||
|
||||
$$\text{FRACPT}(x) = x-\lfloor x\rfloor$$
|
||||
|
||||
Because this function is periodic, it can be used to limit angles to the $[0, 2\pi)$ range with:
|
||||
$$f(\theta) = 2\pi\cdot\text{FRACPT}\biggr(\frac{\theta}{2\pi}\biggr)$$
|
||||
|
||||
### Heaviside function
|
||||
|
||||
The Heaviside function effectively returns a boolean whether the number is greater than 0.
|
||||
$$
|
||||
\begin{align*}
|
||||
H(x) = \begin{cases}
|
||||
0 &\text{ if } t < 0 \\
|
||||
1 &\text{ if } t \geq 0
|
||||
\end{cases}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
This can be used to construct other piecewise functions by enabling them with $H(x-a)$ as a factor, where $a$ is the interval.
|
||||
|
||||
In a nutshell:
|
||||
|
||||
- $1-H(t-a)$ lets you "turn a function off" at at $t=a$
|
||||
- $H(t-a)$ lets you "turn a function on at $t=a$
|
||||
- $H(t-a) - H(t-b)$ leaves a function on in the interval $(a, b)$
|
||||
|
||||
!!! example
|
||||
TODO: example for converting piecewise to heaviside via collecting heavisides
|
||||
|
||||
and vice versa
|
||||
|
||||
## Periodicity
|
||||
|
||||
The function $f(t)$ is periodic only if there is a repeating pattern, i.e. such that for every $x$, there is an $f(x) = f(x + nT)$, where $T$ is the period and $n$ is any integer.
|
||||
|
||||
### Circular motion
|
||||
|
||||
Please see [SL Physics 1#6.1 - Circular motion](/g11/sph3u7/#61-circular-motion) and its subcategory "Angular thingies" for more information.
|
||||
|
||||
## Partial function decomposition (PFD)
|
||||
|
||||
In order to PFD:
|
||||
|
||||
1. Factor the denominator into *irreducibly* quadratic or linear terms.
|
||||
2. For each factor, create a term. Where capital letters below are constants:
|
||||
- A linear factor $Bx+C$ has a term $\frac{A}{Bx+C}$.
|
||||
- An *irreducibly* quadratic factor $Dx^2+Ex+G$ has a term $\frac{Hx+J}{Dx^2+Ex+G}$.
|
||||
- Duplicate factors have terms with denominators with that factor to the power of 1 up to the number of times the factor is present in the original.
|
||||
4. Set the two equal to each other such that the denominators can be factored out.
|
||||
5. Create systems of equations to solve for each constant.
|
||||
|
||||
!!! example
|
||||
To decompose $\frac{x}{(x+1)(x^2+x+1)}$:
|
||||
$$
|
||||
\begin{align*}
|
||||
\frac{x}{(x+1)(x^2+x+1)} &= \frac{A}{x+1} + \frac{Bx+C}{x^2+x+1} \\
|
||||
&= \frac{A(x^2+x+1) + (Bx+C)(x+1)}{(x+1)(x^2+x+1)} \\
|
||||
x &= A(x^2+x+1) + (Bx+C)(x+1) \\
|
||||
0x^2 + x + 0 &= (Ax^2 + Bx^2) + (Ax + Bx + Cx) + (A + C) \\
|
||||
\\
|
||||
&\begin{cases}
|
||||
0 = A + B \\
|
||||
1 = A + B + C \\
|
||||
0 = A + C
|
||||
\end{cases}
|
||||
\\
|
||||
A &= -1 \\
|
||||
B &= 1 \\
|
||||
C &= 1 \\
|
||||
\\
|
||||
∴ \frac{x}{(x+1)(x^2+x+1)} &= -\frac{1}{x+1} + \frac{x + 1}{x^2 + x + 1}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
## Trigonometry
|
||||
|
||||
1 radian represents the angle when the length of the arc of a circle is equal to the radius. Where $s$ is the arc length:
|
||||
|
||||
$$\theta=\frac{s}{r}$$
|
||||
|
||||
The following table indicates the special angles that should be memorised:
|
||||
|
||||
| Angle (rad) | 0 | $\frac{\pi}{6}$ | $\frac{\pi}{4}$ | $\frac{\pi}{3}$ | $\frac{\pi}{2}$ | $\pi$ |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| cos | 1 | $\frac{\sqrt{3}}{2}$ | $\frac{\sqrt{2}}{2}$ | $\frac{1}{2}$ | 0 | -1 |
|
||||
| sin | 0 | $\frac{1}{2}$ | $\frac{\sqrt{2}}{2}$ | $\frac{\sqrt{3}}{2}$ | 1 | 0 |
|
||||
| tan | 0 | $\frac{\sqrt{3}}{3}$ | 1 | $\sqrt{3}$ | not allowed | 0 |
|
||||
|
||||
### Identities
|
||||
|
||||
The Pythagorean identity is the one behind right angle triangles:
|
||||
|
||||
$$\cos^2\theta+\sin^2\theta = 1$$
|
||||
|
||||
Cosine and sine can be converted between by an angle shift:
|
||||
|
||||
$$
|
||||
\cos\biggr(\theta-\frac{\pi}{2}\biggr) = \sin\theta \\
|
||||
\sin\biggr(\theta-\frac{\pi}{2}\biggr) = \cos\theta
|
||||
$$
|
||||
|
||||
The **angle sum identities** allow expanding out angles:
|
||||
|
||||
$$
|
||||
\cos(a+b)=\cos a\cos b - \sin a\sin b \\
|
||||
\sin(a+b)=\sin a\cos b + \cos a\sin b
|
||||
$$
|
||||
|
||||
Subtracting angles is equal to the conjugates of the angle sum identities.
|
||||
|
||||
The **double angle identities** simplify the angle sum identity for a specific case.
|
||||
|
||||
$$
|
||||
\sin2\theta = 2\sin\theta\cos\theta \\
|
||||
$$
|
||||
|
||||
The **half angle formulas** are just random shit.
|
||||
|
||||
$$
|
||||
1+\tan^2\theta = \sec^2\theta \\
|
||||
\cos^2\theta = \frac{1}{2}(1+\cos2\theta) \\
|
||||
\sin^2\theta = \frac{1}{2}(1-\cos2\theta)
|
||||
$$
|
||||
|
||||
### Inverse trig functions
|
||||
|
||||
Because extending the domain does not pass the horizontal line test, for engineering purposes, inverse sine is only the inverse of sine so long as the angle is within $[-\frac{\pi}{2}, \frac{\pi}{2}]$. Otherwise, it is equal to that version mod 2 pi.
|
||||
|
||||
$$y=\sin^{-1}x \iff x=\sin y, y\in [-\frac{\pi}{2}, \frac{\pi}{2}]$$
|
||||
|
||||
This means that $x\in[-1, 1]$.
|
||||
|
||||
$$
|
||||
\sin(\sin^{-1}x) = x \\
|
||||
\sin^{-1}(\sin x) = x \text{ only if } x\in[-\frac{\pi}{2}, \frac{\pi}{2}]
|
||||
$$
|
||||
|
||||
Similarly, inverse **cosine** only returns values within $[0,\pi]$.
|
||||
|
||||
Similarly, inverse **tangent** only returns values within $(-\frac{\pi}{2}, \frac{\pi}{2})$. However, $\tan^{-1}$ is defined for all $x\in\mathbb R$.
|
||||
|
||||
Although most of the reciprocal function rules can be derived, secant is only valid in the odd range $[-\pi, -\frac{\pi}{2})\cup [0, \frac{\pi}{2})$, and returns values $(-\infty, -1]\cup [1, \infty)$.
|
||||
|
||||
### Electrical signals
|
||||
|
||||
Waves are commonly presented in the following format, where $A$ is a **positive** amplitude:
|
||||
|
||||
$$g(t)=A\sin(\omega t + \alpha)$$
|
||||
|
||||
In general, if given a sum of a sine and cosine:
|
||||
|
||||
$$a\sin\omega t + b\cos\omega t = \sqrt{a^2 + b^2}\sin(\omega t + \alpha)$$
|
||||
|
||||
The sign of $\alpha$ should be determined via its quadrant via the signs of $a$ (sine) and $b$ (cosine) via the CAST rule.
|
||||
|
||||
!!! example
|
||||
Given $y=5\cos 2t - 3\sin 2t$:
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
A\sin (2t+\alpha) &= A\sin 2t\cos\alpha + A\cos 2t\sin\alpha \\
|
||||
&= (A\cos\alpha)\sin 2t + (A\sin\alpha)\cos 2t \\
|
||||
\\
|
||||
\begin{cases}
|
||||
A\sin\alpha = 5 \\
|
||||
A\cos\alpha = -3
|
||||
\end{cases}
|
||||
\\
|
||||
\\
|
||||
A^2\sin^2\alpha + A^2\cos^2\alpha &= 5^2 + (-3)^2 \\
|
||||
A^2 &= 34 \\
|
||||
A &= \sqrt{34} \\
|
||||
\\
|
||||
\alpha &= \tan^{-1}\frac{5}{3} \\
|
||||
&\text{since sine is positive and cosine is negative, the angle is in Q3} \\
|
||||
∴ \alpha &= \tan^{-1}\frac{5}{3} + \pi
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
## Limits
|
||||
|
||||
### Limits of sequences
|
||||
|
||||
!!! definition
|
||||
- A **sequence** is an infinitely long list of numbers with the **domain** of all natural numbers (may also include 0).
|
||||
- A sequence that does not converge is a **diverging** sequence.
|
||||
|
||||
A sequence is typically denoted via braces.
|
||||
|
||||
$$\{a_n\}\text{ or } \{a_n\}^\infty_{n=0}$$
|
||||
|
||||
Sometimes sequences have formulae.
|
||||
|
||||
$$\left\{\frac{5^n}{3^n}\right\}^\infty_{n=0}$$
|
||||
|
||||
The **limit** of a sequence is the number $L$ that the sequence **converges** to as $n$ increases, which can be expressed in either of the two ways below:
|
||||
|
||||
$$
|
||||
a_n \to L \text{ as } n\to\infty \\
|
||||
\lim_{n\to\infty}a_n=L
|
||||
$$
|
||||
|
||||
: > Specifically, a sequence $\{a_n\}$ converges to limit $L$ if, for any positive number $\epsilon$, there exists an integer $N$ such that $n>N \Rightarrow |a_n - L | < \epsilon$.
|
||||
|
||||
Effectively, if there is always a term number that would lead to the distance between the sequence at that term and the limit to be less than any arbitrarily small $\epsilon$, the sequence has the claimed limit.
|
||||
|
||||
!!! example
|
||||
A limit can be proved to exist with the above definition. To prove $\left\{\frac{1}{\sqrt{n}}\right\}\to0$ as $n\to\infty$:
|
||||
$$
|
||||
\begin{align*}
|
||||
\text{Proof:} \\
|
||||
n > N &\Rightarrow \left|\frac{1}{\sqrt{n}} - 0\right| < \epsilon \\
|
||||
&\Rightarrow \frac{1}{\epsilon^2} < n
|
||||
\end{align*} \\
|
||||
\ce{Let \epsilon\ be any positive number{.} If n > \frac{1}{\epsilon^2}, then \frac{1}{\sqrt{n}}-> 0 as n -> \infty{.}}
|
||||
$$
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 1#Limits](/g11/mhf4u7/#limits) for more information.
|
||||
|
||||
The **squeeze theorem** states that if a sequence lies between two other converging sequences with the same limit, it also converges to this limit. That is, if $a_n\to L$ and $c_n\to L$ as $n\to\infty$, and $a_n\leq b_n\leq c_n$ is **always true**, $b_n\to L$.
|
||||
|
||||
!!! example
|
||||
$\left\{\frac{\sin n}{n}\right\}$: since $-1\leq\sin n\leq 1$, $\frac{-1}{n}\leq\frac{\sin n}{n}\leq \frac{1}{n}$. Since both other functions converge at 0, and sin(n) is always between the two, sin(n) thus also converges at 0 as n approaches infinity.
|
||||
|
||||
If function $f$ is continuous and $\lim_{n\to\infty}a_n$ exists:
|
||||
|
||||
$$\lim_{n\to\infty}f(a_n)=f\left(\lim_{n\to\infty}a_n\right)$$
|
||||
|
||||
On a side note:
|
||||
|
||||
$$\lim_{n\to\infty}\tan^{-1} n = \frac{\pi}{2}$$
|
||||
|
||||
### Limits of functions
|
||||
|
||||
The definition is largely the same as for the limit of a sequence:
|
||||
|
||||
: > A function $f(x)\to L$ as $x\to a$ if, for any positive $\epsilon$, there exists a number $\delta$ such that $0<|x-a|<\delta\Rightarrow|f(x)-L|<\epsilon$.
|
||||
|
||||
Again, for the limit to be true, there must be a value $x$ that makes the distance between the function and the limit less than any arbitrarily small $\epsilon$.
|
||||
|
||||
The extra $0 <$ is because the behaviour for when $x=a$, which may or may not be defined, is irrelevant.
|
||||
|
||||
!!! example
|
||||
To prove $3x-2\to 4$ as $x\to 2$:
|
||||
$$
|
||||
\ce{for any \epsilon\ > 0, there is a \delta\ > 0\ such that:}
|
||||
$$
|
||||
$$
|
||||
\begin{align*}
|
||||
|x-2| < \delta &\Rightarrow|(3x-2) - 4| &< \epsilon \\
|
||||
&\Leftarrow |(3x-2) -4| &< \epsilon \\
|
||||
&\Leftarrow |3x-6| &< \epsilon \\
|
||||
&\Leftarrow |x-2| &< \frac{\epsilon}{3} \\
|
||||
\delta &= \frac{\epsilon}{3}
|
||||
\end{align*}
|
||||
$$
|
||||
$$
|
||||
\ce{Let \epsilon\ be any positive number{.} If }|x-2|<\frac{\epsilon}{3}, \\
|
||||
\text{then }|(3x-2)-4|<\epsilon\text{. Therefore }3x-2\to 4\text{ as }x\to 2.
|
||||
$$
|
||||
|
||||
!!! warning
|
||||
When solving for limits, negatives have to be considered if the limit approaches a negative number:
|
||||
|
||||
$$\lim_{x\to -\infty}\frac{x}{\sqrt{4x^2-3}} = \frac{1}{-\frac{1}{\sqrt{x}^2}\sqrt{4x^2-3}}$$
|
||||
|
||||
As the angle in **radians** of an arc approaches 0, it is nearly equal to the sine (vertical component).
|
||||
|
||||
$$
|
||||
\lim_{\theta\to 0}\frac{\sin\theta}{\theta} = 1
|
||||
$$
|
||||
|
||||
This function is commonly used in engineering and is known as the sinc function.
|
||||
|
||||
$$
|
||||
\text{sinc}(x) = \begin{cases}
|
||||
\frac{\sin x}{x}&\text{ if }x\neq 0 \\
|
||||
0&\text{ if }x=0
|
||||
\end{cases}
|
||||
$$
|
||||
|
||||
## Continuity
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 1#Limits and continuity](/g11/mhf4u7/#limits-and-continuity) for more information.
|
||||
|
||||
Most common functions can be assumed to be continuous (e.g., $\sin x,\cos x, x, \sqrt{x}, \frac{1}{x}, e^x, \ln x$, etc.).
|
||||
|
||||
: > $f(x)$ is continuous in an interval if for any $x$ and $y$ in the interval and any positive number $\epsilon$, there exists a number $\delta$ such that $|x-y|<\delta\Rightarrow |f(x)-f(y)| < \epsilon$.
|
||||
|
||||
Effectively, if $f(x)$ can be made infinitely close to $f(y)$ by making $x$ closer to $y$, the function is continuous.
|
||||
|
||||
If two functions are continuous:
|
||||
|
||||
- $(f\circ g)(x)$ is continuous
|
||||
- $(f\pm g)(x)$ is continuous
|
||||
- $(fg)(x)$ is continuous
|
||||
- $\frac{1}{f(x)}$ is continuous anywhere $f(x)\neq 0$
|
||||
|
||||
### Intermediate value theorem
|
||||
|
||||
The IVT states that if a function is continuous and there is a point between two other points, its term must also be between those two other points.
|
||||
|
||||
: > If $f(x)$ is continuous, if $f(a)\leq C\leq f(b)$, there must be a number $c\in[a,b]$ where $f(c)=C$.
|
||||
|
||||
The theorem is used to validate using binary search to find roots (guess and check).
|
||||
|
||||
### Extreme value theorem
|
||||
|
||||
The EVT states that any function continuous within a **closed** interval has at least one maximum and minimum.
|
||||
: > If $f(x)$ is continuous in the **closed interval** $[a, b]$, there exist numbers $c$ and $d$ in $[a,b]$ such that $f(c)\leq f(x)\leq f(d)$.
|
||||
|
||||
## Derivatives
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 1#Rate of change](/g11/mhf4u7/#rate-of-change) and [SL Math - Analysis and Approaches#Derivatives](/g11/mhf4u7/#derivatives) for more information.
|
||||
|
||||
The derivative of a function $f(x)$ at $a$ is determined by the following limit:
|
||||
|
||||
$$\lim_{x\to a}\frac{f(x)-f(a)}{x-a}$$
|
||||
|
||||
If the limit does not exist, the function is **not differentiable at $a$**.
|
||||
|
||||
Alternative notations for $f'(x)$ include $\dot f(x)$ and $Df$ (which is equal to $\frac{d}{dx}f(x)$).
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 1#Finding derivatives using first principles](/g11/mhf4u7/#finding-derivatives-using-first-principles) and [SL Math - Analysis and Approaches 1#Derivative rules](/g11/mhf4u7/#derivative-rules) for more information.
|
||||
|
||||
Some examples of derivatives of inverse functions:
|
||||
|
||||
- $\frac{d}{dx}f^{-1}(x) = \frac{1}{\frac{dx}{dy}}$
|
||||
- $\frac{d}{dx}\sin^{-1} x = \frac{1}{\sqrt{1-x^2}}$
|
||||
- $\frac{d}{dx}\cos^{-1} x = -\frac{1}{\sqrt{1-x^2}}$
|
||||
- $\frac{d}{dx}\tan^{-1} x = \frac{1}{1+x^2}$
|
||||
- $\frac{d}{dx}\log_a x = \frac{1}{(\ln a) x}$
|
||||
- $\frac{d}{dx}a^x = (\ln a)a^x$
|
||||
|
||||
### Implicit differentiation
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 1#Implicit differentiation](/g11/mhf4u7/#implicit-differentiation) for more information.
|
||||
|
||||
### Mean value theorem
|
||||
|
||||
The MVT states that the average slope between two points will be reached at least once between them if the function is differentiable.
|
||||
|
||||
: > If $f(x)$ is continuous in $[a, b]$ and differentiable in $(a, b)$, respectively, there must be a $c\in(a,b)$ such that $f'(c)=\frac{f(b)-f(a)}{b-a}$.
|
||||
|
||||
### L'Hôpital's rule
|
||||
|
||||
As long as $\frac{f(x)}{g(x)} = \frac{0}{0}\text{ or } \frac{\infty}{\infty}$:
|
||||
|
||||
$$\lim_{x\to a}\frac{f(x)}{g(x)} = \lim_{x\to a}\frac{f'(x)}{g'(x)}$$
|
||||
|
||||
: > If $f(x)$ and $g(x)$ are differentiable (except maybe at $a$), and $\lim_{x\to a}f(x) = 0$ and $\lim_{x\to a}g(x) = 0$, the relation is true.
|
||||
|
||||
### Related rates
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 1#Related rates](/g11/mhf4u7/#related-rates) for more information.
|
||||
|
||||
## Differentials
|
||||
|
||||
$\Delta x$ and $\Delta y$ represent tiny increments of $x$ and $y$. $dx$ and $dy$ are used when those tiny ammounts approach 0.
|
||||
|
||||
Specifically, by rearranging the definition of the deriative, $df$ is a short form for the **differential** of $f$:
|
||||
|
||||
$$f'(x)dx=dy=df$$
|
||||
|
||||
By abusing differentials, the tangent line of a point in a function can be approximated.
|
||||
|
||||
$$\Delta f\approx f'(x)\Delta x$$
|
||||
|
||||
!!! example
|
||||
If $f(x) = \sqrt{x},x_0=81$, $\sqrt{78}$ can be estimated by:
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
\Delta x&=dx=78-81=-3 \\
|
||||
\frac{df}{dx} &= f'(x) \\
|
||||
df &= f'(x)dx \\
|
||||
&= \frac{1}{2\sqrt{81}}(-3) = -\frac{1}{6} \\
|
||||
f(78) &= \sqrt{81}-\frac{1}{6} \\
|
||||
&= \frac{53}{54}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
### Curve sketching
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 1#5.2 - Increasing and decreasing functions](/g11/mhf4u7/#52-increasing-and-decreasing-functions) for more information.
|
||||
|
||||
## Integrals
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 2#Integration](/g11/mhf4u7/#52-increasing-and-decreasing-functions) for more information.
|
||||
|
||||
### More integration rules
|
||||
|
||||
- $\int a^xdx = \frac{a^x}{\ln a} + C$
|
||||
- $\int\sec^2xdx=\tan x+C$
|
||||
- $\int\text{cosh } xdx = \text{sinh } x + C$
|
||||
- $\int\text{sinh } xdx = \text{cosh } x + C$
|
||||
- $\int\frac{1}{\sqrt{1-x^2}}dx = \sin^{-1}x+C$
|
||||
- $\int\csc^2xdx = -\cot x+C$
|
||||
- $\int\sec x\tan x dx = \sec x + C$
|
||||
- $\int\csc x\cot xdx = -\csc x + C$
|
||||
- $\int\frac{1}{1+x^2}dx=\tan^{-1}x+C$
|
||||
- $\int\sec xdx = \ln|\sec x + \tan x| + C$
|
||||
- $\int\csc x dx = -\ln|\csc x + \cot x| + C$
|
||||
|
||||
### Integration by parts
|
||||
|
||||
IBP lets you replace an integration problem with a different, potentially easier one.
|
||||
|
||||
$$
|
||||
\int u\ dv = uv-\int v\ du
|
||||
$$
|
||||
|
||||
or, in function notation:
|
||||
|
||||
$$
|
||||
\int u(x)v'(x)dx = u(x)v(x)-\int v(x)u'(x)dx
|
||||
$$
|
||||
|
||||
Effectively, a product of two factors should be made simpler such that one is differentiable and the other is integratable. While there are integrals on both sides, the constant $C$ can be cancelled out for simplicity.
|
||||
|
||||
Heuristics to be used:
|
||||
|
||||
- $dv$ must be differentiable
|
||||
- $u$ should be simpler when differentiated
|
||||
- IBP might need to be used repeatedly
|
||||
- IBP and u-substitution might be needed together
|
||||
|
||||
!!! example
|
||||
To solve $\int xe^xdx$:
|
||||
|
||||
Let $u=x$, $dv=e^xdx$:
|
||||
|
||||
$\therefore du=dx, v=e^x + C$
|
||||
|
||||
via IBP:
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
\int udv &= xe^x - \int e^xdx \\
|
||||
&= xe^x-e^x + K
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 2#Area between two curves](/g11/mcv4u7/#area-between-two-curves) for more information.
|
||||
|
||||
- A **Type 1** region is bounded by functions of $x$ — it's open-ended in the x-axis.
|
||||
- A **Type 2** region is bounded by functions of $y$, which can be solved by integrating $y$.
|
||||
- A **Type 3** region can be viewed as either Type 1 or 2.
|
||||
|
||||
Substituting $u=\cos\theta$, $du=-\sin\theta d\theta$ is common.
|
||||
|
||||
### Mean values
|
||||
|
||||
|
||||
The **mean value** of a continuous function $f(x)$ in $[a, b]$ is equal to:
|
||||
|
||||
$$\text{m.v.} (f) = \frac{1}{b-a}\int_a^b f(x)dx$$
|
||||
|
||||
The **root mean square** is equal to the square root of the mean value for each point:
|
||||
|
||||
$$\text{r.m.s.} (f) = \sqrt{\frac{1}{b-a}\int_a^b f(x)^2dx}$$
|
||||
|
||||
### Trigonometric substitution
|
||||
|
||||
If $a\in\mathbb R$, functions of the form $\sqrt{x^2\pm a^2}$ or $\sqrt{a^2-x^2}$ can be rearranged in the form of a trig function.
|
||||
|
||||
- In $\sqrt{x^2 + a^2} \rightarrow x=a\tan\theta$
|
||||
- In $\sqrt{x^2-a^2} \rightarrow x=a\sec\theta$
|
||||
- In $\sqrt{a^2-x^2} \rightarrow x=a\sin\theta$
|
||||
|
||||
…which can be used to derive other trig identities to be integrated.
|
||||
|
||||
### Rational integrals
|
||||
|
||||
All integrals of rational functions are expressible as more rational functions, ln, and arctan.
|
||||
|
||||
Partial fraction decomposition is useful here.
|
||||
|
||||
$$\int \frac{1}{x^2+a^2}dx=\frac{1}{a}tan^{-1}\left(\frac{x}{a}\right)+C$$
|
||||
|
||||
## Summary of all integration rules
|
||||
|
||||
- $\int x^n\ dx = \frac{1}{n+1}x^{n+1} + C,n\neq -1$
|
||||
- $\int \frac{1}{x}dx = \ln|x| + C$
|
||||
- $\int e^x\ dx = e^x + C$
|
||||
- $\int a^x\ dx = \frac{1}{\ln a} a^x + C$
|
||||
- $\int\cos x\ dx = \sin x + C$
|
||||
- $\int\sin x\ dx = -\cos x + C$
|
||||
- $\int\sec^2 x\ dx = \tan x + C$
|
||||
- $\int\csc^2 x\ dx = -\cot x + C$
|
||||
- $\int\sec x\tan x\ dx = \sec x + C$
|
||||
- $\int\csc x\cot x\ dx = -\csc x + C$
|
||||
- $\int\text{cosh}\ x\ dx = \text{sinh}\ x + C$
|
||||
- $\int\text{sinh}\ x\ dx = \text{cosh}\ x + C$
|
||||
- $\int\text{sech}^2\ x\ dx = \text{tanh}\ x + C$
|
||||
- $\int\text{sech}\ x\text{tanh}\ x\ dx = \text{sech}\ x + C$
|
||||
- $\int\frac{1}{1+x^2}dx=\tan^{-1}x+C$
|
||||
- $\int\frac{1}{a^2+x^2}dx=\frac{1}{a}\tan^{-1}\left(\frac{x}{a}\right)+C$
|
||||
- $\int\frac{1}{\sqrt{1-x^2}}dx=\sin^{-1}x+C$
|
||||
- $\int\frac{1}{x\sqrt{x^2-1}}dx=\sec^{-1}x+C$
|
||||
- $\int\sec x\ dx = \ln|\sec x+\tan x|+C$
|
||||
- $\int\csc x\ dx = -\ln|\csc x + \cot x|+C$
|
||||
|
||||
## Applications of integration
|
||||
|
||||
The length of a curve over a given interval is equal to:
|
||||
|
||||
$$L=\int^b_a\sqrt{1+\left(\frac{dy}{dx}\right)^2\ dx}$$
|
||||
|
||||
For curves bounded by functions of $y$:
|
||||
|
||||
$$L(y)=\int^b_a\sqrt{1+\left(\frac{dx}{dy}\right)^2\ dy}$$
|
||||
|
||||
### Solids of revolution
|
||||
|
||||
Please see [SL Math - Analysis and Approaches 2#Volumes of solids of revolution](/g11/mcv4u7/#volumes-of-solids-of-revolution) for more information.
|
||||
|
||||
The **parallel axis theorem can be used** to shift the axis of the solid to $y=k$:
|
||||
|
||||
$$V=\pi\int^b_a [f(x)^2 + 2kf(x)]\ dx$$
|
||||
|
||||
Around the vertical axis about the origin with a function that is bounded by $y$:
|
||||
|
||||
$$V=\int^b_a2\pixf(x)\ dx$$
|
||||
|
||||
Around the vertical axis about the origin with functions bounded by $x$:
|
||||
|
||||
$$V=\int^b_a2\pi(x-k)[f(x)-g(x)]\ dx$$
|
||||
|
||||
The **frustrum** is the sesction bounded by two parallel plates.
|
||||
|
||||
The surface area of the solids are as follows:
|
||||
|
||||
$$SA=\int^b_a2\pi f(x)\sqrt{1+f'(x)^2}\ dx$$
|
||||
|
||||
Around the vertical axis about the origin:
|
||||
|
||||
$$SA=\int^b_a2\pi x\sqrt{1+f'(x)^2}\ dx$$
|
||||
|
||||
### Improper integrals
|
||||
|
||||
An improper integral is a definite integral where only one bound is defined:
|
||||
|
||||
!!! example
|
||||
$\int_2^\infty$ or $\int_a^b$, where only $a$ is defined.
|
||||
|
||||
These can be expanded into limits:
|
||||
|
||||
$$\int_a^\infty f(x)\ dx = \lim_{t\to\infty}\int_a^t f(x)\ dx$$
|
||||
|
||||
The integral converges to a value if the limit exists.
|
||||
|
||||
$$\int_{-\infty}^a f(x)\ dx = \lim_{t\to-\infty}\int^a_tf(x)\ dx$$
|
||||
|
||||
Discontinuities can be simply dodged. If there is a discontinuity:
|
||||
|
||||
- at $b$: $\int_a^{b^-}f(x)\ dx$
|
||||
- at $a$: $\int_{a^+}^b f(x)\ dx$
|
||||
- at $a<c<b$: $\int_a^cf(x)\ dx + \int_c^bf(x)\ dx$
|
||||
|
||||
Limits to both infinities must be broken up because they may not approach them at the same rate.
|
||||
|
||||
$$\int^\infty_{-\infty}x\ dx = \int^0_{-\infty} x\ dx + \int^\infty_0 x\ dx$$
|
||||
|
||||
## Polar form
|
||||
|
||||
Please see [MATH 115: Linear Algebra#Polar form](/ce1/math115/#polar-form) for more information.
|
||||
|
||||
Instead of $r$ and $\theta$, engineers use $\rho$ and $\phi$.
|
||||
|
||||
For $\rho \geq 0$, these basic conversions go between the two forms:
|
||||
|
||||
- $x=\rho\cos\phi$
|
||||
- $y=\rho\sin\phi$
|
||||
- $\phi=\sqrt{x^2+y^2}$
|
||||
- $\phi=\tan^{-1}\left(\frac{y}{x}\right) + 2k\pi,k\in\mathbb Z$
|
||||
|
||||
Polar form allows for simpler representations such as $x^2+y^2=4 \iff \rho=2$
|
||||
|
||||
Functions are described in the form $\rho=f(\phi)$, such as $\rho=\sin\phi+2$.
|
||||
|
||||
### Area under curves
|
||||
|
||||
From the axis to the curve:
|
||||
|
||||
$$A=\int^\beta_\alpha\frac{1}{2}[f(\phi)]^2\ d\phi$$
|
||||
|
||||
Between two curves:
|
||||
|
||||
$$A=\int^\beta_\alpha\frac{1}{2}[f(\phi)^2-g(\phi)^2]\ d\phi$$
|
||||
|
||||
Arc length:
|
||||
|
||||
$$L=\int^\beta_\alpha\sqrt{f'(\phi)^2 + f(\phi)^2}\ d\phi = \int^\beta_\alpha\sqrt{\left(\frac{d\rho}{d\phi}\right)^2+\rho^2}\ d\phi$$
|
||||
|
||||
## Complex numbers
|
||||
|
||||
Please see [MATH 115: Linear Algebra#Complex Numbers](/ce1/math115/#complex-numbers) for more information.
|
||||
|
||||
### Impedance
|
||||
|
||||
Where $\~i$ is a complex number representing the current of a circuit:
|
||||
|
||||
$$\~i(t)=I\cdot Im(e^{j\omega t})$$
|
||||
|
||||
This can be related to Ohm's law, because $v(t)=IR\sin(\omega t)$ such that $\~v=IRe^{j\omega t}$:
|
||||
|
||||
$$\~v=R\~i$$
|
||||
|
||||
In fact, t
|
||||
|
||||
$$
|
||||
\~v=Z\~i,\text{ where } Z=\begin{cases}
|
||||
\begin{align*}
|
||||
&R &\text{ for resistors} \\
|
||||
&\frac{1}{j\omega C} &\text{ for capacitors} \\
|
||||
&j\omega L &\text{ for inductors}
|
||||
\end{align*}
|
||||
\end{cases}
|
||||
$$
|
||||
|
||||
Impedance has similar properties to resistance.
|
||||
|
||||
- In series: $Z = Z_1 + Z_2 + Z_3 ...$
|
||||
- In parallel: $\frac{1}{Z} = \frac{1}{Z_1} + \frac{1}{Z_2} + \frac{1}{Z_3} ...$
|
Reference in New Issue
Block a user