IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Voir le flux RSS

Messages des blogs récents

  1. Python. Intégrale d'une fonction par trois méthodes classiques

    par , 01/12/2019 à 09h20
    Code Python : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    from termcolor import cprint
    from typing import List, Callable
    import numpy as np
    from scipy.integrate import simps
     
     
    def rectangles(f: Callable, a: int, b: int, n: int) -> float:
        """Intégrale d'une fonction par la méthode des rectangles"""
        S = 0
        for i in range(0, n):
            Xi = a + (b - a) * i/float(n)
            Xj = a + (b - a) * (i + 1)/float(n)
            S += f((Xi +
    ...