Trying to solve a 3rd degree polynomial and feed those coefficients into a solver to determine x given y (at eft 6 hrs what density should I expect). Im using 7.9 so is there any good solvers that I could use from Apache Commons or a good way to roll my own?

from org.apache.commons.math3.fitting import PolynomialCurveFitter as pcf
from org.apache.commons.math3.fitting import WeightedObservedPoints as wop
eft = [0.0, 7, 15, 23]
dcw = [0.583,0.72, 2.82, 7.29]
fitter = pcf.create(2)
tstPoints = wop()
for i in range(4):
time = eft[i]
density = dcw[i]
tstPoints.add(time, density)
coeff = fitter.fit(tstPoints.toList())
for i in range(len(coeff)):
print coeff[i]

@JordanCClark 's library seems to have the functionality you need (and up to 5th degree polynomials it looks like).

But if finding roots of a 3rd degree polynomial is all you need, there is a formula for it you could hardcode by hand. The hard part I imagine would be handling the potential imaginary numbers that can arise The Cubic Formula

If youâ€™re not comfortable using someone elseâ€™s library and or handling the imaginary numbers, you can always try implementing your own version of Newtonâ€™s method or some other numerical approximation method for finding roots for which you can find the process online.

Thanks @JordanCClark and @bkarabinchak.psi for the libraries and recommendations. I figured since I was using the Apache Commons library to get the nth degree polynomial I could then put that into a solver from the same library to get the roots maybe something like these [solvers]. (LaguerreSolver (Apache Commons Math 3.3 API))

Since we converting an Excel sheet to Ignition were just using the goal seek option in Excel to solve for x given y using the coefficients. Is there a good way to implement this in Ignition using some existing library?

I havenâ€™t verified this personally but this post in stackoverflow -

uses the brent Method in java for finding roots. Read the entire post as thereâ€™s some caveats - only finds roots within your interval range, and only that are more than an interval size apart (in his example, more than .01 apart).

You can try replicating his code. You can start off with

I donâ€™t know how excelâ€™s goal seek works behind the scenes but you are just trying to find roots essentially so any root finding algorithm should fit your needs.