It’s been discovered that salamanders can count and dogs can do calculus. When salamanders have a choice between tubes containing two fruit flies or three, they always go for the tube of three. And dogs always figure out the most efficient route to take when catching a ball.

However, the mathematical abilities of salamanders are limited, according to researcher Claudia Uller, who says they “failed in the same way that babies and monkeys do” when confronted by more than three objects.

Primates do a little better?they can tell the greater of two quantities, as long as it’s smaller than four, without any training. “There is a limit on the number of objects that can be tracked at one time,” says brain researcher Alan Leslie, because the part of their brains that focus attention can?t deal with more than four objects.

Math professor Tim Pennings has a Welsh Corgi named Elvis who can do calculus. Pennings was teaching a calculus class where he drew diagrams on a blackboard showing Tarzan getting stuck in quicksand and Jane trying to find the best way to rescue him. He said, “So Tarzan is in the quicksand, and Jane is across the river and down the bank a ways, and she’s got to get to him as quickly as possible. She can run at a certain speed, and she can swim at a certain speed, which is obviously slower than when she runs, and the question is, what’s her best strategy for getting to Tarzan in the quickest amount of time?”

This is a basic problem in calculus, which is used to find the quickest route from point A to point B. The shortest route is not always the quickest. It would take longer for Jane to jump in the river and swim straight to Tarzan than it would for her to run part of the way to a point closer to Tarzan and then jump in the river and swim across.

Later that day, Pennings tossed a ball to Elvis at the beach and noticed that he didn’t swim straight out to get it, but ran down the beach first. He says, “I thought, man, that’s exactly what I drew on the board. He’s doing the very same thing.”

The next day, Pennings took one of his students to the beach with Elvis, and together they calculated the routes he took when he chased a ball. Back in the math lab, they plotted his routes on a graph and “it turns out that all the choices he made were right in line, or very close, to the optimal choice,” Pennings says. The dog was doing calculus.

Elvis is now on a lecture tour with Pennings, helping to explain math to students.

Want to find out how much the animals around you know? Learn to communicate with them! Find out how on this week’s Dreamland.