Пример #1
0
    def test_prod_escalar(self):

        # dados de entrada
        nv1 = [0.719815751, 0.575852601, 0.14396315, 0.359907875]
        nv2 = [0.733235575, 0.513264902, 0.073323557, 0.439941345]
        nv3 = [0, 0.235702261, 0.942809042, 0.235702261]

        self.assertAlmostEqual(0.99225369, algebra.prod_escalar(nv1, nv2), 5)
        self.assertAlmostEqual(0.356290619, algebra.prod_escalar(nv1, nv3), 5)
        self.assertAlmostEqual(0.29380298, algebra.prod_escalar(nv2, nv3), 5)
Пример #2
0
  def test_prod_escalar(self):

    # Input:
    nv1 = [0.719815751, 0.575852601, 0.14396315, 0.359907875]
    nv2 = [0.733235575, 0.513264902, 0.073323557, 0.439941345]
    nv3 = [0, 0.235702261, 0.942809042, 0.235702261]
  
    self.assertAlmostEqual(0.99225369 , algebra.prod_escalar(nv1,nv2), 5)
    self.assertAlmostEqual(0.356290619 , algebra.prod_escalar(nv1,nv3), 5)
    self.assertAlmostEqual(0.29380298 , algebra.prod_escalar(nv2,nv3), 5)
Пример #3
0
def semelhanca_vetores(vetor1, vetor2):
  nv1 = algebra.normaliza(vetor1)
  nv2 = algebra.normaliza(vetor2)
  return algebra.prod_escalar(nv1, nv2)
Пример #4
0
def semelhanca_vetores(vetor1, vetor2):
    nv1 = algebra.normaliza(vetor1)
    nv2 = algebra.normaliza(vetor2)
    return algebra.prod_escalar(nv1, nv2)