r - Using rootSolve for non-linear system in matrix form -


for part of thesis have write programm, solves system of non-linear equations:

equations 1

where $\lambda$ diagonal matrix $\lambda_1$ , $\lambda_2$ diagonal entries. thus, 6 equations 6 unknown parameters:

equations 2

i tried use package rootsolve , found introduction document provided me example without explanation of steps. have been trying code according examples lost how can model this. tips or sources more information package helpful! in advance!

what did far:

i) tried solve system in non-matrix form, extended 'b' matrix row , used lampda , lampda2, x5 , x6 in code respectively! error matrix singular, should not possible. values choosen arbitrarily.

model <- function(x) {   f1 <- x[1]^2+x[2]^2   f2 <- x[1]*x[3]+x[2]*x[4]   f3 <- x[3]^2+x[4]^2   f4 <- x[5]*x[1]^2+x[6]*x[2]^2    f5 <- x[5]*x[1]*x[3]+x[6]*x[2]*x[4]   f6 <- x[5]*x[3]^2+x[6]*x[4]^2   f7 <- x[5] (edit: how model free-variables?)   f8 <- x[6]   c(f1 = 3, f2 = 23, f3 = 21, f4=2, f5=1, f6=4, f7, f8)    }   multiroot(f = model, start = c(1, 1, 1, 2,2,2,3,3)) 

ii) tried model matrix form, error here number of derivatives returned not equal ones in initial condition.

f3 <- function(x){   x<-matrix(ncol=2,nrow=3)   y1<-matrix(c(1,2,3,4),nrow=2,ncol=2)   y2<-matrix(c(6,5,4,9),nrow=2,ncol=2)    x[1:2,]%*%t(x[1:2,])-y1,   x[1:2,]%*%(x[3,]*diag(2))%*%t(x[1:2,])-y2,   ) } multiroot(f3, start<-c(1,1,1,1,2,2))     


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -