Solving all math and teaching it as you go

Hello MATLAB community,
I have another mission for my project and I am trying to get it started.
So the objective is to make a code that can solve math problems but also show you how to solve the input math problem. I know there is certain ways to solve some math problem (adding, subtracting ,etc) however when it get to the gritty of things I would like to make it so go step by step solving problems. Like derivative or finding varibles etc.
I was hopping to have a options on how to input the problem in the code and code solves it but shows how to solve it.
DOes anyone have any idea or suggest or example to get me started and moving?
Thank you

6 comentarios

Jan
Jan el 21 de Jun. de 2019
Editada: Jan el 21 de Jun. de 2019
The question is not clear enough to be answered. "Make code that can solve math problems" sound like some genious work. "Math problems" is an extremely wide field and e.g. "adding and subtracting" is not enough for the tensor arithmetics of the 4 dimensional space time used in Einstein's theory of General Relativity.
"Finding variables" can mean a variety of things.
Please explain your problem with more details: Which kind of problems do you want to solve? What should be computed automatically and which part is done by Matlab? Post some examples.
Guillaume
Guillaume el 21 de Jun. de 2019
Editada: Guillaume el 21 de Jun. de 2019
Reading this, it sounds like you have a vague idea of what you want but have not really thought it through in great details. So really, at this point you've yet to do the first step of any engineering project, which is to define your requirements and scope.
Once you have a better idea of what you want, then we can help. By the sound of it, it probably won't be a trivial task, I would expect several months-men worth of coding.
John D'Errico
John D'Errico el 21 de Jun. de 2019
You want to solve math problems automatically, as well as show you the logic that was used? David Hilbert left a few behind that should prove interesting. Perhaps you are watching the wrong tv shows, where computers can do anything.
No matter what, your task will prove exceedingly difficult, unless you SEVERELY restrict the class of problems that will be allowed. nd even then, asking it to return the steps taken to solve the problem will be quite difficult, since this means you cannot just feed the problem into solve from the symbolic toolbox. You will need to fully parse all problems, and do the work in code, yourself.
As has been said, expect to spend man-months, if not man-years to solve such a task, depending on how much sophistication this will involve.
Rainaire Hansford
Rainaire Hansford el 21 de Jun. de 2019
Okay well the lets start off with this scope.
To answer you comment @Jan, I would like my project to eventually be able to solve and teach any math problem. For now I would just stick with the simple basics and work my way up.
For example if I someone want to find x in any given eqaution e.g 3x=4. Very very simple.
The user would input the eqaution in the code and the code will solve it. (x=4/3=1.3333.....)
But I need a way to make the code tell the user that you need to isolate x by dividing 3 on both sides. I know that sounds very complex but I just wanted to see if there was a way.
@Guillaume. My "requirement" for my project is to create a program that teaches people peferably students how to do the math. Like the example that I meantion above my "scope" is to have the user input his/her quesition (weather it algbra, calculus or matrices) the code will solve it and basically show its work so the user can see it.
So if you want to give me any idea how I can start. What would either of you suggest for a code where a user puts in any equation, let say: x+5x=3x+2 and I would like it to solve for x. Lets just start there. Any suggestions?
Guillaume
Guillaume el 21 de Jun. de 2019
Computers are not magic, you need an algorithm before you can write code. Your example is still not very well define. Solve x+5x=3x+2
  • Do you allow for any variable name, not just x? If so, how does the code know which is the variable to solve for?
  • Do you allow for the multiplication sign to be omited as you have done? If so, what algorithm do you use for the code to figure out the missing multiplication signs?
  • Do you allow just for linear equations or do you want more complex equations (polynomial?, non-linear? ode? pde?) which require completely different solving methods. If so, how does the code determine which solving method to use?
  • What, exactly, do you want the computer to display? If you were to use matlab solving functions, you'd just get a result. Looking at the intermediate steps that the code uses would be of no use as it's completely different to what a human would do.
That's only started questions for a "simple problem".
As for "any math problem", that's a vast subject. Geometry is part of maths, do you also want to write a user interface that can draw geometric shape? What about logic? As John wrote, there are plenty of math problems that we don't even know how to solve, and yet you want something that can solve any math problem.
Yes, you can probably write a tool that will allow you to solve linear equations in one variable. You will need to parse the expression yourself, since if you put that into syms, it will start by doing much of the work for you. And of course, you will need to pre-parse any lines, since MATLAB does not understand things like 5x or 3x, and anything in the symbolic toolbox, must have ==, not =.
syms x
x+5*x==3*x+2
ans = 
Note that it already did some automatic simplification. If you want a tool that explains things, you need to pre-parse EVERYTHING, and then do all of the symbolic operations yourself. You would need to re-write the symbolic toolbox.
But now, go on to something only slightly more sophisticated, for example
exp(x) - x == 1
Here there is technically a solution, but it requires using the LambertW function. But there is no simple algebraic way to solve it, without recourse to knowledge of special functions.
But if we change that to something else, like
cos(x) - x == 1
now there is no solution.
Your code would need to be quite sophisticated.

Iniciar sesión para comentar.

 Respuesta aceptada

Jan
Jan el 21 de Jun. de 2019
Editada: Jan el 21 de Jun. de 2019

3 votos

This will be an extremely demanding project. You find some software which can simplify symbolic expressions, e.g. Matlab's Symbolic Toolbox, Maple, Sage, Maxima, etc. See https://en.wikipedia.org/wiki/List_of_computer_algebra_systems . These softwares required several years of development and a team of programmers and mathematicians. As soon as you enter the level of solving integrals, a general purpose code might be a candidate for the Fields-Medaille. Even your trivial example 3x=4 needs some not mentioned restrictions, e.g. that x is a real scalar number, and not a natural number or an n-dimensional tensor.
So if you want your program to solve math problems beyond the 8.th year of school, I do not see a real chance to get it to work. You mention "students", so the code must be able to handle x=exp(-x) and a^n+b^n=c^n (for n>2 and a,b,c are natural numbers). It took 350 years and the work of the most famous mathematicians to solve the latter problem, so I'm sure your code must be extraordinarily complex to solve "all" maths problems. (The "all" is in quotes, because Turing and Gödel have proved already, that this is not possible in general.)
I think you underestimate massively the complexity of the problem. Even this forum cannot offer enough assistence to solve it. The best idea is to use some of the many existing programs for sybmolic calculations - you will need more than one, because all of them have some specific powers and fail for other problems.

1 comentario

Guillaume
Guillaume el 21 de Jun. de 2019
and we're only talking about a small subset of algebra here, which itself is only a very small subset of "any math problem"!
I repeat, the first step is going to be to fix the exact scope, in great details, of what class of problems the code is going to solve. If this is going to be a summer project, that scope will be very small. Most likely, time would be better spent writing a program where the problems, solution, and steps are all entered by the teacher. In which case, the difficulty is in coding the user interface. I wouldn't recommend using matlab for that, there are much better tools for coding UIs.

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 21 de Jun. de 2019

Comentada:

el 13 de Jun. de 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by