knitr::opts_chunk$set( error = TRUE, collapse = TRUE, comment = "#>", out.width = "100%" )
A <- Ryacas::ysym( matrix(c("a", "c", "b", "d"), ncol = 2) ) expr <- paste0("Determinant(", A, ")") a <- 1 b <- 2 c <- 3 d <- 4 B <- matrix(c(a, c, b, d), ncol = 2)
testthat::test_that("a*d-b*c", { testthat::expect_equal( "a*d-b*c", yacR::Exe( expr, R = FALSE, format = "ysym", simplify = TRUE )$yacas_cmd ) testthat::expect_equal( "a*d-b*c", yacR::Exe( expr, R = FALSE, format = "str", simplify = TRUE ) ) }) testthat::test_that("a d - b c", { testthat::expect_equal( "a d - b c", yacR::Exe( expr, R = FALSE, format = "tex", simplify = TRUE ) ) }) testthat::test_that("det(B)", { testthat::expect_equal( det(B), eval( yacR::Exe( expr, R = TRUE, simplify = TRUE ) ) ) }) testthat::test_that("error", { testthat::expect_error( yacR::Exe( expr, R = FALSE, format = "error", simplify = TRUE ) ) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.