





'''simple docstring'''




from __future__ import annotations

import numpy as np
from numpy import floataa
from numpy.typing import NDArray





def 	__lowerCamelCase			(      __lowerCAmelCase       :							NDArray[floataa]      ,    __lowerCAmelCase       :							NDArray[floataa]      ,    __lowerCAmelCase       :							list[int]      ,    __lowerCAmelCase       :							int      ,    )		->  list[float]:
   snake_case						,    snake_case 						=   coefficient_matrix.shape
   snake_case						,    snake_case 						=   constant_matrix.shape

   if rowsa != colsa:
      snake_case 						=   F'''Coefficient matrix dimensions must be nxn but received {rowsa}x{colsa}'''
      raise ValueError(__lowerCAmelCase		)

   if colsa != 1:
      snake_case 						=   F'''Constant matrix must be nx1 but received {rowsa}x{colsa}'''
      raise ValueError(__lowerCAmelCase		)

   if rowsa != rowsa:
      snake_case 						=   (
          """Coefficient and constant matrices dimensions must be nxn and nx1 but """
          F'''received {rowsa}x{colsa} and {rowsa}x{colsa}'''
      )
      raise ValueError(__lowerCAmelCase		)

   if len(__lowerCAmelCase		) != rowsa:
      snake_case 						=   (
          """Number of initial values must be equal to number of rows in coefficient """
          F'''matrix but received {len(__lowerCAmelCase		)} and {rowsa}'''
      )
      raise ValueError(__lowerCAmelCase		)

   if iterations <= 0:
      raise ValueError("""Iterations must be at least 1"""		)

   snake_case 						=   np.concatenate(
       (coefficient_matrix, constant_matrix)      ,    axis=1		)

   snake_case						,    snake_case 						=   table.shape

   strictly_diagonally_dominant(__lowerCAmelCase		)

   # Iterates the whole matrix for given number of times
   for _ in range(__lowerCAmelCase		):
      snake_case 						=   []
      for row in range(__lowerCAmelCase		):
         snake_case 						=   0
         for col in range(__lowerCAmelCase		):
            if col == row:
               snake_case 						=   table[row][col]
            elif col == cols - 1:
               snake_case 						=   table[row][col]
            else:
               temp += (-1) * table[row][col] * init_val[col]
         snake_case 						=   (temp + val) / denom
         new_val.append(__lowerCAmelCase		)
      snake_case 						=   new_val

   return [float(__lowerCAmelCase		) for i in new_val]





def 	__lowerCamelCase			(      __lowerCAmelCase       :							NDArray[floataa]		)		->  bool:
   snake_case						,    snake_case 						=   table.shape

   snake_case 						=   True

   for i in range(0      ,    __lowerCAmelCase		):
      snake_case 						=   0
      for j in range(0      ,    cols - 1		):
         if i == j:
            continue
         else:
            total += table[i][j]

      if table[i][i] <= total:
         raise ValueError("""Coefficient matrix is not strictly diagonally dominant"""		)

   return is_diagonally_dominant


# Test Cases
if __name__ == "__main__":
 import doctest

 doctest.testmod()








'''simple docstring'''




def 	__lowerCamelCase			(      __lowerCAmelCase       :							int		)		->  int:
   assert isinstance(__lowerCAmelCase      ,    __lowerCAmelCase		), F'''The input value of [n={number}] is not an integer'''

   if number == 1:
      return 2
   elif number < 1:
      snake_case 						=   F'''The input value of [n={number}] has to be > 0'''
      raise ValueError(__lowerCAmelCase		)
   else:
      snake_case 						=   sylvester(number - 1		)
      snake_case 						=   num - 1
      snake_case 						=   num
      return lower * upper + 1


if __name__ == "__main__":
 print(F"""The 8th number in Sylvester's sequence: {sylvester(8)}""")

