# Load the required package and data
library(readr)
data <- read_csv("trial 1 diprotic.csv")
## Rows: 94 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): volume, pH
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Extract volume and pH data for plotting
VolVect <- data$volume
VolVect
## [1] 0.000 0.005 0.010 0.023 0.054 0.132 0.328 0.528 0.728 0.928
## [11] 1.128 1.328 1.528 1.728 1.928 2.128 2.328 2.528 2.728 2.928
## [21] 3.129 3.329 3.529 3.729 3.929 4.129 4.329 4.529 4.729 4.929
## [31] 5.129 5.329 5.529 5.729 5.929 6.129 6.329 6.529 6.729 6.929
## [41] 7.129 7.329 7.529 7.729 7.929 8.129 8.329 8.529 8.729 8.929
## [51] 9.129 9.329 9.529 9.730 9.930 10.130 10.330 10.530 10.730 10.930
## [61] 11.130 11.330 11.530 11.730 11.930 12.130 12.330 12.530 12.730 12.930
## [71] 13.130 13.330 13.530 13.730 13.930 14.130 14.330 14.530 14.730 14.930
## [81] 15.130 15.330 15.530 15.730 15.930 16.130 16.330 16.531 16.731 16.931
## [91] 17.074 17.194 17.359 17.484
pHVect <- data$pH
pHVect
## [1] 2.11 2.11 2.10 2.10 2.10 2.11 2.12 2.15 2.18 2.21 2.24 2.27 2.30 2.33 2.37
## [16] 2.40 2.43 2.46 2.50 2.53 2.57 2.60 2.64 2.67 2.71 2.75 2.79 2.83 2.87 2.91
## [31] 2.95 3.00 3.04 3.10 3.15 3.21 3.26 3.33 3.41 3.49 3.57 3.67 3.78 3.90 4.03
## [46] 4.16 4.29 4.41 4.51 4.61 4.69 4.77 4.84 4.90 4.96 5.02 5.07 5.13 5.18 5.22
## [61] 5.26 5.31 5.35 5.40 5.44 5.48 5.52 5.57 5.61 5.65 5.70 5.74 5.79 5.83 5.88
## [76] 5.93 5.97 6.03 6.09 6.15 6.21 6.27 6.34 6.42 6.51 6.60 6.71 6.84 6.99 7.21
## [91] 7.40 7.54 7.76 8.12
# Plot the Titration Curve
plot(VolVect, pHVect, xlab = 'Volume (mL)', ylab = 'pH', main = 'Titration Curve')
# Convert pH values to H+ concentration
H <- 10^-(pHVect)
H
## [1] 7.762471e-03 7.762471e-03 7.943282e-03 7.943282e-03 7.943282e-03
## [6] 7.762471e-03 7.585776e-03 7.079458e-03 6.606934e-03 6.165950e-03
## [11] 5.754399e-03 5.370318e-03 5.011872e-03 4.677351e-03 4.265795e-03
## [16] 3.981072e-03 3.715352e-03 3.467369e-03 3.162278e-03 2.951209e-03
## [21] 2.691535e-03 2.511886e-03 2.290868e-03 2.137962e-03 1.949845e-03
## [26] 1.778279e-03 1.621810e-03 1.479108e-03 1.348963e-03 1.230269e-03
## [31] 1.122018e-03 1.000000e-03 9.120108e-04 7.943282e-04 7.079458e-04
## [36] 6.165950e-04 5.495409e-04 4.677351e-04 3.890451e-04 3.235937e-04
## [41] 2.691535e-04 2.137962e-04 1.659587e-04 1.258925e-04 9.332543e-05
## [46] 6.918310e-05 5.128614e-05 3.890451e-05 3.090295e-05 2.454709e-05
## [51] 2.041738e-05 1.698244e-05 1.445440e-05 1.258925e-05 1.096478e-05
## [56] 9.549926e-06 8.511380e-06 7.413102e-06 6.606934e-06 6.025596e-06
## [61] 5.495409e-06 4.897788e-06 4.466836e-06 3.981072e-06 3.630781e-06
## [66] 3.311311e-06 3.019952e-06 2.691535e-06 2.454709e-06 2.238721e-06
## [71] 1.995262e-06 1.819701e-06 1.621810e-06 1.479108e-06 1.318257e-06
## [76] 1.174898e-06 1.071519e-06 9.332543e-07 8.128305e-07 7.079458e-07
## [81] 6.165950e-07 5.370318e-07 4.570882e-07 3.801894e-07 3.090295e-07
## [86] 2.511886e-07 1.949845e-07 1.445440e-07 1.023293e-07 6.165950e-08
## [91] 3.981072e-08 2.884032e-08 1.737801e-08 7.585776e-09
# Define experiment parameters
VE <- 8.56
VI <- 25
BC <- 0.1
# Calculate the Fraction Bound (F)
F <- (2 - ((VolVect * BC) + (H) * (VI + VolVect)) / (VE * BC))
tF <- F
# Plot Fraction Bound vs pH
plot(pHVect, tF, xlab = 'pH', ylab = 'Fraction Bound', main = "Fraction Bound vs pH")
# Load the nls2 library for curve fitting
library(nls2)
## Loading required package: proto
fitline <- nls2(tF ~ (H / KD1 + 2 * H^2 / (KD1 * KD2)) / (1 + H / KD1 + H^2 / (KD1 * KD2)),
start = list(KD1 = 0.0001, KD2 = 0.01))
# Output the summary of the fitting model
summary(fitline)
##
## Formula: tF ~ (H/KD1 + 2 * H^2/(KD1 * KD2))/(1 + H/KD1 + H^2/(KD1 * KD2))
##
## Parameters:
## Estimate Std. Error t value Pr(>|t|)
## KD1 2.228e-06 4.937e-08 45.14 <2e-16 ***
## KD2 2.165e-03 4.314e-05 50.18 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.02642 on 92 degrees of freedom
##
## Number of iterations to convergence: 8
## Achieved convergence tolerance: 1.823e-06
# Add the fitted line to the plot
lines(pHVect, predict(fitline), col = "blue")
This experiment investigated the titration of a diprotic acid, focusing on determining its dissociation constants, Ka1 and Ka2, using nonlinear least squares (nls) analysis. The titration involved adding a strong base to the diprotic acid and measuring pH changes at various stages. The data was fit to a theoretical model to estimate the dissociation constants, with nls regression providing best-fit values for Ka1 and Ka2, characterizing the acid’s dissociation.
A diprotic acid dissociates in two stages, donating two protons, each with its dissociation constant, Ka1 and Ka2, indicating the acid’s strength at each stage. Determining these constants is essential for understanding solution behavior, buffering capacity, and pH change during titration. Nonlinear regression was used for precise estimation, enabling the fitting of observed data to the dissociation equilibria model, thus yielding accurate Ka1 and Ka2 values.
Ka1 = \(2.24 * 10^-4\) Ka2 = \(2.88 * 10^-8\)
Ka1 = \(2.23 * 10^-6\) Ka2= \(2.17 * 10^-3\)
Using Excel for autotitration, we found Ka1 = \(2.24 \times 10^{-4}\) and Ka2 = \(2.88 \times 10^{-8}\). In R, we found Ka1 = \(2.23 \times 10^{-6}\) and Ka2 = \(2.17 \times 10^{-3}\). This suggests different methods may yield varying Ka values.
To analyze dissociation constants, we transformed titration data to a binding curve by calculating the fraction bound at each pH. This approach models the extent of proton donation for a diprotic acid molecule, using:
Fraction Bound Equation for Diprotic Acid: \(Diprotic~ Fration~ Bound~ =~ 2~ - \frac{(BC~ *~ Vadd)~ +~ [H^+](Vi~ +~ Vadd)}{(BC~ *~ Ve)}\)
The nls function fit this model to experimental data, minimizing residuals to estimate Ka1 and Ka2.
Through titration and nls analysis, we determined the dissociation constants Ka1 and Ka2 for the diprotic acid. The fitted values reveal the acid’s dissociation behavior in solution. These constants align with expected proton dissociations, reflecting the acid’s strength at each stage. The nls method effectively estimates these values, proving useful in titration analysis.