Mathematical Functions
Important Notes
The entries in the table below are the mathematical functions provided in the library. Each of them is a ready-made instance of a libcalculus.Function
, which are callable for evaluation but can also be used with methods such as libcalculus.integrate
, libcalculus.residue
etc., as is documented in Analysis Methods.
Evaluating such a function is very simple - \(\text{sinh}(3)\) can be evaluated using libcalculus.sinh(3)
. Please note that the variable name in the following table is mostly \(z\) - this is not to imply that those functions can only accept complex inputs; real inputs are accepted as well. Read the Caveats section for more information.
Builtin Functions
Name |
Mathematical Notation |
Notes |
---|---|---|
|
\(z\mapsto\left|z\right|\) |
Absolute value |
|
\(z\mapsto\text{arccos}\left(z\right)\) |
Inverse cosine |
|
\(z\mapsto\text{arccot}\left(z\right)\) |
Inverse cotangent |
|
\(z\mapsto\text{arccsc}\left(z\right)\) |
Inverse cosecant |
|
\(z\mapsto\text{arcosh}\left(z\right)\) |
Inverse hyperbolic cosine |
|
\(z\mapsto\text{arcoth}\left(z\right)\) |
Inverse hyperbolic cotangent |
|
\(z\mapsto\text{arcsch}\left(z\right)\) |
Inverse hyperbolic cosecant |
|
\(z\mapsto\text{arcsec}\left(z\right)\) |
Inverse secant |
|
\(z\mapsto\text{arcsin}\left(z\right)\) |
Inverse sine |
|
\(z\mapsto\text{arctan}\left(z\right)\) |
Inverse tangent |
|
\(z\mapsto\text{arg}\left(z\right)\) |
Complex argument |
|
\(z\mapsto\text{arsech}\left(z\right)\) |
Inverse hyperbolic secant |
|
\(z\mapsto\text{arsinh}\left(z\right)\) |
Inverse hyperbolic sine |
|
\(z\mapsto\text{artanh}\left(z\right)\) |
Inverse hyperbolic tangent |
|
\(z\mapsto\bar{z}\) |
Complex conjugate |
|
\(z\mapsto c\) |
Constant function |
|
\(z\mapsto\text{cos}\left(z\right)\) |
Cosine |
|
\(z\mapsto\text{cosh}\left(z\right)\) |
Hyperbolic cosine |
|
\(z\mapsto\text{cot}\left(z\right)\) |
Cotangent |
|
\(z\mapsto\text{coth}\left(z\right)\) |
Hyperbolic cotangent |
|
\(z\mapsto\text{csc}\left(z\right)\) |
Cosecant |
|
\(z\mapsto\text{csch}\left(z\right)\) |
Hyperbolic cosecant |
|
\(z\mapsto e\) |
Euler’s number |
|
\(z\mapsto e^z\) |
Exponential function |
|
\(z\mapsto z\) |
Identity function |
|
\(z\mapsto\text{Im}\left(z\right)\) |
Imaginary part |
|
\(t\mapsto\left(1-t\right)z_1+tz_2\) |
Contour representing a line with \(t\in\left[0,1\right]\) |
|
\(z\mapsto\text{ln}\left(z\right)\) |
Natural logarithm (principal branch) |
|
\(z\mapsto \pi\) |
Constant π |
|
\(z\mapsto \begin{cases} \text{then_}\left(z \right ) & ; \;\text{comp_}\left(z \right )=\mathbb{T} \\ \text{else_}\left(z \right ) & ; \;\text{comp_}\left(z \right )=\mathbb{F} \end{cases}\) |
If |
|
\(z\mapsto\text{Re}\left(z\right)\) |
Real part |
|
\(z\mapsto\text{sec}\left(z\right)\) |
Secant |
|
\(z\mapsto\text{sech}\left(z\right)\) |
Hyperbolic secant |
|
\(z\mapsto\text{sin}\left(z\right)\) |
Sine |
|
\(z\mapsto\text{sinh}\left(z\right)\) |
Hyperbolic sine |
|
\(t\mapsto \text{center}+\text{radius}\cdot e^{2\pi it}\) |
Contour representing a circle with \(t\in\left[0,1\right]\) |
|
\(z\mapsto\text{tan}\left(z\right)\) |
Tangent |
|
\(z\mapsto\text{tanh}\left(z\right)\) |
Hyperbolic tangent |
Operations
Any standard mathematical operation can be applied to a libcalculus.Function
object.
Given two libcalculus.Function
objects f
and g
:
Syntax |
Mathematical Notation |
Notes |
---|---|---|
|
\(z\mapsto -f\left(z\right)\) |
Function additive inverse |
|
\(z\mapsto f\left(z\right)+g\left(z\right)\) |
Function addition |
|
\(z\mapsto f\left(z\right)-g\left(z\right)\) |
Function subtraction |
|
\(z\mapsto f\left(z\right)\cdot g\left(z\right)\) |
Function multiplication |
|
\(z\mapsto \frac{f\left(z\right)}{g\left(z\right)}\) |
Function division |
|
\(z\mapsto \left(f\left(z\right)\right)^{g\left(z\right)}\) |
Function exponentiation |
|
\(z\mapsto f\left(g\left(z\right)\right)\) |
Function composition |
The corresponding in-place operations are supported; operations with constants are supported where applicable as well:
>>> (2 * libcalculus.sin)(3)
0.2822400161197344
>>> (4 ** libcalculus.sin)(3)
(1.2160815815872013+0j)
Other Remarks
Try to use library builtins as much as possible - this comes in handy with mathematical constants for example:
f = libcalculus.pi * libcalculus.sin
g = np.pi * libcalculus.sin
In this instance, f.latex()
will return "\\pi \\sin\\left(x\\right)"
(corresponding to \(\pi \sin\left(x\right)\)), while g.latex()
will return "3.14159 \\sin\\left(x\\right)"
(corresponding to \(3.14159 \sin\left(x\right)\)).
Caveats
The library employs a fundamental distinction between “purely complex-valued” functions and ones that might occasionally return a complex value: (1j * libcalculus.sin)(3)
will call an underlying C++ function accepting a real input and returning a complex output; however, libcalculus.arcsin(3)
will actually return np.nan
. To avoid this, cast to complex - libcalculus.arcsin(complex(3))
will correctly return (1.5707963267948966+1.762747174039086j)
.