_2nde_vecteurs.py

Created by jeromemunier

Created on February 28, 2021

696 Bytes

Script contenant les fonctions de bases sur les vecteurs (niveau 2nde)


#Calcul les coordonnées du vecteur AB
def vecteur(xa,ya,xb,yb):
  return(xb-xa,yb-ya)

#test de colinearité des vecteurs u et v
def colineaires1(xu,yu,xv,yv):
  d=xu*yv-xv*yu
  if d==0:
    return(True)
  else:
    return(False)

#test de colinéarité amélioré    
def colineaires(xu,yu,xv,yv):
  return(xu*yv-xv*yu==0)
 
#test de parallélisme de 2 droites 
def paralleles(xa,ya,xb,yb,xc,yc,xd,yd):
  xab,yab=vecteur(xa,ya,xb,yb)
  xcd,ycd=vecteur(xc,yc,xd,yd)
  return(colineaires(xab,yab,xcd,ycd))
  
#test d'alignement de 3 points  
def alignes(xa,ya,xb,yb,xc,yc):
  xab,yab=vecteur(xa,ya,xb,yb)
  xca,yca=vecteur(xc,yc,xa,ya)
  return(colineaires(xab,yab,xca,yca))

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.