| 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, |
|