I have a huge expression around 231 terms and each of these expressions has some power of cos(e) or sin(e) and they can be mixed as well, each term also has an r(distance) term in the denominator raised to some power as well.
Here is a small portion of the expression
What I'd like to do is sum the expression over all angle e's and then over all r's and use lambdify and scipy to minimize the expression with respect to 4 other parameters present in the equation.
Things I tried
I have tried to do the sums using sum indexed in scipy but am not able to make it work, the power bit is tricky also once I have the sum indexed expression and I expand it how do i pass the list of angle values at which to calculate the expression
Also since the expression is pretty large I'd like to do the sum indexing etc. in a loop without individually resolving expression for each power.
(If my question is not clear, let me know.)
This is how I finally managed to solve my problem -