# Difference between revisions of "Math for CS Review"

(→Memorize) |
(→Memorize) |
||

Line 26: | Line 26: | ||

** and, or, not - read about in [https://www.khanacademy.org/computing/ap-computer-science-principles/computers-101/logic-gates-and-circuits/a/logic-gates Khan academy] | ** and, or, not - read about in [https://www.khanacademy.org/computing/ap-computer-science-principles/computers-101/logic-gates-and-circuits/a/logic-gates Khan academy] | ||

** De Morgan's laws: not (A and B) is equivalent to (not A) or (not B). not (A or B) is equivalent to (not A) and (not B). | ** De Morgan's laws: not (A and B) is equivalent to (not A) or (not B). not (A or B) is equivalent to (not A) and (not B). | ||

+ | ** Also, A and (B or C) is equivalent to (A and B) or (A and C). And, A or (B and C) is equivalent to (A or B) and (A or C). | ||

** Should be able to answer questions about truth tables for and / or / not, and evaluate expressions of and's / or's / not's | ** Should be able to answer questions about truth tables for and / or / not, and evaluate expressions of and's / or's / not's |

## Revision as of 11:50, 24 August 2022

Note - Khan Academy Math is a good resource to look up and refresh general math knowledge. Khan Academy AP CS Principles and Khan Academy Computing also have some content related to math embedded within them.

# Memorize

These are things you need to memorize.

*Order of operations:*first parenthesis, then exponents, then multiplication/division/modulus, then addition and subtraction. And left to right.*Powers/exponents*- 2
^{10}= 1024, roughly 1 thousand - 2
^{a+b}= 2^{a}* 2^{b} - y
^{a+b}= y^{a}* y^{b} - 2
^{-a}= 1 / (2^{a}) - 2
^{20}= 1024 × 1024, roughly 1 million - 2
^{30}= 1024 × 1024 × 1024, roughly 1 billion

- 2
*Logarithms*- log
_{b}x = y, means b^{y}= x, for any b > 1 - log
_{10}1000 = 3 - log
_{2}1024 = 10 - log
_{b}x = log_{c}x / log_{c}b, for any b > 1, c > 1 - log
_{2}10 is about 3.32 - log
_{b}(x^{y}) = y log_{b}x, for any b > 1 - log
_{b}(x y) = log_{b}x + log_{b}y, for any b > 1

- log
*Formulae*- Arithmetic Sum: (1 + 2 + ... + n) = n * (n+1) / 2
- Geometric Sum: 1 + r + r
^{2}+ r^{3}+ ... + r^{n}= (r^{n+1}-1) / (r-1)

*Boolean logic*- Possible values - true, false - can mean on, off - often represented by 1, 0
- and, or, not - read about in Khan academy
- De Morgan's laws: not (A and B) is equivalent to (not A) or (not B). not (A or B) is equivalent to (not A) and (not B).
- Also, A and (B or C) is equivalent to (A and B) or (A and C). And, A or (B and C) is equivalent to (A or B) and (A or C).
- Should be able to answer questions about truth tables for and / or / not, and evaluate expressions of and's / or's / not's