This is probably very simple but I don't see the solution now. Let us say I have a variable e defined as
e=n
ReplaceAll can subsitute n with value 3 using
e/.n->3
The problem is when e is given by an integral of some function f[{n_}, r_] with n as a parameter
e=Integrate[f[{n}, r],{r, rmin, rmax}]
Then the use of
e/.n->3
will take too long if the integral in question is hard to evaluate and so, better would be FIRST to replace n with its numerical value and THEN evaluate the integral.
If e was defined as a function
e[n_]:=Integrate[f[{n}, r],{r, rmin, rmax}]
there would be no problem. But my function f depends on quite many definitions (using "n") I made earlier. It works ok but then in the end of my code there is a complicated f which makes the integration (i.e. evaluation of "e") too long - and I don't want to change all the definitions I made before.
What to do if I want to keep "e" as above, i.e. I don't want to define it as a function?
n
is eventually replaced by a number, why not simply definen
beforehand? E.g.n=3;e=n
. $\endgroup$e
for several values ofn
, (e.g. using Table). $\endgroup$