From: Megh Dal <megh700004_at_yahoo.com>

Date: Fri, 09 May 2008 01:24:17 -0700 (PDT)

}

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))

Date: Fri, 09 May 2008 01:24:17 -0700 (PDT)

Still I did not find any suggestion. Is my problem not elaborate enough?

Megh Dal <megh700004_at_yahoo.com> 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 <P.Dalgaard_at_biostat.ku.dk> 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 ~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk) FAX: (+45) 35327907 --------------------------------- [[elided Yahoo spam]] --------------------------------- [[elided Yahoo spam]] [[alternative HTML version deleted]]Received on Fri 09 May 2008 - 08:48:53 GMT______________________________________________ R-help_at_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.

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Fri 09 May 2008 - 09:30:36 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*