Hacker News new | past | comments | ask | show | jobs | submit login
A math problem generator (github.com/lukew3)
145 points by mindcrime on Dec 19, 2022 | hide | past | favorite | 45 comments



Personally I don't care about the quibbling over semantics as far as "problem" vs "exercise". Fine, call it a "math exercise generator". That's something I personally wanted and was very happy to find this, and I expect it's something a lot of other people (especially people doing self-study) will find useful.

I think it would also be fun to look at contributing to this, and see about maybe adding some generators for additional probl... er, exercises. In particular, adding more stuff in the Calculus section might be an interesting challenge, and could make this even more useful.


Agree. This can be very useful for an online learning tool. Will see how I can leverage this. Thanks for this.


Hi, I'm the project author. It's cool to see so many people suddenly take interest in this project. I haven't touched it for a while, but seeing such support has restored my desire to work on it. I would love to hear your thoughts and would be happy to respond to any questions!


I applaud your effords. But unfortunately, this perpetuates the notion that this is what math is. It's mundane calculations, best done by a machine. Nobody even underatands why it's meaningful to multiply matrices like that.

How come that high school math is full of this stuff, like doing manual matrix multiplications over and over, but not a single mathematical proof?

Society would really benefit from people training logical reasoning, which is what a mathematical proof is. Rather that than a manual matrix multiplication.

Heck, even most of my SWE colleagues can't even write down a real proof.


Thanks. I don't believe that math is simply learning how to perform calculations. However, I also don't think that I'm in the best position to teach students how to understand why they do these calculations. It is entirely up to teachers and those who create curriculum to teach students why these calculations work. This project simply gives teachers another tool to help students solidify their what they have learned.


Don't let the naysayers grind you down. Your project is very useful for what it is! You can't please everybody but in this case you're doing a pretty good job.


I love your Repo. It is fun to solve these tasks and to have an abundance of these is even more compelling.

I love Math and this is sort of casual gaming.


This sentiment probably stems from an incredibly privileged place.

Mathematicians and people who are/were good at math are always quick to disregard the "boring" math.

First I'd like so make it clear that I agree with you.

However, in reality, all this stuff is seen as a prerequisite to get to "the good stuff". Real world education systems have this gatekeeper in place for everyone who isn't exceptional.

So while I absolutely share your sentiment, I find it very misplaced (and a bit distasteful) here for a tool that can actually just help real world self learners overcome those barriers. Self learners that just want to learn the basics from ground up are already often ignored by the whole math community.

Math is exercising, that is something high school math and university math very much have in common.

Had OP posted a generator for proof based exercises and problems, I guarantee you some mathematician would've showed up to rant just as much about how trivial undergraduate level proofs are ;)


Funny, I always took it to the inverse - the ones naturally good at math loved these kinds of exercises (and got even better as a result) and the other kids hated the exercises since they took forever, were difficult, and they couldn’t understand why it mattered they became good at them. Making it more relevant is helpful to both groups but more so the ones that didn’t already have a reason to be interested no? Either way as long as you can convince them practice is a good thing you’re golden.


I'd wager that a typical math homework felt like a grind to everyone sooner or later, depending on overall load and topic, so the attitude towards it would be as personal as with anything else. I was never one of those IMO-level exceptionals, though scored OK nationally, and hated doing essentially same problem 50 times in a row. My friends were chiller on average, but I never noticed any skill-loathing relation.


One thing though, doing exercises (or problems, whatever you want to call them) is extremely helpful for actually learning math. For your matrix example, I had a very excellent teacher for linear algebra and one of the most helpful things they did was spend the first few weeks of the course teaching manual calculation and actually forcing us to do the manual calculations. At the time this felt like a total waste of time, since after all that is what computers are for, right? However, actually doing the calculations helped greatly to reinforce my memory for matrix manipulation and what is actually occurring.

