Bonjour

Je souhaite afficher des données de type flottante et des entier dans un tableau.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
 
import numpy as np
 
L = 183
Ct = 3.0 * (10**(-4))
OM = 0.05
k2 =np.array([7, 6, 5, 4, 3, 2])
x = np.array([12, 12.6, 14.2, 16.2, 19.8, 32.1])-10
 
theta = [x /2*L]
 
r1 = 3 * np.ones(6)
r2 = k2 + 3
r = r2 - r1
F = (x*Ct)/(OM*2*L)
f = 0
 
 
print("F", F)
 
tableau = [k2, r2, x, theta, r1, r, f, F]
 
for i in range(len(tableau)):
    for j in range((tableau[i])):
        print(tableau[i][j])
voici l'erreur

for j in range((tableau[i])):
TypeError: only integer scalar arrays can be converted to a scalar index.

Si j'ai bien traduit, le problème est que les tableaux n'affichent que les données de type entiers.

Comment faire pour afficher un tableau avec nombre avec des virgules ?

A bientôt