Go through the number of iterations determined by the argument "steps". Be careful with high values (above 5) since the time to calculate increases exponentially. >>> iterate([np.array([0, 0]), np.array([1, 0])], 1) [array([0, 0]), array([0.33333333, 0. ]), array([0.5
(initial_vectors: list[np.ndarray], steps: int)
| 36 | |
| 37 | |
| 38 | def iterate(initial_vectors: list[np.ndarray], steps: int) -> list[np.ndarray]: |
| 39 | """ |
| 40 | Go through the number of iterations determined by the argument "steps". |
| 41 | Be careful with high values (above 5) since the time to calculate increases |
| 42 | exponentially. |
| 43 | >>> iterate([np.array([0, 0]), np.array([1, 0])], 1) |
| 44 | [array([0, 0]), array([0.33333333, 0. ]), array([0.5 , \ |
| 45 | 0.28867513]), array([0.66666667, 0. ]), array([1, 0])] |
| 46 | """ |
| 47 | vectors = initial_vectors |
| 48 | for _ in range(steps): |
| 49 | vectors = iteration_step(vectors) |
| 50 | return vectors |
| 51 | |
| 52 | |
| 53 | def iteration_step(vectors: list[np.ndarray]) -> list[np.ndarray]: |
no test coverage detected