Replace diagonal

# S3 method for caracas_symbol
diag(x) <- value

Arguments

x

A caracas_symbol.

value

Replacement value

Examples

if (has_sympy()) {
  A <- matrix(c("a", 0, 0, 0, "a", "a", "a", 0, 0), 3, 3)
  B <- as_sym(A)
  B
  diag(B)
  diag(B) <- "b"
  B
  diag(B)
}
#> c: [b  b  b]