trouver.py

Created by gregoirehulin06

Created on December 14, 2023

1.29 KB


#Ce script est conçu pour calculer et décrire un plan dans l'espace 
#tridimensionnel. Lorsque vous fournissez les coefficients a, b, et c de 
#l'équation générale d'un plan, qui est ax + by + cz + d = 0, ainsi que 
#les coordonnées d'un point (x, y, z) situé sur ce plan, le script détermine 
#la valeur de d. Après avoir trouvé d, il fournit une description du plan, 
#y compris l'équation complète du plan avec la valeur calculée de d et le 
#vecteur normal du plan basé sur les coefficients a, b, et c.

def description_plan(a, b, c, x, y, z):
    d = -(a*x + b*y + c*z)
    description = "Plan : {}x + {}y + {}z + {} = 0\n".format(a, b, c, d)
    description += "Point ({}, {}, {}) sur le plan.\n".format(x, y, z)
    description += "Vecteur normal du plan : ({}, {}, {})".format(a, b, c)
    return description

continuer = 'o'
while continuer.lower() == 'o':
    print("\nSaisissez les coefficients du plan (a, b, c) :")
    a, b, c = [float(input(f"{coef} = ")) for coef in ["a", "b", "c"]]
    
    print("\nSaisissez les coordonnées d'un point (x, y, z) sur le plan :")
    x, y, z = [float(input(f"{coord} = ")) for coord in ["x", "y", "z"]]
    
    print(description_plan(a, b, c, x, y, z))
    
    continuer = input("\nCalculer pour un autre plan ? (o/n) : ")

print("Fin.")

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.