Profile cover photo
Profile photo
John Ahlgren
68 followers
68 followers
About
John's posts

Post has attachment
A Soft Introduction to Constraints in Inductive Logic Programming
I've written a gentle introduction to my research in constraints used in inductive logic programming.

Post has attachment
std::vector with constructors that throw exceptions
When using std::vector, reallocating may happen for several reasons: class A { . . . } ; std :: vector < A > v ; v . push_back ( A ( ) ) ; v . push_back ( A ( ) ) ; // may reallocate v . resize ( 100 ) ; // may reallocate When reallocation happens, all elem...

Post has attachment
Inductive Reasoning Visualized
Ever wondered what inductive reasoning would look like it you could draw a picture? Here's how: Click on the image or here for a larger one. I'll explain what you're looking at. Let us say you know the following facts: Gaia is a parent of Cronus. Cronus is ...

Post has attachment
How similar are two words? Or two formulas?
The problem Consider the word "John". How similar is it to "Jon", "Johan", and "on"? This of course depends on precisely what we mean by similar. But we an intuition that "John" and "Jon" should be more similar than say "John" and "Table". In particular, "s...

Post has attachment
Telescoping Sums
Consider generalizations to the closed form formula for arithmetic sums: \[ \sum_{k=1}^n k = 1+2+\ldots + n = \frac{n(n+1)}{2} \] Here's the formula for the square sums: \[ \sum_{k=1}^n k^2 = 1^2+2^2+\ldots + n^2 = \frac{n(n+1)(2n+1)}{6} \] And cube sums:
\...

Post has attachment
Solving Logic Riddles using AI Programming
Consider three persons, Caesar, Brutus, and Cassius. One is a king, another is a bureaucrat, and the third is a spy. The king never lies, whereas the bureaucrat always lies. The spy either lies or tells the truth. Caesar claims that Cassius is a bureaucrat,...

Post has attachment
Which shape gives the largest area?
The Isoperimetric Inequality Given a rope of length L, say 100 meters, what is the largest closed area you can make? If we try a square, each side has to be L/4 (25 meters), and we'll end up with an area of (L/4)^2 = 625 square meters. If we however try a c...

Post has attachment
Mathematical Realism and Anti-realism: all the way down to the Nature of the Universe itself
There's this age old question of where mathematics come from: is it a product of the human mind, or does it exist independently of it? Here's the labels: Realism: A realist believes that math exists outside of our  minds. We discover mathematics, we don't i...

Post has attachment
How to iterate over the values of a std::map
Now that C++ has lambdas, the C++ STL algorithms are practically useful. One problem is that iterators to std::map and std::unordered_map refer to std::pair<Key,Value> rather than just the value. Therefore, we cannot do: std :: map < int , std :: string > m...

Post has attachment
STL Container Performance
STL Container Performance There's already a good  table at Stack Overflow listing time complexity (in Big O notation) of common operations with C++ STL containers, although it's structured in a more abstract way and a little hard to read because it's not a ...
Wait while more posts are being loaded