The function is simple. It outputs a mathematical expression string and a result value. it is quite easy to use. Compared with the calculator provided by the system, it can easily display expressions. I have released a version before. The new version has the same interface as the old version. The difference is that I have rewritten a library for mathematical expression parsing.
The mathematical expression parsing algorithm uses fractional recursion, which is quite efficient. Maybe the Polish method will be faster. Let's talk about it later.
Code and software:
Http://files.cnblogs.com/WhyEngine/MathExpression.zip
Earlier versions:
Http://www.cnblogs.com/WhyEngine/p/3513478.html
Yesterday I posted a blog post "3D visualization of WHY mathematical expressions", which uses the same expression Parsing Code as it. the expression format is the same. the difference lies in the new version, because today we have added the function of parsing floating point numbers in scientific formats.
Built-in function Operators
(1) Standard Single Object Operator
+ ,-
For example:A =-B
(2) standard binary Operators
+,-, *,/, %, ^
For example, c = a * B
(3) The single-object operator of a function is like sin ()
Positive, negative, abs, floor, ceil, sign, sqrt, exp, log, log2, log10, sin, cos, tan, asin, acos, atan, rand
(4) function binary operators, such as pow (a, B)
Add, sub, multiply, divide, max, min, mod, pow, atan2, rand2,
(5) The operator of the function is like lerp (a, B, r)
Lerp, clamp, gray, add3, min3, max3, average3
(6) function four-object operators, such as average4 (a, B, c, d)
Add4, min4, max4, average4
I will not explain the specific function functions. I can guess the function name. I will not look at the code again.