Without using numpy, write the Python function
geo_sum(n)
that returns the sum of the first n terms of the series:print(geo_sum(1)) # 1.0 print(geo_sum(3)) # 1.75 print(geo_sum(5)) # 1.9375
Using numpy and no loops, write the
geo_sum(n)
function.
Array Operations
Without using numpy, write the Python function geo_sum(n)
that returns the sum of the first n terms of the series:
print(geo_sum(1)) # 1.0
print(geo_sum(3)) # 1.75
print(geo_sum(5)) # 1.9375
Using numpy and no loops, write the geo_sum(n)
function.