1 | initial version |
Would something like the following help ?
sage: def f(n):
....: return sum(SR.var('x_{}'.format(k))SR.var('x_{}'.format(k+1)) for k in range(1,n+1))
....:
sage: f(3)
x_1x_2 + x_2x_3 + x_3x_4
2 | No.2 Revision |
Would something like the following help ?
sage: def f(n):
....: return 3 | No.3 Revision |
Would something like the following help ?
sage: def f(n):
....: return sum(SR.var('x_{}'.format(k))*SR.var('x_{}'.format(k+1)) for k in range(1,n+1))
....: sage: f(3)
x_1*x_2 + x_2*x_3 + x_3*x_4