# Summation and Product Notation

## Introduction

In this arti­cle we are going to talk about the sum­ma­tion and prod­uct nota­tion, what they mean and how to per­form the cal­cu­la­tions. At the end we will see how to pro­gram sum­ma­tion and prod­uct nota­tion in Java or C# language.

## What is summation and product notation?

Sum­ma­tion and prod­uct are ways of defin­ing math­e­mat­i­cal oper­a­tions that con­sist of sequences of sums and prod­ucts respectively.

Imag­ine that we have to add or mul­ti­ply all the num­bers start­ing at 1 and end­ing at 1000, but also mul­ti­ply each of them by 3.

Using sym­bol­o­gy we can write long oper­a­tions like that in short. In addi­tion the prop­er­ties can help us to sim­pli­fy the expres­sion and to cal­cu­late the results.

## Sigma Notation

In the next video you can see the con­cept of the sig­ma nota­tion and an excer­cise solved using pro­gram­ming tech­niques in Unity.

# CHECK OUT THIS CRAZY EXPERIMENT

The sum­ma­tion is sym­bol­ized by the Greek let­ter Sig­ma in cap­i­tal letters.

Below the sum­ma­tion sym­bol the index vari­able is indi­cat­ed and from which val­ue it starts. At the top of the sym­bol is the last val­ue to be tak­en by the index.

To the right of the sym­bol is the expres­sion that deter­mines all the terms of the sum­ma­tion, each term aris­es from replac­ing the index in the expres­sion from the first to the last value.

In equa­tion 1 we see on the left side the expres­sion of the sum­ma­tion and on the right side the devel­oped operation.

(1) ## How to program a Summation?

To imple­ment the sum­ma­tion in some pro­gram­ming lan­guage is rel­a­tive­ly sim­ple, we must define a vari­able to accu­mu­late the sum that must be ini­tial­ized in 0 (neu­tral ele­ment for the sum). We have to take into account which numer­i­cal set the sum­mands belong to, this will depend on the type of vari­able to choose.

We define an inte­ger vari­able for the end of the summation.

We make a for loop that goes from the begin­ning of the sum­ma­tion to the end and inside the loop we define the oper­a­tion to make.

In fig­ure 1 we see the imple­men­ta­tion of the sum of equa­tion 1 togeth­er with the print­ed result in console.

## Symbol of Product notación

The prod­uct nota­tion is sym­bol­ised by the let­ter Pi in cap­i­tal letters.

Under the pro­duc­er sym­bol is indi­cat­ed the index vari­able and from which val­ue it starts. In the upper part of the sym­bol is indi­cat­ed the last val­ue that the index will take.

To the right of the sym­bol is the expres­sion that deter­mines all the terms of the pro­duc­er, each term aris­es from replac­ing the index in the expres­sion from the first to the last value.

In equa­tion 2 we see on the left side the expres­sion of the pro­duc­er and on the right side the devel­oped operation.

(2) ## Implement the product notation in programming

We must define a vari­able to accu­mu­late the prod­uct that must be ini­tial­ized in 1 (neu­tral ele­ment of the prod­uct). We also ana­lyze the type of num­bers we are mul­ti­ply­ing to choose the type of the accu­mu­la­tion variable.

We define a whole vari­able for the end of the producer.

We make a for loop that goes from the begin­ning of the pro­duc­tion to the end and inside the loop we define the oper­a­tion to be performed.

In fig­ure 2 we see the imple­men­ta­tion of the pro­duc­er of equa­tion 2 togeth­er with the print­ed result in console.