Ask Your Question
0

Function generator

asked 2014-01-16 16:15:30 +0100

czsan gravatar image

updated 2015-01-24 13:52:58 +0100

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 16:50:32 +0100

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 17:03:38 +0100 )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 16:15:30 +0100

Seen: 668 times

Last updated: Jan 16 '14