Prev: Integrate expression
Next: Problem in Mathematica 7
From: AK on 27 May 2010 06:43 Dear all, Can anyone tell me what the Operate function is good for? Looking at the help, it says Operate[p, f[x,y]] gives p[f][x,y]. Concentrating on just the rhs above for a moment, the only obvious way to me of attaching a useful meaning to it is that if p is a function that takes another function f, and additionally has some anonymous parameters - I mean #1,#2, etc.; sorry if i've got the terminology wrong - say for example: p[f_] = f[#1] + #2^2 & then p[Sin][4,3] has some meaning Coming back to Operate's definition, the corresponding lhs wrt is Operate[p, Sin[4,3]] which looks problematic first of all because Sin[] is being passed two parameters instead of one. (Mathematica complains if you run the above command, but still gives the answer expected from Operate's definition) So unless f happens to take the same number of arguments as the # arguments in p, the usage seems rather awkward in the first place... or does its intended application lie precisely in cases where both p and f have the same number of parameters, or where f can take a variable number of parameters (I haven't looked at Mathematica functions with variable number of parameters yet, so I'm just guessing). Or did I miss the point entirely? Regards, AK
|
Pages: 1 Prev: Integrate expression Next: Problem in Mathematica 7 |