Skip to main content
added 176 characters in body
Source Link
void life
  • 352
  • 2
  • 9

This is becauseIf I understand your question correctly, you're asking how to replace the iteration variable in sum with some other selected variable.

The reason your code doesn't work is that, in Sum the iteration variable is treated as local usinglocalised by making use of Block. You can use With to replace all occurrences of a symbol inside an expression with aanother value (even inside held expressions) So

With[{r = Extract[{0, 0, x, y, 0}, 3], 
    inf = Extract[{0, 0, x, y, 0}, 5], 
    sp = x + y}, 
    Sum[t^sp, {r, inf, Infinity}, 
      Assumptions -> {t < 1 && t > 0}]]

will give what you expect.

$\frac{t^y}{(1 - t)}$

This is because the iteration variable in Sum is treated as local using Block. You can use With to replace all occurrences of a symbol inside an expression with a value (even inside held expressions) So

With[{r = Extract[{0, 0, x, y, 0}, 3], 
    inf = Extract[{0, 0, x, y, 0}, 5], 
    sp = x + y}, 
    Sum[t^sp, {r, inf, Infinity}, 
      Assumptions -> {t < 1 && t > 0}]]

will give what you expect.

$\frac{t^y}{(1 - t)}$

If I understand your question correctly, you're asking how to replace the iteration variable in sum with some other selected variable.

The reason your code doesn't work is that, in Sum the iteration variable is localised by making use of Block. You can use With to replace all occurrences of a symbol inside an expression with another value (even inside held expressions) So

With[{r = Extract[{0, 0, x, y, 0}, 3], 
    inf = Extract[{0, 0, x, y, 0}, 5], 
    sp = x + y}, 
    Sum[t^sp, {r, inf, Infinity}, 
      Assumptions -> {t < 1 && t > 0}]]

will give what you expect.

$\frac{t^y}{(1 - t)}$

Source Link
void life
  • 352
  • 2
  • 9

This is because the iteration variable in Sum is treated as local using Block. You can use With to replace all occurrences of a symbol inside an expression with a value (even inside held expressions) So

With[{r = Extract[{0, 0, x, y, 0}, 3], 
    inf = Extract[{0, 0, x, y, 0}, 5], 
    sp = x + y}, 
    Sum[t^sp, {r, inf, Infinity}, 
      Assumptions -> {t < 1 && t > 0}]]

will give what you expect.

$\frac{t^y}{(1 - t)}$