Ask HN: Sites, guides, videos to learn math by programming? - SolveEverything
======
dsacco
I think your question is underspecified. What are your _concrete_ goals? What
kind of mathematics do you want to learn, and how do you want to apply it?
Given that information we can make more prescriptive suggestions. As stated,
your question doesn’t give us any information on your current level of
mathematical maturity or background knowledge. Do you already know discrete
mathematics? Do you know calculus? These are meaningful questions that impact
how appropriate any given answer is.

I also disagree with the implicit premise of the question. I wouldn’t
recommend you try to learn any kind of nontrivial math by trying to program
it. Learning e.g. _linear algebra_ as opposed to just _matrix multiplication_
implies understanding the theory of vector spaces and linear transformations.
You can certainly implement algorithms based off of results in linear algebra,
and you can implement operations (like scalar-vector multiplication), but
programming doesn’t really make sense as a tool to help you learn the
mathematics unless all you want to do is computation.

------
pasabagi
[https://github.com/Jam3/math-as-code](https://github.com/Jam3/math-as-code)

Take a look at this. It translates a whole load of maths notation into
Javascript, which makes it all surprisingly straightforward and non-
mysterious, at least as far as the symbols are concerned.

------
cuchoi
Learning math for programming or by programming? Not sure about the usefulness
of programming to learning Math. For Statistics, I can see the added value
([https://speakerdeck.com/jakevdp/statistics-for-
hackers](https://speakerdeck.com/jakevdp/statistics-for-hackers)).

Do you have any examples?

~~~
SolveEverything
there's the smart ppl on hn that had talked about how math was way easier when
learned by programming

link is somewhere in my massive notes

~~~
dsacco
I don’t think that really makes sense. Most mathematics cannot actually be
learned by programming. They’re just different things.

You can _illustrate_ some mathematics (especially set theory and discrete
math) with code, and you can _implement_ some mathematical algorithms in code.
But to learn mathematics you have to implement the algorithm, not just see it
used with examples. In order to implement the algorithm you have to first
understand it. To understand it, you have to first build up to it in theory.

If you attempt to learn math by programming it, your understanding of that
math is going to be very “shallow”. Tools like SageMath and Mathematica are
good for computation, but the goal of learning is generality, and that’s
diminished if you learn through computation. Ideally you’d learn the
mathematics _first_ , then apply it - then you can choose to apply it by
programming specific results, but that won’t be relevant to whether or not
you’ve learned it.

I’d be curious to see the links you’re talking about, because I’ve never heard
math people say they learned math by programming. I’ve heard of people
implementing mathematical operations and algorithms in code, but that’s not
the same thing.

~~~
yesenadam
Broadly I agree; also I'm no maths professor.

But the talking as if _understanding_ can't be helped by programming, seems
wrong to me, if only because I've been doing it all my life. Maybe we have
different definitions of _deep_ and _shallow_ , but you can memorize a formula
with no understanding. Playing around with it with a program, and seeing what
happens, you get a hands-on experience that no amount of ..abstract generality
can replace. I keep reading about how the great mathematicians have gotten
their results not by doing mysterious genius things only they can, but by
getting their hands dirty, playing around with base and border cases, seeing
what happens with pencil and paper, in a way identical to mucking around with
programs.

To give a couple of concrete examples: I wrote a program that had planets
orbiting a central mass, and playing around with it I gained for the first
time a gut understanding of _orbiting_ , and how natural it is in 3D space -
it's something that just doesn't happen in the normal human environment.
Fiddling around with fractal formulae, _seeing what happens_. Drawing the
distributions of prime numbers, prime pairs etc. On and on, I could give
hundreds of examples, you get the idea.

Sure, it would be silly trying to recreate 2000 years of mathematical progress
on your own without reading textbooks, but exploring, getting a feel for
things, learning for yourself, is an important part too, to say the least. And
one equally deserving the name 'learning', if not more.

Read Oakeshott's essay _Rationalism in Politics_ for the best explanation I've
seen for this modern affliction where only things that can be explicitly
written down are counted as knowledge. (It's super-enlightening - I was
embarrassed how much I learned from it, always a good sign. I even learned a
lot about piano teaching—my day job at the time—from reading it.)

~~~
dsacco
_> Playing around with it with a program, and seeing what happens, you get a
hands-on experience that no amount of ..abstract generality can replace._

That’s not really correct. I think we’re talking about two different things.
I’m not stating that you can learn mathematics without actively doing it. I’m
stating that programming is a poor medium with which to actively do
mathematics _until_ you’ve already learned it. Active learning is absolutely
important, which is why solving problems is important. But those problems
rarely take a form that are straigtforward to implement in code.

The reason is because the broader theory of mathematics does not translate
into code without significant difficulty. You can do _computation_ of
particular formulas by implementing them in code, but it would be strange to
e.g. reason about what a field is by writing code to generate an array of
numbers that technically adheres to the field axioms for addition and
multiplication. You can do it, and it would help you a lot for operations over
fields, but that isn’t going to help you prove that the set of all rational
numbers is a field. You’re already past that if you’re implementing the code,
because the computer is implicitly accepting that all _xy_ and _x + y_ are in
_Q_ if _x_ and _y_ are in _Q_.

I’m a fan of using something like SageMath or Mathematica in a learning
environment for computational math homework. But I honestly can’t imagine
learning from a textbook and following along by writing code. The code is very
useful for deriving insights about _what_ something is, but it’s not as useful
for insights about _why_ something is.

~~~
yesenadam
Sure. A couple of comments only:

The example you give of fields is a good one, but one counter-example of an
area where playing around doesn't help much if at all, doesn't really affect
the question whether you can learn maths by programming, to which the answer
'No' seems wrong to me. If one person is blind, it doesn't mean nobody can
see. Sure, you can't learn all of it. But the other extreme, where you seem to
be saying, you can't learn anything—which saying things like that you can't
learn a particular piece of maths from programming "until you’ve already
learned it" seem close to—seems equally wrong to me. In the area you're
talking about, sure, it's hard to see how computers would help ones intuition.
But that's very far from meaning that all areas are like that.

Also, you're talking about problems, homework - answering other peoples'
questions. I didn't have that in mind, but learning, exploring for oneself.
And in areas where _no-one_ knows the why, one is exploring the what, how
things work. I think you're just thinking of abstract areas where that's not
really possible, but in a lot of areas it absolutely is.

But yes, I think we're not disagreeing so much as talking and focussing on
different aspects/areas of mathematics. And probably you know muuch more maths
than I do, and possibly mucking around with computers is of less use in the
higher realms than in the lowly plains I inhabit. But still, I can't help
thinking that the problem with thinking that knowledge is exhausted by _know-
that_ ( _know-how_ disregarded as not real/important because can't be written
down explicitly, as diagnosed in _Rationalism in Politics_ ) is a part of
thinking that the things that you say, correct as they are, fit together into
any kind of argument that programming is of no use in learning mathematics.
But it seems we have entirely different levels/areas in mind.

Thanks for the comments, very interesting.

------
0x54MUR41
I would recommend Brilliant [0], it contains courses and exercises on math,
science, and computer science. This site also offers weekly challenging
problems.

[0]: [https://brilliant.org](https://brilliant.org)

------
maltalex
Project Euler [0] comes to mind, although it's more of a collection of math
problems to be solved by programming. Definitely not a guide or tutorial.

[0]: [https://projecteuler.net/](https://projecteuler.net/)

------
welikethepark
This is something I've been interested in as well. I have dyscalculia and
struggled in school with math and formal notation but have never really had a
problem when it comes to understanding code. I wish someone smarter than me
would teach stuff like algebra, calculus and statistics in something like
javascript.

------
vik144
Check out this book called "Doing Math with Python".
[https://nostarch.com/doingmathwithpython](https://nostarch.com/doingmathwithpython)

------
dinosaurs
Coding Math
([https://www.youtube.com/user/codingmath](https://www.youtube.com/user/codingmath))

------
zapperdapper
If you want to learn Math, Kahn Academy is very good.

------
rahimnathwani
Coding the matrix (book)

