Re: Question: Applying a list of funcs to a list of expressions
- Subject: [mg2971] Re: [mg2924] Question: Applying a list of funcs to a list of expressions
- From: penny at edu-suu-scf.sc.suu.edu (Des Penny)
- Date: 17 Jan 1996 04:50:52 -0600
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Wolfram Research, Inc.
- Sender: mj at wri.com
>I would like to specify a list of functions such as: > >funcs = {f1, f2, f3} > >and a list of values to which the functions will be >applied: > >vals = {val1, val2, val3} > >I would then like to apply to each function to each corresponding value >respectively to obtain the following list: > >DesiredOutputList = {f1[val1], f2[val2], f3[val3]} Hi: I know it's not very elegant but this will work: Table[funcs[[i]][ vals[[i]] ], {i,1,Length[funcs]}] Hope this helps. Cheers, Des Penny ========================== Des Penny Physical Science Dept. Southern Utah University Cedar City, UT 84720 VOICE: (Office): (801) 586-7708 (Home) : (801) 586-2286 FAX: (801) 865-8051 e-mail: penny at suu.edu ==========================