Still I did not find any suggestion. Is my problem not elaborate enough? Megh Dal <[EMAIL PROTECTED]> wrote: I think I should be clear exactly what I want :
take following example : a = b = seq(1, 50000, by=500) v = matrix(0, nrow=length(a), ncol=length(a)) for (i in 1:length(a)) { for (j in 1:length(a)) { d = c(17989*a[i], -18109*b[j]) v[i,j] = t(d) %*% matrix(c(0.0001741, 0.0001280, 0.0001280, 0.0002570), nrow=2) %*% d } } library("rgl") open3d() persp3d(a,b,v,col="green",alpha=0.7,aspect=c(1,1,0.5)) shade <- outer(a, b, function(x,y) (0 < (x-y)) & ((x-y) < 20000)) persp3d(a,b,v,col=ifelse(shade, "red", "green"), alpha=0.7,aspect=c(1,1,0.5)) Here you see that the surface is the plot of a x'Cx for different values of components of x. And the red region is the portion of that plot that satisfy 0 <x-y < 20000.. Now suppose user choose a point on red portion of that surface. Now I have to tell (through some computationally efficient way) what is the corresponding component values of x. Any suggestion please? Peter Dalgaard <[EMAIL PROTECTED]> wrote: Megh Dal wrote: > Hi, > > I want to find solution of function : f(x,y) = x'Cx - a under constraints : > > 0 < x,y < p > 0 < x-y< q > > where a, p,q are given constants and x = (x, y) and C is a 2X2 matrix (given) > > Can anyone suggest me any R function to do that? > > Not likely. What you have (if C is positive definite) is the intersection between the boundary of an ellipse and the interior of a parallelepiped, where the center of the ellipse and one corner of the parallelepiped is at (0,0). This is the union of between zero and three curve segments (hmm, maybe only two) and I don't think any of the standard solvers and minimizers can come up with that kind of result. -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 --------------------------------- [[elided Yahoo spam]] --------------------------------- [[elided Yahoo spam]] [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org 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.