Re: A Mathematica Puzzle Involving Computation of Expected Utilities

• To: mathgroup at christensen.cybernetics.net
• Subject: [mg850] Re: A Mathematica Puzzle Involving Computation of Expected Utilities
• From: rubin at msu.edu (Paul A. Rubin)
• Date: Wed, 26 Apr 1995 00:17:20 -0400
• Organization: Michigan State University

```In article <3mver3\$r0s at news0.cybernetics.net>,
SChandler at uh.edu (Seth Chandler) wrote:
->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
->

MapThread[ Map, {funcs, states} ] . probs

I don't know about "better" or "more elegant."  It seems to work when the
function list is a list of pure functions.

Paul

**************************************************************************
* Paul A. Rubin                                  Phone: (517) 432-3509   *
* Department of Management                       Fax:   (517) 432-1111   *
* Eli Broad Graduate School of Management        Net:   RUBIN at MSU.EDU    *
* Michigan State University                                              *
* East Lansing, MI  48824-1122  (USA)                                    *
**************************************************************************
Mathematicians are like Frenchmen:  whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different.                                    J. W. v. GOETHE

```

• Prev by Date: Re: Selection of sublist using Cases
• Next by Date: Re: simplex tableau help wanted
• Previous by thread: A Mathematica Puzzle Involving Computation of Expected Utilities
• Next by thread: Programming Options for Power Expand