Tag: Algorithms
Common Optimizations for Levenshtein Edit Distance
I have been studying algorithms to compute the Levenshtein edit distance between two strings, which is defined as the minimum number of “edits” required to transform one string into another string. This is useful for a variety of things, from DNA sequence alignment to spell correction to address validation. I am studying it to resolve misspelled and OCR’ed scientific names of organisms to their real names, a famous problem in the field. The idea, of course, is to search a list of correct names for the given name and select the correct name that has the lowest distance to the given name. Sometimes this is called fuzzy matching.
Tag: Software Engineering
Common Optimizations for Levenshtein Edit Distance
I have been studying algorithms to compute the Levenshtein edit distance between two strings, which is defined as the minimum number of “edits” required to transform one string into another string. This is useful for a variety of things, from DNA sequence alignment to spell correction to address validation. I am studying it to resolve misspelled and OCR’ed scientific names of organisms to their real names, a famous problem in the field. The idea, of course, is to search a list of correct names for the given name and select the correct name that has the lowest distance to the given name. Sometimes this is called fuzzy matching.
Making a Pratt Parser Generator Part 1
A brief history of the Pratt parsing algorithm
The history of programming language parsers is dominated by the thorny challenge of parsing expressions, mathematical expressions in particular, taking into account the precedence of operators in the expressions. Modern formal language theory began with the work of Noam Chomsky in the 1950s, in which Chomsky lays out a mathematical framework for linguistics. Under this mathematical framework, languages exist within a hierarchy of languages defined according to how difficult the language is to parse.1 But computer programmers needed practical, efficient algorithms to parse computer programs for translation to machine code. Parsers of the 1950s relied on ad hoc logic rather than systematic algorithms (a feature which persists to this day, though to a much lesser degree). The 1960s was a golden age of parsing algorithm research when nearly all of the concepts and algorithms we use today were discovered and rigorously studied. By the early 1970s, parsing theory had evolved to the point that Stephen C. Johnson, a computer scientist at Bell Labs / AT&T, was able to start work on YACC (now “Yacc”), “Yet Another Compiler Compiler.”2 YACC was first publically described in 1975 and shipped with Unix version 33 and is still in use today.
Tag: Compilers
Making a Pratt Parser Generator Part 1
A brief history of the Pratt parsing algorithm
The history of programming language parsers is dominated by the thorny challenge of parsing expressions, mathematical expressions in particular, taking into account the precedence of operators in the expressions. Modern formal language theory began with the work of Noam Chomsky in the 1950s, in which Chomsky lays out a mathematical framework for linguistics. Under this mathematical framework, languages exist within a hierarchy of languages defined according to how difficult the language is to parse.1 But computer programmers needed practical, efficient algorithms to parse computer programs for translation to machine code. Parsers of the 1950s relied on ad hoc logic rather than systematic algorithms (a feature which persists to this day, though to a much lesser degree). The 1960s was a golden age of parsing algorithm research when nearly all of the concepts and algorithms we use today were discovered and rigorously studied. By the early 1970s, parsing theory had evolved to the point that Stephen C. Johnson, a computer scientist at Bell Labs / AT&T, was able to start work on YACC (now “Yacc”), “Yet Another Compiler Compiler.”2 YACC was first publically described in 1975 and shipped with Unix version 33 and is still in use today.
What is the IELR(1) Parsing Algorithm?
This short article is for those students, programmers, and computer scientists who already have a basic idea of what a parser is and does but who want to know what that mysterious reference to “IELR(1)” means in the Bison parser generator manual.
The IELR(1) Parsing Algorithm
The IELR(1) parsing algorithm was developed in 2008 by Joel E. Denny as part of his Ph.D. research under the supervision of Brian A. Malloy at Clemson University. The IELR(1) algorithm is a variation of the so-called “minimal” LR(1) algorithm developed by David Pager in 1977, which itself is a variation of the LR(k) parsing algorithm invented by Donald Knuth in 1965. The IE in IELR(1) stands for inadequacy elimination (see last section).
Defining the Wolfram Language Part 2: Operator Properties
In this third installment of our n part series, “Defining the Wolfram Language,” we begin to study the properties, namely the arity, affix, associativity, and precedence, of the Mathematica operators we found in Part 1. If we ended Part 1 proud of our accomplishment—perhaps even a little smug—then we will get reacquainted with our humility in this article.
Generalizing PEMDAS: What is an operator?
In programming languages, an operator is a symbol used to represent a specific operation such as subtraction of integers or dereferencing a pointer. The symbols +, *, and ! are commonly used as operators in many programming languages, for example. In this article we define some basic programming language terminology that allows us to categorize operators according to their different properties.
Computation with Expressions
Virtually all programming languages have expressions, like 2 + 4, which consist of operators (the + operator in 2 + 4) and their operands (or arguments; the 2 and the 4), that is, the things operators operate on. This language is barrowed from mathematics where, for example, $17/2 + \sin(\pi/2)$ is an expression that evaluates to the value $19/2$. Most programming languages also have other language constructs like statements and declarations that are not expressions. In some languages, like Wolfram Language, everything is an expression. In these languages, an entire program itself is an expression, albeit possibly a very complex one, and executing a program is called evaluation.
Defining the Wolfram Language Part 1: Finding Operators
Finding All Wolfram Language Operators
In this second article, Part 1 of an n part series on Defining the Wolfram Language, we start getting our hands dirty hunting down every single operator in Mathematica and each operator’s linguistic properties. To my knowledge, nobody outside of Wolfram has created such an exhaustive list before.
Defining the Wolfram Language Part 0: The Challenge
What is the definition of the Wolfram Language? This is the first in a series of articles attempting to answer this question.
The grammar of mathematical expressions
Using computers to do automatic translation has a long and rich history in computer science. A course in compiler construction is a veritable survey of topics in computer science running the gamut from formal languages to data structures and algorithms to Hopfcroft’s algorithm to minimize deterministic automata. One of the first things a student learns in a compiler construction course is how to formally describe the grammar of a language using (extended) Backus–Naur form (EBNF).
Tag: COVID-19
Bayes' Theorem and the Deathly Hallows
This article is an expanded version of the math part of an article I cowrote with marine biologist Dr. Andrew Rhyne about how many well-meaning public health professionals have misinterpreted the math behind test efficiency, Bayes’ Theorem. This misinterpretation has lead to dangerous public policy positions. Anyone with a math allergy is invited to read that article instead.
I and Dr. Andrew Rhyne, marine biologist and my longtime collaborator in fighting wildlife crime, have spent a lot of time in the last several months working on how best to fight the COVID-19 pandemic, especially in college communities like our own Roger Williams University.
Tag: Healthcare
Bayes' Theorem and the Deathly Hallows
This article is an expanded version of the math part of an article I cowrote with marine biologist Dr. Andrew Rhyne about how many well-meaning public health professionals have misinterpreted the math behind test efficiency, Bayes’ Theorem. This misinterpretation has lead to dangerous public policy positions. Anyone with a math allergy is invited to read that article instead.
I and Dr. Andrew Rhyne, marine biologist and my longtime collaborator in fighting wildlife crime, have spent a lot of time in the last several months working on how best to fight the COVID-19 pandemic, especially in college communities like our own Roger Williams University.
Tag: Statistics
Bayes' Theorem and the Deathly Hallows
This article is an expanded version of the math part of an article I cowrote with marine biologist Dr. Andrew Rhyne about how many well-meaning public health professionals have misinterpreted the math behind test efficiency, Bayes’ Theorem. This misinterpretation has lead to dangerous public policy positions. Anyone with a math allergy is invited to read that article instead.
I and Dr. Andrew Rhyne, marine biologist and my longtime collaborator in fighting wildlife crime, have spent a lot of time in the last several months working on how best to fight the COVID-19 pandemic, especially in college communities like our own Roger Williams University.
Tag: Mathematica
Defining the Wolfram Language Part 2: Operator Properties
In this third installment of our n part series, “Defining the Wolfram Language,” we begin to study the properties, namely the arity, affix, associativity, and precedence, of the Mathematica operators we found in Part 1. If we ended Part 1 proud of our accomplishment—perhaps even a little smug—then we will get reacquainted with our humility in this article.
Defining the Wolfram Language Part 1: Finding Operators
Finding All Wolfram Language Operators
In this second article, Part 1 of an n part series on Defining the Wolfram Language, we start getting our hands dirty hunting down every single operator in Mathematica and each operator’s linguistic properties. To my knowledge, nobody outside of Wolfram has created such an exhaustive list before.
Defining the Wolfram Language Part 0: The Challenge
What is the definition of the Wolfram Language? This is the first in a series of articles attempting to answer this question.
Using Mathematica From Python
In which I show you how to programmatically interface with a Mathematica kernel from Python.
Tag: Computer Science
Common Optimizations for Levenshtein Edit Distance
I have been studying algorithms to compute the Levenshtein edit distance between two strings, which is defined as the minimum number of “edits” required to transform one string into another string. This is useful for a variety of things, from DNA sequence alignment to spell correction to address validation. I am studying it to resolve misspelled and OCR’ed scientific names of organisms to their real names, a famous problem in the field. The idea, of course, is to search a list of correct names for the given name and select the correct name that has the lowest distance to the given name. Sometimes this is called fuzzy matching.
Making a Pratt Parser Generator Part 1
A brief history of the Pratt parsing algorithm
The history of programming language parsers is dominated by the thorny challenge of parsing expressions, mathematical expressions in particular, taking into account the precedence of operators in the expressions. Modern formal language theory began with the work of Noam Chomsky in the 1950s, in which Chomsky lays out a mathematical framework for linguistics. Under this mathematical framework, languages exist within a hierarchy of languages defined according to how difficult the language is to parse.1 But computer programmers needed practical, efficient algorithms to parse computer programs for translation to machine code. Parsers of the 1950s relied on ad hoc logic rather than systematic algorithms (a feature which persists to this day, though to a much lesser degree). The 1960s was a golden age of parsing algorithm research when nearly all of the concepts and algorithms we use today were discovered and rigorously studied. By the early 1970s, parsing theory had evolved to the point that Stephen C. Johnson, a computer scientist at Bell Labs / AT&T, was able to start work on YACC (now “Yacc”), “Yet Another Compiler Compiler.”2 YACC was first publically described in 1975 and shipped with Unix version 33 and is still in use today.
What is the IELR(1) Parsing Algorithm?
This short article is for those students, programmers, and computer scientists who already have a basic idea of what a parser is and does but who want to know what that mysterious reference to “IELR(1)” means in the Bison parser generator manual.
The IELR(1) Parsing Algorithm
The IELR(1) parsing algorithm was developed in 2008 by Joel E. Denny as part of his Ph.D. research under the supervision of Brian A. Malloy at Clemson University. The IELR(1) algorithm is a variation of the so-called “minimal” LR(1) algorithm developed by David Pager in 1977, which itself is a variation of the LR(k) parsing algorithm invented by Donald Knuth in 1965. The IE in IELR(1) stands for inadequacy elimination (see last section).
Defining the Wolfram Language Part 2: Operator Properties
In this third installment of our n part series, “Defining the Wolfram Language,” we begin to study the properties, namely the arity, affix, associativity, and precedence, of the Mathematica operators we found in Part 1. If we ended Part 1 proud of our accomplishment—perhaps even a little smug—then we will get reacquainted with our humility in this article.
Generalizing PEMDAS: What is an operator?
In programming languages, an operator is a symbol used to represent a specific operation such as subtraction of integers or dereferencing a pointer. The symbols +, *, and ! are commonly used as operators in many programming languages, for example. In this article we define some basic programming language terminology that allows us to categorize operators according to their different properties.
Computation with Expressions
Virtually all programming languages have expressions, like 2 + 4, which consist of operators (the + operator in 2 + 4) and their operands (or arguments; the 2 and the 4), that is, the things operators operate on. This language is barrowed from mathematics where, for example, $17/2 + \sin(\pi/2)$ is an expression that evaluates to the value $19/2$. Most programming languages also have other language constructs like statements and declarations that are not expressions. In some languages, like Wolfram Language, everything is an expression. In these languages, an entire program itself is an expression, albeit possibly a very complex one, and executing a program is called evaluation.
Defining the Wolfram Language Part 1: Finding Operators
Finding All Wolfram Language Operators
In this second article, Part 1 of an n part series on Defining the Wolfram Language, we start getting our hands dirty hunting down every single operator in Mathematica and each operator’s linguistic properties. To my knowledge, nobody outside of Wolfram has created such an exhaustive list before.
Defining the Wolfram Language Part 0: The Challenge
What is the definition of the Wolfram Language? This is the first in a series of articles attempting to answer this question.
The grammar of mathematical expressions
Using computers to do automatic translation has a long and rich history in computer science. A course in compiler construction is a veritable survey of topics in computer science running the gamut from formal languages to data structures and algorithms to Hopfcroft’s algorithm to minimize deterministic automata. One of the first things a student learns in a compiler construction course is how to formally describe the grammar of a language using (extended) Backus–Naur form (EBNF).
Using Mathematica From Python
In which I show you how to programmatically interface with a Mathematica kernel from Python.
Tag: Education
How Springer sent me to collections for adopting their textbook.
The story begins with one of those little mundane activities that fill every professor’s day. Right before the spring semester began I was evaluating various textbook options for the next time I teach undergraduate real analysis. Stephen Abbott’s Understanding Analysis published by Springer seemed to be exactly the kind of book I was looking for.
How To Ask Your Professor For Something
Do you need to ask your professor for an extension on a due date or to reschedule a quiz? A little thought before you click send on that email can make a big difference. Here is some advice.
Sneaky Continuous Functions
While the target audience of this article is my fantastic calculus students, other math teachers might enjoy it as well.
Sneaky Continuous Functions
When students in first semester calculus first start learning about limits, they are often asked to determine limits using the graph of a function, which we will call the graphical method, and also by constructing a table of values of the function, which we will call the numerical method. Students should be warned that these methods, while perfectly legitimate and often quite useful, are really just fancy ways of guessing the value of the limit, that is, the graphical and numerical methods do not supply us with mathematical certainty regarding the value of the limit. After all, what if your function is very sneaky and merely looks like it’s approaching a value $L$ as $x$ approaches $c$ when in fact it ultimately approaches a different value $K$?
Susan Meisenhelder's 'MOOC Mania'
Susan Meisenhelder offers a scathing critique of MOOCs in her article “MOOC Mania” published in the latest issue of Thought & Action. (Here is a link to a ~5mb pdf of her article.)
The evidence so far suggests that MOOCs are great for a very specific kind of student looking for a very specific kind of product, but that MOOCs are really awful for some of the very groups that they are marketed to serve, namely students with less privilege (low-income, working class), and students on the lower end of the academic success scale (little education, poor performers).
When Students Die
A colleague who had been worried about one of her star students who had been missing from class for a couple of weeks came into my office. “She committed suicide yesterday.” She needed to talk through it. She told me that she and two other professors had gone to the Student Services people a few days earlier—on a weekend—concerned about the student. She told me about all the ways they had tried to get to the bottom of what was going on in the days leading up to it. Any reasonable person would describe their efforts as far above and beyond the call of duty, as not just responsible but compassionate. “If I had seen her before it happened, I would have tackled her to the ground,” she said with the sincerity and desperation of someone struggling to find how after all of that effort things still went wrong. But you can’t. No tackle could wrest this student from the grip of tragedy. You try to be there for the students, to be supportive and available. But now and then a student will die.
Tag: Mathematics
Bayes' Theorem and the Deathly Hallows
This article is an expanded version of the math part of an article I cowrote with marine biologist Dr. Andrew Rhyne about how many well-meaning public health professionals have misinterpreted the math behind test efficiency, Bayes’ Theorem. This misinterpretation has lead to dangerous public policy positions. Anyone with a math allergy is invited to read that article instead.
I and Dr. Andrew Rhyne, marine biologist and my longtime collaborator in fighting wildlife crime, have spent a lot of time in the last several months working on how best to fight the COVID-19 pandemic, especially in college communities like our own Roger Williams University.
Platonic Solids and the School of Athens
Euclid in The School of Athens
This is a very special fresco painting by Italian Renaissance artist Raphael in the Vatican Museum called The School of Athens. It depicts the great philosophers of ancient Greece, famously with Plato pointing up and Aristotle pointing down.
Hangout On Air - Math: A Love Story
The Mathematics Community on Google+ had our second ever Hangout On Air last week. I was joined by Luis Guzman, Jason Davison, and Amy Robinson in a conversation that ranged from fluid dynamics to applying the mathematics of networks to map our ideas to JPEG image compression.
Sneaky Continuous Functions
While the target audience of this article is my fantastic calculus students, other math teachers might enjoy it as well.
Sneaky Continuous Functions
When students in first semester calculus first start learning about limits, they are often asked to determine limits using the graph of a function, which we will call the graphical method, and also by constructing a table of values of the function, which we will call the numerical method. Students should be warned that these methods, while perfectly legitimate and often quite useful, are really just fancy ways of guessing the value of the limit, that is, the graphical and numerical methods do not supply us with mathematical certainty regarding the value of the limit. After all, what if your function is very sneaky and merely looks like it’s approaching a value $L$ as $x$ approaches $c$ when in fact it ultimately approaches a different value $K$?
Blogging the JMM: Saying Goodbye
It’s over. Getting my internet fix in the hotel lobby at midnight, walking 18 miles a day through the convention center, sitting in uncomfortable chairs for hours, getting dinner in a local restaurant and realizing halfway through the meal that every single person dining there is also a mathematician, randomly bumping into an old friend or mentor or student–it ended today at around lunchtime when I made the trek back to the hotel lobby one last time.
Blogging the JMM: Friday
I love the exhibit hall. I love books, and the exhibit hall is full of some of my favorite kinds of books. I spend hours picking through the texts, flipping through their pages. The AMS sold me on a great book directed at undergraduates on Fourier analysis and an advanced text on Riemannian manifolds. In fact, they managed to photograph me mid-purchase! I also learned they are selling their first ever children’s book this spring.
Blogging the JMM: Thursday
The best part of the Joint Meetings is networking with like-minded people. I ran into many old friends and colleagues. Today (Thursday) several math bloggers and Google+‘ers organized an impromptu meeting for lunch. I stuck a sign on the message board inviting other math bloggers to join us, and a cohort of tumblr bloggers discovered it and joined us. Such is the power of the JMM message board.
Blogging The JMM: Wednesday
Today I learned about connections between musical rhythm and knot theory, abstract algebra and dance, a Navy ship from the mid 1800s called the U.S.S. Constellation, and some great undergraduate real analysis pedagogy. In today’s post, I’ll share with you some of the most interesting mathematical ideas I heard today.
Blogging the largest math conference in the world
I am in Baltimore to attend the 2014 Joint Mathematics Meetings, the largest gathering of mathematicians in the world involving the American Mathematical Society, the Mathematics Association of America, and many other professional societies related to the mathematics profession. There will be over 2500 talks given on topics ranging from the mathematics of pop-up books (#489) to the density of Henig efficient points in locally convex topological vector spaces (#2341) to rational numbers and the common core (#903). Thousands of mathematicians, teachers, and students will be rubbing elbows and talking shop. There will be a mathematical art gallery and film screenings. Last year there were even performances of a mathematical play! This will be my third time attending the Joint Meetings. The previous two times were a total blast.
Tag: Programming
Using Mathematica From Python
In which I show you how to programmatically interface with a Mathematica kernel from Python.
Tag: Python
Using Mathematica From Python
In which I show you how to programmatically interface with a Mathematica kernel from Python.
Tag: Art
Platonic Solids and the School of Athens
Euclid in The School of Athens
This is a very special fresco painting by Italian Renaissance artist Raphael in the Vatican Museum called The School of Athens. It depicts the great philosophers of ancient Greece, famously with Plato pointing up and Aristotle pointing down.
Tag: Geometry
Platonic Solids and the School of Athens
Euclid in The School of Athens
This is a very special fresco painting by Italian Renaissance artist Raphael in the Vatican Museum called The School of Athens. It depicts the great philosophers of ancient Greece, famously with Plato pointing up and Aristotle pointing down.
Tag: Academia
How Springer sent me to collections for adopting their textbook.
The story begins with one of those little mundane activities that fill every professor’s day. Right before the spring semester began I was evaluating various textbook options for the next time I teach undergraduate real analysis. Stephen Abbott’s Understanding Analysis published by Springer seemed to be exactly the kind of book I was looking for.
Tag: Teaching
How To Ask Your Professor For Something
Do you need to ask your professor for an extension on a due date or to reschedule a quiz? A little thought before you click send on that email can make a big difference. Here is some advice.
Tag: Science Communication
Hangout On Air - Math: A Love Story
The Mathematics Community on Google+ had our second ever Hangout On Air last week. I was joined by Luis Guzman, Jason Davison, and Amy Robinson in a conversation that ranged from fluid dynamics to applying the mathematics of networks to map our ideas to JPEG image compression.
Tag: Data Science
Does a 1929 market chart predict a market crash?
No. No it does not. Not even a little bit.
Tag: Finance
Does a 1929 market chart predict a market crash?
No. No it does not. Not even a little bit.
Tag: Calculus
Sneaky Continuous Functions
While the target audience of this article is my fantastic calculus students, other math teachers might enjoy it as well.
Sneaky Continuous Functions
When students in first semester calculus first start learning about limits, they are often asked to determine limits using the graph of a function, which we will call the graphical method, and also by constructing a table of values of the function, which we will call the numerical method. Students should be warned that these methods, while perfectly legitimate and often quite useful, are really just fancy ways of guessing the value of the limit, that is, the graphical and numerical methods do not supply us with mathematical certainty regarding the value of the limit. After all, what if your function is very sneaky and merely looks like it’s approaching a value $L$ as $x$ approaches $c$ when in fact it ultimately approaches a different value $K$?