MathGroup Archive 2001

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

Search the Archive

Re: assigning parameters from a matrix


Here is one possibility (if I understand what you are trying to do
correctly). Let suppose your {a,b,c} data from your ReadList function
looks like this:

mydata = Table[{Random[], Random[], Random[]}, {4}]

{{0.964053, 0.729247, 0.867568}, {0.942935, 0.0860712, 0.588032},
{0.0714172,  0.65093, 0.890847}, {0.476312, 0.124108, 0.0936164}}

Now we convert the data into a set of rules:
myrules = Map[Thread[{a, b, c} -> #] &, mydata]

Here is our function

myfunc[x_] := c Sin[a x + b]

Then we apply our rules to the function

myfunc[x] /. myrules

{0.867568 Sin[0.729247 + 0.964053 x],
  0.588032 Sin[0.0860712 + 0.942935 x],
  0.890847 Sin[0.65093 + 0.0714172 x],
  0.0936164 Sin[0.124108 + 0.476312 x]}

Cheers,

Brian


In article <95glkt$8fg at smc.vnet.net>,
  "F cartwright" <flc at ualberta.ca> wrote:
> Hi. I was hoping someone could help me.
>
> I have a function with 3 parameters, and I want to use a matrix to
look at
> the shape of this function in response to specific combinations of the
> parameters (e.g., a = 1, b = 2, c = 3).  I have created a matrix with
my
> different sets of parameters and have used the ReadList command to
enter
> into Mathematica. What command(s) do I use to apply the function to
the
> matrix and look at the different outcomes?  I am having repeated lack
of
> success with Map.
>
> Please hel


Sent via Deja.com
http://www.deja.com/


  • Prev by Date: Re: Raise lists of a list to powers
  • Next by Date: Re: Typesetting summation and product symbols
  • Previous by thread: Re: assigning parameters from a matrix
  • Next by thread: Export challenge