vetores.py

Created by numworks-pt

Created on March 10, 2020

152 Bytes

O script contém duas funções relativas ao cálculo de vetores. A função coordinates(x_A,y_A,x_B,y_B) devolve as coordenadas do vetor AB com A(x_A,y_A) e B(x_B,y_B). A função collinear(x_1,y_1,x_2,y_2) devolve True se os vetores u(x_1,y_1) e v(x_2,y_2) forem colineares e False se não forem.


from math import *
def coordinates(x_A,y_A,x_B,y_B):
  return x_B-x_A,y_B-y_A
def collinear(x_1,y_1,x_2,y_2):
  return x_1*y_2-x_2*y_1==0

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.