FAQ Database Discussion Community


How is the logic reasoning done in these three codes?

python,square-root,bisection,epsilon
def findRoot1(x, power, epsilon): low = 0 high = x ans = (high+low)/2.0 while abs(ans**power - x) > epsilon: if ans**power < x: low = ans else: high = ans ans = (high+low)/2.0 return ans def findRoot2(x, power, epsilon): if x < 0 and power % 2 == 0: return...

python fuction finding root( or zero) with minimum distance from real root epsilon

python,function,zero,epsilon
So its and exercises for python i am totally stuck! you have a random Function in [a,b] you already know that the a is negative and b is positive and it has only ONE root. The true root is : -0.94564927392359 and you have to make a def that will...

Java: Double machine epsilon is not the smallest x such that 1+x != 1?

java,floating-point,epsilon
I am trying to determine the double machine epsilon in Java, using the definition of it being the smallest representable double value x such that 1.0 + x != 1.0, just as in C/C++. According to wikipedia, this machine epsilon is equal to 2^-52 (with 52 being the number of...

precision of comparing double values with EPSILON in C

c,floating-point,double,epsilon
Doing function that takes 2 arrays (column1 and column2) from struct CSV D and plots the graph from it. Idea is to find max, min values of each array, then break range between min−EPSILON and max+EPSILON in to 600 equal regions, where EPSILON = 10^(−6) Problem is that function does...