'''Experiments with convergence of series

Input:
    N... number of summands
    Z... duration of pause (seconds)

Typical call of program: 
    from python05_3 import fct
    fct(20, 2)   # fct(N,Z)

'''

import numpy as np
from time import sleep

def fct(N,Z):
    R1, R2, R3, R4, R5 = np.zeros(5)  # We initialize R1,...,R5 as zero
    
    for i in range(1,N+1):
       j = 1.0/i
       R1 += j**0.99    # We add j**0.99 to the -previous- value of R1
       R2 += j
       R3 += j**1.01
       R4 += j**2
       R5 += 1./np.math.factorial(i)
       print(i, R1, R2, R3, R4, R5)
       sleep(Z)