Re: Function of list of functions
- To: mathgroup at smc.vnet.net
- Subject: [mg104068] Re: Function of list of functions
- From: Andrey <oradev at rambler.ru>
- Date: Sun, 18 Oct 2009 05:25:40 -0400 (EDT)
- References: <hb9k72$rv$1@smc.vnet.net> <hbc8aj$ctt$1@smc.vnet.net>
On Oct 17, 3:03 pm, David Bailey <d... at removedbailey.co.uk> wrote: > Andrey wrote: > > Hello! > > May be anybody can help me. So, I have this: > > > L = {{1, 2, 3}, {1, 2, 3}, {1, 2, 3}}; > > Fun1[t_] := ListPlot[L[[1, t]]]; > > Fun2[t_] := ListPlot[L[[2, t]]]; > > Fun3[t_] := ListPlot[L[[3, t]]]; > > > FunRes[t_] := {Fun1[t], Fun2[t], Fun3[t]}; > > > Everything is ok, BUT if I want to add element to list of FunRes[t_] > > in loop, I have an error? so I mean this: > > > FunRes[t_] := {}; > > For[i = 1, i <= 3, i++, > > {Subscript[Fun, i][t_] := ListPlot[L[[i, t]]], > > AppendTo[FunRes[t], Subscript[Fun, i][t]]}] > > > Please, help me, where I am wrong? > > It is very hard to figure out what you want to achieve here. Here are a > few thoughts: > > Let's start with a list where we can tell what we are plotting: > > L = {{1, 2, 3}, {10, 20, 30}, {100, 200, 300}}; > > This will plot the second sublist: > > ListPlot[L[[2]]] > > Here is a function that will plot the n'th sublist: > > fun[n_] := ListPlot[L[[n]]] > > e.g. > > fun[3] > > Note that in your code FunRes[t] evaluates a function, so it makes > absolutely no sense to use AppendTo on the result! > > Tell us what you really want to do, and someone will tell you how to do i= t! > > BTW, it is highly recommended that you don't use variable names that > start with a capital letter (unless you use a special character further > in the name) to avoid confusion with Mathematica's symbols. > > David Baileyhttp://www.dbaileyconsultancy.co.uk Thank you everybody for your replays. Sorry for my english. I wanted this, and it is works: L = {{1, 2, 3}, {1, 2, 3}, {1, 2, 3}}; FuncTestList[n_, v_] := L [[n, v]] FunRes[v_] := Table[FuncTestList[i, v], {i, 1, 3}]