[LON-CAPA-users] Titration problem--extracting limited data from an array

Robley Light lon-capa-users@mail.lon-capa.org
Thu, 24 May 2007 10:02:02 -0400

I'm hoping someone can suggest a better way to handle this, either by coding
or by a mathmatical manipulation.
Is this something that maxima could do?

I found the code for plotting titration curves at Tom O'Havers' web site:
monoprotic acid: http://www.wam.umd.edu/~toh/models/TitrationDemo.html
triprotic acid: http://www.wam.umd.edu/~toh/models/Titration.html

So this is easy to code for gnuplot.  For example, in the problem

I generate the arrays to be plotted as follows:

<script type="loncapa/perl">

for ($pH=0; $pH<=12.99; $pH+=0.33){
    push @pH, $pH;
  $Hconc = 10**-$pH;
    push @Hconc, $Hconc;
  $VolB =
    push @VolB, $VolB;

As O'Haver points out, this is an "inverse" solution, where [H+] is the
independent variable and the volume of base is the dependent variable, even
though one is plotting the other way.

This array gives a set of values in @pH and @VolB that vary in regular
increments of $pH (of 0.33 units), which is okay for plotting purposes. (I
could make the increments as small as I like).

What I would like to do for a different prelab problem is to generate array
data that is in regular increments of $VolB (say 0.05 mL), or roughly if not
exactly regular increments,--which is more like data one is likely to
generate in a lab titration. I want to present these array values in a table
rather than in a plot.

Short of solving the equation specifically for [H+] as a function of VolB
(probably possible in this case, very complicated in the di- and tri-protic
acid cases), is there a way to extract such data from the arrays generated
by the above code?  My Perl knowledge is relatively limited.


Robley J. Light                  Professor Emeritus of Chemistry and
Department of Chemistry          Phone:   (850) 644-3844
   and Biochemistry              Email:  rlight@chem.fsu.edu  
Florida State University         Fax:      (850) 644-8281
Tallahassee, FL 32306-4390    Home Page:

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.