Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: best solution?

  • To: mathgroup at
  • Subject: [mg22905] Re: best solution?
  • From: Eckhard Hennig <hennig at>
  • Date: Thu, 6 Apr 2000 02:04:26 -0400 (EDT)
  • Organization: ITWM
  • References: <8ce9t3$>
  • Sender: owner-wri-mathgroup at

Peter Weijnitz schrieb in Nachricht <8ce9t3$14a at>...
>I have a function e.g F[a,b,c,x] =a Sin[b x +c]  and a number of parameter
>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.)


you can use the Mathematica command Apply with a level specification to
achieve what you want. Of course, this is only one of many possible
solutions; an alternative is shown in In[4].

In[1]:= F[a_, b_, c_, x_] := a Sin[b x + c]

In[2]:= k = {{a1, b1, c1}, {a2, b2, c2}, {a3, b3, c3}};

In[3]:= Apply[F[##, x]&, k, 2]

Out[3]= {a1 Sin[c1 + b1 x], a2 Sin[c2 + b2 x], a3 Sin[c3 + b3 x]}

In[4]:= F[Sequence @@ #, x]& /@ k

Out[4]= {a1 Sin[c1 + b1 x], a2 Sin[c2 + b2 x], a3 Sin[c3 + b3 x]}



Dipl.-Ing. Eckhard Hennig      mailto:hennig at
Institut fuer Techno- und Wirtschaftsmathematik e.V. (ITWM)
Erwin-Schroedinger-Strasse,  67663 Kaiserslautern,  Germany
  Voice: +49-(0)631-205-3126    Fax: +49-(0)631-205-4139

     ITWM - Makers of Analog Insydes for Mathematica

  • Prev by Date: Re: best solution?
  • Next by Date: Mathematica NDSolve max number of grid points error
  • Previous by thread: Re: best solution?
  • Next by thread: Re: best solution?