Skip to content

Commit 1cf1353

Browse files
committed
v3.0.1
General improvements
1 parent 862839c commit 1cf1353

File tree

4 files changed

+1601
-535
lines changed

4 files changed

+1601
-535
lines changed

README.md

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Although the main development goal of the class was the integration with [CSV In
1111
* __Basic math operators__: `+` `-` `*` `/` `\` `^` `!`
1212
* __Logical expressions__: `&` (AND), `|` (OR), `||` (XOR)
1313
* __Binary relations__: `<`, `<=`, `<>`, `>=`, `=`, `>`, `$` (LIKE)
14+
* __Outstanding matrix and statistical functions__: `CHOLESKY`, `MLR` (Multivariate Linear Regression), `FIT` (Curve fitting), `INVERSE`, and a lot more!
1415
* __More than 90 built-in functions__: `Max`, `Sin`, `IRR`, `GAUSS`, `LSQRSOLVE`, `Switch`, `Iff`, `DateDiff`, `Solve`, `fZero`, `Format`...
1516
* __Very flexible and powerful__: variables, constants and user-defined functions (UDFs) support.
1617
* __Implied multiplication for variables, constants and functions__: `5avg(2;abs(-3-7tan(5));9)`, `5(x)` and `x(2)(3)` are valid expressions.
@@ -194,23 +195,64 @@ End Sub
194195
'@------------------------------------------------------
195196
' Here a list of the new functions and its results
196197
'***********************************ADVANCED MATH FUNCTIONS***************************************************************
197-
''' FZERO('2x^2+x-12';-2;3) : x = 2.21221445045296 (find a zero for the given function in the interval -2<=x<=3)
198-
'''
199-
''' a = {1;0;4}; b = {1;1;6}; c = {-3;0;-10}; d = {2;3;4}
200-
''' LUDECOMP(ARRAY(a;b;c)) : {{-3;0;-10};{-0.333333333333333;1;2.66666666666667};{-0.333333333333333;0;0.666666666666667}}
201-
''' LUSOLVE(ARRAY(a;b;c);{{'x';'y';'z'}};{{2;3;4}};True) : x = -18; y = -9; z = 5
202-
''' MMULT(INVERSE(ARRAY(a;b;c));ARRAY(d)) : {{-18};{-9};{5}}
203-
''' MMULT(ARRAY(a;b;c);INVERSE(ARRAY(a;b;c))) : {{1;0;0};{0;1;0};{0;0;1}}
204-
'''
205198
''' A={{-2;40};{-1;50};{0;62};{1;58};{2;60}}
206-
''' FIT(A;1;4) : {{62 + 3.6667*x -9.6667*x^2 + 0.3333*x^3 + 1.6667*x^4};{1}} 4th degree polynomial fitting
207199
''' B={{0;0.1};{0.5;0.45};{1;2.15};{1.5;9.15};{2;40.35};{2.5;180.75}}
208-
''' FIT(B;2) : {{0.102*e^(2.9963*x)};{0.9998}} Exponential Fitting
209200
''' C={{1;0.01};{2;1};{3;1.15};{4;1.3};{5;1.52};{6;1.84};{7;2.01};{8;2.05};{9;2.3};{10;2.25}}
210-
''' FIT(C;5) : {{0.9521*ln(x)+0.1049};{0.9752}} Logarithmic fitting
201+
''' ----------------------------------------------------------------------------
202+
''' | Fitting data model with a 4th degree polynomial |
203+
''' | FIT(A;1;4) : {{62 + 3.6667*x -9.6667*x^2 + 0.3333*x^3 + 1.6667*x^4};{1}} |
204+
''' | |
205+
''' | Exponential Fitting |
206+
''' | FIT(B;2) : {{0.102*e^(2.9963*x)};{0.9998}} |
207+
''' | |
208+
''' | Logarithmic Fitting |
209+
''' | FIT(C;5) : {{0.9521*ln(x)+0.1049};{0.9752}} |
210+
''' ----------------------------------------------------------------------------
211+
'''
212+
''' X={{1;1};{2;2};{3;3};{4;4};{5;1};{6;2};{7;3};{8;4}}
213+
''' Y={{2;4.1;5.8;7.8;5.5;5.2;8.2;11.1}}
214+
''' ------------------------------------------------------------------------------------------
215+
''' | Multivariate Linear Regression with regressors/predictors interaction. |
216+
''' | |
217+
''' | MLR(X;Y;True;'X1:X2') : {{0.8542 + 0.4458*X1 + 0.945*X2 + 0.0792*X1*X2};{0.947;0.9072}} |
218+
''' ------------------------------------------------------------------------------------------
219+
'''
220+
''' ----------------------------------------------------------------
221+
''' | Finding a zero for the given function in the interval -2<=x<=3 |
222+
''' | |
223+
''' | FZERO('2x^2+x-12';-2;3) : x = 2.21221445045296 |
224+
''' ----------------------------------------------------------------
225+
'''
226+
''' a = {1;0;4}; b = {1;1;6}; c = {-3;0;-10}; d = {2;3;4}
227+
''' ------------------------------------------------------------------------------------------------
228+
''' | Using LU decomposition for a given matrix |
229+
''' | |
230+
''' | LUDECOMP(ARRAY(a;b;c)) : |
231+
''' | |
232+
''' | {{-3;0;-10};{-0.333333333333333;1;2.66666666666667};{-0.333333333333333;0;0.666666666666667}} |
233+
''' ------------------------------------------------------------------------------------------------
234+
'''
235+
''' ----------------------------------------------------------------------------------
236+
''' | Using LU decomposition for solve linear equations system |
237+
''' | |
238+
''' | LUSOLVE(ARRAY(a;b;c);{{'x';'y';'z'}};{{2;3;4}};True) : x = -18; y = -9; z = 5 |
239+
''' ----------------------------------------------------------------------------------
240+
'''
241+
''' ---------------------------------------------------------------------------
242+
''' | Using matrix multiplication for solve a linear equations system |
243+
''' | |
244+
''' | MMULT(INVERSE(ARRAY(a;b;c));ARRAY(d)) : {{-18};{-9};{5}} |
245+
''' | MMULT(ARRAY(a;b;c);INVERSE(ARRAY(a;b;c))) : {{1;0;0};{0;1;0};{0;0;1}} |
246+
''' ---------------------------------------------------------------------------
211247
'''
212248
''' A={{2;4};{-5;1},{3;-8}};b={{10;-9.5;12}}
213-
''' MROUND(LSQRSOLVE(A;b);4) : {{2.6576};{-0.1196}} solve overdetermined system of equations using least squares and QRdec
249+
''' --------------------------------------------------------------------
250+
''' | Solving overdetermined system of equations using least squares and |
251+
''' | the QR decomposition |
252+
''' | |
253+
''' | MROUND(LSQRSOLVE(A;b);4) : {{2.6576;-0.1196}} |
254+
''' --------------------------------------------------------------------
255+
'''
214256
'***********************************STATISTICAL FUNCTIONS*******************************************************************************
215257
''' ROUND(NORM(0.05);8) = 0.96012239
216258
''' ROUND(CHISQ(4;15);8) = 0.99773734
@@ -249,13 +291,13 @@ End Sub
249291
''' YEAR(NOW()) = 2022
250292
''' WEEKDAYNAME(1;true;2) = 'lun.'
251293
''' WEEKDAY(NOW()) = 2
252-
''' TIMEVALUE(NOW()) = '7:53:00 a. m.'
253-
''' TIMESERIAL(x;y;z) = '6:45:50 a. m.' for x = 7; y = -15; z = 50
294+
''' TIMEVALUE(NOW()) = '7:53:00 a. m.'
295+
''' TIMESERIAL(x;y;z) = '6:45:50 a. m.' for x = 7; y = -15; z = 50
254296
''' MONTH(NOW()) = 10
255297
''' MONTHNAME(x;y) = 'marzo' for x = 3; y = false
256-
''' MONTH(x) = 10 for x = '10/10/2022 7:53:10 a. m.'
257-
''' MINUTE(x) = 53 for x = '10/10/2022 7:53:12 a. m.'
258-
''' HOUR(x) = 7 for x = '10/10/2022 7:53:15 a. m.'
298+
''' MONTH(x) = 10 for x = '10/10/2022 7:53:10 a. m.'
299+
''' MINUTE(x) = 53 for x = '10/10/2022 7:53:12 a. m.'
300+
''' HOUR(x) = 7 for x = '10/10/2022 7:53:15 a. m.'
259301
''' DAY(DATE()) = 10
260302
''' DATEVALUE(DATE()) = '10/10/2022'
261303
''' DATESERIAL(2022;x+2;3y) = '21/12/2022' for x = 10; y = 7

0 commit comments

Comments
 (0)