Yes, proofs are a powerful part of mathematics, but they aren't at all the only goal. For someone like a machinist, proofs seem entirely impractical and like a waste of effort. My high school geometry class was heavily proof based, and most of the people in my class couldn't understand why we were doing these exercises. As a result, they didn't actually learn many of the helpful tricks from intro geometry that can help with things like machining or carpentry. In fact, I'd talked to someone who was in that class that now runs a cabinetmaking shop and they mentioned feeling cheated in high school due to our geometry class. I thought it was very well taught, but I ended up doing a BS in math. I was surprised that we ended up with very different views of the same class >10 years later.

Plus, even after MS level math courses, I can appreciate the need to do exercises. I look at them the same way as practicing playing an instrument. Sure, you can intellectually understand everything about a performance, but the only way to learn is through practice. I haven't had to touch 3d calc in a hot minute, but an upcoming side project will need that. First thing I am doing is (legally acquiring) some undergrad textbooks and solution guides and working through problems before comparing results. Yes, I can do proofs, but going through a worked example and comparing results is an excellent way of learning.


> Yes, proofs are a powerful part of mathematics, but they aren't at all the only goal.

Ultimately, they are.


Just a reminder: Proofs are usually stuff for a master course.

I think these short outburst of calculations are helpful and fun. I for example host a private website for sub/add/mult/div tasks and consider them as same sort of casual gaming, solving these "math problems" in the shortest time possible.

Author's great repo inspired me to add more stuff. I like it.


I realize you may not want to share it, but if you have some sort of resource you could point me at I'd appreciate it, since I also like doing basic arithmetic as a mental game. I view it as similar to the type of casual timekilling that one would do with sudoku or minesweeper, but at least semi-productive in that I'm building mental arithmetic skills. If you feel inclined to share the source so I could run my own instance, I can be reached at my username + google's mail service.


You might like catmath.io. Unless you hate cats.


> Just a reminder: Proofs are usually stuff for a master course.

And that's my criticism. If more people in society cared why something is true, we wouldn't have falsehoods abound all around us that are obviously wrong and logically screamingly incorrect.

Matrix multiplication is an uninportant detail. Modus ponens is what holds everything together. But rarely anybody can handle the latter, nor even has heard of it.


I'm super happy to see this project. I was thinking about doing something similar a while ago to use in flashcards. I find spaced repetition really useful in a lot of areas, but for math exercises it never really made sense as I would just memorize the answer rather than actually doing the calculation to see if I remember the steps! Ultimately I gave up as it felt like a way to procrastinate by doing something I like (programming) instead of something I don't really enjoy (math).

I might poke around with this and Anki sometime though and see if I was onto something!


Really like the project, I am curious if you would be willing to accept a PR for a LaTeX generator output flag? That seems like a fun addition to do, but it is a scope expansion so before spending time on it I'd thought I'd ask if that would be something you would accept for the project?

Edit: The reason I ask is that providing a tex generator would possibly help K12 teachers generate exercise sheets, since obviously the terminal output wouldn't do for providing to students. I see that basic Tex is availiable, but from what I see it doesn't support templates.


Yeah, better LaTeX support is going to be my top priority right now. See this issue for my current plans: https://github.com/lukew3/mathgenerator/issues/387

I'd love to get some input on this.



Wolfram has a similar product that they call a “problem generator” [1]

[1]https://www.wolframalpha.com/problem-generator/


I guess it's my problem, but having been blown away by AI so often recently, I was sort of expecting more here. I suppose an AI that could generate full text problem statements together with sample solutions for basic university level math courses like probability or linear algebra isn't too far out of reach at this point anymore. There could also be some actual market opportunities in that, both with educators and students who want to prep for tests.


> isn't too far out of reach

If you are referring to the recent ChatGPT developments, it can't even solve these very basic exercises.


I was more thinking of Github Copilot, but ChatGPT is similarly good at programming. Programming is arguably even less error-forgiving than providing a written answer to math problems (I was more thinking of problems that ask for an analytical rather than numerical answers, which is also what most university-level math courses ask for). I wouldn't have expected those models to perform nearly as well at programming as they do, so I've updated my prior.

