Problem 1.7

I didn’t realize that the fractional parts of n*41/29 were not unique for n>=1. In the beginning, I thought the fractional parts of n*41/29 and n*Sqrt(2) were going to further apart not keeping a mind on the fact that all of the points are going to be in [0,1] and {n*41/29} is actually goes to zero.

Problem1.7

Problem 1.1

The first time I was Trying to do the problem. I didn’t understand how the while loop was working. My code was that if the expression |x-n*Sqrt(2)|<Epsilon then increase the n by 1. However, since|x-n*Sqrt(2)| is always greater than or equal to Epsilon for n=1 the n never need to be increased. Here’s the result from the faulty misunderstanding of the while loop:

Untitled-14

The below code has some issues with it due to parenthesis mismatch:

Untitled-1

Here’s the final outcome of the coding after understanding how the while loop was working:

Exercise1.1