Go to page:

Search:   Help

Edit

# Calculyx

Categories: calculyx, preview
<< | Page list | >>

Back-of-envelope calculations using instant preview.

## Calculyx

The calculyx package enables the numerical evaluation of mathematical expressions in LyX dynamically by means of instant preview. Such expressions can be created in the LyX math editor with considerable ease. With instant preview turned on, it also displays them elegantly. The LaTeX package calculyx.sty uses the ‘mini LaTeX runs’ of the instant preview facility to numerically evaluate such expressions, generally without having to make any change to their LaTeX form. Results can be presented in the form expression = result.

### Components and requirements.

A zipped archive of the calculyx package can be found at calculyx. The package contains the LaTeX file calculyx.sty, the LyX module calculyx.module (defining the Calculate custom inset), four explanatory documents in LyX format, Calculyx-1-basics, Calculyx-2-calculus, Calculyx-3-tables, etc. and Calculyx-4-hacking, and a Python script dummy_export.py.

Version 3.1 of the package requires LyX 2.3.0 or later for all commands to function as described. For users of earlier versions of calculyx, note that there have been significant changes to a number of commands with the aim of greater uniformity of use over the whole package. Please check the documentation, particularly for \clyxtabulate, which has been completely reworked.

calculyx.sty requires a number of LaTeX packages: amsmath, amssymb, booktabs (for tables), and diffcoeff (for derivatives). In particular it requires recent versions of the LaTeX3 bundles l3kernel and l3packages. The calculational engine is the LaTeX3 floating point module l3fp in l3kernel. (From a user's point of view, LaTeX3 packages are used like any other LaTeX packages.) Note that your version of l3kernel should be no older than 6 December 2016 if you want to be able to use the table-creating command \clyxtabulate.

### Functionality

Calculyx accepts(or tries to accept) LaTeX expressions 'as is', without demanding 'calculator formatting' or extra parentheses. It handles: numbers in decimal or scientific notation form; constants (\pi, e, \deg); arithmetic operations +, -, *, /, ^ (or **) and LaTeX variants like \times and \div; \frac and variants; \sqrt and \surd; trigonometric and hyperbolic functions and inverses; natural logarithm and exponential functions, \max, \min and \gcd; binomial coefficients and factorials; sums and products (including to infinity!); limits; derivatives (orders one and two, ordinary and partial, explicit d-notation or primes or dots); and definite integrals in one variable. Although variables will generally be single letters from the roman or greek alphabets, they are not restricted to single tokens (primes, subscripts, etc. are allowed), the same font, or these alphabets.

As well as the basic \clyx command which evaluates expressions, the package includes the command \clyxtabulate to construct tables of functions (including multi-column tables with, e.g., maximum values highlighted), the command \clyxiterate to iterate functions (as in chaos theory) or find fixed points, the command \clyxsolve to find zeros or local minima or maxima of functions, and \clyxrecur to calculate the terms of a recurrence relation (like the Fibonacci sequence).

#### Note

Because of a change in l3kernel from 12 May 2018, versions 3.0 or earlier of calculyx will fail to evaluate hyperbolic functions or their inverses if using a version of l3kernel from that date or later. Version 3.1 of calculyx (the current version) is unaffected.

### Categories

Category: calculyx preview