Double summation without loops

I have following double summation: ∑10,i=1 ∑i,j=1 (i^5/(10+j^i))

(as seen on this picture Double summation

I am quite lost with this exercise, I tried the following code but I it returns an error although giving me a number - pretty sure it is not correct. Any help is greatly valued!

  i <- seq(1, 10, 1) 
  j <- seq(1, i, 1)
  denominators <- 10+j^i
  fractions <- (i^5)/denominators


  i = rep(1:10, each=5)
  j = rep(i, 10)
  # find the sum 

One way you can do it by making the complete square of i, j and then ignoring the ones where j > i:

# make vectors of indices
i <- rep(1:10, each = 10)
j <- rep(1:10, times = 10)

# which ones are j <= i
k <- j <= i

# find the sum
#> [1] 20835.22

Created on 2020-11-13 by the reprex package (v0.3.0)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.