Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1992
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

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

Search the Archive

vectors with mma

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: vectors with mma
  • From: BENNINGA at wilma.wharton.upenn.edu
  • Date: Sun, 25 Oct 92 11:37 EDT

October 25, 1992

Dear Mathematica support:

This is a not-especially intelligent query about (I think)
writing a vector-dependent program in Mma.

I'm trying to write a small program to do portfolio problems in
finance.  I want to both manipulate numbers and do analytics.
Here's part of the program:


     Clear[S,X,Y,x,n,ER,ERp,Varp,Var,V]
     n=4;
     X=Array[x,n]; (* portfolio proportions *)
     Y=Array[ER,n]; (* vector of expected asset returns *)
     S=Array[V,{n,n}]; (* variance/covariance matrix *)
     ERp=X.Y; (* expected portfolio return *)
     Varp=X.S.X; (* portfolio variance *)
     D[ERp,x[1]]
     D[Varp,x[1]]

This program produces the correct output:  I.e., the last two
lines produce the derviative of ERp wrt x[1] and the derivative
of Varp wrt x[1].

Now suppose I try to put numerical values in for X, Y, and S.
For instance, the next cell of this program has the following:


     Y={6,7,8,9};
     S = {{10,2,4,5},{2,20,4,1},{4,4,40,10},{5,1,10,60}};
     X = {0.4919379941,0.2998194609,0.1116229845,0.0966195605};
     ERp

I would have thought that this cell should produce a numerical
answer.  However, it only produces the following:
     
     ER[1] x[1] + ER[2] x[2] + ER[3] x[3] + ER[4] x[4]
     

Can anyone tell me what I'm doing wrong?

Simon Benninga
Finance Department
Wharton School
University of Pennsylvania
BENNINGA at WHARTON.UPENN.EDU

FAX:  215-898-6200
TEL:  215-898-9466

P.S.  As you can see, I'm new to Mma.  I'm using version 2.1 for
MS-DOS Windows.  If anyone out there is doing finance with Mma,
I'd be interested in making contact.





  • Prev by Date: function
  • Next by Date: Re: Suppressing the use of special functions
  • Previous by thread: Re: function
  • Next by thread: RE>vectors with mma