user
Find an approximating polynomial of known degree for a given data.

Example:
For input data:

```
x = {0,  1,  2,  3,  4,  5,  6,   7,   8,   9,   10};
y = {1,  6,  17, 34, 57, 86, 121, 162, 209, 262, 321};

```

The approximating polynomial is:

```
3 x2 + 2 x + 1

```

Here, the polynomial's coefficients are (3, 2, 1).

This task is intended as a subtask for Measure relative performance of sorting algorithms implementations.
assistant
(formerly Perl 6)
We'll use a Clifford algebra library. Very slow.

Rationale (in French for some reason):

Le système d'équations peut s'écrire :

(

a
+
b

x

i
+
c

x

i

2
=

y

i
)

i
=
1
…
N
{\displaystyle {\displaystyle \left(a+bx\_{i}+cx\_{i}^{2}=y\_{i}\right)\_{i=1\ldots N}}}
, où on cherche 

(
a
,
b
,
c
)
∈


R

3
{\displaystyle {\displaystyle (a,b,c)\in \mathbb {R} ^{3}}}
. On considère 

R

N
{\displaystyle {\displaystyle \mathbb {R} ^{N}}}
 et on répartit chaque équation sur chaque dimension:

(
a
+
b

x

i
+
c

x

i

2
)


e

i
=

y

i


e

i
{\displaystyle {\displaystyle (a+bx\_{i}+cx\_{i}^{2})\mathbf {e} \_{i}=y\_{i}\mathbf {e} \_{i}}}

Posons alors :

x

0
=

∑

i
=
1

N


e

i
,

x

1
=

∑

i
=
1

N

x

i


e

i
,

x

2
=

∑

i
=
1

N

x

i

2


e

i
,


y
=

∑

i
=
1

N

y

i


e

i
{\displaystyle {\displaystyle \mathbf {x} \_{0}=\sum \_{i=1}^{N}\mathbf {e} \_{i},\,\mathbf {x} \_{1}=\sum \_{i=1}^{N}x\_{i}\mathbf {e} \_{i},\,\mathbf {x} \_{2}=\sum \_{i=1}^{N}x\_{i}^{2}\mathbf {e} \_{i},\,\mathbf {y} =\sum \_{i=1}^{N}y\_{i}\mathbf {e} \_{i}}}

Le système d'équations devient : 

a


x

0
+
b


x

1
+
c


x

2
=

y
{\displaystyle {\displaystyle a\mathbf {x} \_{0}+b\mathbf {x} \_{1}+c\mathbf {x} \_{2}=\mathbf {y} }}
.

D'où :

a
=

y
∧


x

1
∧


x

2

/
(


x

0
∧


x

1
∧


x

2
)


b
=

y
∧


x

2
∧


x

0

/
(


x

1
∧


x

2
∧


x

0
)


c
=

y
∧


x

0
∧


x

1

/
(


x

2
∧


x

0
∧


x

1
)
{\displaystyle {\displaystyle {\begin{aligned}a=\mathbf {y} \land \mathbf {x} \_{1}\land \mathbf {x} \_{2}/(\mathbf {x} \_{0}\land \mathbf {x\_{1}} \land \mathbf {x\_{2}} )\\b=\mathbf {y} \land \mathbf {x} \_{2}\land \mathbf {x} \_{0}/(\mathbf {x} \_{1}\land \mathbf {x\_{2}} \land \mathbf {x\_{0}} )\\c=\mathbf {y} \land \mathbf {x} \_{0}\land \mathbf {x} \_{1}/(\mathbf {x} \_{2}\land \mathbf {x\_{0}} \land \mathbf {x\_{1}} )\\\end{aligned}}}}

```
use MultiVector;

constant @x1 = <0 1 2 3 4 5 6 7 8 9 10>;
constant @y = <1 6 17 34 57 86 121 162 209 262 321>;

constant $x0 = [+] @e[^@x1];
constant $x1 = [+] @x1 Z* @e;
constant $x2 = [+] @x1 »**» 2  Z* @e;

constant $y  = [+] @y Z* @e;

.say for
  $y∧$x1∧$x2/($x0∧$x1∧$x2),
  $y∧$x2∧$x0/($x1∧$x2∧$x0),
  $y∧$x0∧$x1/($x2∧$x0∧$x1);

```

Output:

```
1
2
3

```