Also, I encounter TypeError: Fraction.from_float() only takes floats, not 0.0400000000000000 (Float)
This seems even weirder. I specify it as a float On Saturday, September 3, 2022 at 11:28:22 PM UTC+2 Yang Liu wrote: > Hi, > > I want to write a for loop to calculate all possible values, so I declare > m=a/b #my test case a/b==3/2 > r=np.linspace(0,m,10,dtype=float) > for i in range(len(r)): > f(Fraction.from_float(r[i])) > > where f is some function I write to print out some function space. > But I get > TypeError: Cannot interpret '1.50000000000000' as a data type > > Any idea on how why I get the error? > > If I cast m= float(a/b), I can work it out. However, > Fraction.from_float(r[i]) in this case will not result in a fraction. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/ac9a6350-4c37-4b2c-b20f-9be4162b7c68n%40googlegroups.com.