Suppose $t\in\mathbb{R_+}$ - some parameter, $V: \mathbb{R}\to\mathbb{R}$ - some function. I have an operator $S:f\mapsto S[f]$ that maps a function $f$ to a function $S[f]$: $$ S[f](x) = f(x+\sqrt{t})+2f(x)+f(x-\sqrt{t})-\arctan(tV(x))f(x) $$ My goal is to find a formula for power $S^n$ of the operator $S$, and I wonder if Mathematica can help here. To find a general formula I first decided to compute some of the powers $S^2, S^3,...$ and look for a pattern. But doing so on paper is very tedious process. How can I input this formula to Mathematica and use its ability of symbolic computation to get formal representation (with like terms collected) for $S^2[f]=S[S[f]]$, $S^3[f]=S[S[S[f]]]$?

For example, formula for $S^2$ would look like this: $$ f(x+2\sqrt{t})+4f(x+\sqrt{t})+6f(x)+4f(x-\sqrt{t})+f(x-2\sqrt{t})-\arctan(tV(x+\sqrt{t}))f(x+\sqrt{t}) -4\arctan(tV(x))f(x)-\arctan(tV(x-\sqrt{t}))f(x-\sqrt{t}))-\arctan(tV(x))f(x+\sqrt{t})-\arctan(tV(x))f(x-\sqrt{t})+\arctan(tV(x))^2 $$

Simpler example: let $K[f][x] = f[x+t]+f[x]$. Then $$K^2[f][x] = K[f][x+t]+K[f][x] = f[x+2t]+2f[x+t]+f[x]$$ $$K^3[f][x] = K^2[f][x+t]+K^2[f][x] = f[x+3t]+3f[x+2t]+3f[x+t]+f[x]$$

So by inputing $K[f][x] = f[x+t]+f[x]$ and 3-rd power I would like to get the output $$f[x+3t]+3f[x+2t]+3f[x+t]+f[x]$$

  • $\begingroup$ Take a look at Nest: reference.wolfram.com/language/ref/Nest.html#32108 $\endgroup$ – mattiav27 Mar 9 '16 at 14:41
  • $\begingroup$ @mattiav27, thanks, I think that's the part of what I need! How do I input an operator, i.e. a function, that maps a function to a function? $\endgroup$ – Glinka Mar 9 '16 at 14:57
  • $\begingroup$ @Glinka It is more or less how you described it. You need to define S[f_][x_], and then apply Nest (or Fold) to S[f][x] for the "powers" of $S[f]$. $\endgroup$ – Anton Antonov Mar 9 '16 at 15:33
  • $\begingroup$ @AntonAntonov, the main obstacle is how to define a function, that take as an argument another function? Something like S[f, x]=f[x+2]+f[x]? Then S^2[f, x] = f[x+4]+2f[x+2]+f[x] $\endgroup$ – Glinka Mar 9 '16 at 15:50
  • $\begingroup$ @Glinka I think you should redefine $S$ in your question. It seems you want the parameter $t$ in the function body to be the exponent. E.g. $S^t[f](x):=f(x+t)+2f(x)+f(x-t)$. $\endgroup$ – Anton Antonov Mar 9 '16 at 16:23

I think it perhaps would help if you showed exactly what you expect by e.g. nesting your operator at least twice, so we can check the correctness of the results, but hopefully the following should get you started is going to work for you.

This is a simpler example to show how this approach might work:

ClearAll[op, f, a, v, t, x]
op[f_] = f[2 #] + v[t] &;
Through[NestList[op, a, 3][x]]

(* Out:
{a[x], a[2 x] + v[t], a[4 x] + 2 v[t], a[8 x] + 3 v[t]}

Applying this to your problems will yield:

ClearAll[f, S, t, x]
S[f_] = (f[# + Sqrt[t]] + 2 f[#] + f[# - Sqrt[t]]) - ArcTan[t V[#]] f[#] &;
Through[NestList[S, f, 3][x]] // Simplify

(* Out:
{ f[x], 
  -(-2 + ArcTan[t V[x]]) f[x] + f[-Sqrt[t] + x] + f[Sqrt[t] + x], 
  (6 - 4 ArcTan[t V[x]] + ArcTan[t V[x]]^2) f[x] + f[-2 Sqrt[t] + x] + 4 f[-Sqrt[t] + x] 
  - ArcTan[t V[x]] f[-Sqrt[t] + x] - ArcTan[t V[-Sqrt[t] + x]] f[-Sqrt[t] + x] + 
  4 f[Sqrt[t] + x] - ArcTan[t V[x]] f[Sqrt[t] + x] - ArcTan[t V[Sqrt[t] + x]] f[Sqrt[t] + x] 
  + f[2 Sqrt[t] + x]}
  • $\begingroup$ Thank you, that's exactly what I was looking for! $\endgroup$ – Glinka Mar 9 '16 at 16:41


This update is with code for the definition of the simpler function $K$.

ClearAll[K, PowerK]
K[f_, t_][x_] := f[x + t] + f[x];
PowerK[f_, t_, 1][x_] := K[f, t][x];
PowerK[f_, t_, 0][x_] := 1;
PowerK[f_, t_, n_][x_] := 
  PowerK[f, t, n - 1][x + t] + PowerK[f, t, n - 1][x];
Power[K, n_Integer][f_, t_][x_] := PowerK[f, t, n][x];

Here is how to use with Power:

(K^3)[f, t][x]
(* f[x] + 3 f[t + x] + 3 f[2 t + x] + f[3 t + x] *)

Here is an image with more examples:

enter image description here First answer

Definition of $S$ and $f$:

S[f_, t_][x_] := f[x - Sqrt[t]] + 2 f[x] + f[x - Sqrt[t]];

f[x_] := x^3;

Note that $S$ in the question had several global parameters $t$ and $V$. I used only $t$.

Now we apply Nest:

Nest[S[f, 4], 1, 4]
(* -31318496301456 *)

Here is an image with more examples:

enter image description here

  • $\begingroup$ Thank you for your answer! That is not quite what I was looking for, but still very useful. $\endgroup$ – Glinka Mar 9 '16 at 16:42
  • $\begingroup$ @Glinka Please see my update. I think it is very close to what you want. $\endgroup$ – Anton Antonov Mar 9 '16 at 16:57
  • $\begingroup$ yes, it is, thank you! $\endgroup$ – Glinka Mar 10 '16 at 10:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.