简体   繁体   中英

Matrix algebra with unknown value in R

There is a way to solve matrix algebra in R, like it's possible to do in the site: https://www.symbolab.com/solver/matrix-calculator

I'm trying to solve this on R: image with aexample of what i'm trying to solve

I have also tried to use the package ktsolve, but i think it can't do what i want.

Thanks for your time.

Depending on your goals, optimization may be the fastest and easiest alternative like in

calculate <- function(x){
    A <- matrix(c(1 ,2 ,x), nrow = 1)
    B <- matrix(c(1, 2, 3, 4, 5, 2, 6, 2, 1), nrow = 3)
    C <- matrix(c(1, 2, x), nrow = 3)
    return(abs(A %*% B %*% C - 1))
}


optimize(calculate, c(-100, 100))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM