Learn R Programming

⚠️There's a newer version (1.1.0) of this package.Take me there.

High Dimensional Numerical and Symbolic Calculus in R

Efficient C++ optimized functions for numerical and symbolic calculus.

The R package calculus implements C++ optimized functions for numerical and symbolic calculus, such as the Einstein summing convention, fast computation of the Levi-Civita symbol and generalized Kronecker delta, Taylor series expansion, multivariate Hermite polynomials, high-order derivatives, ordinary differential equations, differential operators and numerical integration in arbitrary orthogonal coordinate systems. The library applies numerical methods when working with functions or symbolic programming when working with characters or expressions. The package handles multivariate numerical calculus in arbitrary dimensions and coordinates and implements the symbolic counterpart of the numerical methods whenever possible, without depending on external computer algebra systems. Except for Rcpp, the package has no strict dependencies in order to provide a stable self-contained toolbox that invites re-use.

Quickstart

Install the package.

install.packages("calculus")

Load the package.

library(calculus)

Read or browse the documentation and the vignettes.

Philosophy

The package provides a unified interface to work with mathematical objects in R. The library applies numerical methods when working with functions or symbolic programming when working with characters or expressions. To describe multidimensional objects such as vectors, matrices, and tensors, the package uses the class array regardless of the dimension. This is done to prevent unwanted results due to operations among different classes such as vector for unidimensional objects or matrix for bidimensional objects.

Dependencies

The package integrates seamlessly with cubature for efficient numerical integration in C. However, except for Rcpp, the package has no strict dependencies in order to provide a stable self-contained toolbox that invites re-use.

Testing

Several unit tests are implemented via the standard framework offered by testthat and run via continuous integration.

Contribute

Report a bug and star the repository.

Cite as

Guidotti, E. (2020). "calculus: High dimensional numerical and symbolic calculus in R". https://arxiv.org/abs/2101.00086

A BibTeX entry for LaTeX users is

@Misc{,
    title = {calculus: High Dimensional Numerical and Symbolic Calculus in R},
    author = {Emanuele Guidotti},
    year = {2020},
    eprint = {2101.00086},
    archiveprefix = {arXiv},
    primaryclass = {cs.MS},
    url = {https://arxiv.org/abs/2101.00086}
}

Copy Link

Version

Install

install.packages('calculus')

Monthly Downloads

2,355

Version

0.3.2

License

GPL-3

Maintainer

Emanuele Guidotti

Last Published

December 18th, 2021

Functions in calculus (0.3.2)

delta

Generalized Kronecker Delta
calculus-package

calculus: High Dimensional Numerical and Symbolic Calculus
c2e

Characters to Expressions
e2c

Expressions to Characters
diagonal

Tensor Diagonals
curl

Numerical and Symbolic Curl
derivative

Numerical and Symbolic Derivatives
contraction

Numerical and Symbolic Tensor Contraction
divergence

Numerical and Symbolic Divergence
cross

Numerical and Symbolic Cross Product
%dot%

Numerical and Symbolic Dot Product
%sum%

Numerical and Symbolic Sum
mxtr

Numerical and Symbolic Matrix Trace
%prod%

Numerical and Symbolic Product
mxinv

Numerical and Symbolic Matrix Inverse
%diff%

Numerical and Symbolic Difference
taylor

Taylor Series Expansion
%div%

Numerical and Symbolic Division
jacobian

Numerical and Symbolic Jacobian
laplacian

Numerical and Symbolic Laplacian
wrap

Wrap Characters in Parentheses
%kronecker%

Numerical and Symbolic Kronecker Product
einstein

Numerical and Symbolic Einstein Summation
%outer%

Numerical and Symbolic Outer Product
gradient

Numerical and Symbolic Gradient
evaluate

Evaluate Characters and Expressions
hermite

Hermite Polynomials
mx

Numerical and Symbolic Matrix Product
mxdet

Numerical and Symbolic Determinant
%inner%

Numerical and Symbolic Inner Product
hessian

Numerical and Symbolic Hessian
epsilon

Levi-Civita Symbol
index

Tensor Indices
ode

Ordinary Differential Equations
partitions

Integer Partitions
integral

Numerical Integration