The post So You Still Don’t Understand Hindley-Milner? Part 3 appeared first on Pivotal Labs.
]]>Read on at my blog (since these blogs don’t support MathJax) →
The post So You Still Don’t Understand Hindley-Milner? Part 3 appeared first on Pivotal Labs.
]]>The post So You Still Don’t Understand Hindley-Milner? Part 2 appeared first on Pivotal Labs.
]]>We’ll give a recursive definition of what an expression is; in other words, we’ll state what the most basic kind of expression is, we’ll say how to create new, more complex expressions out of existing expressions, and we’ll say that only things made in this way are valid expressions.
Read on at my blog (since these blogs don’t support MathJax) →
The post So You Still Don’t Understand Hindley-Milner? Part 2 appeared first on Pivotal Labs.
]]>The post Entropy: How Password Strength Is Measured appeared first on Pivotal Labs.
]]>Let’s step back for a sec and fill in some context. What are we trying to do? We’d like some way to measure how hard it is to guess our passwords, a number that serves as a heuristic standard of password strength. But there are two fundamentally different things we might want to measure:
How hard would it be for someone to guess your password with essentially no knowledge of how you created your password?
How hard would it be for someone to guess your password if they knew the process used to generate it? This is of course assuming that there is a process, for example some script that does some Math.rand
-ing and produces a password string.
The term “entropy” has been used to refer to both kinds of calculations, but they’re clearly entirely different things: the former essentially takes a string as input, the latter takes a random process as input. Hence, “entropy is not entropy.”
Alright, well if entropy isn’t entropy, let’s see what entropies are. We’ll look at the standard mathematical formulation of the random-process-entropy which comes from information theory. And we’ll look at the function used to calculate particular-string-entropy in one of the most popular password strength testers. And that’s all we’re going to do, we’ll look at how the calculations are done, without dwelling too much on the differences between the two approaches or what their use cases are.
Read on at my blog (since these blogs don’t support MathJax) →
The post Entropy: How Password Strength Is Measured appeared first on Pivotal Labs.
]]>The post Yo Dawg, I Herd You Like Math appeared first on Pivotal Labs.
]]>.html.erb
file into an .html
file), where the resulting LaTeX file has the output of the R code. It makes it super easy to embed statistical calculations, graphs, and all the good stuff R gives you right into your TeX files. It let’s you put math in your math, so you can math while you math.
I’ve got a little project which:
Here’s what the pre-“knitted” LaTeX looks like with the embedded R:
\documentclass{article} \usepackage{graphicx} %% begin.rcode setup, include=FALSE % opts_chunk$set(fig.path='figure/latex-', cache.path='cache/latex-') %% end.rcode \begin{document} After scraping data for all passing TDs in 2012, we get the following histogram for number of TD passes by team. %% begin.rcode cache=TRUE % scrape <- read.csv('scrape.csv') % raw_data <- scrape[scrape[,"X"]!="",] % tds_for_passers <- transform(raw_data[c("Tm","TD")], TD = as.numeric(as.character(TD))) % tds_for_teams <- aggregate(tds_for_passers$TD, by=list(Team=tds_for_passers$Tm), FUN=sum) % hist(tds_for_teams$x) %% end.rcode The teams with the greatest and least TDs: %% begin.rcode % low_high <- c(which.min(tds_for_teams$x), which.max(tds_for_teams$x)) % tds_for_teams[low_high,"Team"] %% end.rcode \end{document}
You can comment out the line in the factory
script that deletes the tds2012-out.tex
file if you want to see what it looks like post-knit. The resulting TeX file basically contains a ton of new commonad definitions but the meat of it is what it does with your R code. It formats and displays the R code itself, and then it displays the output of the R code. Wherever the output is a graph, you’ll see \includegraphics[...]{...}
. knitr will do the R computation, render the graphics, create a figures
subdirectory and store them there for the \includegraphics
to reference. Whenever the output is simply text or mathematical expressions, you’ll see the R output translated to pure LaTeX markup.
Pretty cool stuff!
The post Yo Dawg, I Herd You Like Math appeared first on Pivotal Labs.
]]>The post Is It Possible to Be 15% Swedish? appeared first on Pivotal Labs.
]]>Let’s quickly see why the real life answer is “no.” But first we should lay out the assumptions implicit in the problem. We’re going to assume that at some point in time, everyone was either entirely Swedish or entirely non-Swedish. There’s a chicken-and-egg problem that we’re sweeping under the rug here, but that’s what rugs are for. Next we’re assuming that every person after that point in time has their Swedishness wholly and equally determined by their parents Swedishness. So if mom is 17% Swedish and dad is 66% Swedish, then baby is ½ x 17% + ½ x 66% = 41.5% Swedish.
Read on at my blog (since these blogs don’t support MathJax) →
The post Is It Possible to Be 15% Swedish? appeared first on Pivotal Labs.
]]>The post So You Still Don’t Understand Hindley-Milner? Part 1 appeared first on Pivotal Labs.
]]>I was out for drinks with Josh Long and some other friends from work, when he found out I “speak math.” He had come across this StackOverflow question and asked me what it meant:
Before we figure out what it means, let’s get an idea for why we care in the first place. Daniel Spiewak’s blog post gives a really nice explanation of the purpose of the HM algorithm, in addition to an in-depth example of its application:
Functionally speaking, Hindley-Milner (or “Damas-Milner”) is an algorithm for inferring value types based on use. It literally formalizes the intuition that a type can be deduced by the functionality it supports.
Okay, so we want to formalize an algorithm for inferring types of any given expression. In this post, I’m going to touch on what it means to formalize something, then describe the building blocks of the HM formalization. In Part 2, I’ll flesh out the building blocks of the formalization. Finally in Part 3, I’ll translate that StackOverflow question.
Read on at my blog (since these blogs don’t support MathJax) →
The post So You Still Don’t Understand Hindley-Milner? Part 1 appeared first on Pivotal Labs.
]]>Whether you're learning math for pleasure or profit (jumping on the Big Data bandwagon), there are times when it may seem intimidating, overwhelming, confounding, etc. My assertion is that if you think like a programmer, you already have a leg up when it comes to learning math.
Continue readingThe post Making math make sense to programmers appeared first on Pivotal Labs.
]]>I gave today’s Tech Talk at Pivotal Labs SF on this very topic. The outline of the talk is listed below, and these are the slides. I’ll be following up with a series of mini blog posts extracting the contents of the talk.
The post Making math make sense to programmers appeared first on Pivotal Labs.
]]>