My problem is that in the below code, every time I want to change $g$ I also have to change $f$.
Let's say we have three functions: $f$, $h$, and $g$ ($h$ is not really relevant for the question, but its there).
Now let's say that we don't specify what $g$ is yet, because we don't want to restrict it to one particular form. But we define $f$ as follows:
f[x_]:=h[x]+NIntegrate[g[y],{y,0,x}]
Now let's say we want to plot $f[5]$ as a function of a parameterization of $g$:
g[y_]:=a*y^b
(*I am tempted to write the following:*)
Plot3D[f[5],{a,0,1},{b,0,1}]
But the above code obviously doesn't do anything. In order for the approach to work, we would have to instead define
f[x_,a_,b_]:=h[x]+NIntegrate[g[y,a,b],{y,0,x}]
g[y_,a_,b_]:=a*y^b
Plot3D[f[5,a,b],{a,0,1},{b,0,1}]
There are two problems with this approach:
It is kind of clumsy
It is not versatile. If we want a specification of $g$ that has 3 parameters, then we need to redefine $f$ as well.
If we have higher levels of nesting of functions, this becomes even more of a hassle.
Is there a way to do this in a cleaner way without passing parameters from function to function, or at least in a way that if we want to change the parameter specification of $g$, we don't have to change all the others as well?
Is there a Canonical way to do this?



gandhalso as arguments tof... – Henrik Schumacher Jan 17 '18 at 11:21SubValuesare used. Can't findSubValuesin Help though. – Hugh Jan 17 '18 at 15:17