Question: How is a cyclic command sequence programmed?

In the attached file, I would like to calculate the expressions for the function f(n,x) using a recursion for a given index range, e.g., n=3..15. I would appreciate any advice on this.
 

NULL

restart;

kernelopts(version);

`Maple 2026.1, X86 64 WINDOWS, Jun 04 2026, Build ID 2018217`

(1)

f(1,x):=x;

x

(2)

f(2,x):=2*x + 2*sin(x);

2*x+2*sin(x)

(3)

f(n,x):=2*f(n-1,x)-f(n-2,x)+2*sin((n-1)*x)/(n-1);

2*f(n-1, x)-f(n-2, x)+2*sin((n-1)*x)/(n-1)

(4)

f(3,x):=eval(f(n,x),n=3);

3*x+4*sin(x)+sin(2*x)

(5)

f(4,x):=eval(f(n,x),n=4);

4*x+6*sin(x)+2*sin(2*x)+(2/3)*sin(3*x)

(6)

NULL

NULL


 

Download test24c.mw

 

Please Wait...