There is a formula editor for indicators, the formula is saved as a text string. Then, when calculating the index, the formula is disassembled into a structure in the form of a tree and calculated. How to check that the entered formula has not been saved previously for some other indicator? For example, a formula of the form (a+b)*c is equal to ac+bc . I would be grateful for any help, at least a link to any literature.
Closed due to the fact that the issue is too general for the participants jfs , AK ♦ , Harry , pavel , aleksandr barakin 14 Jan '17 at 1:32 .
Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .
1 answer
I think that with 100% guarantees the task cannot be solved.
In my opinion, should do so.
1. To learn how to describe the scope of a function's parameters definition according to the principle “general-particular”, where by “general” we mean the type of variable and its boundaries, and by “special” we mean exceptions (zones of special attention).
2. To learn how to describe the domain of definition of a function of several parameters (the decisive rule "hit-do not hit").
3. Write a generator for each parameter and check for the domain of definition.
4. Write tests for cross-checking of functions, separately for parameters and areas of definition.
5. Write a test for checking the values ​​of functions.
6. Read additional literature on unit tests.
7. Learn how to make clear reports on the results of the test (the hesitant consumer should see the forest behind the trees).
sin(x)^2and1 - cos(x)^2same. - VladD