For28. Given a real number X (|X| < 1) and an integer N (> 0). Find the value of expression
\(1 + X/2 - 1 \cdot X^2/(2 \cdot 4) + 1 \cdot 3 \cdot X^3/(2 \cdot 4 \cdot 6) - ... + \\
+ (-1)^{N - 1} \cdot 1 \cdot 3 \cdot ... \cdot (2 \cdot N  - 3) \cdot X^N/(2 \cdot 4 \cdot ... \cdot (2 \cdot N)).\)
The resulting number is an approximate value of the function \(\sqrt{1+X}\).

Solution in Python 3:

import math
X = -0.9
N = 100
print('X = ', X)
print('N = ', N)

p = X/2
S = 1 + X/2
k = 2
for i in range(2,N+1):
k += 2
p *= (-1)*(k-3)/k * X
S += p
print(i," : ",k," : ",p," : ",S)

print("Result:")
print(S)
print("sqrt(1+x):")
print(math.sqrt(1+X))