Package: libcalculus
libcalculus: A comprehensive real and complex analysis library for Pythonlibcalculus is fully written in C++ and Cython for bindings to Python; all numeric calculations take place in C++ and take full advantage of SIMD vectorization and OpenMP threading wherever available.FeaturesFunctional programming approach to analysis in PythonNumeric integration and differentiation of real and complex functionsFull integration with NumPy: functions support array inputsLaTeX support: every function object has a.latex()that produces its LaTeX markupTechnologylibcalculus is written in C++20 and bound to Python via Cython; operations between functions are performed using C++ lambdas, and all calculations happen at the C++ level, with Python only interfacing methods and results.Installationlibcalculus can be installed from pip:pip install libcalculusExamplesHere is a snippet demonstrating some of the library's features:>>>importlibcalculus,numpyasnp>>>f=libcalculus.csc@(1/libcalculus.identity)# csc(1 / z)>>>f(1+2j)(1.0316491868272164+1.9336686363989997j)>>>libcalculus.residue(f,0,tol=1e-4)(0.16666666639893526-8.181230860681676e-06j)>>>print(f.latex("z"))\csc\left(\frac{1}{z}\right)>>>contour=libcalculus.line(2,1+1j)# 2(1 - t) + (1 + 1i)t>>>libcalculus.integrate(f,contour,0,1)# integrate along the contour between t=0 and t=1(-2.0551412843830605+1.1351565349386723j)>>>libcalculus.threads(4)# Enable threading>>>arr=np.array([[1,2j,3],[4+1j,5+2j,7+3j]])>>>print(f(arr))[[1.18839511+0.j-0.+1.91903475j3.05628425+0.j][4.03942207+0.99000843j5.02878731+1.98839211j7.02013025+2.99133798j]]Source BuildBuilding from source can be beneficial when looking to tailor optimizations to one's specific CPU architecture or so as to modify source code privately.
This can be done easily with the proper required libraries - Boost, Cython and NumPy.LinuxA convenient driver script for compilation with different options, testing etc. is available on Linux.$gitclonehttps://gitlab.com/ariter777/libcalculus&&cdlibcalculus
$./run.sh--debugbuildtest# Run with -h (or without any flags) for helpExtra compiler and linker flags can be provided with theCXXFLAGSandLDFLAGSenvironment variables.WindowsOn Windows you will need to run the individual scripts separately;setup.pyfor building, andtest.pyfor testing.>git clone https://gitlab.com/ariter777/libcalculus&&cdlibcalculus>python setup.py build_ext --inplace>python test.py --Function --RealFunction --Contour --ComplexFunctionLicenseCopyright (c) 2022, Ariel Terkeltoub
All rights reserved.Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:* Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials provided
   with the distribution.

* Neither the name of the libcalculus developers nor the names of any
   contributors may be used to endorse or promote products derived
   from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE