[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/PythonCoderUnicorn/R-Code/main/DS_Math.Rmd [Back]  [Original]

--- title: "Math for Data Science" author: "notebook by Zane Dax" output: html_notebook: toc: yes theme: spacelab --- # Math Foundation for Data Science This is my rework of topics covered in *Duke University's* **Data Science Math Skills** course from Coursera, which is not in R or Python. ## Sets A mathematical set is a collection of items, made of elements. ```{r Sets} A = c(1,2,-3,7) E = c('apple','pear','mango') A E ``` ### Set Theory Notation In set A, 2 is an element, and mango is an element in set E. This is described as: 2 is an $\in$ A and mango is an $\in$ E. ### Cardinality The cardinality of a set is simply the size or number of elements in it. For set E, there are 3 items, so we write $|$E$|$= 3 # Intersection of sets The intersection is the conditional argument symbol of sets, either "And" or "Or" regarding their elements. ```{r} A = c(1,2-3,7) B = c(2,8,-3,10) D = c(5,10) ``` ## Intersection "and" The element or elements of 1 set have same value in the other set. Both values matching is required for condition to be true. *Note: The notation is to use { } for a set.* Sets A and B both have 2 and -3 elements A $\cap$ B = {2,-3} Sets B and D do not both have shared elements, resulting in an empty set B $\cap$ D = $\emptyset$ The full notation for this: A $\cap$ B = {x: X $\in$ and X $\in$ B} ## Intersection union The union is not what you might assume, it is not the "and" but rather the **or** condition of elements in sets. The elements in 1 or both sets to satisfy the condition.
A $\cup$ B = {x: X $\in$ A or X $\in$ B} = {1,2,-3,7,8,10} # Numbers There are different types of numbers in math but the ones focused here are $\mathbb{R}$ and $\mathbb{Z}$ which are Real and Integers. Take a negative 7 integer and get the absolute value. ```{r abs} n = -7 abs(n) ``` ## Numeric Conditionals The values between variables compared on whether one variable is greater, less than or equal to, and greater or equal to the other value. | symbol | meaning | |--------| --------| | > | greater than x | | < | less than x | | >= | greater or equal to x | | =< | less than or equal to x | **Boolean Logic** evaluates the condition and returns a True or False (1 or 0) ```{r} a = 3.14 b = 6.5 x = 2 y = 17 # Boolean Logic a > b a
Web Proxy Viewer  |  New URL  |  Original Page