Redberry is an open source computer algebra system designed for tensor manipulation.

Key features:
• Mathematical $\LaTeX$-style syntax for tensorial expressions
• Programming language with internal support of symbolic algebra
• Core algorithms for symbolic manipulation with tensorial expressions
• Extensive and consistent Java API
Application area:
• Classical and quantum theory of fields
• Feynman diagrams and renormalization
• Computational graph theory and graph algorithms

Example: one-loop counterterms
The following code gives one-loop counterterms of theory of nonminimal vector field $A_\mu$ in a curved space-time, determined from the following action: $S = \int d^4 x \sqrt{-g} \left(-\frac{1}{4} (\nabla_\mu A_\nu - \nabla_\nu A_\mu)^2 -\frac{1}{2\xi} (\nabla_\mu A^\mu)^2 +\frac{1}{2}P^{\alpha\beta} \,A_\alpha A_\beta \right)$
import cc.redberry.groovy.Redberry import static cc.redberry.core.tensor.Tensors.* import static cc.redberry.groovy.RedberryPhysics.* import static cc.redberry.groovy.RedberryStatic.* /* * One-loop counterterms for nonminimal vector field */ use(Redberry) { setSymmetric('P_\\mu\\nu') def KINV = ('KINV_\\alpha^\\beta = ' + 'd_\\alpha^\\beta + g*n_\\alpha*n^\\beta').t def K = ('K^{\\mu\\nu}_\\alpha^{\\beta} = ' + 'g^{\\mu\\nu}*d_{\\alpha}^{\\beta} - g/(2*(1+g))*(' + 'g^{\\mu\\beta}*d_\\alpha^\\nu + ' + 'g^{\\nu\\beta}*d_\\alpha^\\mu)').t def S = 'S^\\rho^\\mu_\\nu=0'.t def W = 'W^{\\alpha}_{\\beta}=P^{\\alpha}_{\\beta}+g/(2*(1+g))*R^\\alpha_\\beta'.t def F = 'F_\\mu\\nu\\alpha\\beta=R_\\mu\\nu\\alpha\\beta'.t def div = oneloopdiv2(KINV, K, S, W, F) def counterterms = (Factor & 'P^\\alpha_\\alpha = P'.t) >> div.counterterms println counterterms }
Multiplying the produced result by $1\left/16\pi(d-4)\right.$ and integrating over the space-time volume gives: $\Gamma^{(1)}_{\infty} = \frac{1}{16\pi(d-4)} \int d^4 x \sqrt{-g} \left( \frac{1}{120}(-32+5 \gamma^2+10 \gamma) R_{\epsilon\mu} R^{\epsilon\mu} +\frac{1}{48}\gamma^2 P^2 +\right.\\ +\frac{1}{240} R^2 (28+5 \gamma^2+20 \gamma)+\frac{1}{24} (\gamma^2+12+6 \gamma) P_{\beta\alpha} P^{\alpha\beta} +\\ \left.+\frac{1}{12}\gamma (4+\gamma) R_{\nu\epsilon} P^{\nu\epsilon} +\frac{1}{24} R (\gamma^2+4+2 \gamma) P\right)$ where $R_{\mu\nu}$ is a Ricci tensor, $R$ is a Riemann scalar curvature, $P = P^{\mu}{}_\mu$ and $\gamma = -1 -\xi$.