diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/README.md b/level-4/computational-mathematics/student-notes/fabio-lama/README.md new file mode 100644 index 0000000..87223ca --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/README.md @@ -0,0 +1,76 @@ +# About + +Listed here is a collection of cheatsheet by topic. Those cheatsheets do not +explain the topics in depth, but rather serve as quick lookup documents. +Therefore, the course material provided by the lecturer should still be studied +and understood. Not everything that is tested at the mid-terms or final exams is +covered and the Author does not guarantee that the cheatsheets are free of +errors. + +* [Number bases](./cheatsheet_number_bases.pdf) +* [Sequences and Series](./cheatsheet_sequence_series.pdf) +* [Modular Arithmetic](./cheatsheet_modular_arithmetic.pdf) +* [Trigonometry](./cheatsheet_trigonometry.pdf) +* [Graphs of Functions & Kinematics](./cheatsheet_graphs_functions_kinematics.pdf) +* [Trigonometrical Functions & Identities](./cheatsheet_trigonometrical_functions_identities.pdf) +* [Exponential & Logarithm Functions](./cheatsheet_exponential_logarithm_funcions.pdf) +* [Gradients of Curves & Differentiation](./cheatsheet_gradients_curves_differentiation.pdf) +* [Vectors](./cheatsheet_vectors.pdf) +* [Matrices](./cheatsheet_matrices.pdf) +* [Statistics](./cheatsheet_statistics.pdf) +* [Probability & Combinatorics](./cheatsheet_probability_combinatorics.pdf) + +# Building + +_NOTE_: This step is only necessary if you chose to modify the base docments. + +The base documents are written in [AsciiDoc](https://asciidoc.org/) and can be +found in the `src/` directory. + +The following dependencies must be installed (Ubuntu): + +```console +$ apt install -y ruby-dev wkhtmltopdf +$ gem install asciidoctor +$ chmod +x build.sh +``` + +To build the documents (PDF version): + +```console +$ ./build.sh pdf +``` + +Optionally, for the HTML version: + +```console +$ ./build.sh html +``` + +and for the PNG version: + +```console +$ ./build.sh png +``` + +The generated output can be deleted with `./build.sh clean`. + +# Disclaimer + +The Presented Documents ("cheatsheets") by the Author ("Fabio Lama") are +summaries of specific topics. The term "cheatsheet" implies that the Presented +Documents are intended to be used as learning aids or as references for +practicing and does not imply that the Presented Documents should be used for +inappropriate practices during exams such as cheating or other offences. + +The Presented Documents are heavily based on the learning material provided by +the University of London, respectively the VLeBooks Collection database in the +Online Library, especially on the books: + +* _Foundation maths (Harlow: Pearson, 2016) 6th edition by Croft, A. and R. Davison_ +* _Precalculus with Limits (January 1, 2017) 4th edition by Ron Larson_ + +The Presented Documents may incorporate direct or indirect definitions, +examples, descriptions, graphs, sentences and/or other content used in those +provided materials. **At no point does the Author present the work or ideas +incorporated in the Presented Documents as their own.** diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/build.sh b/level-4/computational-mathematics/student-notes/fabio-lama/build.sh new file mode 100755 index 0000000..309f406 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/build.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Because `make` sucks. + +gen_html() { + # Remove suffix and prefix + FILE=$1 + OUT=${FILE%.adoc} + HTML_OUT="cheatsheet_${OUT}.html" + + asciidoctor $FILE -o ${HTML_OUT} +} + +# Change directory to src/ in order to have images included correctly. +cd "$(dirname "$0")/src/" + +case $1 in + html) + for FILE in *.adoc + do + # Generate HTML file. + gen_html ${FILE} + done + + # Move up from src/ + mv *.html ../ + ;; + pdf) + for FILE in *.adoc + do + # Generate HTML file. + gen_html ${FILE} + + # Convert HTML to PNG. + PDF_OUT="cheatsheet_${OUT}.pdf" + wkhtmltopdf \ + --enable-local-file-access \ + --javascript-delay 2000\ + $HTML_OUT $PDF_OUT + done + + # Move up from src/ + mv *.pdf ../ + + # Cleanup temporarily generated HTML files. + rm *.html > /dev/null 2>&1 + ;; + png | img) + for FILE in *.adoc + do + # Generate HTML file. + gen_html ${FILE} + + # Convert HTML to PNG. + IMG_OUT="cheatsheet_${OUT}.png" + wkhtmltopdf \ + --enable-local-file-access \ + --javascript-delay 2000\ + $HTML_OUT $IMG_OUT + done + + # Move up from src/ + mv *.png ../ + + # Cleanup temporarily generated HTML files. + rm *.html > /dev/null 2>&1 + ;; + clean) + rm *.html > /dev/null 2>&1 + rm *.png > /dev/null 2>&1 + rm ../*.html > /dev/null 2>&1 + rm ../*.png > /dev/null 2>&1 + ;; + *) + echo "Unrecognized command" + ;; +esac \ No newline at end of file diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_exponential_logarithm_funcions.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_exponential_logarithm_funcions.pdf new file mode 100644 index 0000000..3e9af55 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_exponential_logarithm_funcions.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_gradients_curves_differentiation.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_gradients_curves_differentiation.pdf new file mode 100644 index 0000000..a8918aa Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_gradients_curves_differentiation.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_graphs_functions_kinematics.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_graphs_functions_kinematics.pdf new file mode 100644 index 0000000..3230f13 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_graphs_functions_kinematics.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_matrices.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_matrices.pdf new file mode 100644 index 0000000..1172abe Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_matrices.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_modular_arithmetic.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_modular_arithmetic.pdf new file mode 100644 index 0000000..42a425e Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_modular_arithmetic.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_number_bases.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_number_bases.pdf new file mode 100644 index 0000000..9ae01df Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_number_bases.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_probability_combinatorics.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_probability_combinatorics.pdf new file mode 100644 index 0000000..379f6bd Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_probability_combinatorics.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_sequence_series.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_sequence_series.pdf new file mode 100644 index 0000000..b6dc998 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_sequence_series.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_statistics.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_statistics.pdf new file mode 100644 index 0000000..df23892 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_statistics.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_trigonometrical_functions_identities.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_trigonometrical_functions_identities.pdf new file mode 100644 index 0000000..0b96b36 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_trigonometrical_functions_identities.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_trigonometry.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_trigonometry.pdf new file mode 100644 index 0000000..d0b2f6b Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_trigonometry.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_vectors.pdf b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_vectors.pdf new file mode 100644 index 0000000..82c33d3 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/cheatsheet_vectors.pdf differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/exponential_logarithm_functions/exponential_function.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/exponential_logarithm_functions/exponential_function.png new file mode 100644 index 0000000..97acfff Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/exponential_logarithm_functions/exponential_function.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/gradients_curves_differentiation/gradient_function.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/gradients_curves_differentiation/gradient_function.png new file mode 100644 index 0000000..98a5871 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/gradients_curves_differentiation/gradient_function.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/gradients_curves_differentiation/maximum_minimum_points.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/gradients_curves_differentiation/maximum_minimum_points.png new file mode 100644 index 0000000..fc0b15b Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/gradients_curves_differentiation/maximum_minimum_points.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/closed_interval.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/closed_interval.png new file mode 100644 index 0000000..fce91ca Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/closed_interval.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/domain_range_function.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/domain_range_function.png new file mode 100644 index 0000000..45f1ed2 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/domain_range_function.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/graph_axis.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/graph_axis.png new file mode 100644 index 0000000..0ff8ee2 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/graph_axis.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/open_interval.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/open_interval.png new file mode 100644 index 0000000..9e22be2 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/open_interval.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/plotting_graph.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/plotting_graph.png new file mode 100644 index 0000000..931a45a Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/graphs_functions/plotting_graph.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/cos_function.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/cos_function.png new file mode 100644 index 0000000..450ac4f Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/cos_function.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/four_quadrants.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/four_quadrants.png new file mode 100644 index 0000000..38005bb Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/four_quadrants.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/sin_function.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/sin_function.png new file mode 100644 index 0000000..ebcc480 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/sin_function.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/tan_function.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/tan_function.png new file mode 100644 index 0000000..52ca55e Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/tan_function.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/third_quadrant.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/third_quadrant.png new file mode 100644 index 0000000..b10b8ce Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/trigonometrical_functions_identities/third_quadrant.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/adding_three_vectors.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/adding_three_vectors.png new file mode 100644 index 0000000..ba42e63 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/adding_three_vectors.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/adding_vectors.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/adding_vectors.png new file mode 100644 index 0000000..f08b4b1 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/adding_vectors.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/cartesian_components.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/cartesian_components.png new file mode 100644 index 0000000..0e442cc Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/cartesian_components.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/multiply_negative_vectors.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/multiply_negative_vectors.png new file mode 100644 index 0000000..7106188 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/multiply_negative_vectors.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/multiply_vectors.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/multiply_vectors.png new file mode 100644 index 0000000..ce835c2 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/multiply_vectors.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/simple_vector.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/simple_vector.png new file mode 100644 index 0000000..8b27c1a Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/simple_vector.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/subtract_negative_vector.png b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/subtract_negative_vector.png new file mode 100644 index 0000000..a836832 Binary files /dev/null and b/level-4/computational-mathematics/student-notes/fabio-lama/src/assets/vectors/subtract_negative_vector.png differ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/exponential_logarithm_funcions.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/exponential_logarithm_funcions.adoc new file mode 100644 index 0000000..dc05fbf --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/exponential_logarithm_funcions.adoc @@ -0,0 +1,106 @@ += Cheatsheet - Exponential & Logarithm Functions +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Exponential Expressions + +An expression of the form stem:[a^x] is called an **exponential expression**, +where _a_ is the **base** and _x_ is the **exponent**,**power** or **index**. + +NOTE: The most common exponential expression is stem:[e^x], where _e_ is the +constant _2.71828..._. Also known as "Euler's number". This number is found in +many natural phenomena. + +== Exponential Functions + +An exponential function has the form of stem:[y = e^x]. This function has important properties: + +* _y_ is never negative. +* When stem:[x=0], then stem:[y = 1] +* As _x_ increases, then _y_ increases (**exponential growth**). + +image::assets/exponential_logarithm_functions/exponential_function.png[align="center"] + +== Logarithms + +The logarithm is the inverse function to the exponentiation. The following two +equations are equivalent. + +[stem] +++++ +y = a^x hArr log_a (y) = x +++++ + +For example: + +[stem] +++++ +5^3 = 125 hArr log_5 (125) = 3 +++++ + +Also, conventionally we define **natural logarithms** as: + +[stem] +++++ +log = log_10\ +ln = log_e +++++ + +=== Calculating Logarithms to any Base + +[stem] +++++ +log_a X = (log_10 X)/(log_10 a)\ +log_a X = (ln X)/(ln a) +++++ + +This also means that - for example: + +[stem] +++++ +log_5 (125) = (log (125))/(log (5)) +++++ + +Additionally: + +[stem] +++++ +log_a a = 1 +++++ + +=== Laws + +**First Law**: + +[stem] +++++ +log A + log B = log AB +++++ + +**Second Law**: + +[stem] +++++ +log A - log B = log (A/B) +++++ + +Also note that: + +[stem] +++++ +log 1 = 0 +++++ + +**Third Law** + +[stem] +++++ +n log A = log A^n +++++ + +such as stem:[3 log 2 = log 2^3 = log 8]. This applies for all stem:[n in RR]. + diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/gradients_curves_differentiation.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/gradients_curves_differentiation.adoc new file mode 100644 index 0000000..933fdd6 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/gradients_curves_differentiation.adoc @@ -0,0 +1,186 @@ += Cheatsheet - Gradients of Curves & Differentiation +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Gradient Function + +The **gradient** (or "slope") of a graph tells us something about the **rate of +change** and "steepness" of a function. Given a function stem:[y = f(x)] we +denote its gradient function by "dee _y_ by dee _x_" or simply by "_y_ dash". + +[stem] +++++ +(dy)/(dx) = y' +++++ + +IMPORTANT: This is **not** defined as "_dy_ divided by _dx_", respectively _dy_ +and _dx_ don't have any meaning here. Rather, we take stem:[(dy)/(dx)] as a +symbol of its own, such as stem:[y']. + +image::assets/gradients_curves_differentiation/gradient_function.png[align="center"] + +The gradient function is also called **first derivative**. The process of +obtaining this is also known as **differentiation**. Saying to differentiate +stem:[y = x^5] means to find its gradient function stem:[y]. _Differential +calculus_ studies this more in depth. + +== Gradient function of stem:[y = x^n] + +For any function of the form stem:[y = x^n] the gradient function is found from +the following formula: + +[stem] +++++ +y = x^n " then " y' = nx^(n-1) +++++ + +For example: + +[stem] +++++ +"if " y = x^3 " then " y' = 3x^(3-1) = 3x^2 +++++ + +Respectively: + +[stem] +++++ +y' = f'(x^3) = 3x^2 +++++ + +When we substitute _x_ and the result is negative, the curve is falling. If the +result is positive, the curve is rising. We write stem:[y'(x = 2)] or simply +stem:[y'(2)] to denote the value of the gradient function when stem:[x = 2]. + +The gradient function of some common functions: + +|=== +|For: stem:[y=f(x)]|For: stem:[y'=f'(x)]|Notes + +|constant|0| +|stem:[x]|1| +|stem:[x^2]|2x| +|stem:[x^n]|stem:[nx^(n-1)]| +|stem:[e^x]|stem:[e^x]| +|stem:[e^(kx)]|stem:[ke^(kx)]|_k_ is a constant +|stem:[sin x]|stem:[cos x]| +|stem:[cos x]|stem:[-sin x]| +|stem:[sin kx]|stem:[k cos kx]|_k_ is a constant +|stem:[cos kx]|stem:[-k sin kx]|_k_ is a constant +|stem:[ln kx]|stem:[1 // x]|_k_ is a constant +|=== + +== Rules for Finding Gradient Functions + +Rules for finding gradients of non-single terms. + +=== Rule 1 + +To find the gradient function of a sum of two functions we can simply find the two gradient functions separately and those together. + +[stem] +++++ +y = f(x) + g(x) " then " y' = f'(x) + g'(x) +++++ + +For example: + +[stem] +++++ +y = x^2 + x^4\ +f'(x^2) = 2x\ +f'(x^4) = 4x^3\ +"hence " y' = f'(x^2 + x^4) = 2x + 4x^3 +++++ + +=== Rule 2 + +Extension of the first rule. + +[stem] +++++ +y = f(x) - g(x) " then " y' = f'(x) - g'(x) +++++ + +For example: + +[stem] +++++ +y = x^5 - x^7\ +f'(x^5) = 5x^4\ +f'(x^7) = 7x^6\ +"hence " y' = f'(x^5 - x^7) = 5x^4 - 7x^6 +++++ + +=== Rule 3 + +[stem] +++++ +y = kf(x) " then " y' = kf'(x) +++++ + +where _k_ is a number. + +For example: + +[stem] +++++ +y = 3x^2 = 3(x^2)\ +x^2 = 2x\ +"hence " y' = f'(3x^2) = 3(2x) = 6x +++++ + +== Higher Derivatives + +To find the derivative of the derivative itself, known as the **second +derivative** and denoted as stem:[y"''"], we define: + +[stem] +++++ +y"''"" = (d^2y)/(dx^2) +++++ + +stem:[y"''"] is found by differentiating stem:[y']. + +For example: + +[stem] +++++ +"if " y' = 4x^3 " then " y"''" = 4(3x^2) = 12x^2 +++++ + +== Maximum and Minimum Points + +image::assets/gradients_curves_differentiation/maximum_minimum_points.png[align="center"] + +Points where the gradient is zero are known as **stationary points**, such as +points _A_, _B_, _C_ and _D_ (seen in the graph above). A point like _A_ is the +**maximum turning point** (or just **maximum**). A point like _C_ is the +**minimum turning point** (or just **minimum**). Points like _B_ and _D_ are +known as **points of inflexion**, where the curve falls and rises (unlike _A_ +where the curve only falls and _C_ where the curve only rises). + +IMPORTANT: Stationary points are located by setting the gradient function equal +to zero, that is stem:[y' = 0]. + +For example, to find the stationary points of: + +[stem] +++++ +y = 3x^2 - 6x + 8 +++++ + +we deterime the gradient function stem:[y'] by differentiating _y_: + +[stem] +++++ +y' = nx^(n-1)\ +y' = 3x^(3-1) = 3x^n\ +y' = 9x +++++ + +//y = x^n " then " y' = nx^(n-1) \ No newline at end of file diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/graphs_functions_kinematics.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/graphs_functions_kinematics.adoc new file mode 100644 index 0000000..745fc49 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/graphs_functions_kinematics.adoc @@ -0,0 +1,106 @@ += Cheatsheet - Graphs of Functions and Kinematics +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Intro + +We introduce horizontal and vertical axes. These axes intersect at a point +stem:[O] called the origin. The horizontal axis is used to represent the +*independent* variable, commonly stem:[x], and the vertical axis is used to +represent the *dependent* variable, commonly stem:[y]. The region shown is then +referred to as the stem:[x – y] plane. + +image::assets/graphs_functions/graph_axis.png[align="center"] + +== Intervals + +We only need part of the stem:[x]/stem:[y] axis when plotting graphs. Each +coordinate on the axis is called an *interval*. There are three types of +intervals: + +* _Closed interval_: includes its end-points, e.g. stem:[{x:x in bbb R, 1 <= x <= 3}], denoted as stem:[[1,3\]] (square brackets). +* _Open interval_: does not include its end-points, e.g. stem:[{x:x in bbb R, 1 < x < 3}], denoted as stem:[(1,3)] (round brackets). +* _Semi-open and semi-closed interval_: may be open at one end and closed at the other, e.g. stem:[{x:x in bbb R, 1 < x <= 3}], denoted as stem:[(1,3\]] (round and square bracket). + +Closed intervals use the filled marking, stem:[[-3,4\]]: + +image::assets/graphs_functions/closed_interval.png[align="center"] + +Open intervals used the hollow marking, stem:[(1,4)]: + +image::assets/graphs_functions/open_interval.png[align="center"] + +== Plotting Graphs of a Function + +Plotting a graph of stem:[y = 2x - 1] for stem:[-3 <= x <= 3]: + +|=== +|stem:[x]|stem:[-3]|stem:[-2]|stem:[-1]|stem:[0]|stem:[1]|stem:[2]|stem:[3] +|stem:[y]|stem:[-7]|stem:[-5]|stem:[-3]|stem:[-1]|stem:[1]|stem:[3]|stem:[5] +|=== + +image::assets/graphs_functions/plotting_graph.png[align="center"] + +== Domain and Range of Function + +The set of values that we allow the independent variable to take is called the +*domain* of the function. If the domain is not specified, we take the largest +set possible. The set of values taken by the output is called the *range* of +function. The domain and range can extend indefinitely (infinite) in one or both +directions. + +For example, the function stem:[f] is given by stem:[y = f(x) = 2x], for +stem:[1 <= x <= 3]. + +image::assets/graphs_functions/domain_range_function.png[align="center"] + +== Kinematics + +Describes the motion of objects without reference to forces, hence +**acceleration will always be constant**. + +Basic definitions: + +[stem] +++++ +d = "displacement"\ +v = "velocity"\ +a = "acceleration"\ +t = "time" +++++ + +**Velocity** and **displacement** can have subscripts that indicate initial +conditions: + +[stem] +++++ +v_o = v_i = "initial velocity"\ +v_t = v_f = "final velocity" +++++ + +Fundamental equations: + +* stem:[v_t = v_i + at] +** The velocity of any object at time stem:[t] is equal to +the _initial_ velocity plus the acceleration times stem:[t] +* stem:[x_t = x_o xx v_i t + 1/2 at^2] +** The position of the object at time stem:[t] is qual to the _initial_ +position stem:[x_o] plus its _initial_ velocity stem:[v_i] multiplied by time +stem:[t] plus stem:[1/2 at^2]. +* stem:[v_f^2 = v_i^2 + 2ad] +** Velocity squared at time stem:[t] is equal to the _initial_ velocity squared +plus stem:[2ad]. + +Additionally: + +[stem] +++++ +d = v_i t + 1/2 at^2\ +v_f^2 = v_i^2 + 2ad\ +v_f = v_i + at\ +d = ((v_i+v_f)/2)t +++++ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/matrices.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/matrices.adoc new file mode 100644 index 0000000..b661c3b --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/matrices.adoc @@ -0,0 +1,120 @@ += Cheatsheet - Matrices +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Intro + +A **matrix** is a set of numbers ("elements") arranged in the form of a +rectangle and enclosed in curved brackets. The matrix _A_ is of size **"two by +three"**: + +[stem] +++++ +A = ([1,2,3],[3,4,6]) +++++ + +A **square** matrix has the same number of rows as colummns: + +[stem] +++++ +([2,-7],[-1,6]) +++++ + +A **diagnoal** matrix is a square matrix where all elements are _0_ except those +on the diagonal from the top left to the bottom right. + +[stem] +++++ +([7,0],[0,9]) " , " ([9,0],[0,0]) " and " ([-1,0,0],[0,8,0],[0,0,-17]) +++++ + +An **identity** matrix is a diagonal matrix where all the diagonal elements are equal to _1_. + +== Addition and Subtraction + +Two matrices that have the same size can be added/subtracted by simply +adding/subtracting the corresponding elements. + +[stem] +++++ +([1,2],[3,4]) + ([5,2],[1,0]) = ([1+5, 2+2],[3+1,4+0]) = ([6,4],[4,4]) +++++ + +Respectively: + +[stem] +++++ +([1,2],[3,4]) + ([5,2],[1,0]) = ([1-5, 2-2],[3-1,4-0]) = ([-4,0],[2,4]) +++++ + +== Multiplication and Division by Number + +A matrix is multiplied by a number by multiplying/dividing each element by that +number. + +[stem] +++++ +4([1,2],[3,-9]) = ([4 xx 1, 4 xx 2],[4 xx 3, 4 xx -9]) = ([4,8],[12,-36]) +++++ + +Respectively: + +[stem] +++++ +1/4([16],[8]) = ([1/4 xx 16],[1/4 xx 8]) = ([4],[2]) +++++ + +== Multiplying two Matrices together + +Two matrices can only be multiplied together if the number of colums in the +first matrix is equal to the number of rows in the second matrix. The product of +two such matrices is a matrix that has the same number of rows as the first +matrix and the same number of columns as the second. If matrix _A_ has size +stem:[p xx q] and _B_ has size stem:[q xx s], then _AB_ has size stem:[p xx s]. + +[stem] +++++ +([1,4],[6,3]) xx ([2],[5]) = ([1xx2 + 4xx5],[6xx2 + 3xx5]) = ([22],[27]) +++++ + +And + +[stem] +++++ +([1,4,9],[2,0,1]) xx ([1,9],[8,7],[-7,3]) = ([1xx1+4xx8+9xx-7,1xx9+4xx7+9xx3],[2xx1+0xx8+1xx-7,2xx9+0xx7+1xx3]) = ([-30, 64],[-5, 21]) +++++ + +== The Inverse of a stem:[2 xx 2] Matrix + +The matrix stem:[A^(-1)] is the **inverse** of matrix _A_ (note that the +stem:[-1] superscript should not be read as a power). + +[stem] +++++ +"If " A = ([a,b],[c,d]) " then " A^(-1) = 1/(ad-bc)([d,-b],[-c,a]) +++++ + +Note that the elements on the leading diagonal are interchanged. + +Additinally: + +[stem] +++++ +A xx A^(-1) = A^(-1) xx A=I +++++ + +Where stem:[I] is the identity matrix. + +=== Determinant + +If quantity stem:[ad - bc] in the formula for the inverse is known as the +**determinant** of the matrix, indicated by stem:[abs(A)]. + +[stem] +++++ +"If " A = ([a,b],[c,d]) " then its determinant is " abs(A) = [[a,b],[c,d]] = ad-bc +++++ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/modular_arithmetic.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/modular_arithmetic.adoc new file mode 100644 index 0000000..b27f7de --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/modular_arithmetic.adoc @@ -0,0 +1,75 @@ += Cheatsheet - Modular Arithmetic +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Intro + +Modulo is a math operation that finds the remainder when one number is divided +by another. Two numbers are _congruent_ modulo a given number if they give the +same remainder when divided by that number. + +If we divide 5 by 3, the remainder is 2. Hence: + +[stem] +++++ +5 -= 2 mod 3 +++++ + +== Congruence + +We say that "stem:[a] is _congruent_ to stem:[b] modulo stem:[n]", denoted by: + +[stem] +++++ +a -= b mod n +++++ + +if stem:[n] is a divisor of stem:[a - b], or equivalently, if stem:[n|(a-b)]. +Similarly, we write: + +[latexmath] +++++ +a \not\equiv b \bmod n +++++ + +if stem:[a] is not congruent (or incongruent) to stem:[b] modulo stem:[n], or +equivalently, if latexmath:[n \nmid (a-b)]. + +For example: + +[stem] +++++ +5 -= 2 mod 3\ +5 -= 5 mod 3\ +5 -= 8 mod 3 +++++ + +and negative numbers: + +[stem] +++++ +5 -= 2 mod 3\ +5 -= -1 mod 3\ +5 -= -4 mod 3 +++++ + +== Multiplicative Inverse + +The modular multiplicative inverse of an integer stem:[a] modulo stem:[n] is an +integer stem:[b] such that: + +[stem] +++++ +ab -= 1 mod n +++++ + +and: + +[stem] +++++ +a^(n-2) = a^(-1) mod n +++++ \ No newline at end of file diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/number_bases.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/number_bases.adoc new file mode 100644 index 0000000..0d9e341 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/number_bases.adoc @@ -0,0 +1,107 @@ += Cheatsheet - Number Bases +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Decomposing Number Bases + +=== The Decimal System + +The decimal system is the "base 10" system, which only has the numbers stem:[(0, 1, ..., 9)]. + +[stem] +++++ +253 = 200 + 50 + 3\ += 2(100) + 5(10) + 3(1)\ += 2(10^2) + 5(10^1) + 3(10^0) +++++ + +=== The Binary System + +The binary system is the base 2 system, which only has the numbers stem:[(0, 1)]. + +[stem] +++++ +10001 = 1(2^4) + 0(2^3) + 0(2^2) + 0(2^1) + 1(2^0)\ += 1(16) + 0(8) + 0(4) + 0(2) + 1(1)\ += 16 + 1\ += 17_10 +++++ + +== Conversion To Base + +Example: convert stem:[58_10] to base 2. + +[stem] +++++ +58-:2 = 29 ", remainder " 0\ +29-:2 = 14 ", remainder " 1\ +14-:2 = 7 ", remainder " 0\ +7-:2 = 3 ", remainder " 1\ +3-:2 = 1 ", remainder " 1\ +1-:2 = 0 ", remainder " 1 +++++ + +Hence stem:[58_10 = 111010_2] (read remainder from bottom up). + +Example: convert stem:[558_10] to base 5. + +[stem] +++++ +558-:5 = 111 ", remainder " 3\ +111-:5 = 22 ", remainder " 1\ +22-:5 = 4 ", remainder " 2\ +4-:5 = 0 ", remainder " 4 +++++ + +Hence stem:[558_10 = 4213_5]. + +== Non-integer Numbers + +=== Decimal to Binary + +[stem] +++++ +17.375_10 = 1 xx 10^1 + 7 xx 10^0 + 3 xx 10^(-1) + 7 xx 10^(-2) + 5 xx 10^(-3)\ += 10 + 7 + 3/10 + 7/100 + 5/1000 +++++ + +First, convert the integer: + +[stem] +++++ +17_10 = 10001_2 +++++ + +Now the fractional part: + +[stem] +++++ +0.375 xx 2 = 0.75 = 0 + 0.75\ +0.75 xx 2 = 1.5 = 1 + 0.5\ +0.5 xx 2 = 1.0 = 1 + 0 +++++ + +Stop at stem:[0] (e.g. stem:[1 + 0]). Now combine the final integers, top to bottom: stem:[0.375_10 = 0.011_2]. + +Hence: + +[stem] +++++ +17.375_10 = 10001.011_2 +++++ + +=== Binary to Decimal + +Example: stem:[1101.101_2]. + +[stem] +++++ +1101 = 1(2^3) + 1(2^2) + 0(2^1) + 1(2^0) + 1(2^(-1)) + 0(2^(-2)) + 1(2^(-3))\ += 8 + 4 + 1 + 1/2 + 1/8\ += 8 + 4 + 1 + 0.5 + 0.125\ += 13.625 +++++ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/probability_combinatorics.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/probability_combinatorics.adoc new file mode 100644 index 0000000..b676c54 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/probability_combinatorics.adoc @@ -0,0 +1,181 @@ += Cheatsheet - Probability & Combinatorics +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Intro + +Some events are impossible, while others are quite certain to happen. When +something is impossible, we say that the probability is **0**. If something is +very likely going to happen, we say the probability is **1**. We use the letter +**P** to indicate a probability of something occuring. + +[stem] +++++ +P("a human will live for 1'000 years") = 0\ +P("all of us will die someday") = 1 +++++ + +No probabilities are outside the range of 0 to 1. + +We say that two events are **complementary** if they exclude each other, for +example something can either exist or not exist, but not exist and not exist at +the same time. The sum of the probabilities of the two complementary events must +always equal 1, also known as the **total probability**. + +== Calculating Theoretical Probabilities + +If the odds of some event occuring is the same for all possible events (e.g. +when rolling a dice), the probability is **unbiased**. This **theoretical +probability** is calculated the following way: + +[stem] +++++ +P("obtaining our chosen event") = ("number of ways the chosen event can occur"/"total number of possibilities") +++++ + +For example, the probability of rolling _4_ on a dice is: + +[stem] +++++ +P("rolling 4") = 1/6 = 0.1666... +++++ + +Or, the probability of rolling above _4_ (by rolling _5_ or _6_): + +[stem] +++++ +P("rolling above 4") = 2/6 = 1/3 = 0.333... +++++ + +== Independent Events + +If two events such as stem:[A] and stem:[B] are **independent** from each other, +then the probability of obtaining stem:[A] and stem:[B] is given by: + +[stem] +++++ +P(A " and " B) = P(A) xx P(B) +++++ + +For example, what is the probability that a coin toss and a dice throw result in +a _head_ and a _six_? We calculate: + +[stem] +++++ +1/2 xx 1/6 = 1/12 +++++ + +== Combinatorics + +We can calculate the permutations and combinations of elements. Permutations and +combinations are similar, but differ due to the fact that combinations do not +care about ordering. + +=== Permutations + +A **permutations** of _n_ different elements is an ordering of the elements such +that one element is first, one is second, one is third, and so on. In order to +calculate the number of different permutations of _n_ elements we use the +**factorial** of _n_, respectively stem:[n!]: + +[stem] +++++ +n! = n xx (n-1) xx ... 2 xx 1 +++++ + +For example: + +[stem] +++++ +6! = 1 xx 2 xx 3 xx 4 xx 5 xx 6 = 720 +++++ + +Additionally, there are stem:[3! = 6] permutations of the letters stem:[X, Y] +and stem:[Z]: + +[stem] +++++ +X Y Z\ +Y X Z\ +X Z Y\ +Z Y X\ +Z X Y\ +Y Z X +++++ + +NOTE: stem:[0! = 1]. + +==== Permutations of stem:[n] Elements Taken stem:[r] at the Time + +The number of permutations of _n_ elements taken _r_ at a time: + +[stem] +++++ +P_r^n = (n!)/((n-r)!) = n(n -1)(n-2)...(n-r+1) +++++ + +For example, consider the question: + +> There are 8 horses running in a race. In how many different ways can these +horses come in first, second and thrid (ties excluded)? + +We can calculate: + +[stem] +++++ +P_3^8 = (8!)/((8-3)!) = (8!)/(5!) = 336 +++++ + +==== Distinguishable Permutations + +When there are non-unique elements in a list, such as stem:[{A, B, B, C, C, C, D}], +we might want to calculate the number of _distinguishable permutations_, not all +possible permutation. + +We the use formula: + +[stem] +++++ +(n!)/(n_1! xx n_2! xx ... n_k!) +++++ + +Where stem:[n_k] is the number of kinds of elements. As an example, for the set +stem:[{A, B, B, C, C, C, D}], we have one _A_, two _B_'s, three _C_'s and one +_D_: + +[stem] +++++ +(7!)/(1! xx 2! xx 3! xx 1!) = 5040/12 = 420 +++++ + +=== Combinations + +Unlike permutations, combinations do not care about ordering. Respectively: + +[stem] +++++ +{A, B, C} = {C, B, A} +++++ + +To calculate the number of possible combinations of stem:[{A, B, C}], we use the +number of letters as stem:[r] and use the following formula (where stem:[P_r^n] +is defined in the permutations section): + +[stem] +++++ +C_r^n = (n!)/((n-r)!r!) = (P_r^n)/(r!) +++++ + +respectively (note that stem:[0! = 1]): + +[stem] +++++ +C_3^3 = (3!)/((3-3)!3!) = 6/6 = 1 +++++ + +Unlike permutations, combinations always require an stem:[r] (i.e. combinations +of _n_ elements taken at _r_ at a time). diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/sequence_series.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/sequence_series.adoc new file mode 100644 index 0000000..be346a7 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/sequence_series.adoc @@ -0,0 +1,220 @@ += Cheatsheet - Sequences and Series +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Intro + +**Sequence**: A set of (arbitrary) numbers ("terms") written down in a specific order. + +[stem] +++++ +S = (1, 3, 5, 7, 9) +++++ + +A sequence can be _finite_ or _infinite_: + +[stem] +++++ +S = (0, 1, 2, 3, ...) +++++ + +== Notations + +Given stem:[S = (0, 1, 2, 3)], then stem:[S_2 in S] equals to stem:[1] and +stem:[S_3 in S] equals to stem:[2] (sometimes the index starts at _0_, common in Computer Science). + +Terms of a sequence can often be found by using a formula. For example, given: + +[stem] +++++ +x_k = 2k + 3 +++++ + +then stem:[x_3 = 2 xx 3 + 3 = 9] and stem:[x_4 = 11]. + +== Arithmetic Progression + +A arithmetic progression (or sequence) _adds_ a fixed amount to the previous +term. + +[stem] +++++ +S = (a, a + d, a + 2d, a + 3d, ...) +++++ + +where stem:[a] is the _first term_ and stem:[d] is the _common difference_ of +the arithmetic progression stem:[S]. For example: + +[stem] +++++ +S = (1, 7, 13, 19, ...) +++++ + +where stem:[a] is _1_ and stem:[d] is _6_. The stem:[n]-th term of an +arithmetic progression is given by: + +[stem] +++++ +a + (n-1)d +++++ + +For example, the third term in stem:[S] is: + +[stem] +++++ +S_3 = 1 + (3 -1)6\ +S_3 = 1 + 2 xx 6\ +S_3 = 13 +++++ + +== Geometric Progression + +A geometric progression (or sequence) _multiplies_ the previous terms by a fixed +amount. + +[stem] +++++ +S = (a,ar,ar^2,ar^3,...) +++++ + +where stem:[a] is the _first term_ and stem:[r] is the _common ratio_. For example: + +[stem] +++++ +S = (2, 10, 50, 250, ...) +++++ + +where stem:[a] is _2_ and stem:[r] is _5_. The stem:[n]-th term of an geometric +progression is given by: + +[stem] +++++ +ar^(n-1) +++++ + +For example, the third term in stem:[S] is: + +[stem] +++++ +S_3 = 2 xx 5^(3-1)\ +S_3 = 2 xx 5^2\ +S_3 = 50 +++++ + +== Infinite Sequences + +An infinite sequences continues indefinitely. As the sequences progresses, it +gets closer and closer to a fixed value. For example, the following sequences +and smaller + +[stem] +++++ +S = (s, 1/2, 1/3, 1/4, 1/5, ...) +++++ + +which can be written as stem:[x_k = 1/k] for stem:[k = (1, 2, 3, ...)]. We say that "stem:[1/k] tends to zero as stem:[k] tends to infinity" or "as stem:[k] tends to infinity, the _limit_ of the sequence is zero": + +[stem] +++++ +lim_(k -> oo) 1/k = 0 +++++ + +When a sequence possesses a limit it is said to **converge**. A sequence such as +stem:[x_k = 3k - 2] which is stem:[(1, 4, 7, 10, ...)] does have a limit, which +is said to **diverge**. + +== Series & Sigma Notation + +If the terms of a sequence are added, the result is known as a _series_. + +[stem] +++++ +sum_(k=1)^(k=5) k = 1 + 2 + 3 + 4 + 5 = 15 +++++ + +Note that notations can be abbreviated: + +[stem] +++++ +sum_(k=1)^(k=5) k = sum_(k = 1)^5 k = sum_1^5 k +++++ + +== Arithmetic Series + +If the terms of an arithmetic sequence are added, the result is known as an +arithmetic series. The sum of the first stem:[n] terms of an arithmetic series +with first term stem:[a] and common difference stem:[d] is denoted by +stem:[S_n] and given by: + +[stem] +++++ +S_n = n/2 (2a + (n-1)d) +++++ + +Alternatively, this can be written as: the sum of the first stem:[n] terms of an +arithmetic series with first term stem:[a_1] and last term stem:[a_2] is denoted +by stem:[S_n] and given by: + +[stem] +++++ +S_n = n/2 (a_1 + a_2) +++++ + +For example, the sum of of the first stem:[3] items in stem:[sum_(k=1)^(k=50) k] is: + +[stem] +++++ +S_3 = (3 (1 + 3))/2\ +S_3 = (3 xx 4)/2 = 12/2 = 6 +++++ + +Additional, the sum of stem:[sum_(k=1)^(k=50) (2k + 1)] is: + +[stem] +++++ +S_50 = 50/2 xx ((2xx1 + 1) + (2xx50 +1))\ +S_50 = 50/2 xx (3+101)= 5200/2 = 2600 +++++ + +== Geometric Series + +If the terms of a geometric sequence are added, the result is known as a +geometric series. The sum of the first stem:[n] terms of a geometric series with +first term stem:[a] and common ratio stem:[r] is denoted by stem:[S_n] and given +by: + +[stem] +++++ +S_n = (a(1-r^n))/(1-r) " provided " r " is not equal to " 1 +++++ + +For example, the sum of the stem:[3] first terms of stem:[(2, 10, 50, 250, ..)] is: + +[stem] +++++ +S_3 = (2(1-5^3))/(1-5)\ +S_3 = (2xx1-2xx5^3)/(-4)\ +S_3 = (-248)/-4 = 62 +++++ + +== Infinite Geometric Series + +If the terms of an infinite sequence are added, the result is known as an infinite +series. The sum of an infinite number of terms of a geometric series with first term +stem:[a] and common ratio stem:[r] is denoted by stem:[S_(oo)] and given by: + +[stem] +++++ +S_(oo) = a/(1-r) " provided " -1 < r < 1 +++++ + +For example, a first term of stem:[2] and a common ration of stem:[1/3] is: + +[stem] +++++ +S_(oo) = 2/(1-(1/3)) = 2/(2/3) = 3 +++++ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/statistics.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/statistics.adoc new file mode 100644 index 0000000..c0eff73 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/statistics.adoc @@ -0,0 +1,171 @@ += Cheatsheet - Statistics +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== The Arithmetic Mean + +The **arithmetic mean**, or **mean**, is the first average and is found in a set +of values by adding up all the values and dividing the result by the total +number of values in the set. + +[stem] +++++ +"mean" = ("sum of the values")/("total number of values") +++++ + +For example, the sum of all marks is stem:[5 + 8 + 8 + 6 = 27], where the number +of marks is stem:[4], hence: + +[stem] +++++ +27/4 = 6.75 +++++ + +In more advanced math, we say we have stem:[n] values and call those stem:[x_1, +x_2, ..., x_n] where the _mean_ is given as stem:[bar x] ("x bar"). We sum up +all those values and divide it by _n_: + +[stem] +++++ +bar x = (sum_(i = 1)^n x_i)/n +++++ + +=== Frequencies + +When the data is presented in the form of a frequency distribution the mean is +found by first multiplying each data value by its frequency and the mean is +found by dividing this sum by the sum of all the frequencies + +The frequencies are given as: + +[stem] +++++ +f_1 -> x_1\ +f_2 -> x_2\ +f_3 -> x_3\ +...\ +f_n -> x_n +++++ + +For example, a frequency distribution would be a table that shows how many +students (stem:[f_n]) got which mark (stem:[x_n]): + +[stem] +++++ +0 -> 0 " (0 students got mark 0)"\ +...\ +15 -> 7 " (15 students got mark 7)"\ +12 -> 8 " (12 students got mark 8)"\ +... +++++ + +And is calculated as: + +[stem] +++++ +bar x = (sum_(i=1)^n f_i xx x_i)/(sum_(i=1)^n f_i) +++++ + +== The Median + +The **median** is the second average and is found in a set a set of values by +listing the numbers in ascending order and the selecting the value that lies +halfway along the list. If there are two numbers halfway, implying the size of +the set is even, then the two numbers are averages (i.e. the mean). + +For example, in the set stem:[{1,4,5,7,9}] the value haflway is stem:[5], making +that value the **median** of the set. Additionally, in the set +stem:[{3,4,5,6,7,7}] there are two values halfway, stem:[5] and stem:[6], and we +can calculate the mean in order to receive the median: + +[stem] +++++ +(5+6)/2 = 11/2 = 5.5 +++++ + +== The mode + +The **mode** is the third average and indicates in a set of values what value +occurs the most often. For example, in the set of values stem:[{1, 2, 3, 4, 4, +4, 5, 5}] the value stem:[4] appears the most, making it the mode. Sets that +have two modes are called **bimodal**. + +== Variance and Standard Deviation + +The means of sets can be the same even though the values are widely spread, for +example: + +[stem] +++++ +4 + 7 + 10 = 7\ +7 + 7 + 7 = 7 +++++ + +If this spread/information should be considered, then the **variance** and +**standard deviation** is used. + +=== Variance + +The variance shows the spread between the values. + +[stem] +++++ +"variance" = (sum_(i=1)^n (x_i - bar x)^2)/n +++++ + +Respectively: + +[stem] +++++ +"variance" = ((4 - 7)^2 + (7 - 7)^2 + (10 - 7)^2)/3 = 18/3 = 6 +++++ + +and + +[stem] +++++ +"variance" = ((7 - 7)^2 + (7 - 7)^2 + (7 - 7)^2)/3 = 0 +++++ + +Even though the mean between the two sets are the same, the variance shows us +that the spread differs quite a lot between both sets. + +In case of frequency distribution: + +[stem] +++++ +"variance" = (sum_(i=1)^n f_i (x_i - bar x)^2)/(sum_(i=1)^n f_i) +++++ + +=== Standard Deviation + +The standard deviation shows the deviation from the mean, indicating which +values are "standard", and which values are "non-standard" respectively vary a +lot from most values. + +[stem] +++++ +"standard deviation" = sqrt ((sum_(i=1)^n (x_i - bar x)^2)/n) +++++ + +The standard deviation is just the square root of the variance. From the +examples in the variance section, we can conclude: + +[stem] +++++ +"standard deviation" = sqrt (6) ~~ 2.449 +++++ + +and + +[stem] +++++ +"standard deviation" = sqrt (0)\ = 0 +++++ + +Any values above (stem:[bar x + "standard deviation"]) and below (stem:[bar x - +"standard deviation"]) the mean are considered non-standard. diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/trigonometrical_functions_identities.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/trigonometrical_functions_identities.adoc new file mode 100644 index 0000000..e875224 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/trigonometrical_functions_identities.adoc @@ -0,0 +1,140 @@ += Cheatsheet - Trigonometrical Functions & Identities +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Quadrants & Projections + +The _x_ and _y_ axes divide the plane into four quadrants. The angle +stem:[theta] is of the following degree based where the arm is located: + +* First quadrant, then stem:[0° <= theta <= 90°] +* Second quadrant, then stem:[90° <= theta <= 180°] +* Third quadrant, then stem:[180° <= theta <= 270°] +* Fourth quadrant, then stem:[270° <= theta <= 360°] + +image::assets/trigonometrical_functions_identities/four_quadrants.png[align="center"] + +Consider the projection of the arm to be _OC_ and label the _x_ projection _OB_ +and the _y_ projection _OA_. The trigonometrical ratios are defined as: + +[stem] +++++ +sin theta = "OA"/"OC" = "BC"/"OC"\ +cos theta = "OB"/"OC" = "AC"/"OC"\ +tan theta = "OA"/"OB" = "BC"/"AC" +++++ + +_(Note that in the image above, stem:["OA" = "BC"] and stem:["OB" = "AC"]. The +rules for those trigonometrical functions are not any different than what's +already covered in 'Cheatsheet - Trigonometry')_ + +Given that _x_ and _y_ can be negative, this also means that stem:[sin theta], +stem:[cos theta] and/or stem:[tan theta] can either be positive or negative, +depending on in which quadrant the arm is located and which projection is used +for the calculation. + +For example, in this graph: + +image::assets/trigonometrical_functions_identities/third_quadrant.png[align="center"] + +stem:[sin theta] and stem:[cos theta] are negative and stem:[tan theta] is +positive, because _x_ (_OB_) and _y_ (OA) are negative, but _OC_ is positive. +Respectively: + +[stem] +++++ +sin theta = "AC"/"OC" = "OB"/"OC"\ +cos theta = "OA"/"OC" = "BC"/"OC"\ +tan theta = "AC"/"OA" = "AC"/"BC" = "OB"/"OA" = "OB"/"BC" +++++ + +Given that stem:["OB" = "AC"] and stem:["BC" = "OA"]. + +== Adding/Subtracting 360° + +Adding or subtracting 360° to/from the arm does not alter the ratios, since it's +a full rotation. Hence: + +[stem] +++++ +sin theta = sin(theta + 360°) = sin(theta - 360°)\ +cos theta = cos(theta + 360°) = cos(theta - 360°)\ +tan theta = tan(theta + 360°) = tan(theta - 360°) +++++ + +== The Sine, Cosine and Tans Functions + +The sine function is stem:[y = sin theta], which repeats every 360°: + +image::assets/trigonometrical_functions_identities/sin_function.png[align="center"] + +This cosine function is stem:[y = cos theta], which repeats every 360°: + +image::assets/trigonometrical_functions_identities/cos_function.png[align="center"] + +The tangent function is stem:[y = tan theta], which repeats every 180°: + +image::assets/trigonometrical_functions_identities/tan_function.png[align="center"] + +== Identities + +Identities imply equations that are true for every value of the involved +variables. Important ones are: + +[stem] +++++ +(sin theta)/(cos theta) = tan theta +++++ + +and: + +[stem] +++++ +(sin A)^2 + (cos A)^2 \ += sin^2 A + cos^2 A = 1 +++++ + +Additionally: + +[stem] +++++ +sin theta = -sin(theta - 180°)\ +sin theta = sin(180° - theta)\ +sin theta = -sin(360° - theta)\ +\ +cos theta = -cos(theta - 180°)\ +cos theta = -cos(180° - theta)\ +cos theta = cos(360° - theta)\ +\ +tan theta = -tan(180° - theta)\ +tan theta = tan(theta - 180°)\ +tan theta = -tan(360° - theta) +++++ + +IMPORTANT: This means that trigonometric functions can have more than one solution. + +=== Common Identities + +[stem] +++++ +(sin A)/(cos A) = tan A\ +sin(A + B) = sin A cos B + sin B cos A\ +sin(A - B) = sin A cos B - sin B cos A\ +sin 2A = 2 sin A cos A\ +cos(A + B) = cos A cos B - sin A sin B\ +cos(A - B) = cos A cos B + sin A sin B\ +cos 2A = (cos A)^2 - (sin A)^2 = cos^2 A - sin^2 A\ +tan(A + B) = (tan A + tan B)/(1 - tan A tan B)\ +tan(A - B) = (tan A - tan B)/(1 + tan A tan B)\ +sin A + sin B = 2 sin ((A + B)/2) cos ((A-B)/2)\ +sin A - sin B = 2 sin ((A - B)/2) cos ((A + B)/2)\ +cos A + cos B = 2 cos ((A + B)/2) cos ((A - B)/2)\ +cos A - cos B = -2 sin ((A - B)/2) sin ((A + B)/2)\ +sin A = -sin(-A)\ +cos A = cos(-A)\ +tan A = -tan(-A) +++++ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/trigonometry.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/trigonometry.adoc new file mode 100644 index 0000000..bbba182 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/trigonometry.adoc @@ -0,0 +1,115 @@ += Cheatsheet - Trigonometry +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Intro + +If stem:[B = 90], then stem:["AC"] is called the *hypotenuse*, the side +*opposite* of stem:[theta] is stem:[BC] and the remaining side, stem:["AB"], is +*adjacent* to stem:[theta]. Angle stem:[A] is written as stem:[/_"BAC"], +stem:[/_A] or just stem:[A]. + +Each side of a triangle is named based on the lowercase letter of the angle +opposite of the side. + +[stem] +++++ +a = "BC"\ +b = "AC"\ +c = "AB" +++++ + +The total degree of all angles is always stem:[180°] + +[stem] +++++ +A + B + C = 180° +++++ + +== Convert Degree to Radiant + +[stem] +++++ +360° = 2 pi " rads" +++++ + +To convert stem:[x] degrees to radians stem:[y]: + +[stem] +++++ +x * pi/180 = y +++++ + +For example, stem:[255°]: + +[stem] +++++ +225 * pi/180 ~~ 3.93 " rads" +++++ + +And in reverse: + +[stem] +++++ +3.93 * 180/pi ~~ 225° +++++ + +== Trigonometrical Ratios + +_sine_, _cosine_ and _tangent_ are trigonometric functions that can be applied +to *right-angled triangles* to determine the degree of an angle. The degree of +an angle is independent from the length of each side. + +[stem] +++++ +sin theta = ("side opposite to " theta)/"hypotenuse" = "BC"/"AC"\ +cos theta = ("side adjacent to " theta)/"hypotenuse" = "AB"/"AC"\ +tan theta = ("side opposite to " theta)/("side adjacent to " theta) = "BC"/"AB" +++++ + +_sine_ and _cosine_ are always less than one. + +[stem] +++++ +sin x <= 1\ +cos x <= 1 +++++ + +The ratio of an angle can be reversed. + +[stem] +++++ +sin 45° = 0.70710678\ +sin^(-1) 0.70710678 = 45° +++++ + +== Pythagoras, sine and Cosine Rule + +For any *right-angled* triangle, the following theorem applies: + +[stem] +++++ +a^2 + b^2 = c^2\ +sqrt (a^2 + b^2) = c +++++ + +where stem:[c] is the hypotenuse. For any right-angled, acute and obtuse (non +right-angled) triangles, the sine and cosine rules apply: + +[stem] +++++ +a/(sin A) = b/(sin B) = c/(sin C) +++++ + +and: + +[stem] +++++ +a^2 = b^2 + c^2 - 2bc cos A\ +b^2 = a^2 + c^2 - 2ac cos B\ +c^2 = a^2 + b^2 - 2ab cos C +++++ diff --git a/level-4/computational-mathematics/student-notes/fabio-lama/src/vectors.adoc b/level-4/computational-mathematics/student-notes/fabio-lama/src/vectors.adoc new file mode 100644 index 0000000..6bc3732 --- /dev/null +++ b/level-4/computational-mathematics/student-notes/fabio-lama/src/vectors.adoc @@ -0,0 +1,132 @@ += Cheatsheet - Vectors +Fabio Lama +:description: Module: CM1015 Computational Mathematics, started 04. April 2022 +:doctype: article +:sectnums: 4 +:toclevels: 4 +:stem: + +== Intro + +Quantities that can be described as single numbers (**magnitudes**) are known as +**scalars**. Vectors are quantities that have a magnitude but also a +**direction** and are represented as arrows, where the length represents the +magnitude and the direction is given as points on a stem:[x-y] plane: + +image::assets/vectors/simple_vector.png[align="center"] + +Here, the vector _A_ to _B_ is written as stem:[vec "AB"] (sometimes stem:[ul a] +or stem:[bb a]), where _A_ is the _tail_ and _B_ is the _head_. The +**magnitude** of stem:[vec "AB"] is written as stem:[vec abs(AB)] or stem:[bb +ul a]. + +Two vectors are **equal** if they have the same magnitude **and** the same +direction. + +A **unit vector** has magnitude of 1, written as stem:[bb hat a] + +== Multiplying Vector by Scalar + +image::assets/vectors/multiply_vectors.png[align="center"] + +[stem] +++++ +bb a = 4\ +3 bb a = 12\ +1/2 bb a = 2 +++++ + +Multiplying by a negative number **reverses** the direction, but the magnitude +stays **positive**. + +image::assets/vectors/multiply_negative_vectors.png[align="center"] + +[stem] +++++ +bb a = 4\ +-3 bb a = 12 +++++ + +The unit vector of stem:[bb a] is given by: + +[stem] +++++ +bb hat a = (1)/(bb abs(a)) bba +++++ + +For example: + +[stem] +++++ +bb a = 4\ +bb hat a = 1/4 bb a\ +bb b = 1/2\ +bb hat b = 1/(1/2) bb b = 2 bb b +++++ + +== Adding and Subtracting Vectors + +If stem:[bb a] and stem:[bb b] are two vectors then we can form the vector +stem:[bb a + bb b]. We take stem:[bb b] by its tail and move it to the head of +stem:[bb a] while still maintaining magnitude and direction. + +image::assets/vectors/adding_vectors.png[align="center"] + +Or with more vectors: + +image::assets/vectors/adding_three_vectors.png[align="center"] + +When subtracting vectors, we consider that: + +[stem] +++++ +bb a - bb b = bb a + (- bb b) +++++ + +Therefore, we reverse the **direction** of stem:[bb b] and move the tail of +stem:[- bb b] to the head of stem:[bb a]. + +Additionally: + +image::assets/vectors/subtract_negative_vector.png[align="center"] + +== Cartesian Components + +We have a stem:[x-y] plane, where unit vector of the _x_ axis is stem:[bb i] and +the unit vector of the _y_ axis is stem:[bb j]. + +image::assets/vectors/cartesian_components.png[align="center"] + +We can see that: + +[stem] +++++ +vec "OP" = vec "OA" + vec "AP"\ +vec "OA" = 2 bb i\ +vec "AP" = 4 bb j\ +vec "OP" = 2 bb i + 4 bb j +++++ + +The quantities 2 and 4 are **Cartesian components** of the vector stem:[vec +abs(OP)]. + +By using Pythagoras' theorem we can calculate the +magnitude of stem:[vec "OP"]: + +[stem] +++++ +vec abs(OP) = sqrt(x^2 + y^2) +++++ + +== Scalar Product + +We have already seen how to multiply a vector by a scalar (single number). To +multiply a vector by a vector: + +[stem] +++++ +bb a xx bb b = abs(bb a) xx abs(bb b) xx cos theta +++++ + +where stem:[theta] is the angle between stem:[bb a] and stem:[bb b]. This scalar +product is also know as the **dot product**.