27rohitb.github.io

Other Stuff 2

We have used 2 libraries here:

Creating polynomials

Generating by coefficients:

# [] in the below function is x^(n)'s coeffs for n=0 ... N
p = Polynomial( [1,3,5] )

Generating by roots:

#
q = fromroots( [1,-4,4] )

Evaluating polynomials created using above method:

p(x) # evaluate for x

NOTE: Basic maths operation work without “.”:

p + q # works
2*p - q # workds

Derivative & Integrals:

derivative(p)
integrate(p)

Root finding

root(q) # find root of poly_type var