I'm having trouble with a function which is supposed to work on another function. Simplified version:
one[x_] := 1 (* the argument *)
problem[f_] := Integrate[f[t], {t, 0, #}] & (* the function doing the work *)
Simple enough, right? But when I pass
problem[one] // InputForm (* to paste into se *)
I get
Integrate[one[t], {t, 0, #1}] &
and even
FullSimplify[problem[one]] // InputForm
just gives
Integrate[one[t], {t, 0, #1}] &
But I know that the function is there, since if I evaluate
problem[one][17]
it (properly) gives
17
How do I get Mathematica to substitute the function's definition for its name so it can simplify the result (in this case, evaluate the integral)?
(System details: 64-bit Mathematica 10.0.2.0, Windows 7 Pro SP1, i7-4770.)
problem
is what's called an anonymous or inline function. It's a function waiting to take arguments which will replace the#
. That's why you don't get a result until you feed it the upper bound of your integral (17 in your example). Until then, it's just a function waiting for an argument to evaluate. What is it that you expectproblem[one]
to look like instead? $\endgroup$Evaluate @@ problem[one]
$\endgroup$