MathGroup Archive 1995

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

Search the Archive

A Mathematica Puzzle Involving Computation of Expected Utilities

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg804] A Mathematica Puzzle Involving Computation of Expected Utilities
  • From: SChandler at uh.edu (Seth Chandler)
  • Date: Fri, 21 Apr 1995 01:43:25 -0400

Suppose you have m functions 

In[1]
funcs=Array[f,4]

Out[1]
{f[1], f[2], f[3], f[4]}

and you want to associate them with a list with n elements 

In[2]
probs=Array[p,5]

Out[2]
{p[1], p[2], p[3], p[4], p[5]}


and an m x n array that looks something like this.

In[3]  states=Array[s,{4,5}]

Out[3]
{{s[1, 1], s[1, 2], s[1, 3], s[1, 4], s[1, 5]}, 
  {s[2, 1], s[2, 2], s[2, 3], s[2, 4], s[2, 5]}, 
  {s[3, 1], s[3, 2], s[3, 3], s[3, 4], s[3, 5]}, 
  {s[4, 1], s[4, 2], s[4, 3], s[4, 4], s[4, 5]}}

so that you end up with the following output

{p[1] f[1][s[1, 1]] + p[2] f[1][s[1, 2]] + 
   p[3] f[1][s[1, 3]] + p[4] f[1][s[1, 4]] + 
   p[5] f[1][s[1, 5]], 
  p[1] f[2][s[2, 1]] + p[2] f[2][s[2, 2]] + 
   p[3] f[2][s[2, 3]] + p[4] f[2][s[2, 4]] + 
   p[5] f[2][s[2, 5]], 
  p[1] f[3][s[3, 1]] + p[2] f[3][s[3, 2]] + 
   p[3] f[3][s[3, 3]] + p[4] f[3][s[3, 4]] + 
   p[5] f[3][s[3, 5]], 
  p[1] f[4][s[4, 1]] + p[2] f[4][s[4, 2]] + 
   p[3] f[4][s[4, 3]] + p[4] f[4][s[4, 4]] + 
   p[5] f[4][s[4, 5]]}

The best procedure I have come up with is as follows:

(states*funcs).pr/.Times[a_,b_,c_]->b*a[c]

But I'm willing to bet there's a better and more elegant way.  Plus, this
method does not work when the functions are not abstractions like f[1], but
actual pure functions like, say, Function[x,-Exp[-x]].  

Does anyone have a suggestion?

P.S. This would be useful in determining the expected utilities of n players
in a game that can end up in m states.

==================================
Professor Seth J. Chandler
University of Houston Law Center
BLB132
Houston, Texas 77204
SChandler at uh.edu



  • Prev by Date: Re: Running Mathematica in Windows 95
  • Next by Date: Programming Options for Power Expand
  • Previous by thread: Plotting waves
  • Next by thread: Re: A Mathematica Puzzle Involving Computation of Expected Utilities