Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
teaching:progappchim:ph-3d [2014/02/17 11:16] – villersd | teaching:progappchim:ph-3d [2021/02/16 09:27] (Version actuelle) – villersd | ||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
Cas d'un acide en fonction d'un ajout de base et d'une dilution globale : cf. [[http:// | Cas d'un acide en fonction d'un ajout de base et d'une dilution globale : cf. [[http:// | ||
- | <sxh python; title : pH-3D_topo-01.py> | + | <code python pH-3D_topo-01.py> |
#! / | #! / | ||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||
Ligne 47: | Ligne 47: | ||
Vb=0. # volume of added base | Vb=0. # volume of added base | ||
log10dil=0 | log10dil=0 | ||
- | print pH_monoprotic_acid(log10dil, | + | print(pH_monoprotic_acid(log10dil, |
+ | |||
fig = plt.figure() | fig = plt.figure() | ||
ax = Axes3D(fig) | ax = Axes3D(fig) | ||
X,Y = np.linspace(-9., | X,Y = np.linspace(-9., | ||
- | print type(X), X.ndim, X.shape, X.dtype | + | print(type(X), X.ndim, X.shape, X.dtype) |
- | print type(Y), Y.ndim, Y.shape, Y.dtype | + | print(type(Y), Y.ndim, Y.shape, Y.dtype) |
Xc, Yc = np.meshgrid(X, | Xc, Yc = np.meshgrid(X, | ||
Z = Xc+Yc # just to create Z | Z = Xc+Yc # just to create Z | ||
- | print type(Xc), Xc.ndim, Xc.shape, Xc.dtype | + | print(type(Xc), Xc.ndim, Xc.shape, Xc.dtype) |
- | print type(Yc), Yc.ndim, Yc.shape, Yc.dtype | + | print(type(Yc), Yc.ndim, Yc.shape, Yc.dtype) |
- | print type(Z), Z.ndim, Z.shape, Z.dtype | + | print(type(Z), Z.ndim, Z.shape, Z.dtype) |
- | print range(len(X)) | + | print(range(len(X))) |
for ix in range(len(X)): | for ix in range(len(X)): | ||
for iy in range(len(Y)): | for iy in range(len(Y)): | ||
Ligne 70: | Ligne 70: | ||
ax.set_zlabel(' | ax.set_zlabel(' | ||
plt.show() | plt.show() | ||
- | </sxh> | + | </code> |
La figure obtenue avec la librairie 3D de MatPlotlib peut être manipulée (zoom, rotations). En voici une image correspondant à la figure de l' | La figure obtenue avec la librairie 3D de MatPlotlib peut être manipulée (zoom, rotations). En voici une image correspondant à la figure de l' | ||
{{: | {{: | ||
+ | |||
+ | ====== Prolongements, | ||
+ | * [[http:// | ||
+ |