### 5.25.29 Rational interpolation : thiele

thiele takes as the first argument a matrix data of type n× 2 where that i -th row holds coordinates x and y of i -th point, respectively. The second argument is v, which may be an identifier, number or any symbolic expression. Function returns R(v) where R is the rational interpolant. Instead of a single matrix data, two vectors x=(x1,x2,…,xn) and y=(y1,y2,…,yn) may be given (in this case, v is given as the third argument).

This method computes Thiele interpolated continued fraction based on the concept of reciprocal differences.

It is not guaranteed that R is continuous, i.e. it may have singularities in the shortest segment which contains all components of x .

#### Examples

Input :

thiele([[1,3],[2,4],[4,5],[5,8]],x)

Output :

(19*x`^`2-45*x-154)/(18*x-78)

Input :

thiele([1,2,a],[3,4,5],3)

Output :

(13*a-29)/(3*a-7)

In the following example, data is obtained by sampling the function f(x)=(1−x4) e1−x3 .

Input :

data_x:=[-1,-0.75,-0.5,-0.25,0,
0.25,0.5,0.75,1,1.25,1.5,1.75,2]; data_y:=[0.0,2.83341735599,2.88770329586,
2.75030303645,2.71828182846,2.66568510781,
2.24894558809,1.21863761951,0.0,-0.555711613283, -0.377871362418,-0.107135851128,-0.0136782294833]; thiele(data_x,data_y,x)

Output :

(-1.55286115659*x`^`6+5.87298387514*x`^`5-5.4439152812*x`^`4
+1.68655817708*x`^`3-2.40784868317*x`^`2-7.55954205222*x
+9.40462512097)/(x`^`6-1.24295718965*x`^`5-1.33526268624*x`^`4
+4.03629272425*x`^`3-0.885419321*x`^`2-2.77913222418*x
+3.45976823393)