I was inspired to create it while taking the Fast.ai course and seeing Jeremy Howard share  how a "complicated" Frobenius norm equation could be implemented in a single line of Python.
It's open source here: https://github.com/vthommeret/mathtocode
I would appreciate any and all feedback!
> It's time to start reading papers. And papers look something like this, which if you're anything like me, that's terrifying. And I'm not going to lie, it's still the case when I start looking at a new paper, every single time, I think, I'm not smart enough to understand this. I just can't get past that immediate reaction. So I just look at this stuff and I go, that's not something I understand.
> But then I remember, this is the Adam paper and you've all seen Adam implemented in one cell of Microsoft Excel.
> 1. Even familiar stuff looks complex in a paper!
> 2. Papers are important for deep learning beyond the basics, but hard to read.
> 3. Learn to pronounce Greek letters.
Any chance for a license like MIT?
NotImplementedError: the 'axis' parameter is currently not supported on line 7
I used variations of:
It's been a long time since I've taken linear algebra, so I don't remember some of these operations.
So it should look something like this: `np.sqrt((m * * 2).sum())`
Re: The error message, it looks like it's occurring because `sum` doesn't normally take any parameters and interprets the argument as an "axis" parameter — https://numpy.org/doc/1.18/reference/generated/numpy.sum.htm...
Order of operations is tricky and I could do a better job breaking it down. Still plan to add the Show Solution button but need to get some sleep :-).
In the meantime you can see all the possible solutions in the repo! https://github.com/vthommeret/mathtocode/tree/master/questio...
 Remove the space between the asterisks / I had to add it since HN interprets them as italics.
It's fairly outdated (5-years old) and doesn't implement some of the functions I wanted to use (like equality), but otherwise works pretty well.
The HN thread:
Feedback: Please autofocus to input box - it will be a smoother experience!
It has Borel spaces: https://leanprover-community.github.io/mathlib_docs/measure_...
Math to Code is open source, so if you can express a solution with NumPy you can easily add new questions / I'm happy to take pull requests — https://github.com/vthommeret/mathtocode/blob/master/questio...
Is a cool experiment, and it could be good to lose the fear in papers. Maybe you could add some exercises with formulas or different papers that are a must read.
It's possible that it timed out when computing the result — it evaluates the answer in a web worker with a 2.5s timeout and execution is slower on mobile. I used to get timeouts more regularly, but it's fairly optimized now — it checks all of the test inputs and evaluates both the expected solution and user-provided solution in a single Python function.
The explanatory text "Note that the matrix first element-wise multiplied by 3." is very unclear.
Also, looking at it from a Python novice, it is not clear we were supposed to know that the .prod() operator can act on something that is not purely a named variable, but can work on an already manipulated quantity within parentheses.
Also, and this is not your fault but of Python's, but it is not clear (or merits some explanation) why some operators take the form "operator(x)" while others behave like "x.operator" or even "x.operator()" with no argument.
I've simplified question 9 to just `m.prod()` from the previous solution of `(m * 3).prod()` for now.
Re: Methods vs. functions — I completely agree! I actually originally implemented Math to Code using Tensorflow.js (which was simpler than using a Python interpreter) where the syntax was:
np.sqrt((m ** 2).sum())
PyTorch has a similarly clean syntax to Tensorflow.js and includes operator overloading, but there doesn't seem to be a PyTorch shim for Skulpt, but that would be a fun project.
Also, my difficulty with numpy isn't applying functions to arrays, it's seeing __repr__ of a multi-dimensional arrays and grokking what it's showing me.
Site worked well on both my iphone and pc btw.
I'd like to more clearly show the answers / I originally didn't show what the test inputs (e.g. if square root is tested with 25, 9, and 4) so you couldn't just return 5 if 25, 3 if 9, etc... but I could display some of the test inputs and not all of them.
It definitely would be great to show the intermediate results of the calculations and for things like matrix multiplication `a.dot(b)` isn't very complicated, but it doesn't give you intuition on what's happening under the hood.
Thanks for the iPhone feedback — I tried my best to make sure it worked well on mobile. The few examples I could find of interactive Python tutorials usually involved spinning up a VM with multi-second lag for each question and textareas which were not at all mobile-optimized so I wanted to try and do something better :-).
Is there something specific that did work for you? I tried all the examples on Python 3.7.3 and they worked for me. One notable thing that's missing is that the @ operator for matrix multiplication, but I hope to add that in the future.
 http://skulpt.org Python 3 Grammar. The master branch is now building and running using the grammar for Python 3.7.3. There are still lots of things to implement under the hood, but we have made a huge leap forward in Python 3 compatibility. We will still support Python 2 as an option going forward for projects that rely on it.