This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**Basic 1D linear generator from 2 pts*/ | |
LEXT = LAMBDA(X,XS,YS, | |
LET(X_1,INDEX(XS,1), | |
X_2, INDEX(XS,2), | |
Y_1, INDEX(YS,1), | |
Y_2, INDEX(YS,2), | |
Y_1+(X-X_1)*(Y_2-Y_1)/(X_2-X_1) | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
/**Cumulative sum over array*/ | |
CSUM = LAMBDA(arr, | |
SCAN(0,arr,LAMBDA(a,c,a+c))); | |
/**Ignores Null ref (empty, space or 0), returns "" or VAl if provided*/ | |
IFN = LAMBDA(REF,FUN,[VAL], | |
IF(OR(REF="",REF=" ",REF=0),IF(ISOMITTED(VAL),"",VAL),FUN) | |
); | |
/**1D linear interpolation, set SORTED=0 for unsorted data - presorting data recommended*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Unit parsing and conversion --- | |
// Core workbook function for unit conversion | |
// Unit strings can be defined using "*" and "/". Parentheses will be interpreted. | |
// Integers following unit name will be interpreted as powers (+/- allowed). Do not provide carat or **, exponent is implied. | |
// Other operations e.g. (addition/subtraction) are not allowed. | |
// Units will be checked for dimensional consistency within kg, m, s, A, K, mol, cd. Angles are dimensionless and may allow improper conversions. | |
// Offset units (°C,°F) are not handled. Only absolutes (K,R) and deltas (Δ°C,Δ°F) are handled at this time. | |
// Generic prefixes are not handled at this time. Where common, they are included as duplicate entries e.g. m & km |