# [R] minimization function

Gabor Grothendieck ggrothendieck at gmail.com
Sat Apr 10 23:39:50 CEST 2010

```Check out the quadprog package.

On Sat, Apr 10, 2010 at 5:36 PM, li li <hannah.hlx at gmail.com> wrote:
> Hi, thanks for the reply.
>   A will be a given matrix satisfying condition 1. I want to find the
> vector w that minimizes the
> quadratic form. w satisfies condition 2.
>
>
> 2010/4/10 Paul Smith <phhs80 at gmail.com>
>
>> On Sat, Apr 10, 2010 at 5:13 PM, Paul Smith <phhs80 at gmail.com> wrote:
>> >>    I am trying to minimize the quardratic form w'Aw, with certain
>> >> constraints.
>> >> In particular,
>> >>    (1) A=(a_{ij}) is n by n matrix and it is symmetric positive
>> definite,
>> >>        a_{ii}=1 for all i;
>> >>        and 0<a_{ij}<1 for i not equal j.
>> >>    (2) w'1=n;
>> >>    (3) w_{i}>=0
>> >>
>> >> Analytically, for n=2, it is easy to come up with a result. For larger
>> n, it
>> >> seems
>> >> difficult to obtain the result.
>> >>
>> >> Does any one know whether it is possible to use R to numerically compute
>> it?
>> >
>> > And your decision variables are? Both w[i] and a[i,j] ?
>>
>> In addition, what do you mean by "larger n"? n = 20 is already large
>> (in your sense)?
>>
>> Paul
>>
>> ______________________________________________
>> 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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

```