Added more operations

This commit is contained in:
Dmitriy Shishkov 2023-10-17 22:28:47 +03:00
parent 19b230254a
commit 2f935064f3
Signed by: dm1sh
GPG Key ID: 027994B0AA357688
2 changed files with 12 additions and 2 deletions

View File

@ -37,16 +37,21 @@ Functions:
| `cosh` | $\cosh(x)$ | | `cosh` | $\cosh(x)$ |
| `cot` | $\cot(x)$ | | `cot` | $\cot(x)$ |
| `exp` | $\exp(x)$ | | `exp` | $\exp(x)$ |
| `inf` | $\inf(X)$ |
| `lg` | $\lg(x)$ | | `lg` | $\lg(x)$ |
| `ln` | $\ln(x)$ | | `ln` | $\ln(x)$ |
| `log10` | $\log_{10}(x)$ | | `log10` | $\log_{10}(x)$ |
| `log2` | $\log_2(x)$ | | `log2` | $\log_2(x)$ |
| `max` | $\sup(X)$ |
| `min` | $\inf(X)$ |
| `prod` | $\displaystyle \prod_{i=0}^n x_i$ | | `prod` | $\displaystyle \prod_{i=0}^n x_i$ |
| `sgn` | $sgn(x)$ | | `sgn` | $sgn(x)$ |
| `sign` | $sgn(x)$ |
| `sin` | $\sin(x)$ | | `sin` | $\sin(x)$ |
| `sinh` | $\sinh(x)$ | | `sinh` | $\sinh(x)$ |
| `sqrt` | $\sqrt{x}$ | | `sqrt` | $\sqrt{x}$ |
| `sum` | $\displaystyle\sum_{i=0}^n x_i$ | | `sum` | $\displaystyle\sum_{i=0}^n x_i$ |
| `sup` | $\sup(X)$ |
| `tan` | $\tan(x)$ | | `tan` | $\tan(x)$ |
| `tanh` | $\tanh(x)$ | | `tanh` | $\tanh(x)$ |
@ -58,6 +63,6 @@ Floating points: `.`, `,`
Functions have only one argument, provided in braces. Operators must have two operands except minus (if it is the first character of equation or braced expression). Functions have only one argument, provided in braces. Operators must have two operands except minus (if it is the first character of equation or braced expression).
`avg`, `sum` and `prod` applied on `numpy.ndarray` produce `float`. `avg`, `sum`, `max`, `sup`, `min`, `inf` and `prod` applied on `numpy.ndarray` produce `float`.
**! There is no error handling yet !** **! There is no error handling yet !**

View File

@ -26,18 +26,23 @@ functions: dict[str, FunctionType] = {
"cosh": np.cosh, "cosh": np.cosh,
"cot": cot, "cot": cot,
"exp": np.exp, "exp": np.exp,
"inf": np.inf,
"lg": np.log10, "lg": np.log10,
"ln": np.log, "ln": np.log,
"log10": np.log10, "log10": np.log10,
"log2": np.log2, "log2": np.log2,
"max": np.max,
"min": np.min,
"prod": np.prod, "prod": np.prod,
"sgn": np.sign, "sgn": np.sign,
"sign": np.sign,
"sin": np.sin, "sin": np.sin,
"sinh": np.sinh, "sinh": np.sinh,
"sqrt": np.sqrt, "sqrt": np.sqrt,
"sum": np.sum, "sum": np.sum,
"tan": np.tan, "sup": np.max,
"tah": np.tanh, "tah": np.tanh,
"tan": np.tan,
} }
operators: dict[str, OperatorType] = { operators: dict[str, OperatorType] = {