No title

Download script from .\sum.py


import os
import sys
import numpy as np
from numpy import exp, log, sin, cos, tan, arcsin, arccos, arctan, pi
from matplotlib import pyplot as plt


h = 0.3
n = 1000


argv = sys.argv
narg = len(argv)
if narg <= 2:
    print("")
    print("Usage: python sum.py h n")
    print(" Summing up h for n times")
    print("")
    exit()
else:
    h = float(argv[1])
    n = int(argv[2])


print("")
print("h = ", h)
print("n = ", n)

print("")
a = 0.0
for i in range(n):
    aprev = a
    a += h
    print("{}: {} + {} => {}".format(i, aprev, h, a))

print("")