The interpolate command constructs the coefficients of a polynomial passing through the points [Ai,Bi]. The points [Ai] must be distinct. If an optional third argument P is provided, the computation is done modulo P.
A = [1,2]; B = [3,7]; interpolate(A,B); [-1, 4]