You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-5Lines changed: 35 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
- an api
4
4
- a large set of test data
5
+
- aims to determine if two mathematical expressions are equal, either having the same form or not
5
6
- have a public website where you can add some math and check if it works - also the link should be shareable
6
7
7
8
@@ -13,6 +14,7 @@ yarn demo
13
14
14
15
Then go to `http://localhost:$PORT/demo`
15
16
17
+
16
18
## tests
17
19
18
20
```shell
@@ -27,9 +29,9 @@ There is one test that runs fixture data located here: `src/fixtures/latex-equal
27
29
yarn jest src/__tests__/latex-equal.spec.ts -t src/fixtures/latex-equal/7119.ts --reporters default
28
30
```
29
31
32
+
30
33
## Next Steps
31
34
32
-
* Check that we have a test case for any outstanding jira tickets relating to math-validation.
33
35
* Check that api we expose will support what is needed.
34
36
* Do triage on the test failures, add a note to failing test so we can build a picture of the work needed
35
37
@@ -52,27 +54,55 @@ yarn jest src/__tests__/latex-equal.spec.ts -t src/fixtures/latex-equal/7119.ts
52
54
* more advanced literal validation (todo)
53
55
* block input that is clearly too large/unrelated (eg: a user can type in gobbledy-gook - we should just abort if we see that)
54
56
57
+
58
+
## Capabilities
59
+
60
+
It can determine mathematical equivalence between:
61
+
62
+
- linear equations in one variable
63
+
- linear equations in two variables
64
+
- 2-way inequalities in one or two variables
65
+
- compound inequalities in one variable
66
+
- trigonometric identities and functions
67
+
- inverse trigonometric functions
68
+
- similar notation for logarithms and based logarithms
69
+
70
+
It can also handle degrees, radians and gradians
71
+
72
+
55
73
### things that'd be great (but we may have to park until we have more time)
56
74
57
75
* a faster latex parser
58
76
* faster math evaluation
59
77
78
+
60
79
## modes
61
80
62
81
There are 2 modes - literal and symbolic
63
82
64
-
Literal: needs to more advanced than the legacy literal implementation which was essentially a string check.
83
+
Literal: is at its most basic a tuned version of a string validation
84
+
85
+
By default - ignores spaces and parentheses as long as they do not change the meaning of operations (ex. “a+7 +b” will validate against “ ((a) + (7))+b ”)
86
+
- ignores leading zeros: “0.1” will validate against “.1”
87
+
- accepts commas for decimal marks. For example “1,000” will be equivalent with 1000
88
+
89
+
Literal Validation offers two configuration options that can be used to validate some variety of forms for an expression:
90
+
91
+
Ignore trailing zeros option; allows the evaluation to accept zeros to the right of the decimal place “4.5” will validate against “4.50000000000000”
92
+
Ignore order option; makes validation indifferent to the variables order, as long as it does not change operations meaning. In this case “a+7 +b*c” will validate against “7 + a+bc”, but not against “ac+7+b”; without it “a+7 +b” will not validate against “7 + a+b”
93
+
94
+
Symbolic: attempts to decide if expressions are mathematically equivalent or not
95
+
96
+
By default, it offers all configurations presented for literal validation, exceeding it by quite a lot
97
+
In order to check equivalence between 2 expressions, we have to reduce both expressions to the simplest one. Then distribute all coefficients, combine any like terms on each side of the expression, and arrange them in the same order.
65
98
66
-
Symbolic:
67
99
68
100
### Notes
69
101
70
102
*`@babel/runtime` is a devDependency if you ever need to link this repo to another package for testing
71
103
72
104
## TODO
73
-
* strip logs on compile
74
105
* set up api that is compatible w/ ui component options
75
-
* start going through the tests, build up literal + symbolic a bit att the start
76
106
* derivatives kind of work and kind of not - how to use?
0 commit comments