from numpy import linalg,dot import numpy.polynomial.polynomial as poly x7=poly.Polynomial([1,2]) print x7 according to above code in python it should print 1 + 2x^2, but it is pr
Solution 1:
I'd recommend using numpy.poly1d and numpy.polymul, where the coefficients are a0*x2 + a1*x + a2.
For example, to represent 3*x**2 + 2*x + 1:
p1 = numpy.poly1d([3,2,1])
therefor for your problem you could use:
p2= numpy.poly1d([2,0,1])
print p2
and printing p2 will represent: 1 + 2x^2
Share
Post a Comment
for "Print Polynomial In Variable Format In Python"
Post a Comment for "Print Polynomial In Variable Format In Python"