Example as following
I need to have define f[x] through g[x], Does mathmetica NIntegrate g[x] twice when calculating f[x]? How to rewrite it to reduce calculation? My idea is to give the value of g[x] at some x to a variable and use it in f[x].
The value giving should be done inside f[x_]. How to build up the function definition in mathematica in such way?
After a bit of study myself, the new code I write is:
g[x_] := NIntegate[......]; f[x_] = #^2 + # &[g[x]]
The function definition gives correct answer. Does it calculate g[x] once or twice in this way?