MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Optimizing Non-linear Functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41639] Re: [mg41532] Optimizing Non-linear Functions
  • From: Gregory Lypny <gregory.lypny at videotron.ca>
  • Date: Thu, 29 May 2003 08:14:09 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello Everyone,

	Thank you for all of the thoughtful responses to my question.

	Here's an example I got working very well with NMinimize and the kind 
help of Brett Champion who patiently guided me through the syntax (I'm 
a newbie).

Objective function X.V.X

The problem is to minimize the quadratic form, X.V.X, with respect to 
the elements of the 1 x 3 vector X, and where V is a 3x3 covariance 
matrix for the returns on three risky stocks.  X.V.X is the variance of 
return on an investment portfolio where the investment weights are X 
and I want to minimize risk.

Constraints

[1]	R.X==.0601   --- the portfolio must have an expected return of 
6.01% (a number I chose because it is one of many for which I  know the 
exact answer).  R is a 1x3 vector of expected returns (.06, .08, .14).

[2]	X.u==1 -- the investment weights must sum to one or 100% of the 
investor's wealth.

[2]	All x[i]>=0 --- no short selling allowed.  In other words, you 
can't have a negative investment in an asset.

The following will yield the answer the blink of an eye.

<< NumericalMath`NMinimize`
NMinimize[{X.V.X, {x[1] ¡Ã 0, x[2] ¡Ã 0, x[3] ¡Ã 0,
    R.X == .0601,
     X.u == 1}}, {x[1], x[
       2], x[3]}, MaxIterations -> 200, Tolerance -> .000001]

The output is

\!\({0.010915515624999986`, {x[1] -> 0.9949999999999994`, x[2] -> \
0.005000000000000456`, x[3] -> 9.128982292327947`*^-17}}\)

which is darn good considering the exact answer is x[1]=.995, 
x[2]=.005, and x[3]=0

	Regards,

		Greg


  • Prev by Date: Re: Mathematica Keyboard Input
  • Next by Date: Re: A bug?......In[1]:= Sum[Cos[x], {x, 0, Infinity, Pi}]......Out[1]= 1/2
  • Previous by thread: Optimizing Non-linear Functions
  • Next by thread: Syntax Error in File