Can I simplify the sum of a series like this using SymPy or other software?
I can simplify the sum of such series {i}
:
summation(i, (i, 1, n))
I don't know how to deal with the series with subscripts {a_i}
a_1, a_2, a_3, a_4 = symbols("a_1 a_2 a_3 a_4")
Say, I have a equation a_1 + a_2 + ... + a_100 - x = 0
. The answer will be :
x = a_1 + a_2 + ... + a_100
.
It is too long. I want to make it shorter with some other symbols i
and functions summation
, like x = summation(a_i, (i, 1, 100 ))
.
The code Sum(Indexed("x", i), (i, 1, 4)).doit()
will get the result x[1] + x[2] + x[3] + x[4]
. However, I want to reverse the process. I want the code somefunction(x[1]+x[2]+x[3]+x[4])
to get the result Sum(Index("x", i), (i, 1, 4))
.