vettori.py

Created by numworks-italia

Created on April 10, 2020

152 Bytes

Lo script contiene due funzioni concernenti il calcolo sui vettori. La funzione coordinates(x_A,y_A,x_B,y_B) restituisce le coordinate del vettore AB con A(x_A,y_A) e B(x_B,y_B). La funzione collinear(x_1,y_1,x_2,y_2) restituisce True se i vettori u(x_1,y_1) e v(x_2,y_2) sono collineari e False se non lo sono.


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.