Even though lot of people use Python in an object oriented style, it has several functions that enable functional programming. For those of you who don’t know, functional programming is a programming paradigm based on lambda calculus that treats computation as an evaluation of mathematical functions. Some of prominent functional programming languages include Scala, Haskell, Clojure, and so on. You should go through this nice article on functional programming that explains it in layman’s terms. Coming back to the topic at hand, Python provides features like lambda, filter, map, and reduce that can basically cover most of what you would need to operate on data. Let’s go ahead and play with them to understand their awesomeness, shall we? Continue reading

# Tag Archives: Functions

# Why Are They Called “Elliptic” Curves?

Have you heard of elliptic curves before? They are used extensively in number theory and cryptography. The reason elliptic curve cryptography is gaining popularity is because it’s fundamentally much stronger than the RSA algorithm, the algorithm that we all love and adore. If you don’t know what elliptic curves are, just google it and see what they look like. You are reading this sentence without googling it, aren’t you? Okay I’m going to assume that you know what elliptic curves look like. Do they look anything like ellipses? No! So why are they called “elliptic” curves? Continue reading

# What Is A Holomorphic Function?

How do you feel when see the term “holomorphic function”? It just feels like we shouldn’t be looking further into it, right? I mean, it looks like an esoteric mathematical concept that should remain in advanced textbooks. Interestingly enough, holomorphic functions are very useful in real life. Holomorphic functions are ubiquitous in the field of complex analysis. Just to clarify, “complex analysis” doesn’t refer to an analysis that’s complex or difficult. Instead, it refers to analysis of functions of complex numbers. Alright, so let’s go ahead and see how something like this can possibly be useful in real life, shall we? Continue reading

# What Is Zeta Function Regularization?

There is a popular mathematical result which says that the sum of all natural numbers is -1/12. I have discussed it in detail here. This looks very unintuitive to a first time observer. In fact, most people would say that this is some kind of mathematical trickery. How can a bunch of positive numbers sum up to a negative fraction, right? Actually, there is a very real purpose to this whole thing of adding up all the natural numbers to get a negative fraction as the result. However, our general sense tells us that this shouldn’t be possible. The discussion in one of my previous blog posts was about the mathematics involved in this result. This discussion is more about the underlying fundamentals and where these results come from. So how do we explain this situation? Where is it used in real life? Continue reading

# Homomorphism vs Homeomorphism

Did you get the joke in the picture to the left? If not, you will do so in a few minutes. I was recently reading an article and I came across the terms mentioned in the title. From the looks of it, they are very close to each other, right? In many fields within mathematics, we talk about objects and the maps between them. Now you may ask why we would want to do that? Well, transformation is one of the most fundamental things in any field. For example, how do we transform a line into a circle, or fuel into mechanical energy, or words into numbers? There are infinitely many types of transformations that can exist. Obviously, we cannot account for every single type of transformation that can possibly exist. So we limit ourselves to only the interesting ones. So what exactly is it all about? How does it even relate to the title of this blog post? Continue reading

# Functors In C++

When you look at the word “functor”, the first thing that comes to mind is that it looks very similar to “function”. The word actually comes from a field called category theory, which is an abstract branch of mathematics. A category basically consists of objects that are linked to each other in certain ways. This is an extremely simplistic view of a very complex field of mathematics. But basically, that’s what it’s about! As it turns out, this mathematical concept is really useful in the world of programming. If used in the right way, it can be a very powerful tool in your coding arsenal. So what exactly is a functor in the context of programming? How do we use it? Continue reading

# A Beginner’s Look At Lambda Calculus

Back in school, you must remember studying differential and integral calculus. Now what on earth is lambda calculus? Well, lambda calculus is basically a simple notation for functions and applications in mathematics and computer science. It has a significant impact in the field of programming language theory. It forms the basis for all the modern functional programming languages like Haskell, Scala, Erlang, etc. The main idea here is to apply a function to an argument and forming functions by abstraction. The good thing about lambda calculus is that the syntax is quite sparse, which makes it an elegant notation for representing functions. Here, we get a well-formed theory of functions as rules of computation. We will discuss this further soon. Even though the syntax of lambda calculus is sparse, it is really flexible and expressive. This feature makes is particularly useful in the field of mathematical logic. So what exactly is lambda calculus? How do we understand it? Continue reading