Recent Articles

Automatic Differentiation: Higher ranked beings

Mar 13, 2019   #FP  #Haskell 
(Status: Draft) We saw how we can try to calculate derivates of a function while evaluating the function in the first and second posts on automatic differentiation. Those dealt with only functions of a single real number. While that is illustrative of the approach, it was merely warm up so we can deal with differentiable functions of multiple variables that yield multiple values - i.e. vector valued functions of vectors … or more generally, tensor valued functions of tensors. Read More ...

Automatic Differentiation: Dual numbers & Taylor numbers

Mar 12, 2019   #FP  #Haskell 
In the earlier post, we saw how we can calculate the derivative of a function as a function itself. We may not need to do that, but may want the value of a function’s derivative to be calculated while the function expression is being evaluated. Given a normal function expression (in Haskell, for the moment), it is possible to reuse the function definition to calculate its derivative using the idea of dual numbers. Read More ...

Automatic differentiation

Mar 8, 2019   #FP  #Haskell 

At Pramati Chennai, we’ve been having a series of sessions on math. The purpose is to try and connect many concepts usually considered as separate. We’re currently on a track to understand functions of multiple variables and their calculus.

Along the way, I thought it might be a good idea to try and introduce automatic differentiation in a programmatic way so people have a taste of how to precisely capture their ideas. This is not an attempt to implement the AD algorithms (at least not just yet), but to make the key idea concrete.

Read More ...

A hypothetical conversation with an 'imperative programmer'

Mar 7, 2019   #FP 

(This was originally written on May 25, 2015. Publishing it ‘cos a former colleague actually recalled it after all this time when even I had forgotten about it.)

Read More ...

Talk: Machine Learning as extreme TDD

Mar 7, 2019   #haskell  #gender 
I gave a talk last evening at a meetup at Navis giving a soft introduction to machine learning for an audience of mostly developers and QA engineers. I’m sharing the slide deck and also some corrections of mistakes I did in the talk. Click ml-as-tdd.pdf to download the PDF of the slide deck. The PDF has all the animation build stages as separate slides, so you can step through. I also showed some code towards the end of the talk which I’ll add here. Read More ...

async/await subtleties

Jan 3, 2019   #async/await  #Promise  #Exceptions  #try/catch/finally 
ECMAScript’s new async functions and generators simplify working with concurrent I/O code. While they work hand-in-hand with Promises, there are some subtleties that either seem to be underspecified in the language or not talked about much. For the purpose of this post, I assume you’re already familiar with the async keyword and its usage in Javascript as well as the await keyword for awaiting the result of an async function. Read More ...

Integers

Dec 14, 2018   #Integers  #Brahmagupta  #Number line  #Modulo arithmetic 
My son is learning about integers at school. It is quite a challenging topic to come to, especially as, thus far, for him, trying to understand it purely based on the familiar is both a necessity and a tough challenge due to the novelty of the idea. First off, it is not a big deal if kids are unable to grasp integers initially. They eventually do, but given that integers weren’t “natural” enough to be invented for millennia1, it is perfectly normal to not understand them from the get go. Read More ...

Hodja on Debugging

Sep 10, 2018   #Naseeruddin Hodja  #Debugging 
I loved Naseeruddin Hodja stories when I was a kid. Heck I love them now too. They give me a good laugh and, as is common with good humour, manage to point at some truth once in a while. One of these is a story where Hodja is searching for something in the garden. His wife asks him what he’s searching for and he replies he’s searching for his ring. She then asks him about where he’d lost it. Read More ...

Filter Theory in Physics Notation

Sep 7, 2018   #Quantum Mechanics  #Signal Processing  #Filters 
I happened to have picked up quantum mechanics from Feynman’s lectures and Dirac’s book before I got around to my main stream theory of linear filters during my B.Tech. So I went through a somewhat weird path of understanding the math around filter theory based on the quant-mech math I’d picked up. I do think it is clearer than the way linear filter theory books deal with the topic, especially due to an explicit notation for a “signal” in the abstract that is independent of “a representation of a signal”. Read More ...

Channels with async and await

Apr 6, 2018   #CSP  #Javascript 
async and await are, I think, the best thing to happen to Javascript, though I’d very much like something like sweet.js so I can invent it when I needed it most. However, I mostly see them being described in terms of promises. Here, I show how you can implement CSP style channels using them without using promises. A basic channel A basic channel can be thought of as a port that supports a post(value) method, with the value being delivered to whichever end points are consuming values from the channel. Read More ...