oscillateur_harmonique.py

Created by teivaetienne

Created on January 28, 2026

2.85 KB


# METHODES TOMIC - NUMWORKS
# Lignes < 32 car. Sans accent.

def ed():
  print("--- EQUA DIFF 1ER ORDRE ---")
  print("Forme: a(x)y' + b(x)y = f(x)")
  print("")
  print("ETAPE 1: FORME CANONIQUE")
  print("! CRUCIAL: Isolr y' !")
  print("Divise tout par a(x)")
  print("-> y' + P(x)y = Q(x)")
  print("Ex: xy' - 2y = ...")
  print("Devient: y' - (2/x)y = ...")
  print("Ici P(x) = -2/x")
  input("EXE pour suite...")
  
  print("ETAPE 2: SOL HOMOGENE (yh)")
  print("yh = K * exp(-Primitive(P))")
  print("Ex: Prim(-2/x) = -2ln(x)")
  print("yh = K*exp(2ln(x)) = K*x^2")
  print("")
  print("ETAPE 3: SOL PARTICULIERE")
  print("Chercher forme du 2nd membre")
  print("Si Q(x)=Polynome -> yp=Poly")
  print("Si Q(x)=Cst -> yp=Cst")
  input("EXE pour suite...")

  print("Si superposition (somme):")
  print("yp = yp1 + yp2")
  print("Injecter yp ds eq DEPART")
  print("pour trouver les cst.")
  print("")
  print("SOLUTION GENERALE")
  print("y(x) = yh(x) + yp(x)")
  input("EXE pour menu...")

def osc():
  print("--- OSCILLATEURS (2ND) ---")
  print("Type: x'' + w0^2 * x = f(t)")
  print("Identifier w0 (pulsation)")
  print("Ex: x'' + 4x = ... -> w0=2")
  print("")
  print("ETAPE 1: SOL HOMOGENE (xh)")
  print("Eq Carac: r^2 + w0^2 = 0")
  print("Racines: r = +/- i*w0")
  print("xh = A*cos(w0*t)+B*sin(w0*t)")
  input("EXE pour suite...")

  print("ETAPE 2: SOL PARTICULIERE")
  print("Meme forme que f(t)")
  print("Si f(t)=Cst -> xp=Cst")
  print("Si f(t)=at -> xp=At+B")
  print("Injecter xp ds eq diff")
  print("pour trouver A et B")
  print("")
  print("ETAPE 3: CONDITIONS INIT")
  print("x(t) = xh(t) + xp(t)")
  print("Calculer la derivee x'(t)")
  print("Resoudre systeme avec:")
  print("x(0)=... et x'(0)=...")
  print("pour trouver A et B finaux")
  input("EXE pour menu...")

def inv():
  print("--- INTEGRALES MULTIPLES ---")
  print("Aire = Double Int (dx dy)")
  print("Vol = Triple Int (dx dy dz)")
  print("")
  print("COORD CYLINDRIQUES")
  print("x = r * cos(th)")
  print("y = r * sin(th)")
  print("z = z")
  print("! JACOBIEN J = r !")
  print("dV = r dr dth dz")
  input("EXE pour suite...")
  
  print("BORNES (Ex: Cylindre)")
  print("z va de 0 a H")
  print("th (angle) de 0 a 2pi")
  print("r (rayon) de 0 a R")
  print("")
  print("CALCUL PRATIQUE")
  print("1. Separer les integrales")
  print("si bornes constantes")
  print("Int(r dr) * Int(dth)...")
  print("2. Primitives usuelles")
  print("Prim(r) = r^2 / 2")
  print("Prim(cst) = cst * x")
  input("EXE pour menu...")

def menu():
  while True:
    print("")
    print("=== MENU REVISIONS ===")
    print("1. Equa Diff")
    print("2. Oscillateurs")
    print("3. Integrales")
    print("4. Quitter")
    print("======================")
    c = input("Choix (1-4): ")
    if c == "1": ed()
    elif c == "2": osc()
    elif c == "3": inv()
    elif c == "4": break

# Lancement auto
menu()

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.