Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 211988

How to create a loop calculating the summation of exponents

$
0
0

I'm trying to create a loop that will evaluate this equation.

     10
y =  ∑X^j
    j=0 

When x = 5. I am trying to use this code

y=0 # initialize y to 0
x = 5
for(i in 1:5){y[i] = (exp(x[0:10]))}

print(y)

but I can't seem to even get the exponents right, let alone the summation. Anyone know how to use a for loop to evaluate this sum?


Viewing all articles
Browse latest Browse all 211988

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>