Re: best solution?
- To: mathgroup at smc.vnet.net
- Subject: [mg22910] Re: best solution?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Thu, 6 Apr 2000 02:04:29 -0400 (EDT)
- References: <8ce9t3$14a@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Peter,
Some experiments:
k = {{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3}};
F[a_, b_, c_, x_] := a Sin[b x + c]
----------
F[##, x] & @@@ k
{a1 Sin[c1 + b1 x], a2 Sin[c2 + b2 x], a3 Sin[c3 + b3 x]}
------------
FF[x_] := F[##, x] & @@@ k
FF[y]
{a1 Sin[c1 + b1 y], a2 Sin[c2 + b2 y], a3 Sin[c3 + b3 y]}
---------------
FFF[lst_, x_] := F[##, x] & @@@ lst
FFF[k, y]
{a1 Sin[c1 + b1 y], a2 Sin[c2 + b2 y], a3 Sin[c3 + b3 y]}
------------
FFF[k, #] & /@ {x, y}
{{a1 Sin[c1 + b1 x], a2 Sin[c2 + b2 x],
a3 Sin[c3 + b3 x]}, {a1 Sin[c1 + b1 y], a2 Sin[c2 + b2 y],
a3 Sin[c3 + b3 y]}}
----------
Outer[F[Sequence @@ #, #2] &, k, {x, y}, 1]
{{a1 Sin[c1 + b1 x], a1 Sin[c1 + b1 y]}, {a2 Sin[c2 + b2 x],
a2 Sin[c2 + b2 y]}, {a3 Sin[c3 + b3 x], a3 Sin[c3 + b3 y]}}
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Peter Weijnitz" <peter.weijnitz at perimed.se> wrote in message
news:8ce9t3$14a at smc.vnet.net...
> I have a function e.g F[a,b,c,x] =a Sin[b x +c] and a number of parameter
> triplets
> k={{a1,b1,c1},{a2,b2,c2},{a3,b3,c3},....}.
> I would like to feed my function the parameter values in an good and
simple
> way, how?
>
> (Picking out the elements like k[[3,2]]=b3 e.t.c is not what I want.)
> /Peter
>
>
>