Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

Boolean algebra:

A binary variable that can have two possible values: true or false (0 or 1),
and three operators you can use: and, or and not (conjunction, disjunction and
negation).
You can use them on Venn diagrams.
You can create truth tables aswell:

&& | !alive | alive


!dead| zombie | man(alive)
-----|---------------------------
dead | ded | schrodinger

===

Numeral systems

Base 10: 423: four is in the hundreds (4*100), two is in the tens(2*10), the final
is multiplied by one(3*1).

Base2: Since you only have two numbers to work with, each place is multiplied by
two:
x128 x64 x32 x16 x8 x4 x2 x1
| 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1
( 0 + 64 + 32 + 16 + 8 + 0 + 2 + 1).

Base 16: (hexadecimal) 0123456789ABCDEF


(used to represent binary in a more concise way)
HEX: | BIN
0 |0000
1 |0001
A |1010
F |1111

Base 64: Used to encode binary value.


ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
Can also be used to represent binary data like an image as a string or text

===

Floating points:

Unlike integers, which can only represent whole numbers, floating-point numbers
allow computers to handle a wide
range of values, including fractions and extremely large or small numbers. In this
introduction, we will explore
the basics of floating-point representation, its advantages, and some of the
challenges associated with using
floating-point arithmetic in computer systems.

===

Logarithms:

Think of an actual log. The log starts at 16ft, then we saw it in half and it over
and over again until we
reach a length of two. If you try to draw a line through it, its not perfectly
straight, but rather it curves
gradually. In computer science, this is how many algorithms work like binary
search. If we know how many times
we cut the log we can raise 2 to the power of that value, in this case four, to get
the original length of the
log. That's called exponentiation and logarithm is the exact opposite, imagine we
don't know the exact component
but know the original length, and want to figure out how many times we'd have to
cut the log to get the length
of 2. We could calculate that with a base 2 log on the original length (16ft),
returning a value of four. When
it's base2 it's called a binary logarithm, although in math it's more common to use
base10, which is called the
common logarithm.

===

Set theory:

A set is an unordered collection of unique values. The best example is a relational


database where each table is
a set of unique rows, these tables can be joined together in a variety of different
ways based on set theory like
to select records that match on both tables you do an inner join, which is called
an intersection in set theory.
Or to grab all matching records from both tables you do a full outer join, which is
an union in set theory.
When doing left and right joins these concepts are combined like by combining an
intersection with the difference
between the two sets. Now one thing that's important to notice at this point is
that we're talking about structures
that have a finite number of elements, that is, discrete math, as opposed to
continuous math like geomtry and
calculus that deal with real numbers and approximations.

===

Combinations:

Simply put, this is about the art of counting things. Especially when combining
sets into combinations or permutations,
like if you have an app like Tinder, you need to count all the possible
combinations of matches as part of a more complex
algorithm that figures out what to show to the end user( nCr = n! / r! * (n - r) ).
Or maybe you need to construct a
globally distributed database and need to figure out how many database partitions
you'll need around the world. It's about
understanding how patterns can emerge. A good exercise is to write the fibonacci
sequence. Engineers at Google use this
same kind of logic torender tiles on tools like Google maps.

===

Graph theory:

A graph has two basic parts: nodes/vertices and edges that connect them together.
Like a person might be a node and an edge
might be a relationship that connects them together, like you love your mom and
your mom loves you back. This is an undirected
graph because the relationship goes both ways, however, you might also love our
onlyFans girlfriend but this would be a directed
graph because that relationship only goes one way. These graphs can also be
weighted, meaning one relationship is more important
than the other (1 - 0.5 - 0). If a node can traverse back to itself it's called
cycli, otherwise it's known as acyclic.
A good example of this is dikstra's algorithms you find the most efficient way to
navigate through traffic, but before you start
writing graph traversal algortihms, you need to know...

===

Complexity theory:

This can in theory tell you how much time and memory an algorithm should use. Big-O
notation is used to express complexity and
when talking about time, the input represents the number of steps it will take to
complete a task, like if you'd read a single
element from an array that would give O(1), or a constant time, which is extremely
fast and simple. If it is needed to loop
over an array that would give us O of N, and for each iteration in that loop we
loop over the same array again, that is
O of N squared.
But more sophisticated algorithms like binary search cut the search area in half
after each iteration, providing logarithmic
time. Understanding how to measure complexity is essential for tecnical interviews
and a good thing to think about in general.
*the Big O notation doesn't specify how fast something is. A constant time
complexity of O(1) doesn't mean that the
operation/algorithm is fast, but that the speed is constant as the input scales. As
a consequence, an O(n^2) algo can be faster
than an O(n) algo, for some range of small inputs

===

Statistics:

Crucial for things like machine learning, for it is just a fancy way of doing
statistics, for instance, when you type in ChatGPT,
it generates a response based on the probability that it fits the prompt provided
by the user. At the very least, you should
understand MEAN MEDIAN MODE and how standard deviation indicates how close values
in a set are correlated to the mean. This also
includes: BIAS, COVARIANCE, BAYES THEOREM, DISTRIBUTION. A specially useful thing
is the difference between linear regression and
logistic regretion, in a linear regression the goal is to predict a continuous
value, like the amount of money you'd lose after
buying a stock, the relationship between the input and output variable is linear
and the idea is to find a line that best fits
the data set, however, logistic regression is used for a different set of problems
like classification, maybe an app that predicts
if an image is a hotdog or not a hotdog, in this case the relationship is a sigmoid
function rather than linear.

===

Linear algebra:

This comes into play in things like computer graphics and deep neural networks. To
comprehend it you'll need to understand three
weird words: Scalar (a single numeric value), vector (list of numbers, like an one-
dimensional array and finally a matrix, a grid
or two-dimensional array that contains rows and columns of numeric values. What's
cool is that vectors can represent points and
directions in a three dimensional space while matrices can represent
transformations that happen to these vectors. When you play
around in a videogame the lightning and shadows and the graphics change thanks to
liner algebra that's being distributed on your
GPU. Imagine you have a 2D vector that's at 0.2X, 3Y. It represents a single point
in an image. You can perform linear transformations
like scaling, translation, rotation, shear and so on. Let's imagine now you want to
scale the point to a value of 4X, 6Y. You can
represent the scaling factors in a matrix then represent the point as a column
vector and now you can use matrix multiplication to
scale the point to its target location. Operations like this are also essential in
things like cryptography such as RSA encryption
and deep neural networks which use vectors to represent features then use matrix
multiplication to propagate values between nodes
in the network. The underlying math is surprisingly simple but requires a massive
amount of computing power.

===

More math concepts for programmers:


- Modular arithmetic (RSA encryption)
- Differential geometry (smooth surfaces and curves)
- Lambda calculus (functional programming)
- Fourier transformation (image/audio compression & filtering)
- Information theory (data compression)
- Game theory (artifical intelligence)
- Quaternions (computer graphics)

You might also like