Get startedGet started for free

Vectorized operations continued...

We can use some of what we have learned to perform calculations that would otherwise be quite complicated. Let's see an example.

This exercise is part of the course

Data Science R Basics

View Course

Exercise instructions

What is the sum of the following equation: 1 + 1/2^2 + 1/3^2 + ... + 1/100^2? Thanks to Euler we know it should be close to \(\pi^2/6\).

  • Define an object x that contains the numbers 1 through 100
  • Compute the sum 1 + 1/2^2 + 1/3^2 + ... + 1/100^2.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Define an object `x` with the numbers 1 through 100

# Compute the sum 
Edit and Run Code