This site was created as a place for people to write simple computer programs in the context
of exploring mathematics.
Why this site?
A few reasons drove the development of this site.
is that in today's
technologically-based, machine driven society, our youth must learn to
use computers for more than a hub of digital media. No matter what their
field of study, the computer will play a central role. Be it in research or development,
to really make progress, one must invariably
program a computer, in one form or another. Further, this programming
will be, at least loosely, tied to the principles and logic of
In terms of programming, the second
is that the
modern operating system is an extremely difficult environment under
which to program. We think this is a big turn off for most people, kids
in particular. These days, it's simply too hard to get a computer to "do
something." Are you really going to sit a beginner in front of Xcode?
Visual C++? A Unix prompt? No way. And, is popping up an "about box" in
We grew up programming the first home computers, like the TRS-80s. When
you turned these on, you had no choice but to start programming them,
because they didn't really do anything else. And the programming made
would put something on the screen, and
would read keys from the keyboard.
As we look at computer programming environments today, we wonder what
ever happened to the being able to type a single line
and seeing a circle drawn
on the screen at (0,0)
with a radius of 5?
The "instant response" type programming environments, at least for
beginners, are hard to find. We believe such simplicity can draw
beginners into programming because once you have the circle (which is a
"head") you can do a
for the "body," and
you are on you way to programming a stick figure
on the screen!
, we've noticed that math offers a badly
needed context for learning how to code. Likewise, coding offers a
badly needed context for learning things about mathematics. You can
learn math through coding, or coding through math, and this is our the
core theme of our lessons. As A.A. Stepanov said in his book on generic programming,
"The separation of computer science from mathematics greatly
At Codebymath, you'll find a whole slew of coding lessons set in the
context of basic mathematical discovery. Here, we'll show you how to do
some creative programming to discover $\pi$ or calculate a tip. Or, you
can also learn some creative math that will verify a trigonometry
identity or show the difference between sine and cosine. And remember
how boring it was to learn how to convert temperature between the
$^\circ F$ and $^\circ C$ scales? It's a lot more fun to do it using an Arduino
simple coding, all with an actual temperature feed coming in.
This site is a big mix of PHP
The language used to teach the programming is Lua
, chosen because of its minimal punctuation and
clean syntax. The code-editor is courtesy of CodeMirror
, and of course, how would we
do anything without jQuery
? The symbolic math is provided by GiNaC
the 3D-printing (STL functionality) is of our own making, and the GIF-animator came from here
We'd love to hear from you. Idea? Problem? Suggestion? Let us know. Our email name is fopcontact, and it's a gmail account.