Nikita
Nikita

Reputation: 61

Calculating series with two indices in sympy

I need to calculate series (k/m)^2 with k and m from 1 to 100

A = Sum(Sum((k/m)**2, (k, 1, 100)),(m,1,100)) - doesn't work

May I do it using only sympy functions?

Upvotes: 1

Views: 71

Answers (1)

Sklert
Sklert

Reputation: 242

You need to use doit() for sums and then evalf:

A = Sum(Sum((k/m)**2, (k, 1, 100)),(m,1,100)).doit().evalf()

Returns 553196.802627558

Upvotes: 2

Related Questions