YORK — Those who think science and algebra can’t by definition be a lot of fun should have wandered into Matt Duggan’s sixth-grade classroom at York Middle School before the end of the school year. Fun — and oh by the way, learning — was certainly in great supply.

In the “rollercoaster project,” Rube Goldberg meets Isaac Newton, with some construction price costing thrown in for good measure. Anyone familiar with the old Mouse Trap game will get the gist.

The goal of the project is to create a “rollercoaster” using various ramps, cylinders, loop de loops, even string and paper cups so that up to three marbles (one to start, and the others to kick in further down) will take a long time to reach the bottom. So slow and steady mark this race, with various hidden challenges that will slow things down further.

And so, said Duggan, the students are studying physics, really, using Newton’s law of motion using kinetic and potential energy. And the projects reinforce the study of gravity and inertia learned back in the fall in astronomy class, as well as the algebraic theories that the students began to study in math class during the winter.

But the slow descent of the marbles is just one determinant of a good project. It also has to be cost effective. Students “bought” girders, ramps and any other material they need. Each had a price attached to it, “so the more cost competitive you can be, the better,” said Duggan. Students ordered the material they would need for the following day, so had to plan ahead.

“They’re allowed to build up to a certain height, so we’re trying to get them to think about angles. And they can use up to four marbles on the way down,” he said.

Students Marcus Hamel and Peter Martin created the “Rasta roller,” clocking the longest time to the bottom in Duggin’s class – two minutes. “No one has ever done that before.” Their coaster uses three marbles, one triggering the next, and overall project costs were $18,260.

In addition to calculating that, they had to also calculate, among other things, the coaster’s average velocity and the potential energy – “How much energy it could have based on how high it is and how heavy the marble is,” said Hamel.

“It’s really fun, because it’s really hands-on,” said Martin. “It involves physics so much that you learn a lot. The taller it is, the faster it goes. So it involves a lot of fine turning and at first you never get it right.”

“We have the same ideas,” said Hamel. “It was fun even though at some times it challenged our friendship.”

“But in the end it made us better friends,” said Martin.