'''simple docstring'''




from __future__ import annotations

_a   :	Optional[Any] 							=   8.9_88e9  # units = N * m^s * C^-2

def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__						)					->       dict[str, float]:





       """simple docstring"""


       __UpperCAmelCase  :				Optional[int]       				=		abs(chargea * chargea						)

       if (force, chargea, chargea, distance).count(0						) != 1:
              raise ValueError("One and only one argument must be 0"						)
       if distance < 0:
              raise ValueError("Distance cannot be negative"						)
       if force == 0:
              __UpperCAmelCase  :				Any       				=		COULOMBS_CONSTANT * charge_product / (distance**2)
              return {"force": force}
       elif chargea == 0:
              __UpperCAmelCase  :				List[str]       				=		abs(lowerCamelCase__						) * (distance**2) / (COULOMBS_CONSTANT * chargea)
              return {"charge1": chargea}
       elif chargea == 0:
              __UpperCAmelCase  :				str       				=		abs(lowerCamelCase__						) * (distance**2) / (COULOMBS_CONSTANT * chargea)
              return {"charge2": chargea}
       elif distance == 0:
              __UpperCAmelCase  :				Union[str, Any]       				=		(COULOMBS_CONSTANT * charge_product / abs(lowerCamelCase__						)) ** 0.5
              return {"distance": distance}
       raise ValueError("Exactly one argument must be 0"						)


if __name__ == "__main__":
   import doctest

   doctest.testmod()







'''simple docstring'''




from __future__ import annotations

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

def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__							,    )					->       list[float]:





       """simple docstring"""


       __UpperCAmelCase				, __UpperCAmelCase  :				Union[str, Any]       				=		coefficient_matrix.shape
       __UpperCAmelCase				, __UpperCAmelCase  :				Any       				=		constant_matrix.shape

       if rowsa != colsa:
              __UpperCAmelCase  :				str       				=		f"""Coefficient matrix dimensions must be nxn but received {rowsa}x{colsa}"""
              raise ValueError(lowerCamelCase__						)

       if colsa != 1:
              __UpperCAmelCase  :				Optional[Any]       				=		f"""Constant matrix must be nx1 but received {rowsa}x{colsa}"""
              raise ValueError(lowerCamelCase__						)

       if rowsa != rowsa:
              __UpperCAmelCase  :				Optional[int]       				=		(
                  "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:
              __UpperCAmelCase  :				List[str]       				=		(
                  "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"						)

       __UpperCAmelCase  :				NDArray[floataa]       				=		np.concatenate(
           (coefficient_matrix, constant_matrix)							,    axis=1						)

       __UpperCAmelCase				, __UpperCAmelCase  :				Tuple       				=		table.shape

       strictly_diagonally_dominant(lowerCamelCase__						)

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

       return [float(lowerCamelCase__						) for i in new_val]

def _lowercase	(      lowerCamelCase__						)					->       bool:





       """simple docstring"""


       __UpperCAmelCase				, __UpperCAmelCase  :				Optional[int]       				=		table.shape

       __UpperCAmelCase  :				str       				=		True

       for i in range(0							,    lowerCamelCase__						):
              __UpperCAmelCase  :				Union[str, Any]       				=		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()






