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
+67-3Lines changed: 67 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@
33
33
*[Editing a Matrix example](#editing-a-matrix-example)
34
34
*[12. Finding the characteristic polynomial of a Matrix](#12-finding-the-characteristic-polynomial-of-a-matrix)
35
35
*[Logical Calculus](#logical-calculus)
36
+
*[Expanding Calculus](#expanding-calculus)
36
37
*[TO BE CONTINUED](#to-be-continued)
37
38
38
39
@@ -726,8 +727,10 @@ This would give:
726
727
## Logical Calculus
727
728
728
729
The logical expressions in math engine have theirs intentional limitations. Thus allmighty logical expression parser was added around individually evaluated Mathematical expressions which results can be later compared, and logically grouped. The simplest way to evaluate an logical expression in ParserNG is to use the <code>LogicalExpression</code> class.
729
-
<code>LogicalExpression</code> is the class responsible for basic comaprsions and logica expression parsing and evaluation. It calls <code>MathExpression</code> to ech of its basic non-logical parts
730
-
730
+
<code>LogicalExpression</code> is the class responsible for basic comaprsions and logica expression parsing and evaluation. It calls <code>MathExpression</code> to ech of its basic non-logical parts. The default <code>MathExpression</code> can be repalced by any custom implementation of <code>Solvable</code>, but it is only for highly specialized usages. Highlight, where MathExpression is using <code>()</code> for mathematical bracketing, LogicalExpression - as () can be part of underlying comapred mathematical expressiosn uses <code>[]</code> brackets.<br>
731
+
<br>
732
+
In CLI, you can use -l/-L/--logic switch to work with LogicalExpression. Although it is fully compatible with MathExpression you may face unknown issue<br>
Note, that logical parsser supports only dual operators, so where true|false|true is valid, 1<2<3 is invalid!
833
+
Note, that logical parsser's comparsions supports only dual operators, so where true|false|true is valid, 1<2<3 is invalid!
831
834
Thus: [1<2]<3 is necessary and even [[true|false]|true]is recomeded to be used, For 1<2<3 exception is thrown.
832
835
Single letter can logical operands can be used in row. So eg | have same meaning as ||. But also unluckily also eg < is same as <<
833
836
Negation can be done by single ! strictly close attached to [; eg ![true] is ... false. Some spaces like ! [ are actually ok to
@@ -836,6 +839,67 @@ But much less for [r=3;r<r+1 || [r<5]]", which fails and must be declared as "[r
836
839
To avoid this, you can declare all in first dummy expression: "[r=3;r<1] || [r<r+1 || [r<5]]" which ensure theirs allocation ahead of time and do not affect the rest
837
840
If you modify the variables, in the subseqet calls, results maybe funny. Use verbose mode to debug order
838
841
842
+
## Expanding Calculus
843
+
Very often an expressions, or CLI is called above known, huge (generated) array of values. Such can be processed via <code>ExpandingExpression</code>. Unlike other Expressins, this one have List<String> as aditional parameters, where each member is a number. THose numbers can thenbe accessed as L0, L1...Ln. Size of the list is held in special MN variable. The index can be calucalted dynamically, like L{MN/2} - in example of four items, will expand to L2. Although `{}` and `MN` notations are powerfull, the main power is in *slices*:
844
+
```
845
+
Instead of numbers, you can use literalls L0, L1...L99, which you can then call by:
846
+
Ln - vlaue of Nth number
847
+
L2..L4 - will expand to values of L2,L3,L4 - order is hnoured
848
+
L2.. - will expand to values of L2,L3,..Ln-1,Ln
849
+
..L5 - will expand to values of L0,L1...L4,L5
850
+
where ..L5 or L2.. are order sensitive, the L{MN}..L0 or L0..L{MN} is not. But requires dynamic index evaluation
851
+
When used as standalone, VALUES_PNG xor VALUES_IPNG are used to pass in the space separated numbers (the I is inverted order)
852
+
Assume VALUES_PNG='5 9 3 8', then it is the same as VALUES_IPNG='8 3 9 5'; BUt be aware, with I the L.. and ..L are a bit oposite then expected
853
+
L0 then expand to 8; L2.. expands to 9,3,8; ' ..L2 expands to 5,9
854
+
L2..L4 expands to 9,5; L4..L2 expands to 5,9
855
+
```
856
+
ExpandingExpression calls <code>LogicalExpression</code> inside, and yet again the underlying Math evaluator is - defaulting as <code>MathExpression</code> can be repalced by any custom implementation of <code>Solvable</code>. Highlight, where MathExpression is using <code>()</code> for mathematical bracketing, LogicalExpression ses <code>[]</code> brackets. The dynamic indexes in <code>ExpandingExpression</code> uses are wrapped in `{}` <br>
857
+
<br>
858
+
In CLI, you can use -e/-E/--expanding switch to work with Expanding expressions. The array of numbers goes in via VALUES_PNG xor VALUES_IPNG variable. Although it is fully compatible with MathExpression and LogicalExpression you may face unknown issue<br>
0 commit comments