Adib Hasan's Blog, page 2

June 30, 2019

A Week of Poetry: Day 1

I love poetry. Did I ever tell you that? Not really.

I also enjoy world-building, philosophy, travelling to new places, but I never write about any of my experiences. I don’t write about myself much.

Twenty years later, when I’ll ask myself if I lived the life I dreamed for, I will need a definitive answer. The best way to do so would be to document all the interested things happen to me.

I’ll start with poetry. This week I’ll post some of my favorite poems. The first one would be Song of the...

 •  0 comments  •  flag
Share on Twitter
Published on June 30, 2019 11:35

May 27, 2019

An Online Algorithm to Check for Bipartite Graphs

Bipartite Graphs

A graph \(G(V, E)\) is called bipartite if its vertices can be divided into two groups \(X\) and \(Y\) such that every edge connects one vertex from \(X\) and one vertex from \(Y\). The graph drawn below is bipartite.

Given a graph, can you determine if it is bipartite?

This problem is pretty straightforward because the vertices of a bipartite graph can be colored with two colors such that every edge connects two vertices of different colors (see above). This property is cal...

 •  0 comments  •  flag
Share on Twitter
Published on May 27, 2019 15:48

May 19, 2019

How Game of Thrones Should Have Ended

This is a very unusual post for this blog. I hope my regular readers will bear with me.

I love Game of Thrones. I have read the books and the companion novels. I have been following the series for years. I am familiar with most of the fan theories too. Tonight the series finale aired. I didn’t like how the show ended. It felt rushed and very baffling.

I understand that I don’t get to question the showrunners’ creative decisions about the show. However, as a fan I can disagree with them. This...

 •  0 comments  •  flag
Share on Twitter
Published on May 19, 2019 21:29

April 14, 2019

A Blind Robot Beside an Infinite Wall

Let’s think about the following problem:

Consider a wall that stretches to infinitely in both directions. There is a robot at position \(0\) and a door at position \(p\in\mathbb Z\) along the wall \((p\neq 0)\). The robot would like to get to the door, but it knows neither \(p\), nor the direction to the door. Furthermore, the robot cannot sense or see the door unless it stands right next to it. Give a deterministic algorithm that minimizes the number of steps the robot needs to take to get t...

 •  0 comments  •  flag
Share on Twitter
Published on April 14, 2019 20:22

March 22, 2019

Prime Counting Function and Chebyshev Bounds

The distribution of primes plays a central role in number theory. The famous mathematician Gauss had conjectured that the number of primes between \(1\) and \(n\) is roughly \(n/\log n\). This estimation gets more and more accurate as \(n\to \infty\). We use \(\pi(n)\) to denote the number of primes between \(1\) and \(n\). So, mathematically, Gauss’s conjecture is equivalent to the claim

\[\lim_{n\to\infty}\frac{\pi(n)}{n/\log n}=1\]

This conjecture (currently known as the Prime Number Theor...

 •  0 comments  •  flag
Share on Twitter
Published on March 22, 2019 20:42

February 16, 2019

Multiplying Two Polynomials with Fast Fourier Transform

Polynomial multiplication is one of the most important problems in mathematics and computer science. It can be formally defined as follows: You are given two polynomials roughly of equal size,\[A(x)=a_0+a_1x+\dots+a_{n-1}x^{n-1}\]\[B(x)=b_0+b_1x+\dots+b_{n-1}x^{n-1}\]find a polynomial \[C(x)=c_0+c_1x+\dots+c_{2n-2}x^{2n-2}\] such that \(A(x)\cdot B(x)=C(x)\). At first, this may look like an easy problem, since you already know how to multiply polynomials. You … Continue reading Multiplying Tw...

 •  0 comments  •  flag
Share on Twitter
Published on February 16, 2019 23:41

February 10, 2019

No form of beauty

No form of beauty is as flawless, as abstract, or as perennial as the mathematical beauty that derives from unassailable logical perfectness, for a mathematical proof is not earthly science, but a poetry written in logic.
[ –Adib Hasan

 •  0 comments  •  flag
Share on Twitter
Published on February 10, 2019 14:10

No form of beauty is as flawless, as abstract, or as pere...

No form of beauty is as flawless, as abstract, or as perennial as the mathematical beauty that derives from unassailable logical perfectness, for a mathematical proof is not earthly science, but a poetry written in logic. [ –Adib Hasan

 •  0 comments  •  flag
Share on Twitter
Published on February 10, 2019 14:10

February 2, 2019

Generating All Subsets of Size k in Python

Suppose you are given a set \(S\) with \(n\) elements and you need to generate every subset of size \(k\) from it. For instance, if \(S=\{3,4,5\}\) and \(k=2\), then the answer would be \(\{3,4\}\), \(\{3,5\}\), \(\{4,5\}\). So, how would you do that in Python? First of all, this is a really simple exercise. Stuff like … Continue reading Generating All Subsets of Size k in Python →

The post Generating All Subsets of Size k in Python appeared first on Reverberation.

 •  0 comments  •  flag
Share on Twitter
Published on February 02, 2019 09:06

January 29, 2019

Lie Detectors and the Story of Halting Turing Machines

Is it possible to design a machine that detects lies? Sure, people have already built devices called polygraphs that monitor blood pressure, respiration, pulse etc. to determine if a person is giving false information. However, that is not same as “detecting lies” because polygraphs merely measure physical effects of telling lies. On the top of … Continue reading Lie Detectors and the Story of Halting Turing Machines →

The post Lie Detectors and the Story of Halting Turing Machines appeared f...

 •  0 comments  •  flag
Share on Twitter
Published on January 29, 2019 08:56