Of course you'd need to find a math corpus of a similar size to github's repositories first. Overleaf has a bit of a similar position to github in STEM research, so that would be an interesting place to start looking (if it's legally possible). It's probably still too small, but would be interesting to see what a GPT version trained on the Overleaf corpus could do.


I think the coolest thing about this tool that I haven't seen mentioned yet is randomizing homework and tests for students on pen and paper without an expensive web platform. This completely eliminates cheating in a math class. Would some sample AI generated text for problems be nice? Sure. But this is the bulk of the work already done IMO.


Why is there an exercise called "complex division" even though it has nothing to do with complex division?


Thanks for pointing this out. This is a naming error, where complex is used as an antonym of simple. I think a better name would be "rational result division" or even "fraction to decimal". This is being corrected now.


Extend it to produce (and sell!) sample GMAT papers


Are there generators for programming exercises?



Absolutely love the concept.


The author is talented, but these are mundane exercises, not problems. They are all trivial mechanical computations best done by a calculator, that do nothing to promote understanding and insight.

A lot of work went into this, to generate trivial exercises to train rote memorization, like flashcards.


True, perhaps this would be better called an exercise generator. However, when studying this in school, the teachers always called them problems, hence why the title was chosen. The project is aims to help students K-12 and possibly undergrads whose curriculum is aimed to get them comfortable with solving these computations without aid of a calculator, or at least without programs that solve it for them. This is not supposed to be the primary means of teaching, but rather a tool that teachers can use to provide infinite exercises for their students to practice on, with the benefit of students not being able to copy answers directly out of a textbook without understanding how it works.


I have a degree in math and I actually enjoy these types of problems. Keeping sharp at mental arithmetic is really fun and it prompts the brain to come up with shortcuts that can lead to more interesting math. Like, is 51 prime? (No, 5+1 = 6). It's not really rote memorization but getting better at mental arithmetic, which is actually meditative in a way.


Why do you sum the digits? Goldbach?


It is because a number is base ten is like this:

a + 10b + 100c + 1000d + ....

But 10 leaves a remainder of 1 on division by 3 so this number divided by 3 is the same as

a + b + c + d + ...


It's divisible by 3 , because 6


To say this in more detail, it’s observed that any number with digits adding up to multiples of 3 is divisible by 3

https://math.stackexchange.com/questions/341202/how-to-prove...


https://everything2.com/title/m_turner%2527s+postulate

For any integer base B greater than 2, the multiples of the number B-1, when represented in base B will always have the sum of the digits be a multiple of B-1. If B-1 is a square number (4,9,16,...) then the square root of B-1 will also have this property.

(the following node has a proof)


> If B-1 is a square number (4,9,16,...) then the square root of B-1 will also have this property.

In fact, if d is any divisor of B-1 (including a trivial divisor), then d will have this property. (The author of the proof on the page you linked to is aware of this, but the author of the original conjecture isn't. For example, the reply notes that the digital root test for divisibility in hexadecimal works for 3 or 5, which are divisors of 16-1=15, regardless of the fact that 15 isn't a square. It also works for 1 or 15, which are also divisors of 15.)


Almost every physicist would disagree :-)

While mathematicians hate this kind of stuff, it is the bread and butter of physicists. While it is true most of them will not compute the cross product of two concrete vectors by hand, most will compute them symbolically, and the skills to do both are the same.


yet, he's right.

these are "exercises", not "problems" they don't involve creative thinking. look up the difference on any text about "problem solving"


Curiously, ChatGPT falls on its face with about half of these that I checked. It was confidently wrong about them too, but tried its logic again when I corrected it. YMMV.

So if your calculator is a huge neural net, maybe the problems aren't trivial!


Try ask ChatGPT what 12931239 + 712380 is. It can only solve 30 + 46 because it actually memorized/'saw' the latter, but that's nothing new.


But Wolfram Alpha will do them all easily.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: