@@ -3,30 +3,30 @@ def points_to_polynomial(coordinates: list[list[int]]) -> str:
3
3
coordinates is a two dimensional matrix: [[x, y], [x, y], ...]
4
4
number of points you want to use
5
5
6
- >>> print( points_to_polynomial([]) )
6
+ >>> points_to_polynomial([])
7
7
Traceback (most recent call last):
8
8
...
9
9
ValueError: The program cannot work out a fitting polynomial.
10
- >>> print( points_to_polynomial([[]]) )
10
+ >>> points_to_polynomial([[]])
11
11
Traceback (most recent call last):
12
12
...
13
13
ValueError: The program cannot work out a fitting polynomial.
14
- >>> print( points_to_polynomial([[1, 0], [2, 0], [3, 0]]) )
15
- f(x)=x^2*0.0+x^1*-0.0+x^0*0.0
16
- >>> print( points_to_polynomial([[1, 1], [2, 1], [3, 1]]) )
17
- f(x)=x^2*0.0+x^1*-0.0+x^0*1.0
18
- >>> print( points_to_polynomial([[1, 3], [2, 3], [3, 3]]) )
19
- f(x)=x^2*0.0+x^1*-0.0+x^0*3.0
20
- >>> print( points_to_polynomial([[1, 1], [2, 2], [3, 3]]) )
21
- f(x)=x^2*0.0+x^1*1.0+x^0*0.0
22
- >>> print( points_to_polynomial([[1, 1], [2, 4], [3, 9]]) )
23
- f(x)=x^2*1.0+x^1*-0.0+x^0*0.0
24
- >>> print( points_to_polynomial([[1, 3], [2, 6], [3, 11]]) )
25
- f(x)=x^2*1.0+x^1*-0.0+x^0*2.0
26
- >>> print( points_to_polynomial([[1, -3], [2, -6], [3, -11]]) )
27
- f(x)=x^2*-1.0+x^1*-0.0+x^0*-2.0
28
- >>> print( points_to_polynomial([[1, 5], [2, 2], [3, 9]]) )
29
- f(x)=x^2*5.0+x^1*-18.0+x^0*18.0
14
+ >>> points_to_polynomial([[1, 0], [2, 0], [3, 0]])
15
+ ' f(x)=x^2*0.0+x^1*-0.0+x^0*0.0'
16
+ >>> points_to_polynomial([[1, 1], [2, 1], [3, 1]])
17
+ ' f(x)=x^2*0.0+x^1*-0.0+x^0*1.0'
18
+ >>> points_to_polynomial([[1, 3], [2, 3], [3, 3]])
19
+ ' f(x)=x^2*0.0+x^1*-0.0+x^0*3.0'
20
+ >>> points_to_polynomial([[1, 1], [2, 2], [3, 3]])
21
+ ' f(x)=x^2*0.0+x^1*1.0+x^0*0.0'
22
+ >>> points_to_polynomial([[1, 1], [2, 4], [3, 9]])
23
+ ' f(x)=x^2*1.0+x^1*-0.0+x^0*0.0'
24
+ >>> points_to_polynomial([[1, 3], [2, 6], [3, 11]])
25
+ ' f(x)=x^2*1.0+x^1*-0.0+x^0*2.0'
26
+ >>> points_to_polynomial([[1, -3], [2, -6], [3, -11]])
27
+ ' f(x)=x^2*-1.0+x^1*-0.0+x^0*-2.0'
28
+ >>> points_to_polynomial([[1, 5], [2, 2], [3, 9]])
29
+ ' f(x)=x^2*5.0+x^1*-18.0+x^0*18.0'
30
30
>>> points_to_polynomial([[1, 1], [1, 2], [1, 3]])
31
31
'x=1'
32
32
>>> points_to_polynomial([[1, 1], [2, 2], [2, 2]])
0 commit comments