Ask Your Question
0

Function generator

asked 2014-01-16 09:15:30 -0500

czsan gravatar image

updated 2015-01-24 06:52:58 -0500

FrédéricC gravatar image

How can I generate a list (or array) of functions? I have a list which contains the expressions for the functions. For example: F = [x, x^2, (x-1)/x, -1/x] and I want f1(x) = F[1] f2(x) = F[2],... (In Maple there is an indexed function construction) Thanks

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-01-16 09:50:32 -0500

czsan gravatar image

it seems, in my problem the following works:

[F[i].function(x) for i in range(len(F))]

edit flag offensive delete link more

Comments

No need to use indices; `[f.function(x) for f in F]` should work too.

DSM gravatar imageDSM ( 2014-01-16 10:03:38 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-01-16 09:15:30 -0500

Seen: 77 times

Last updated: Jan 16 '14