I'm trying to write a function in Python which gives me values for normalized variables in a desired number of steps. I'm having a problem with rounding values and reaching 1. Since I will need these values in later computations, it is not good enough for me just to get it printed with certain number of decimals. Instead, I need Python to use them in computations like 0,0.00001,0.00002 and so on up to 1...
Here is the code....Any ideas? I forgot to mention that I wouldn't like to use the for loop....
Just to make it clear...im using recursive function to get values for u 0-> 1 which ill later use in berstain polynoms to compute bezier curves/surfaces.
from itertools import count
import sys
def b(u):
if u>=0 and u<=1:
u=count(0.0,0.001)
u=u.next
u=round(u.next(),4)
print(u)
b(u)
else:
sys.exit(0)
b(0)