Large Language Models (LLMs) have emerged as crucial tools in the automation of various processes, owing to their versatility and capacity to produce remarkable results. The outputs generated by LLMs can serve as an input for subsequent tasks. However, the reliability of these models, particularly in terms of the outputs they produce, continues to pose a substantial challenge. When addressing…
If you have even a passing interest in deep learning, chances are you’ve encountered at least one of these functions: sigmoid, softmax, and tanh. Over the past few decades, they have been integral to numerous research efforts and will likely continue to be so for many years to come. What’s truly remarkable is how few people know about the relationship between these functions, and even top…
Problem Suppose we have a sequence of independent random binary variables \(X_1, X_2, …, X_n\) with \(P(X_i=1)=p_i\). Let \(r_k\) be an arithmetic mean of the probabilities among sequences where \(X_1 + X_2 + … + X_n = k\), specifically \(r_k = \binom{n}{k}^{-1} P(X_1 + X_2 + … + X_n = k)\). Show that the identity below always holds for all possible values of \(p_i\) \[\frac{r_k}{r_{k-1}} \ge…
Introduction In the recent decade, gradient-based methods enormously impacted the machine learning field. I have a hard time imagining the most impressive achievements in the field being possible without them. Even if you’re using some application powered by machine learning, there is a high chance that a gradient-based method is being used somewhere under the hood. Certain methods are not hiding…
I’ve encountered Knuth’s numbers in the “Concrete Mathematics: A Foundation for Computer Science” book by Ronald Graham, Donald Knuth, and Oren Patashnik. In the book, the numbers are defined by the following recurrence relation: \[\begin{align} K_{n+1} = 1 + \min \left(2K_{\left\lfloor{\frac{n}{2}}\right\rfloor}, 3K_{\left\lfloor{\frac{n}{3}}\right\rfloor}\right) \end{align}\] with \(K_0=1\). The…
Problem Max the Mathemagician is calling for volunteers. He has a magic wand of length 10 that can be broken anywhere along its length (fractional and decimal lengths are allowed). After the volunteer chooses these breakpoints, Max will multiply the lengths of the resulting pieces. For example, if they break the wand near its midpoint and nowhere else, the resulting product is 5×5, or 25. If the…
Problem Martingale strategy is a rather famous gambling strategy that has been recently discussed in the Numberphile video. In the video, it has been stated that if one decides to follow the strategy, the probability of doubling the initial amount of money approaches 1/e as the initial amount approaches infinity. A more straightforward way to say it is that you get only a 36-37% chance of doubling…
Putnam’s 2006 exam included the following statistical problem Let \(S={1,2,…,n}\) for some integer \(n>1\). Say a permutation \(π\) of \(S\) has alocal maximum at \(k∈S\) if \(π(k)>π(k+1)\) for \(k=1\); \(π(k−1)<π(k)\) and \(π(k)>π(k+1)\) for \(1<k<n\); \(π(k−1)<π(k)\) for \(k=n\). (For example, if \(n=5\) and \(π\) takes values at 1,2,3,4,5 of 2,1,4,5,3, then \(π\) has a local maximum of 2 at…
The Riddler’s puzzle from October 2nd 2020 I have 10 chocolates in a bag: Two are milk chocolate, while the other eight are dark chocolate. One at a time, I randomly pull chocolates from the bag and eat them — that is, until I pick a chocolate of the other kind. When I get to the other type of chocolate, I put it back in the bag and start drawing again with the remaining chocolates. I keep going…
Problem Let’s say we have an office that can be accessed only using an ID card. Each time an employee enters and leaves the office we record this event as a row in the database. In the database, we store user ID, time when an employee entered and left the office. We want to write a query that extracts all time ranges when there was at least one person in the office. Example Let’s say we have 3…
Problem Problem from the FiveThirtyEight website The fifth edition of Dungeons & Dragons introduced a system of “advantage and disadvantage.” When you roll a die “with advantage,” you roll the die twice and keep the higher result. Rolling “with disadvantage” is similar, except you keep the lower result instead. The rules further specify that when a player rolls with both advantage and…
My solutions for the non-geometric IMO 2019 problems. I’m an amature in mathematics which means that these solutions might contain mistakes. Use them at your own risk Problem 1 Solution \[f(2a) + 2f(b) = f(f(a+b))\] Important observation: The order of the variables \(a\) and \(b\) matters in the left equation, but not in the right one. On the right side we can see that addition is commutative…
Problem Notations Before we start we will need to introduce a few notations that can help with the proof. Left and right movement in the process Let’s start with \(N\) coins and find \(k\) coins with \(H\). Next we find a coin at k-th position. There are two possible outcomes: Coin at the k-th position shows \(H\) (head). In this case, we flip the coin from \(H \to T\) which means that now we have…
Problem Let’s say we have \(S\) objects and each object is associated with one of the \(N\) classes. There are \(c_i\) objects associated with the \(i\)-th class. We want to eliminate only \(b\) objects in a way that forms the distribution of classes as close as possible to the uniform distribution. Intuition Intuition suggests that we can eliminate one object at a time by selecting a class with…
In this article, I want to share one simple problem that I’ve encountered in the calculus book and one beautiful result that could be obtained from it. Problem Problem from the Stewart Calculus book, 7th edition, Excercice 11.2, Problem 63 The figure shows two circles \(C\) and \(D\) of radius 1 that touch at \(P\). \(T\) is a common tangent line; \(C_1\) is the circle that touches \(C\), \(D\),…
Problem Solution for the puzzle introduced in the Numberphile video named “Darts in Higher dimensions” This problem is based on the following tweet [1/2] In the game of HyperDarts, the bull’s eye starts out with a diameter of 1, but each dart that lands reduces it to the length of the chord the dart lies on (or 0, if the dart is outside the bull’s eye). pic.twitter.com/Ojz77MJNxj — Greg Egan…
In this article I want to share a simple game I created on Arduino with 8x8 LED matrix created on a single breadboard. The main goal was to build a game console with all components located on a single breadboard. Components Breadboard Arduino UNO 8x8 LED matrix Driver MAX7219 4 Buttons Bunch of wires four 470 Ohm resistors one 10 kOhm resistor Software requirements You need to have: Arduino IDE…
In this post I would like to talk about a problem which I often encounter while I build Machine Learning models. It’s really can be annoying when overall training process takes too long and it’s hard to experiment and improve model’s accuracy when you need to execute the main script over and over again. Even small changes in the script lead to execution of all steps starting from data cleaning and…
For my open-source project I write a lot of documentation that I then convert into HTML pages. When project grows it’s difficult to support such amount of documentation. Mostly because there are a lot of copy and paste that occur in the code. To resolve this problem I came up with a solution that I call Shared Docs . Before I explain it to you I would like to show you an example of some common…
On the Cross Validate website one person asked for a code that implements neural network in SQL and it caught my attention so I decided to give it a try. Unfortunately, the question have been deleted from the website, but I’ve managed to get a screen shot from the cached web page in the google search. So here it is: The question is kind of funny, but I can understand why the person asked such a…
Some time ago I came across one book called Street-Fight Mathematics . I found it extremely interesting and useful. It consists only of 150 pages, but it covers a lot of awesome problem solving techniques. You can actually download the book for free or buy it, though there’s a free copy available it’s still worth paying. There’s one particular problem in this book that caught my attention. It is…