Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'list of functions' topicStudent Support Forum > General > "list of functions"

Next Comment >Help | Reply To Topic
Author Comment/Response
jorge
04/01/10 12:36pm

Hello, greetings from Colombia,

Suppose I have a function that returns a list, say

f[x_]:={x+1,2x};

I want to make a loop that creates an array of functions out of f. The result I want is an array F with the following entries

{#+1&, 2#&}

One answer is to do:

F = Table[f[#][[1]] &, {i, 1, 2}];

which gives me F[[1]][x] to be x+1, as desired. However, doing stuff like differentiating, doesn't work. For instance, F[[1]]'[x] gives crap.

The only way I was able to solve this was making:

F1[x_] := f[x][[1]];
F2[x_] := f[x][[2]];
F={F1,F2};

The problem is that I want a loop that does this for me, and using ToExpression is really ugly.

Thanks a lot.


URL: www.unalmed.edu.co/~jmramirezo,

Subject (listing for 'list of functions')
Author Date Posted
list of functions jorge 04/01/10 12:36pm
Re: list of functions Peter Pein 06/27/10 12:23pm
Next Comment >Help | Reply To Topic