Use with ParameterizedFunctions
In the latexalign tutorial I mentioned that one can use latexalign
directly on a ParameterizedFunction. Here, I make a somewhat more convoluted and hard-to-read example (you'll soon se why):
using Latexify
using ParameterizedFunctions
copy_to_clipboard(true)
ode = @ode_def positiveFeedback begin
dx = y*y*y/(k_y_x + y) - x - x
dy = x^n_x/(k_x^n_x + x^n_x) - y
end k_y k_x n_x
latexify(ode)
This is pretty nice, but there are a few parts of the equation which could be reduced. Using a keyword argument, you can utilise the SymEngine.jl to reduce the expression before printing.
latexify(ode, field=:symfuncs)
Side-by-side rendering of multiple system.
A vector of ParameterizedFunctions will be rendered side-by-side:
ode2 = @ode_def negativeFeedback begin
dx = y/(k_y + y) - x
dy = k_x^n_x/(k_x^n_x + x^n_x) - y
end k_y k_x n_x
latexify([ode, ode2])
Visualise your parameters.
Another thing that I have found useful is to display the parameters of these functions. The parameters are usually in a vector, and if it is somewhat long, then it can be annoying to try to figure out which element belongs to which parameter. There are several ways to solve this. Here are two:
## lets say that we have some parameters
param = [3.4,5.2,1e-2]
latexify(ode.params, param)
or
latexify([ode.params, param]; env=:array, transpose=true)
signif.()
is your friend if your parameters have more significant numbers than you want to see.
Get the jacobian, hessian, etc.
ParameterizedFunctions symbolically calculates the jacobian, inverse jacobian, hessian, and all kinds of goodness. Since they are available as arrays of symbolic expressions, which are latexifyable, you can render pretty much all of them.
latexify(ode.symjac)
Available options
Keyword | Values | Default | Description |
---|---|---|---|
:adjustment | :c for centered, :l for left, :r for right | :c | Set the adjustment of text within the table cells. |
:bracket | Bool | false | Surround variables with square brackets. |
:double_linebreak | Bool | false | Add an extra \\ to the end of the line. |
:head | Array | [] | Add a header to the table. It will error if it is not of the right length (unless empty). |
:latex | Bool | true | Toggle latexification of the table elements. |
:separator | String | " =& " | Specify how to separate the left hand side and the right. |
:side | Array | [] | Add a leftmost column to the table. It will error if it is not of the right length (unless empty). |
:starred | Bool | false | Star the environment to prevent equation numbering. |
:transpose | Bool | true | Flip rows for columns. |