[R] Using multiroot for root solution for a matrix based function
quinter sam
q@@m0000 @end|ng |rom gm@||@com
Tue Nov 17 09:19:41 CET 2020
I have a function which is actually an output of another function and I
therefore cannot change it. I am trying to use *multiroot * from
package *rootSolve
* to compute the roots of the function but its not working at all. Is there
something I am not seeing or is there another alternative that is based on
Newton-Raphson technique?
library(rootSolve)
f <- function(q,m){
c(F1 = 12 * ((exp(q[, 1]) * m[1])/(exp(q[, 1]) * m[1] + exp(q[, 2]) * m[2]
+ m[3])) - c(1,2),
F2 = 12 * ((exp(q[, 2]) * m[2])/(exp(q[, 1]) * m[1] + exp(q[, 2]) * m[2] +
m[3])) - c(3,3))
}
m = c(0.1,0.2,0.7)
I am trying to solve for *q* and from based on the given m, I expect
something like this;
q <- matrix(c(-0.1335314,0.6931472,0.2719337,0.4054651), nrow=2)
How would I call the multiroot for the function f to hopefully get the
above results. I thought of using newtonRaphson from package pracma but
that possibly only handles univariate inputs.
[[alternative HTML version deleted]]
More information about the R-help
mailing list