teaching:progappchim:ph-3d

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
teaching:progappchim:ph-3d [2014/02/17 11:04] – créée villersdteaching: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://pubs.acs.org/doi/abs/10.1021/ed400297t|cet article]]  Cas d'un acide en fonction d'un ajout de base et d'une dilution globale : cf. [[http://pubs.acs.org/doi/abs/10.1021/ed400297t|cet article]] 
  
-<sxh python; title : pH-3D_topo-01.py>+<code python pH-3D_topo-01.py>
 #! /usr/bin/env python #! /usr/bin/env python
 # -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
Ligne 38: Ligne 38:
     p=np.array([-Ka*Kw,-Kw-Ka*(Ca*Va-Cb*Vb)/(Va+Vb),Ka+(Cb*Vb)/(Va+Vb),1])     p=np.array([-Ka*Kw,-Kw-Ka*(Ca*Va-Cb*Vb)/(Va+Vb),Ka+(Cb*Vb)/(Va+Vb),1])
     x=poly.polyroots(p)     x=poly.polyroots(p)
-    y = poly.polyval(x,p) 
     return float(-np.log10(x[np.where(abs(x-27.5)<27.5)]))  # only significant [H+] is returned     return float(-np.log10(x[np.where(abs(x-27.5)<27.5)]))  # only significant [H+] is returned
- 
  
 Ka=1.75E-5 # acid constant (acetic acid) Ka=1.75E-5 # acid constant (acetic acid)
Ligne 49: Ligne 47:
 Vb=0. # volume of added base Vb=0. # volume of added base
 log10dil=0 log10dil=0
-print pH_monoprotic_acid(log10dil,Vb) # sample call +print(pH_monoprotic_acid(log10dil,Vb)) # sample call 
 + 
 fig = plt.figure() fig = plt.figure()
 ax = Axes3D(fig) ax = Axes3D(fig)
 X,Y = np.linspace(-9.,0.,36),  np.linspace(0.,200.,21) X,Y = np.linspace(-9.,0.,36),  np.linspace(0.,200.,21)
-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, Y) Xc, Yc = np.meshgrid(X, Y)
 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 72: Ligne 70:
 ax.set_zlabel('pH') ax.set_zlabel('pH')
 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'article référencé dans Journal of Chemical Education : La figure obtenue avec la librairie 3D de MatPlotlib peut être manipulée (zoom, rotations). En voici une image correspondant à la figure de l'article référencé dans Journal of Chemical Education :
  
 {{:teaching:progappchim:ph_topographic-01.png|}} {{:teaching:progappchim:ph_topographic-01.png|}}
 +
 +====== Prolongements, références ======
 +  * [[http://pubs.acs.org/doi/abs/10.1021/acs.jchemed.6b00682|3-D Topo Surface Visualization of Acid–Base Species Distributions: Corner Buttes, Corner Pits, Curving Ridge Crests, and Dilution Plains]] Garon C. Smith and Md Mainul Hossain, J. Chem. Educ., 2017, 94 (5), pp 598–605 DOI: 10.1021/acs.jchemed.6b00682
 +
  • teaching/progappchim/ph-3d.1392631488.txt.gz
  • Dernière modification : 2014/02/17 11:04
  • de villersd