Top 10 Mathematic Ideas Every Programmer Should Master - by CodeCircuit - Apr, 2023 - JavaScript in Plain English
Top 10 Mathematic Ideas Every Programmer Should Master - by CodeCircuit - Apr, 2023 - JavaScript in Plain English
Member-only story
CodeCircuit · Follow
Published in JavaScript in Plain English
14 min read · Apr 23
However, magic isn’t real math. Developers often avoid learning math because it looks
scary, but they fail to realize that math is the foundation of all programming, from
simple code to complicated programs like computer graphics and neural networks.
Understanding math concepts is what separates a true engineer from a novice.
We are no math genius. We are the opposite, which makes us uniquely qualified to
teach the ten essential math concepts that any programmer needs to understand.
1. Numeral Systems
Photo by Mika Baumeister on Unsplash
Throughout history, humans have used various methods to count things, but most of
them have been based on the number ten. We have ten fingers on our hands, and this
is what we use to count. For example, in the number 423, the four represents four
times one hundred in the hundreds place, the two represents two times ten in the tens
place, and the three represents three times one in the one’s place.
Understanding base two is crucial for understanding other numeral systems like
hexadecimal, which is base 16. Hexadecimal uses the digits 0 through 9 along with A
through F to represent numbers. For example, the number A in hexadecimal
represents the number ten in base 10. Hexadecimal is commonly used to describe
binary values more concisely because each hexadecimal digit can translate into four
bits.
Computers employ base 2 yet still necessitate the representation of numbers in base 10
for human comprehension. Hence, numerical miniatures in applications and
interfaces feature base 10. The conversion of numbers to base 2 becomes necessary to
Open in app
display them in the binary system.
Search Medium
2. Boolean Algebra
Boolean algebra represents a fundamental construct in computer science and
programming, which is almost always utilized while writing code. It is a variant of
algebra that concerns itself with binary variables that can have only two possible
values — true or false.
In this discourse, we will deliberate on the rudimentary elements of Boolean algebra,
and how they are utilized in coding.
The conjunction operator (AND) is employed to fuse two or more Boolean values,
and the resulting value is only true if all the input values are true.
On the flip side, the disjunction operator (OR) is applied to merge two or more
Boolean values, and the resulting value is true if any of the input values are true.
The negation operator (NOT) is utilized to reverse a Boolean value, and the
resulting value is true if the input value is false, and false if the input value is true.
To shed light on the concept of Boolean algebra let us assume a relatable example.
Envision that you are endeavoring to secure a significant other. We can utilize the
Boolean variables “affluent” and “attractive” to define you. If you are both wealthy and
good-looking, you will most likely procure a significant other.
Nevertheless, if you are neither affluent nor attractive, you may have to remunerate a
model significant other. If you are either affluent or attractive, you can still get a
significant other, but your selection will be more restricted. We can demonstrate this
logic in code using if statements, or we can portray it visually using Venn diagrams.
Photo by Tolga Ahmetler on Unsplash
4. Logarithms
Logarithmic functions are a fundamental concept in algebra, frequently taught in high
school mathematics courses. To better comprehend these functions, consider an
actual log, such as a long piece of wood. The log begins at a length of 16 feet and is
gradually sawn in half until it reaches a length of 2 feet. Observe how the line drawn
through the log curves gradually rather than being perfectly straight.
Conversely, the logarithm is the precise reverse of exponentiation. Assume that we are
unaware of the exponent but know the original length of the log, and we want to
determine the number of times the log must be cut to achieve a length of 2 feet. This
can be calculated using a base 2 log on the original length, which yields a value of 4.
When the base is 2, it is directed to a binary logarithm. However, in mathematics, the
common logarithm, which uses base 10, is more prevalent.
5. Set Theory
Set theory may seem unfamiliar to those new to the field of computer science or
programming. However, in essence, it is the study of collections of distinct, unordered
entities. This article seeks to delve deeper into the intricate workings of set theory and
its role in the realm of computer science and programming.
When incorporating left and right joins, these concepts come together. By merging an
intersection with the difference between the two sets, a new set is formed that
encompasses solely the elements common to both sets.
6. Linear algebra
Linear algebra is a branch of mathematics that is necessary for understanding
computer graphics and deep neural networks. To comprehend it, you must first
understand three essential terms: scalar, vector, and matrix.
A scalar is a single numeric value. On the other hand, a vector is a list of numbers,
comparable to a one-dimensional array. Lastly, a matrix is like a grid or two-
dimensional array that contains rows and columns of numeric values.
What makes vectors and matrices fascinating is their ability to represent points,
directions, and transformations. Vectors can represent points and directions in a
three-dimensional space, while matrices can represent transformations that occur to
these vectors.
Consider this: when you move a player around in a video game, the lighting and
shadows, as well as the graphics, change magically. But it’s not magic; it’s linear algebra
that’s being distributed on your GPU.
One area that utilizes this kind of operation extensively is cryptography, more
particularly RSA encryption. Moreover, deep neural networks are dependent on
vectors as a means of representing features. Through matrix multiplication, data can
be propagated between nodes of the network. Despite the apparent simplicity of the
math behind these transformations, the computing power required to handle the
massive amount of data is staggering. The study of math is integral to the
understanding of the magic that computers perform.
7. Combinatorics
Combinatorics is the art of counting and understanding patterns. It deals with the
combinations and permutations of sets and is used in a variety of applications, from
app algorithms to global databases. In this article, we will explore the concept of
combinatorics and its relevance in various fields.
Combinatorics is all about counting things, especially when combining sets into
combinations or permutations. For instance, if you have an app like Tinder, you might
need to count all the possible combinations of matches as part of a more complex
algorithm that figures out what to show the end user. Similarly, if you’re building a
globally distributed database, you need to figure out how many database partitions
you’ll need about the world. Ultimately, it’s all about understanding how patterns can
emerge.
Combinatorics is closely related to graph theory. Graph theory is concerned with the
research of graphs, which are mathematical models applied to explain pairwise
relationships between things. Graph theory is widely used in computer science,
telecommunications, and social network analysis.
8. Statistic
AI is an area of study that heavily relies on the principles of statistics. This field deals
with developing algorithms and models that can learn from data and make predictions
or decisions based on that information. In essence, machine learning is a sophisticated
way of performing statistical analyses.
This piece aims to expound on the importance of statistics in the realm of artificial
intelligence and outline some fundamental statistical concepts that are crucial for
anyone seeking to pursue a career in AI. When you interact with an AI-powered
chatbot like ChatGPT, the system generates a response by computing the probability
that it fits the input prompt based on statistical models.
It is essential to have a clear grasp of the measures of central tendency, namely mean,
median, and mode, which are necessary statistical tools. Additionally, understanding
the concept of standard deviation is crucial as it helps in researching how close or far
apart values in a data set are from the average value.
Linear and logistic regression are two critical statistical methods that are commonly
applied in AI. In linear regression, the goal is to predict continuous values, such as the
loss or gain in monetary terms. The correlation between input and output variables is
linear, and the primary objective is to find the line that best fits the dataset.
On the other hand, logistic regression is valid in different problem scenarios such as
classification, for example, distinguishing between images of hot dogs and non-hot
dogs. The relationship between the input and output variables in this case is not linear
but rather a sigmoid function that predicts the probability of a Boolean variable being
true or false.
9. Complexity Theory
Complexity theory allows us to apprehend how much time and memory an algorithm
should ideally use. Big O notation is utilized in complexity theory to denote complexity.
Concerning time complexity, the input represents the number of steps needed to
execute a given task. For example, extracting a single element from an array would
give us 0 of 1, which is constant time, exceedingly swift, and straightforward.
Conversely, traversing an array would give us 0 of n, where n is the array’s length. If, in
each iteration of that loop, we traverse the same array once more, it would yield 0 of N
squared, which is significantly less efficient.
Sophisticated algorithms like binary search, halve the search space with each iteration,
resulting in logarithmic time complexity. Understanding the measurement of
complexity is fundamental for technical interviews and a necessary consideration in
general.
For instance, if we need to traverse an array of size n, the time complexity would be
O(n). Nevertheless, if we cross the same display once more in each iteration of that
loop, the time complexity would be O(n²), which is considerably less efficient.
Binary search is a more sophisticated algorithm that halves the search area with each
iteration, resulting in logarithmic time complexity. It is vital to apprehend the trade-
offs between the time complexities of different algorithms to select the most efficient
one for a given task.
At its most basic level, a graph is composed of two types of elements: nodes (also
known as vertices) and edges. Nodes are the individual elements within the graph,
while edges are the connections between those elements. For example, in a social
network, a person might be a node, and the relationship between two people might be
an edge. If you love your mom, and your mom loves you back, this would be an
example of an undirected graph, because the relationship goes both ways. On the other
hand, if you love your OnlyFans girlfriend, but she doesn’t love you back, this would be
a directed graph because the relationship only goes one way.
Edges can also be weighted, meaning that one relationship is more important than
another. For example, in a transportation network, some roads might be faster or more
efficient than others, and these relationships could be represented by weighted edges.
Elevate Your Coding with ChatGPT: Explore 250+ Powerful Lines for Peak Performance!
💻📖 Unlock ChatGPT’s potential with practical guidance and innovative ideas.
Join the over 4,000 readers on the journey to becoming all-encompassing, life-long software
engineers and managers. 🌍🚀Start reading Codestar for FREE today. 📚🧑💻✨
Want to make the most out of ChatGPT? Check out our collection of 400+ powerful lines for
ChatGPT! It’s chock-full of ideas and practical information that will help you unleash the full
potential of ChatGPT.
I hope you found it interesting to read. If you’d like to support me as a writer, consider
signing up to become a Medium member. It’s just $5 a month, as you get unlimited access to
Medium.
Follow
Written by CodeCircuit
1.91K Followers · Writer for JavaScript in Plain English
Tech enthusiast😊, offering a fresh take on coding and productivity tips for programmers🧑💻.
https://linktr.ee/codecircuit
148 2
The woman in JavaScript in Plain English
2.6K 36
13.6K 330
CodeCircuit in CodeX
228 8
1.5K 26
Attila Vágó in The Gray Area
Apple Just Held Its Most Mind-blowing Event In Modern Tech History
Forget the first-ever launch of the iPhone, the iPad, or even Apple Silicon.
1.3K 27
Lists
Leadership
30 stories · 54 saves
1.5K 22
3K 24
Rohith Teja in Geek Culture
700 13
Martin Heinz in Better Programming
602 11