substituting vars for a poly quotient in a list comprehension blows up
If I run this but don't substitute the a and b for the polynomials:
a = 3*x^2 + 2*x + 1
b = 5*x^3 - 2*x^2 + 3
c = [((3*x^2 + 2*x + 1)/(5*x^3 - 2*x^2 + 3)).n() for x in [100..30000,step=100]]
for num in c:
print(num)
I get a numeric list, as expected.
If I use f = [(a/b) for x in [100..30000,step=100]] however, I only get variables in x, all the same: (3.00000000000000x^2 + 2.00000000000000x + 1.00000000000000)/(5.00000000000000x^3 - 2.00000000000000x^2 + 3.00000000000000)
And if I try (a/b).n(), I get an error: TypeError: unable to coerce to a ComplexNumber: <class 'sage.rings.fraction_field_element.fractionfieldelement_1poly_field'="">
What's going wrong?
This worked when I used f(x) and g(x) instead of a and b, but I thought I could just name a function that way. I then thought I could use f and g after defining functions, insstead of f(x) and g(x), but that didn't work either, although I think it does in plotting. Where am I misconceiving?
Try