Symbolic diagonal matrix
diag_(x, n = 1L, declare_symbols = TRUE, ...)Character vector with diagonal
Number of times x should be repeated
Passed on to as_sym() when constructing symbolic matrix
Passed on to rep(x, n, ...)
if (has_sympy()) {
  diag_(c(1,3,5))
  diag_(c("a", "b", "c"))
  diag_("a", 2)
  diag_(vector_sym(4))
}
#> c: ⎡v₁  0   0   0 ⎤
#>    ⎢              ⎥
#>    ⎢0   v₂  0   0 ⎥
#>    ⎢              ⎥
#>    ⎢0   0   v₃  0 ⎥
#>    ⎢              ⎥
#>    ⎣0   0   0   v₄⎦