Description Usage Arguments Value Examples
This function transforms a numeric vector representing a polynomial in polynomial space into LaTeX code to render that polynomial. Such vectors represent linear combinations of coefficient and unknown terms, which form the basis of the space. This function is intended for use in Rmarkdown documents with PDF output, where it can convert vectors into formatted equations automatically.
1 2 3 4 5 6 7 | poly2latex(
v,
sym = "t",
dir = "forward",
lhs = paste0("f(", sym, ") = "),
sink = FALSE
)
|
v |
A numeric vector of arbitrary length |
sym |
A character to represent the unknown in the polynomial expression. Defaults to "t" |
dir |
Direction in which the terms of the polynomial represented by the vector increase. For "forward", the default, the constant term is the leftmost, for "backward" the rightmost |
lhs |
Value to use to represent the left-hand side of the equation.
Defaults to |
sink |
Logical determining whether to return the output conventionally or print it directly to console. Defaults to FALSE. |
If sink = TRUE
, a character vector containing LaTeX code to represent
v
as a polynomial. If FALSE
, outputs code directly to console.
1 2 3 4 | poly2latex(1:5)
#Constant function
poly2latex(-7)
poly2latex(round(rnorm(5), digits = 2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.