hbhb.py

Created by mael-bergerac

Created on April 11, 2025

2.3 KB



def puissance(a, n):
    """Calcul de a puissance n (a^n)"""
    resultat = 1
    for _ in range(n):
        resultat *= a
    return resultat

print("Résultat de 2^5 :", puissance(2, 5))

# ----------------------------
# Fiche récapitulative Analyse Numérique (AN)
# ----------------------------

# ----------------------------
# Méthodes de résolution d'équations :
# ----------------------------

# Méthode de Newton (n=1) :
# x_(k+1) = x_k - g(x_k) / g'(x_k)

# Méthode de la Sécante :
# x_(k+1) = x_k - ((x_k - x_(k-1)) / (g(x_k) - g(x_(k-1)))) * g(x_k)

# Méthode de Newton en dimension 2 :
# X_(k+1) = X_k - J(X_k)^(-1) * g(X_k)
# (En pratique : résoudre le système linéaire J(X_k) * (X_(k+1) - X_k) = -g(X_k))

# ----------------------------
# Méthodes d'intégration numérique :
# ----------------------------

# Méthode des rectangles :
# I ≈ h * g(a)
# Erreur : |E| ≤ h2 / 2 * sup(|g'|)

# Méthode du point milieu :
# I ≈ h * g((a+b)/2)
# Erreur : |E| ≤ h3 / 24 * sup(|g''|)

# Méthode du trapèze :
# I ≈ h * (g(a) + g(b)) / 2
# Erreur : |E| ≤ h3 / 12 * sup(|g''|)

# Méthode de Simpson :
# I ≈ (b-a) / 6 * (g0 + 4g1 + g2)
# Erreur : |E| ≤ h5 / 90 * sup(|g4|)

# Méthode de Simpson (p=3) :
# I ≈ (b-a) / 8 * (g0 + 3g1 + 3g2 + g3)
# Erreur : |E| ≤ 3h5 / 80 * sup(|g4|)

# ----------------------------
# Méthodes itératives pour les systèmes linéaires :
# ----------------------------

# Décomposition A = D - U - L :
# D : matrice diagonale
# U : matrice triangulaire supérieure
# L : matrice triangulaire inférieure

# Méthode de Jacobi :
# D X_(k+1) = (L + U) X_k + B

# Méthode de Gauss-Seidel :
# (D + L) X_(k+1) = -U X_k + B

# Condition : Matrice A strictement diagonale dominante

# Méthode LU :
# A = L U
# Résolution :
# 1) L Y = B
# 2) U X = Y
# (Condition : A diagonale strictement dominante ou sous-matrices inversibles)

# Méthode SOR (Sur-relaxation) :
# ((1/ω) D + L) X_(k+1) = ((1-ω)/ω D - U) X_k + B

# Méthode de Cholesky :
# A symétrique définie positive

# ----------------------------
# Normes et conditionnement :
# ----------------------------

# Norme 1 : somme max des valeurs absolues par colonne
# Norme infinie : somme max des valeurs absolues par ligne

# Conditionnement :
# k(A) = ||A|| * ||A−1||

# Erreur relative :
# ||S X|| / ||X|| ≤ k(A) * (||S B|| / ||B||)

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.