# programme Python expliqué
# fonction absolue ()
importer numpy as np
a = 4 + 3j
print ( "Absolu (4 + 3j):" ,
np.absolute (a)) b = 16 + 13j
print ( "Valeur absolue (16 + 13j) :" ,
np.absolute (b)) Sortie : Absolue (4 + 3j) : 5,0 Valeur absolue ( 16 + 13j) : 20,6155281281 Code # 3 : Représentation graphique de numpy.absolute() # Programme Python expliquant
# fonction absolue () import numpy as np
import matplotlib.pyplot as plt
un = np.linspace (start = - 5 , arrêtez = 5 ,
num = 6 , point de terminaison = Vrai )
print ( "Représentation graphique :" ,
np.absolute< /a> (a))
plt.title ( "bleu : avec absolu rouge : sans absolu " )
plt.plot (a, < a href="https://python.engineering/numpy-absolute-python/">np.absolute (a) )
plt.plot (a, a, color = `red` )
plt.show () Sortie : Représentation graphique : [5. 3. 1. 1 . 3. 5.] Liens : https : / /docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.absolute.html , |