maths.matrix_exponentiation

Matrix Exponentiation

Classes

Matrix

Functions

fibonacci_with_matrix_exponentiation(→ int)

Returns the nth number of the Fibonacci sequence that

main(→ None)

matrix_exponentiation_time(→ float)

modular_exponentiation(→ Matrix)

simple_fibonacci(→ int)

Returns the nth number of the Fibonacci sequence that

simple_fibonacci_time(→ float)

Module Contents

class maths.matrix_exponentiation.Matrix(arg: list[list] | int)
__mul__(b: Matrix) Matrix
maths.matrix_exponentiation.fibonacci_with_matrix_exponentiation(n: int, f1: int, f2: int) int

Returns the nth number of the Fibonacci sequence that starts with f1 and f2 Uses the matrix exponentiation >>> fibonacci_with_matrix_exponentiation(1, 5, 6) 5 >>> fibonacci_with_matrix_exponentiation(2, 10, 11) 11 >>> fibonacci_with_matrix_exponentiation(13, 0, 1) 144 >>> fibonacci_with_matrix_exponentiation(10, 5, 9) 411 >>> fibonacci_with_matrix_exponentiation(9, 2, 3) 89

maths.matrix_exponentiation.main() None
maths.matrix_exponentiation.matrix_exponentiation_time() float
maths.matrix_exponentiation.modular_exponentiation(a: Matrix, b: int) Matrix
maths.matrix_exponentiation.simple_fibonacci(n: int, f1: int, f2: int) int

Returns the nth number of the Fibonacci sequence that starts with f1 and f2 Uses the definition >>> simple_fibonacci(1, 5, 6) 5 >>> simple_fibonacci(2, 10, 11) 11 >>> simple_fibonacci(13, 0, 1) 144 >>> simple_fibonacci(10, 5, 9) 411 >>> simple_fibonacci(9, 2, 3) 89

maths.matrix_exponentiation.simple_fibonacci_time() float