Computer Science Canada Equations in Turing |
| Author: | Aange10 [ Tue Sep 27, 2011 8:52 pm ] | ||
| Post subject: | Equations in Turing | ||
What is it you are trying to achieve? I'm writing a program for my Algebra 2 class that can solve a system of equations using substitution. What is the problem you are having? Well I really just have a question, but I've made a new thread so that any other help I need with this will be allocated at the same place (instead of my other topics). My question is: Can turing do equations with undefined variables? For example, lets say that a client has input all the information he/she has, and the equation is Y = 1/2x + 8. Is there a way i could use the variable x in my solving without turing yelling that it is undefined? Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) To whom it may concern...
Please specify what version of Turing you are using 4.1 |
|||
| Author: | Tony [ Tue Sep 27, 2011 9:05 pm ] |
| Post subject: | RE:Equations in Turing |
still don't understand what you are trying to do. A wild guess would be that you are looking to use Prolog instead of Turing. |
|
| Author: | DemonWasp [ Tue Sep 27, 2011 9:14 pm ] |
| Post subject: | RE:Equations in Turing |
No, there is no way to do this (easily). You could write what's called a "symbolic computation engine" (http://en.wikipedia.org/wiki/Symbolic_computation) like Maple (http://en.wikipedia.org/wiki/Maple_%28software%29), but that will be very involved and difficult. |
|
| Author: | Insectoid [ Tue Sep 27, 2011 9:57 pm ] |
| Post subject: | RE:Equations in Turing |
You'd have to store the equation as a string and write the code to parse and calculate that string. Creating any type of calculator that solves complicated equations (ie anything 'bigger' than x*y) is very involved. |
|
| Author: | Aange10 [ Wed Sep 28, 2011 5:51 pm ] |
| Post subject: | RE:Equations in Turing |
What does involved mean? And what do you mean parse? Simplify (I live in the US)? I can do all the math required. I just am not sure how to code it |
|
| Author: | DemonWasp [ Wed Sep 28, 2011 10:09 pm ] |
| Post subject: | RE:Equations in Turing |
"Involved" in this case is meant to suggest "a full university education" and probably "a fairly large team to help you build it". By "parse" I mean "completely decompose the input string into parts". The parts in this case would be literal numbers, like "3", variables like "x" and operators like "+"; from there, you have to build a "tree" out of these things based on operator precedence. Once you have that, you can start on the (difficult) work of solving the equation. Since your examples are very simple (line equations, always as y = mx + b), you could just ask "which is your unknown, x, y, m or b?" and have them input the other three values, and based on that, you could solve for the answer. |
|