<HTML><BODY STYLE="font:10pt verdana; border:none;"><P>Hi,</P> <P>I have the following hypothetical optimization problem:</P> <P>-det(t(x-A%*%x1)%*%(x-A%*%x1))</P> <P>where A,x,x1 are matrices. A coefficients and x and x1 are variable matrices or vectors.</P> <P>I tried to apply optim and nlm functions but I kept receive the following massage:</P> <P>Error in A%*%x1 : non-conformable arguments.</P> <P>The massage appears even the -det() can be calculated and the dimensions are checked.</P> <P>here is my example although there might be no solution for the optimization problem.<BR>A=A<BR>myfn=function(A){</P> <P>x=matrix(c(1.8,0),byrow=T)<BR>x1=matrix(c(.8,1.8),byrow=T)<BR>-det((t(x)-t(x1)%*%A)%*%(x-A%*%x1))<BR>}<BR>A=matrix(c(1,.3,2,-1.2),byrow=T,nrow=2)<BR>optim(A,myfn)</P> <P>Another question regarding optimization:</P> <P>is there any chance that I can find a function or package that can do a constrained optimization such as: -det(x-A*x1-B*x2)' (x-A*x1-B*x2)) </P> <P>subject to </P> <P>p-f(A,B,...)=0, where f denotes a function.</P> <P>Thank you for your help in advance.</P> <P>Ahmad Abu Hammour</P> <P> </P></BODY></HTML>