| x2logx | R Documentation |
Log-transform variables in an equation vector using SymPy
x2logx(eqnvec, whichVar)
eqnvec |
An object of class |
whichVar |
A character vector specifying the variables to be log-transformed. |
The function applies a logarithmic transformation to the specified variables in the equation vector.
For a variable var, the transformation is log(var) and the derivative d/dt log(var) is replaced by
(1/exp(log(var))) * d/dt var, substituting var with exp(log(var)) in the original equation.
The original variable equations are replaced or removed, and the transformed equations are added with updated names prefixed by log_.
The equations are simplified using SymPy to ensure mathematical correctness and compactness.
An updated eqnvec object with transformed equations.
eqnvec <- as.eqnvec(
c("-k1*A + k2*B", "k1*A - k2*B"),
names = c("A", "B")
)
log_transformed_eqns <- x2logx(eqnvec, c("A", "B"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.