tp10_2de.py

Created by jean-luc-poncin

Created on December 18, 2021

332 Bytes


from math import *

# Exercice 10.2, question 3

def f(x):
  return(-49*x**2+532*x-400)

def max():
  a=5
  b=5.1
  while(f(a)<f(b)):
    a=a+0.1
    b=b+0.1
  return([a-0.1,a+0.1])
  
# Exercice 10.2, question 4
  
def max2():
  a=5.3
  b=5.31
  while(f(a)<f(b)):
    a=a+0.01
    b=b+0.01
  return([a-0.01,a+0.01])