41
I have been developing a graphical function display program. I know there are some out there, and there may even be a few available for free, but I wanted to see if it could be done, and I have found the following to pose quite a challenge - Actionscript 2 has no mathematical evaluation function!
In JavaScript, we have eval() for converting a string containing a mathematical function into a numerical result. In Actionscript, the eval() method is used for converting a string into an object reference.
As such, I have had to build my own mathematical evaluator to make this work. So far, it recognises power (^), multiplication (*), division (/), addition (+) and subtraction (-) symbols, but it does not yet recognise brackets
I plan to include this functionality soon.
The Y scale is currently manual. I plan to make this automatic by default, with a manual option to allow the user to zoom into view the results.
To use the program, simply run it under Windows 2000, XP, Vista or 7. Other operating systems may also work, if they support Win32 exes.
Next you must set the X and Y limits. By default, these are both set to -10 to 10.
Next you must enter at least 1 function in one of the "Y=" boxes.
For example, 0.9*x+3 would result in a linear graph.
Also, x^2-5 would result in a curved graph.
If you think this sort of thing would be useful to you, please test it out, and let me know what needs to be changed to make it more useful.
So far, I plan to add bracket recognition to the function parser, an automatic Y-Scale option, more lines on the graph output, and to re-arrange the positions of the text inputs and Plot button to make it look better. If I have missed anything, please tell me.
In JavaScript, we have eval() for converting a string containing a mathematical function into a numerical result. In Actionscript, the eval() method is used for converting a string into an object reference.
As such, I have had to build my own mathematical evaluator to make this work. So far, it recognises power (^), multiplication (*), division (/), addition (+) and subtraction (-) symbols, but it does not yet recognise brackets
I plan to include this functionality soon.The Y scale is currently manual. I plan to make this automatic by default, with a manual option to allow the user to zoom into view the results.
To use the program, simply run it under Windows 2000, XP, Vista or 7. Other operating systems may also work, if they support Win32 exes.
Next you must set the X and Y limits. By default, these are both set to -10 to 10.
Next you must enter at least 1 function in one of the "Y=" boxes.
For example, 0.9*x+3 would result in a linear graph.
Also, x^2-5 would result in a curved graph.
If you think this sort of thing would be useful to you, please test it out, and let me know what needs to be changed to make it more useful.
So far, I plan to add bracket recognition to the function parser, an automatic Y-Scale option, more lines on the graph output, and to re-arrange the positions of the text inputs and Plot button to make it look better. If I have missed anything, please tell me.
<- me