I am trying to make a nested integral operator where the output function of one step must be applied to the dummy variable to be integrated in the next step. Here my code:

w[x_] := Cos[x];
f[t_, n_] := Nest[Integrate[w[t - s] #, {s, 0, t}] &, 1, n];

Observe that, in one step, the output function is applied in $t$ and not $s$. Therefore, in the next integration, $t$ is just a constant, but it must be integrated as well. How can I fix this?

  • $\begingroup$ In the simplest form, you want something like f[0, t_] := 1; f[n_Integer?Positive, t_] := Integrate[Cos[t - s] f[n - 1, s], {s, 0, t}]. The more efficient method involves using the method in this answer. $\endgroup$ – J. M.'s ennui Nov 9 '17 at 1:06
  • $\begingroup$ Does changing # to ((#) /. t -> s) in f get you what you need? $\endgroup$ – Edmund Nov 9 '17 at 1:15
  • $\begingroup$ @J.M., it worked! Thank you for your answer. $\endgroup$ – Pierre Nov 10 '17 at 19:34
  • $\begingroup$ @Edmund, thank you for your tip too! $\endgroup$ – Pierre Nov 10 '17 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.