This is a complete rewrite of this here: http://forum.colorinfection.com/comm... Once again, I have written this function with the goal of increasing performance and utility. Here's a direct comparison of how much better this new function is:
Here's my old grapher with my new function instead for you to play with (also edited slightly to load new values on the fly, as the function is now powerful enough):
To use the function, first take a string with your math expression, simply put it into the CompileExpression function, and keep the output. If you want to now set your variables, just use the SetVariable function (note that as of yet, only single-character alphabetic variable names are supported). Once you have set your values, simply call EvaluateExpression to obtain the result.
Some notable features include an expanded recognized functions list, n-ary functions, boolean operators, increased stability (whitespaces are fine!) and a highly programmable implementation method (adding a new function is extremely easy). I plan to eventually add the absolute value signs |x| as an alternative to the abs() function, the conditional operator b ? x : y, and eventually, basic optimization with constants (so x+2*4 automatically resolves to x+8 without need for further calculation).
Documentation here: https://docs.google.com/spreadsheets... I have not ironed out every problem as of yet, and nor have I included every function I want to add. Feedback/suggestions are very welcome.----------------- Hopefully PA is inconsistent.
- Expressions like xxx now work properly (there was an issue with the regex replacement) - Some changes have been made to the precedence of some cases of implicit multiplication: 2x^3y still is (2x)^(3x), but sinx cosy is now sinx * cosy. - Implicit multiplication now uses the standard multiplication key, allowing for some less confusing code. - The grapher now has a default resolution of 500.
I'm making more solid plans with the conditional operator at the moment.----------------- Hopefully PA is inconsistent.
I believe 1/(x-1.4821) will draw a "vertical asymptote" on [-5, 5]. Reason: Caclulates points, -5, -4.996, -4.992, ..., 1.480 (high positive), 1.484 (large negative) and draw the line from (1.48, ~-500) to (1.484, ~500).
Unless the dots are not connected.----------------- 3.14159265358979323846264338327950288... Nothing Here
Feature Requests • Coloring graphs • Use the "Editable" property of text shapes • Increase thickness of selected graph to make it "stand out" • Nonconnected mode----------------- 3.14159265358979323846264338327950288... Nothing Here
I've added an API for numerical integration! It should be able to handle anything you throw at it, provided that the integral converges. There's support for varied precision goals and recursion depth. But it looks like you can compute at least to 1e-9 precision with not even a hiccup, so it might not be necessary.
To address Mathdude314: • Colored graphs are already supported. Just look in the options. • I made the grapher three years ago, but I can certainly work on converting it to editable. Or remake the grapher completely. • Nonconnected mode: If I remake the grapher, I could probably throw in detection of large discontinuities, or varied precision depending on the change between two values.----------------- Hopefully PA is inconsistent.