0

I'm learning math with Z3 library and Python language, and i don't know How i can find a Polynomial based on Lagrange Interpolation Polynomial? Eg,

I have
f(0) = y0
f(1) = y1
f(2) = y2
....

And I want to find f(X)

I'm work well with Scipy but When changing to Z3 library, it's have no more docs I can be found :(

panda_dth
  • 11
  • 3
  • Lagrange interpolation is different from logical Craig interpolation. Z3 is doing Craig interpolation. You may interessed in http://stackoverflow.com/questions/18048733/algorithm-in-c-to-calculate-coefficients-of-polynomial-using-lagrange-interpolat. – sfrehse Oct 28 '14 at 20:24

1 Answers1

0

I don't know how to answer your question in context of Z3. Z3 does not contain any built-in solver for lagrangian interpolation. You can set of a system of polynomial equalities where the coefficients are kept symbolic. You can then ask Z3 whether the system is solvable. It produces in general algebraic numbers for the coefficients, so I am not sure this is the fit for your application. Of course, in python you can write:

a, b, c = Real('a b c')
def f(X):
    return a*X*X + b*X + c

solve(f(0) == y0, f(1) == y1, f(2) == y2)

where y0, y1, y2 are constants.

MackM
  • 2,906
  • 5
  • 31
  • 45
Nikolaj Bjorner
  • 8,229
  • 14
  • 15