{"id":17902,"date":"2021-08-26T10:42:24","date_gmt":"2021-08-26T05:12:24","guid":{"rendered":"https:\/\/python-programs.com\/?p=17902"},"modified":"2021-11-22T18:37:12","modified_gmt":"2021-11-22T13:07:12","slug":"python-program-to-calculate-sum-of-series-1%c2%b32%c2%b33%c2%b3-n%c2%b3","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-calculate-sum-of-series-1%c2%b32%c2%b33%c2%b3-n%c2%b3\/","title":{"rendered":"Python Program to Calculate Sum of Series 1\u00b3+2\u00b3+3\u00b3+\u2026.+n\u00b3"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Find Isosceles Triangle Area<\/a>
\nThe general mathematical formula to calculate the sum of cubes of a series\u00a0 =\u00a0 ( n (n+1) \/ 6)\u00b2<\/p>\n

where n= nth term of a series.<\/p>\n

Given the nth term of a series and the task is to calculate the sum of the cubes of a series.<\/p>\n

Math Module :<\/strong><\/p>\n

Python’s math module is a built-in module. By importing this module, we can perform mathematical computations.<\/p>\n

Numerous mathematical operations like ceil( ),floor( ),factorial( ),mod( ),value of pi ,…..etc .can be computed with the help of math module.<\/p>\n

math.pow() :<\/strong><\/p>\n

The math. pow() method returns the value of x to the power of y.<\/p>\n

It throws a ValueError if x is negative and y is not an integer.<\/p>\n

Both arguments are converted to floats by this method.<\/p>\n

Note:<\/strong> Using math.pow(1.0,x) or math.pow(x,0.0) always returns 1.0.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given n value = 13<\/pre>\n

Output:<\/strong><\/p>\n

The sum of cubes of a series with the given n value[ 13 ] = 8281.0<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given n value = 6<\/pre>\n

Output:<\/strong><\/p>\n

The sum of cubes of a series with the given n value[ 6 ] = 441.0<\/pre>\n

Program to Calculate Sum of Series 1\u00b3+2\u00b3+3\u00b3+\u2026.+n\u00b3<\/h2>\n

Below are the ways to calculate the sum of the cubes of a given series.<\/p>\n