# Spiegazione del programma Python
# funzione absolute()
import numpy as np
a = 4 + 3j print ( "Absolute (4 + 3j):" ,
np.absolute (a)) b = 16 + 13j
print ( "Valore assoluto (16 + 13j):" ,
np.absolute (b)) Uscita: Assoluto (4 + 3j): 5.0 Valore assoluto ( 16 + 13j): 20.6155281281 Codice n. 3: Rappresentazione grafica di numpy.absolute() # Spiegazione del programma Python
# Absolute() funzione import numpy as np
import matplotlib.pyplot as plt
a = np.linspace (inizia = - 5 , stop = 5 ,
num = 6 , endpoint = True )
print ( "Rappresentazione grafica:" ,
np.absolute< /a> (a))
plt.title ( "blue: with absolute rosso: senza assoluto " )
plt.plot (a, < a href="https://python.engineering/numpy-absolute-python/">np.absolute (a) )
plt.plot (a, a, color = `red` )
plt.show () Risultato: Rappresentazione grafica: [5. 3. 1. 1 . 3. 5.] Link: https: / /docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.absolute.html , |