How to solve Line integral over a p0lynomial of order $n$ programatically (in java)

204 Views Asked by At

I want to solve line integral over an polynomial of order $n$.

i.e. Integration of $ds$ over an bounded polynomial ($a+bx+cx^2+dx^3+\ldots$) where $ds$ is an small element on the curve in $x$-$y$ Plane.

On paper I can solve it by converting $ds$ in to parametric form as $x=t$ and $y=f(t)$ and $ds= \sqrt{(dx/dt)^2 +(dy/dt)^2}dt$ and by changing limit of integration to bounded min and max value.

But programmatically, how to go I do not know? The Polynomial is not fixed, it can change its order.

Currently I am using Apache commons-math-2.2.jar.

Thanks for any type help. Please guide me.

Rakesh