1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
import csv
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import quad
energie = [] #creation des listes
angle = []
section = []
Pcum = []
stockage = []
fichier = csv.reader(open("donnees-energie5.csv","r"))
fichier2 = open("stockage2.txt","a")
for row in fichier: #transferts des donnees dans les listes
energie.append(row[0])
angle.append(row[1])
section.append(row[2])
plt.plot(angle,section)
i = 0
C = 0
angle = [float(x) for x in angle] #transformation en reels
section = [float(y) for y in section]
def fonction(x,y): #fonction a integrer
return np.sin(x)*y
x = angle[i]
y = section [i]
while C<10: #integration pour toutes les valeurs
I = quad(fonction,0,angle[i],args=(y))
stockage.insert(i,I)
C = C+1
i = i+1
Pcum[i] = stockage[i]*2*np.pi |
Partager