I'm trying to solve a system of equations for A and B: 37.07*A + 0.07*B - 36.73*C ~= 0 2.68*A + 24.75*B - 275.77*C ~= 0
The LHS is the product of 2*3 and 3*1 matrices. Constraints: A+B=1 0<=A,B<=1 C=1 I want to minimise the sum of squares of the equations together. The R function solve can solve matrices but not with these constraints. Lp solves equations with these constraints but doesn't use sum of squares; just a linear solution which minimises EQN1 to ~-36.66 by the solution [0,1,1] for example. I know from the help file and previous postings that QR.solve, solve.QP (quadprog) or Optim are able to do this or something similar, but I can't follow the application of these functions. I could use Excel solver but my endgame is to run this solution for many many equations. Would appreciate your help. Scott. ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.