0

I am away from my computer and therefore unable to experiment, but I am keen to scribble down a few Mathematica operations in note form ready for my return. So, forgive the simplistic question…

Say I define some very complicated numerical function f[x_] := … which has an integral that takes a long time for Mathematica to calculate. It makes sense to define the integral as a new function so that Mathematica doesn’t recalculate it each time. Of course, it’s easy enough to evaluate Integrate[f[x],x]

…but how do I assign the output a new function name, say fIntegral[x], so that Mathematica doesn’t recalculate each time? Obviously, I don’t want to write

 fIntegral[x_] := Integrate[f[x],x]

because then the software will evaluate Integrate[f[x],x] each time I use fIntegral[x].

Can I write

Integrate[f[x],x];
fIntegral[x_] := %

or would that not work?

CONTEXT

The question above was simplified for clarity.

The integral expression (Abel summation) for a sum from k = a to b of a function f[k] contains the expression Integrate[x * D[f[x], x], {x, a, b}]. I want to be able to experiment with both D[f[x], x] and Integrate[x * D[f[x], x], {x, a, b}] without Mathematica recalculating them each time - and also without manually redefining them each time I change f.

Richard Burke-Ward
  • 2,231
  • 6
  • 12

0 Answers0