Skip to content

Solutions (polykin.stepgrowth)¤

Overview¤

Equation Case \(M_n\) \(M_w\) \(M_z\)
Case_1 \(A_2 + B_2\)
Case_3 \(A_2 + BB'\)
Case_5 \(A_2 + B_2 + B'\)
Case_6 \(A_2 + A'B\)
Case_7 \(AB + A'B'\)
Case_8 \(A_2 + B_2 + B_2'\)
Case_9 \(A_2 + A_2' + B_2 + B_2'\)
Case_10 \(A_2 + BB' + B_2''\)
Case_11 \(A_2 + A'B' + B_2\)
Flory_Af \(A_f\)
Miller_1 \(A_f + A_2 + BB'\)
Miller_2 \(A_f + B_2\) (substitution effect on \(A_f\) )
Stockmayer \(A_1 + A_2 ... + A_f + B_1 + B_2 + ... + B_g\)

Case_1 ¤

Case_1(
    pB: float, r_BB_AA: float, MAA: float, MBB: float
) -> tuple[float, float]

Case's analytical solution for AA reacting with BB (A₂ + B₂).

The expressions for the number- and mass-average molar masses are:

\[\begin{aligned} M_n &= \frac{\beta M_{AA} + \alpha M_{BB}}{\alpha + \beta -2\alpha\beta} \\ M_w &= \frac{{1 + \alpha\beta}}{{1 - \alpha\beta}} \frac{{\beta M_{AA}^2 + \alpha M_{BB}^2}}{{\beta M_{AA} + \alpha M_{BB}}} + \frac{{4\alpha\beta M_{AA} M_{BB}}} {{(1 - \alpha\beta) (\beta M_{AA} + \alpha M_{BB})}} \end{aligned}\]

where \(\alpha\) and \(\beta\) denote, respectively, the conversions of A and B groups.

References

PARAMETER DESCRIPTION
pB

Conversion of B groups.

TYPE: float

r_BB_AA

Initial molar ratio of BB/AA molecules (or, equivalently, B/A groups). Unit = mol/mol.

TYPE: float

MAA

Molar mass of a reacted AA unit.

TYPE: float

MBB

Molar mass of a reacted BB unit.

TYPE: float

RETURNS DESCRIPTION
tuple[float, float]

Tuple of molar mass averages, (\(M_n\), \(M_w\)).

Examples:

Calculate Mn and Mw for a mixture with 1.01 mol of A₂ (100 g/mol) and 1.0 mol of B₂ (90 g/mol) at 99% conversion of B groups.

>>> from polykin.stepgrowth.solutions import Case_1
>>> Mn, Mw = Case_1(0.99, 1.0/1.01, 100., 90.)
>>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
Mn=6367; Mw=12645
Source code in src/polykin/stepgrowth/solutions.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def Case_1(pB: float,
           r_BB_AA: float,
           MAA: float,
           MBB: float
           ) -> tuple[float, float]:
    r"""Case's analytical solution for AA reacting with BB (A₂ + B₂).

    The expressions for the number- and mass-average molar masses are:

    \begin{aligned}
    M_n &= \frac{\beta M_{AA} + \alpha M_{BB}}{\alpha + \beta -2\alpha\beta} \\
    M_w &= \frac{{1 + \alpha\beta}}{{1 - \alpha\beta}}
      \frac{{\beta M_{AA}^2 + \alpha M_{BB}^2}}{{\beta M_{AA} + \alpha M_{BB}}}
      + \frac{{4\alpha\beta M_{AA} M_{BB}}}
      {{(1 - \alpha\beta) (\beta M_{AA} + \alpha M_{BB})}}
    \end{aligned}

    where $\alpha$ and $\beta$ denote, respectively, the conversions of A and B
    groups.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pB : float
        Conversion of B groups.
    r_BB_AA : float
        Initial molar ratio of BB/AA molecules (or, equivalently, B/A groups).
        Unit = mol/mol.
    MAA : float
        Molar mass of a reacted AA unit.
    MBB : float
        Molar mass of a reacted BB unit.

    Returns
    -------
    tuple[float, float]
        Tuple of molar mass averages, ($M_n$, $M_w$).

    Examples
    --------
    Calculate Mn and Mw for a mixture with 1.01 mol of A₂ (100 g/mol) and
    1.0 mol of B₂ (90 g/mol) at 99% conversion of B groups.
    >>> from polykin.stepgrowth.solutions import Case_1
    >>> Mn, Mw = Case_1(0.99, 1.0/1.01, 100., 90.)
    >>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
    Mn=6367; Mw=12645
    """
    b = pB
    a = b*r_BB_AA

    Mn = (b*MAA + a*MBB)/(a + b - 2*a*b)

    Mw = (1 + a*b)/(1 - a*b)*(b*MAA**2 + a*MBB**2) / \
        (b*MAA + a*MBB) + (4*a*b*MAA*MBB)/((1 - a*b)*(b*MAA + a*MBB))

    return (Mn, Mw)

Case_3 ¤

Case_3(
    pB: float,
    pC: float,
    r_BC_AA: float,
    MAA: float,
    MBC: float,
) -> tuple[float, float]

Case's analytical solution for AA reacting with BC, where BC is an unsymmetric species (A₂ + BB').

Alternative notation:

\[\begin{matrix} AA& +& BC\\ \updownarrow& & \updownarrow\\ A_2& +& BB' \end{matrix}\]

The expressions for the number- and mass-average molar masses are:

\[\begin{aligned} M_n &= \frac{{(\beta + \gamma) M_{AA} + 2\alpha M_{BC}}} {{2\alpha + \beta + \gamma - 2\alpha(\beta + \gamma)}} \\ M_w &= \frac{\left(1+\frac{2\alpha\beta\gamma}{\beta+\gamma}\right)M_{AA}^2 + 4\alpha M_{AA} M_{BC} + \left(\frac{2\alpha}{(\beta + \gamma)^2} (\beta + \gamma + \alpha\beta^2 + \alpha\gamma^2)\right)M_{BC}^2} {\left(1 - \frac{2\alpha\beta\gamma}{\beta + \gamma}\right) \left(M_{AA} + \frac{2\alpha}{\beta + \gamma}M_{BC}\right)} \end{aligned}\]

where \(\alpha\), \(\beta\) and \(\gamma\) denote, respectively, the conversions of A, B and C groups.

References

PARAMETER DESCRIPTION
pB

Conversion of B groups.

TYPE: float

pC

Conversion of C groups.

TYPE: float

r_BC_AA

Initial molar ratio of BC/AA molecules. Unit = mol/mol.

TYPE: float

MAA

Molar mass of a reacted AA unit.

TYPE: float

MBC

Molar mass of a reacted BC unit.

TYPE: float

RETURNS DESCRIPTION
tuple[float, float]

Tuple of molar mass averages, (\(M_n\), \(M_w\)).

Examples:

Calculate Mn and Mw for a mixture with 1.01 mol of A₂ (100 g/mol) and 1.0 mol of BC (90 g/mol) at 99% conversion of B groups and 95% conversion of C groups.

>>> from polykin.stepgrowth.solutions import Case_3
>>> Mn, Mw = Case_3(0.99, 0.95, 1.0/1.01, 100., 90.)
>>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
Mn=2729; Mw=5332
Source code in src/polykin/stepgrowth/solutions.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
def Case_3(pB: float,
           pC: float,
           r_BC_AA: float,
           MAA: float,
           MBC: float
           ) -> tuple[float, float]:
    r"""Case's analytical solution for AA reacting with BC, where BC is
    an unsymmetric species (A₂ + BB').

    Alternative notation:

    \begin{matrix}
    AA&            +&   BC\\
    \updownarrow&   &   \updownarrow\\
    A_2&           +&   BB'
    \end{matrix}

    The expressions for the number- and mass-average molar masses are:

    \begin{aligned}
    M_n &= \frac{{(\beta + \gamma) M_{AA} + 2\alpha M_{BC}}}
                {{2\alpha + \beta + \gamma - 2\alpha(\beta + \gamma)}} \\
    M_w &= \frac{\left(1+\frac{2\alpha\beta\gamma}{\beta+\gamma}\right)M_{AA}^2
        + 4\alpha M_{AA} M_{BC}
        + \left(\frac{2\alpha}{(\beta + \gamma)^2}
        (\beta + \gamma + \alpha\beta^2 + \alpha\gamma^2)\right)M_{BC}^2}
        {\left(1 - \frac{2\alpha\beta\gamma}{\beta + \gamma}\right)
        \left(M_{AA} + \frac{2\alpha}{\beta + \gamma}M_{BC}\right)}
    \end{aligned}

    where $\alpha$, $\beta$ and $\gamma$ denote, respectively, the conversions
    of A, B and C groups.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pB : float
        Conversion of B groups.
    pC : float
        Conversion of C groups.
    r_BC_AA : float
        Initial molar ratio of BC/AA molecules.
        Unit = mol/mol.
    MAA : float
        Molar mass of a reacted AA unit.
    MBC : float
        Molar mass of a reacted BC unit.

    Returns
    -------
    tuple[float, float]
        Tuple of molar mass averages, ($M_n$, $M_w$).

    Examples
    --------
    Calculate Mn and Mw for a mixture with 1.01 mol of A₂ (100 g/mol) and
    1.0 mol of BC (90 g/mol) at 99% conversion of B groups and 95% conversion
    of C groups.
    >>> from polykin.stepgrowth.solutions import Case_3
    >>> Mn, Mw = Case_3(0.99, 0.95, 1.0/1.01, 100., 90.)
    >>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
    Mn=2729; Mw=5332
    """

    b = pB
    c = pC
    a = r_BC_AA*(b + c)/2

    Mn = ((b + c)*MAA + 2*a*MBC)/(2*a + b + c - 2*a*(b + c))

    Mw = ((1 + 2*a*b*c/(b + c))*MAA**2 + 4*a*MAA*MBC +
          (2*a*(b + c + a*b**2 + a*c**2)/(b + c)**2)*MBC**2) \
        / ((1 - 2*a*b*c/(b + c))*(MAA + 2*a/(b + c)*MBC))

    return (Mn, Mw)

Case_5 ¤

Case_5(
    pB: float,
    pC: float,
    r_BC_A: float,
    r_C_B: float,
    MAA: float,
    MBB: float,
    MC: float,
) -> float

Case's analytical solution for AA reacting with BB and C, where B does not react with C (A₂ + B₂ + B').

Alternative notation:

\[\begin{matrix} AA& +& BB & +& C\\ \updownarrow& & \updownarrow& & \updownarrow\\ A_2& +& B_2 & +& B' \end{matrix}\]

The expression for the number-average molar mass is:

\[ M_n = \frac{M_{AA} + \frac{2\alpha}{2\beta + \nu\gamma} M_{BB} + \frac{2\alpha\nu}{2\beta + \nu\gamma} M_{C}} {1 - 2\alpha + \frac{2\alpha(1 + \nu)}{2\beta + \nu\gamma}} \]

where \(\nu\) represents the ratio of C to B groups, and \(\alpha\), \(\beta\) and \(\gamma\) denote, respectively, the conversions of A, B and C groups.

References

PARAMETER DESCRIPTION
pB

Conversion of B groups.

TYPE: float

pC

Conversion of C groups.

TYPE: float

r_BC_A

Initial molar ratio of (B + C)/A groups. Unit = mol/mol.

TYPE: float

r_C_B

Initial molar ratio of C/B groups. Unit = mol/mol.

TYPE: float

MAA

Molar mass of a reacted AA unit.

TYPE: float

MBB

Molar mass of a reacted BB unit.

TYPE: float

MC

Molar mass of a reacted C unit.

TYPE: float

RETURNS DESCRIPTION
float

Number-average molar mass, \(M_n\).

Examples:

Calculate Mn for a mixture with 1.01 mol of A₂ (100 g/mol), 1.0 mol of B₂ (90 g/mol) and 0.01 mol of C (40 g/mol) at 99% conversion of B groups and 95% conversion of C groups.

>>> from polykin.stepgrowth.solutions import Case_5
>>> Mn = Case_5(0.99, 0.95, (2*1.0 + 0.01)/(2*1.01), 0.01/(2*1), 100., 90., 40.)
>>> print(f"Mn={Mn:.0f}")
Mn=6860
Source code in src/polykin/stepgrowth/solutions.py
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
def Case_5(pB: float,
           pC: float,
           r_BC_A: float,
           r_C_B: float,
           MAA: float,
           MBB: float,
           MC: float
           ) -> float:
    r"""Case's analytical solution for AA reacting with BB and C, where
    B does not react with C (A₂ + B₂ + B').

    Alternative notation:

    \begin{matrix}
    AA&  +&  BB  &  +& C\\
    \updownarrow&   & \updownarrow& & \updownarrow\\
    A_2& +&  B_2 &  +& B'
    \end{matrix}

    The expression for the number-average molar mass is:

    $$ M_n = \frac{M_{AA} + \frac{2\alpha}{2\beta + \nu\gamma} M_{BB}
            + \frac{2\alpha\nu}{2\beta + \nu\gamma} M_{C}}
            {1 - 2\alpha + \frac{2\alpha(1 + \nu)}{2\beta + \nu\gamma}} $$

    where $\nu$ represents the ratio of C to B groups, and $\alpha$, $\beta$
    and $\gamma$ denote, respectively, the conversions of A, B and C groups.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pB : float
        Conversion of B groups.
    pC : float
        Conversion of C groups.
    r_BC_A : float
        Initial molar ratio of (B + C)/A groups.
        Unit = mol/mol.
    r_C_B : float
        Initial molar ratio of C/B groups.
        Unit = mol/mol.
    MAA : float
        Molar mass of a reacted AA unit.
    MBB : float
        Molar mass of a reacted BB unit.
    MC : float
        Molar mass of a reacted C unit.

    Returns
    -------
    float
        Number-average molar mass, $M_n$.

    Examples
    --------
    Calculate Mn for a mixture with 1.01 mol of A₂ (100 g/mol), 1.0 mol of B₂
    (90 g/mol) and 0.01 mol of C (40 g/mol) at 99% conversion of B groups and
    95% conversion of C groups.
    >>> from polykin.stepgrowth.solutions import Case_5
    >>> Mn = Case_5(0.99, 0.95, (2*1.0 + 0.01)/(2*1.01), 0.01/(2*1), 100., 90., 40.)
    >>> print(f"Mn={Mn:.0f}")
    Mn=6860
    """

    b = pB
    c = pC
    v = r_C_B
    a = r_BC_A*(b + v*c)/(1 + v)

    Mn = (MAA + 2*a/(2*b + v*c)*MBB + 2*a*v/(2*b + v*c)*MC) / \
         (1 - 2*a + 2*a*(1 + v)/(2*b + v*c))

    return Mn

Case_6 ¤

Case_6(
    pC: float, r_BC_AA: float, MAA: float, MBC: float
) -> float

Case's analytical solution for AA reacting with BC, where A and B react with C (A₂ + A'B).

Alternative notation:

\[\begin{matrix} AA& +& BC\\ \updownarrow& & \updownarrow\\ A_2& +& A'B \end{matrix}\]

The expression for the number-average molar mass is:

\[ M_n = \frac{M_{AA} + \nu M_{BC}}{1 + \nu(1 - \gamma)} \]

where \(\nu\) represents the ratio of BC to AA units, and \(\gamma\) denotes the conversion of C groups.

Note

For this case, a formula for \(M_w\) was also reported, but it provides inconsistent results in the limiting case of BC-only systems.

References

PARAMETER DESCRIPTION
pC

Conversion of C groups.

TYPE: float

r_BC_AA

Initial molar ratio of BC/AA molecules. Unit = mol/mol.

TYPE: float

MAA

Molar mass of a reacted AA unit.

TYPE: float

MBC

Molar mass of a reacted BC unit.

TYPE: float

RETURNS DESCRIPTION
float

Number-average molar mass, \(M_n\).

Examples:

Calculate Mn for a mixture with 0.01 mol of AA (100 g/mol) and 2.0 mol of A'B (80 g/mol) at 99% conversion of B groups.

>>> from polykin.stepgrowth.solutions import Case_6
>>> Mn = Case_6(0.99, 2.0/0.01, 100., 80.)
>>> print(f"Mn={Mn:.0f}")
Mn=5367
Source code in src/polykin/stepgrowth/solutions.py
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
def Case_6(pC: float,
           r_BC_AA: float,
           MAA: float,
           MBC: float
           ) -> float:
    r"""Case's analytical solution for AA reacting with BC, where A and
    B react with C (A₂ + A'B).

    Alternative notation:

    \begin{matrix}
    AA&            +&   BC\\
    \updownarrow&   &   \updownarrow\\
    A_2&           +&   A'B
    \end{matrix}

    The expression for the number-average molar mass is:

    $$ M_n = \frac{M_{AA} + \nu M_{BC}}{1 + \nu(1 - \gamma)} $$

    where $\nu$ represents the ratio of BC to AA units, and $\gamma$ denotes
    the conversion of C groups.

    !!! note

        For this case, a formula for $M_w$ was also reported, but it provides
        inconsistent results in the limiting case of BC-only systems.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pC : float
        Conversion of C groups.
    r_BC_AA : float
        Initial molar ratio of BC/AA molecules.
        Unit = mol/mol.
    MAA : float
        Molar mass of a reacted AA unit.
    MBC : float
        Molar mass of a reacted BC unit.

    Returns
    -------
    float
        Number-average molar mass, $M_n$.

    Examples
    --------
    Calculate Mn for a mixture with 0.01 mol of AA (100 g/mol) and 2.0 mol of
    A'B (80 g/mol) at 99% conversion of B groups.
    >>> from polykin.stepgrowth.solutions import Case_6
    >>> Mn = Case_6(0.99, 2.0/0.01, 100., 80.)
    >>> print(f"Mn={Mn:.0f}")
    Mn=5367
    """
    # a = pA
    # b = pB
    # c = 2*a/v + b
    c = pC
    v = r_BC_AA

    Mn = (MAA + v*MBC)/(1 + v*(1 - c))

    # Mw formula is inconsistent for v->inf
    # Mw = (MAA**2 + 4*a*MAA*MBC/(1 - b) +
    #       (2*a*(a + 2*b)/(1 - b)**2 + v)*MBC**2)/(MAA + v*MBC)

    return Mn

Case_7 ¤

Case_7(
    pA: float,
    pC: float,
    r_CD_AB: float,
    MAB: float,
    MCD: float,
) -> float

Case's analytical solution for AB reacting with CD (AB + A'B').

Alternative notation:

\[\begin{matrix} AB& +& CD\\ \updownarrow& & \updownarrow\\ AB& +& A'B' \end{matrix}\]

The expression for the number-average molar mass is:

\[ M_n = \frac{M_{AB} + \nu M_{CD}}{{1 + \nu - (\alpha + \nu\gamma)}} \]

where \(\nu\) represents the ratio of CD to AB units, while \(\alpha\) and \(\gamma\) denote, respectively, the conversions of A and C groups.

References

PARAMETER DESCRIPTION
pA

Conversion of A groups.

TYPE: float

pC

Conversion of C groups.

TYPE: float

r_CD_AB

Initial molar ratio of CD/AB molecules. Unit = mol/mol.

TYPE: float

MAB

Molar mass of a reacted AB unit.

TYPE: float

MCD

Molar mass of a reacted CD unit.

TYPE: float

RETURNS DESCRIPTION
float

Number-average molar mass, \(M_n\).

Examples:

Calculate Mn for a mixture with 1.0 mol of AB (100 g/mol) and 2.0 mol of A'B' (80 g/mol) at 99% conversion of A groups and 98% conversion of A' groups.

>>> from polykin.stepgrowth.solutions import Case_7
>>> Mn = Case_7(0.99, 0.98, 2.0/1.0, 100., 80.)
>>> print(f"Mn={Mn:.0f}")
Mn=5200
Source code in src/polykin/stepgrowth/solutions.py
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
def Case_7(pA: float,
           pC: float,
           r_CD_AB: float,
           MAB: float,
           MCD: float
           ) -> float:
    r"""Case's analytical solution for AB reacting with CD (AB + A'B').

    Alternative notation:

    \begin{matrix}
    AB&            +&   CD\\
    \updownarrow&   &   \updownarrow\\
    AB&            +&   A'B'
    \end{matrix}

    The expression for the number-average molar mass is:

    $$ M_n = \frac{M_{AB} + \nu M_{CD}}{{1 + \nu - (\alpha + \nu\gamma)}} $$

    where $\nu$ represents the ratio of CD to AB units, while $\alpha$ and
    $\gamma$ denote, respectively, the conversions of A and C groups.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pA : float
        Conversion of A groups.
    pC : float
        Conversion of C groups.
    r_CD_AB : float
        Initial molar ratio of CD/AB molecules.
        Unit = mol/mol.
    MAB : float
        Molar mass of a reacted AB unit.
    MCD : float
        Molar mass of a reacted CD unit.

    Returns
    -------
    float
        Number-average molar mass, $M_n$.

    Examples
    --------
    Calculate Mn for a mixture with 1.0 mol of AB (100 g/mol) and 2.0 mol of
    A'B' (80 g/mol) at 99% conversion of A groups and 98% conversion of A'
    groups.
    >>> from polykin.stepgrowth.solutions import Case_7
    >>> Mn = Case_7(0.99, 0.98, 2.0/1.0, 100., 80.)
    >>> print(f"Mn={Mn:.0f}")
    Mn=5200
    """

    a = pA
    c = pC
    v = r_CD_AB

    Mn = (MAB + v*MCD)/(1 + v - (a + v*c))

    return Mn

Case_8 ¤

Case_8(
    pB: float,
    pC: float,
    r_BC_A: float,
    r_CC_BB: float,
    MAA: float,
    MBB: float,
    MCC: float,
) -> float

Case's analytical solution for AA reacting with BB and CC, where B does not react with C (A₂ + B₂ + B₂').

Alternative notation:

\[\begin{matrix} AA& +& BB & +& CC\\ \updownarrow& & \updownarrow& & \updownarrow\\ A_2& +& B_2 & +& B_2' \end{matrix}\]

The expression for the number-average molar mass is:

\[ M_n = \frac{M_{AA} + \frac{\alpha (M_{BB} + \nu M_{CC})} {\beta + \nu\gamma}} {1 - 2\alpha + \frac{\alpha (1 + \nu)}{\beta + \nu\gamma}} \]

where \(\nu\) represents the ratio of CC to BB units, while \(\alpha\), \(\beta\) and \(\gamma\) denote, respectively, the conversions of A, B and C groups.

References

PARAMETER DESCRIPTION
pB

Conversion of B groups.

TYPE: float

pC

Conversion of C groups.

TYPE: float

r_BC_A

Initial molar ratio of (B + C)/A groups. Unit = mol/mol.

TYPE: float

r_CC_BB

Initial molar ratio of CC/BB molecules (or, equivalently, C/B groups). Unit = mol/mol.

TYPE: float

MAA

Molar mass of a reacted AA unit.

TYPE: float

MBB

Molar mass of a reacted BB unit.

TYPE: float

MCC

Molar mass of a reacted CC unit.

TYPE: float

RETURNS DESCRIPTION
float

Number-average molar mass, \(M_n\).

Examples:

Calculate Mn for a mixture with 1.01 mol of A₂ (100 g/mol), 0.6 mol of B₂ (90 g/mol) and 0.4 mol of B₂' (50 g/mol) at 99% conversion of B groups and 95% conversion of B' groups.

>>> from polykin.stepgrowth.solutions import Case_8
>>> Mn = Case_8(0.99, 0.95, (0.6 + 0.4)/1.01, 0.4/0.6, 100., 90., 50.)
>>> print(f"Mn={Mn:.0f}")
Mn=2823
Source code in src/polykin/stepgrowth/solutions.py
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
def Case_8(pB: float,
           pC: float,
           r_BC_A: float,
           r_CC_BB: float,
           MAA: float,
           MBB: float,
           MCC: float
           ) -> float:
    r"""Case's analytical solution for AA reacting with BB and CC, where B does
    not react with C (A₂ + B₂ + B₂').

    Alternative notation:

    \begin{matrix}
    AA&   +&  BB  &  +& CC\\
    \updownarrow&   & \updownarrow& & \updownarrow\\
    A_2&  +&  B_2 &  +& B_2'
    \end{matrix}

    The expression for the number-average molar mass is:

    $$ M_n = \frac{M_{AA} + \frac{\alpha (M_{BB} + \nu M_{CC})}
            {\beta + \nu\gamma}}
            {1 - 2\alpha + \frac{\alpha (1 + \nu)}{\beta + \nu\gamma}} $$

    where $\nu$ represents the ratio of CC to BB units, while $\alpha$, $\beta$
    and $\gamma$ denote, respectively, the conversions of A, B and C groups.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pB : float
        Conversion of B groups.
    pC : float
        Conversion of C groups.
    r_BC_A : float
        Initial molar ratio of (B + C)/A groups.
        Unit = mol/mol.
    r_CC_BB : float
        Initial molar ratio of CC/BB molecules (or, equivalently, C/B groups).
        Unit = mol/mol.
    MAA : float
        Molar mass of a reacted AA unit.
    MBB : float
        Molar mass of a reacted BB unit.
    MCC : float
        Molar mass of a reacted CC unit.

    Returns
    -------
    float
        Number-average molar mass, $M_n$.

    Examples
    --------
    Calculate Mn for a mixture with 1.01 mol of A₂ (100 g/mol), 0.6 mol of B₂
    (90 g/mol) and 0.4 mol of B₂' (50 g/mol) at 99% conversion of B groups and
    95% conversion of B' groups.
    >>> from polykin.stepgrowth.solutions import Case_8
    >>> Mn = Case_8(0.99, 0.95, (0.6 + 0.4)/1.01, 0.4/0.6, 100., 90., 50.)
    >>> print(f"Mn={Mn:.0f}")
    Mn=2823
    """

    b = pB
    c = pC
    v = r_CC_BB
    a = r_BC_A*(b + v*c)/(1 + v)

    Mn = (MAA + a*(MBB + v*MCC)/(b + v*c))/(1 - 2*a + a*(1 + v)/(b + v*c))

    return Mn

Case_9 ¤

Case_9(
    pB: float,
    pC: float,
    pD: float,
    r_CD_AB: float,
    r_BB_AA: float,
    r_DD_CC: float,
    MAA: float,
    MBB: float,
    MCC: float,
    MDD: float,
) -> float

Case's analytical solution for AA and BB reacting with CC and DD, where A and B react only with C and D (A₂ + A₂' + B₂ + B₂').

Alternative notation:

\[\begin{matrix} AA & + & BB & + & CC & + & DD \\ \updownarrow& & \updownarrow& & \updownarrow& & \updownarrow\\ A_2 & + & A_2' & + & B_2 & + & B_2' \end{matrix}\]

The expression for the number-average molar mass is:

\[ M_n = \frac{M_{AA} + \nu M_{BB} + \frac{\alpha + \nu \beta} {\gamma + \rho \delta} (M_{CC} + \rho M_{DD})} {1 - \alpha + \nu (1 - \beta) + \frac{\alpha + \nu \beta} {\gamma + \rho \delta} \left(1 - \gamma + \rho (1 - \delta)\right)} \]

where \(\nu\) is the ratio of B to A groups, \(\rho\) is the ratio of D to C groups, and \(\alpha\), \(\beta\), \(\gamma\) and \(\delta\) denote, respectively, the conversions of A, B, C and D groups.

References

PARAMETER DESCRIPTION
pB

Conversion of B groups.

TYPE: float

pC

Conversion of C groups.

TYPE: float

pD

Conversion of D groups.

TYPE: float

r_CD_AB

Initial molar ratio of (C+D)/(A+B) groups. Unit = mol/mol.

TYPE: float

r_BB_AA

Initial molar ratio of BB/AA molecules (or, equivalently, B/A groups). Unit = mol/mol.

TYPE: float

r_DD_CC

Initial molar ratio of DD/CC molecules (or, equivalently, D/C groups). Unit = mol/mol.

TYPE: float

MAA

Molar mass of a reacted AA unit.

TYPE: float

MBB

Molar mass of a reacted BB unit.

TYPE: float

MCC

Molar mass of a reacted CC unit.

TYPE: float

MDD

Molar mass of a reacted DD unit.

TYPE: float

RETURNS DESCRIPTION
float

Number-average molar mass, \(M_n\).

Examples:

Calculate Mn for a mixture with 1.0 mol of A₂ (100 g/mol), 0.5 mol of A₂' (80 g/mol), 0.6 mol of B₂ (90 g/mol) and 0.9 mol of B'₂ (70 g/mol) at 99% conversion of A' groups, 98% conversion of B groups, and 99.9% conversion of B' groups.

>>> from polykin.stepgrowth.solutions import Case_9
>>> Mn = Case_9(0.99, 0.98, 0.999, (0.6 + 0.9)/(1.0 + 0.5), 0.5/1.0,
...             0.9/0.6, 100., 80., 90., 70.)
>>> print(f"Mn={Mn:.0f}")
Mn=9961
Source code in src/polykin/stepgrowth/solutions.py
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
def Case_9(pB: float,
           pC: float,
           pD: float,
           r_CD_AB: float,
           r_BB_AA: float,
           r_DD_CC: float,
           MAA: float,
           MBB: float,
           MCC: float,
           MDD: float
           ) -> float:
    r"""Case's analytical solution for AA and BB reacting with CC and DD, where
    A and B react only with C and D (A₂ + A₂' + B₂ + B₂').

    Alternative notation:

    \begin{matrix}
    AA &   + &  BB &  + &  CC  & + & DD \\
    \updownarrow&   & \updownarrow& & \updownarrow& & \updownarrow\\
    A_2 &  + &  A_2' &  + & B_2 & + & B_2'
    \end{matrix}

    The expression for the number-average molar mass is:

    $$ M_n = \frac{M_{AA} + \nu M_{BB} + \frac{\alpha + \nu \beta}
        {\gamma + \rho \delta} (M_{CC} + \rho M_{DD})}
        {1 - \alpha + \nu (1 - \beta) + \frac{\alpha + \nu \beta}
        {\gamma + \rho \delta} \left(1 - \gamma + \rho (1 - \delta)\right)} $$

    where $\nu$ is the ratio of B to A groups, $\rho$ is the ratio of D to C
    groups, and $\alpha$, $\beta$, $\gamma$ and $\delta$ denote, respectively,
    the conversions of A, B, C and D groups.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pB : float
        Conversion of B groups.
    pC : float
        Conversion of C groups.
    pD : float
        Conversion of D groups.
    r_CD_AB : float
        Initial molar ratio of (C+D)/(A+B) groups.
        Unit = mol/mol.
    r_BB_AA : float
        Initial molar ratio of BB/AA molecules (or, equivalently, B/A groups).
        Unit = mol/mol.
    r_DD_CC : float
        Initial molar ratio of DD/CC molecules (or, equivalently, D/C groups).
        Unit = mol/mol.
    MAA : float
        Molar mass of a reacted AA unit.
    MBB : float
        Molar mass of a reacted BB unit.
    MCC : float
        Molar mass of a reacted CC unit.
    MDD : float
        Molar mass of a reacted DD unit.

    Returns
    -------
    float
        Number-average molar mass, $M_n$.

    Examples
    --------
    Calculate Mn for a mixture with 1.0 mol of A₂ (100 g/mol), 0.5 mol of A₂'
    (80 g/mol), 0.6 mol of B₂ (90 g/mol) and 0.9 mol of B'₂ (70 g/mol) at 99%
    conversion of A' groups, 98% conversion of B groups, and 99.9% conversion
    of B' groups.
    >>> from polykin.stepgrowth.solutions import Case_9
    >>> Mn = Case_9(0.99, 0.98, 0.999, (0.6 + 0.9)/(1.0 + 0.5), 0.5/1.0,
    ...             0.9/0.6, 100., 80., 90., 70.)
    >>> print(f"Mn={Mn:.0f}")
    Mn=9961
    """

    b = pB
    c = pC
    d = pD
    v = r_BB_AA
    r = r_DD_CC
    a = r_CD_AB*(1 + v)/(1 + r)*(c + r*d) - v*b

    Mn = (MAA + v*MBB + (a + v*b)/(c + r*d)*(MCC + r*MDD)) / \
        (1 - a + v*(1 - b) + (a + v*b)/(c + r*d)*(1 - c + r*(1 - d)))

    return Mn

Case_10 ¤

Case_10(
    pB: float,
    pC: float,
    pD: float,
    r_BCD_A: float,
    r_BC_DD: float,
    MAA: float,
    MBC: float,
    MDD: float,
) -> float

Case's analytical solution for AA reacting with BC and DD, where A reacts only with B, C or D (A₂ + BB' + B₂'').

Alternative notation:

\[\begin{matrix} AA& +& BC & +& DD\\ \updownarrow& & \updownarrow& & \updownarrow\\ A_2& +& BB' & +& B_2'' \end{matrix}\]

The expression for the number-average molar mass is:

\[ M_n = \frac{M_{AA} + \frac{\alpha( M_{DD} + 2 \nu M_{BC})} {\nu (\beta + \gamma) + \delta}} {1 - \alpha + \frac{\alpha}{\nu (\beta + \gamma) + \delta} \left(1 - \delta + \nu (2 - \beta - \gamma) \right)} \]

where \(2\nu\) represents the ratio of BC to DD units, while \(\alpha\), \(\beta\), \(\gamma\) and \(\delta\) denote, respectively, the conversions of A, B, C and D groups.

References

PARAMETER DESCRIPTION
pB

Conversion of B groups.

TYPE: float

pC

Conversion of C groups.

TYPE: float

pD

Conversion of D groups.

TYPE: float

r_BCD_A

Initial molar ratio of (B + C + D)/A groups. Unit = mol/mol.

TYPE: float

r_BC_DD

Initial molar ratio of BC/DD molecules. Unit = mol/mol.

TYPE: float

MAA

Molar mass of a reacted AA unit.

TYPE: float

MBC

Molar mass of a reacted BC unit.

TYPE: float

MDD

Molar mass of a reacted DD unit.

TYPE: float

RETURNS DESCRIPTION
float

Number-average molar mass, \(M_n\).

Examples:

Calculate Mn for a mixture with 1.01 mol of A₂ (100 g/mol), 0.6 mol of BB' (90 g/mol) and 0.4 mol of B₂'' (50 g/mol) at 99% conversion of B groups, 98% conversion of B' groups and 99.9% conversion of B'' groups.

>>> from polykin.stepgrowth.solutions import Case_10
>>> Mn = Case_10(0.99, 0.98, 0.999, (0.6 + 0.4)/1.01, 0.6/0.4, 100., 90., 50.)
>>> print(f"Mn={Mn:.0f}")
Mn=6076
Source code in src/polykin/stepgrowth/solutions.py
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
def Case_10(pB: float,
            pC: float,
            pD: float,
            r_BCD_A: float,
            r_BC_DD: float,
            MAA: float,
            MBC: float,
            MDD: float
            ) -> float:
    r"""Case's analytical solution for AA reacting with BC and DD, where A
    reacts only with B, C or D (A₂ + BB' + B₂'').

    Alternative notation:

    \begin{matrix}
    AA&  +&  BC &  +& DD\\
    \updownarrow&   & \updownarrow& & \updownarrow\\
    A_2&  +&  BB' &  +& B_2''
    \end{matrix}

    The expression for the number-average molar mass is:

    $$ M_n = \frac{M_{AA} + \frac{\alpha( M_{DD} + 2 \nu M_{BC})}
                                 {\nu (\beta + \gamma) + \delta}}
        {1 - \alpha + \frac{\alpha}{\nu (\beta + \gamma) + \delta}
              \left(1 - \delta + \nu (2 - \beta - \gamma) \right)} $$

    where $2\nu$ represents the ratio of BC to DD units, while $\alpha$,
    $\beta$, $\gamma$ and $\delta$ denote, respectively, the conversions of
    A, B, C and D groups.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pB : float
        Conversion of B groups.
    pC : float
        Conversion of C groups.
    pD : float
        Conversion of D groups.
    r_BCD_A : float
        Initial molar ratio of (B + C + D)/A groups.
        Unit = mol/mol.
    r_BC_DD : float
        Initial molar ratio of BC/DD molecules.
        Unit = mol/mol.
    MAA : float
        Molar mass of a reacted AA unit.
    MBC : float
        Molar mass of a reacted BC unit.
    MDD : float
        Molar mass of a reacted DD unit.

    Returns
    -------
    float
        Number-average molar mass, $M_n$.

    Examples
    --------
    Calculate Mn for a mixture with 1.01 mol of A₂ (100 g/mol), 0.6 mol of BB'
    (90 g/mol) and 0.4 mol of B₂'' (50 g/mol) at 99% conversion of B groups,
    98% conversion of B' groups and 99.9% conversion of B'' groups.
    >>> from polykin.stepgrowth.solutions import Case_10
    >>> Mn = Case_10(0.99, 0.98, 0.999, (0.6 + 0.4)/1.01, 0.6/0.4, 100., 90., 50.)
    >>> print(f"Mn={Mn:.0f}")
    Mn=6076
    """

    b = pB
    c = pC
    d = pD
    v = r_BC_DD/2
    a = r_BCD_A*(v*(b + c) + d)/(2*v + 1)

    Mn = (MAA + a*(MDD + 2*v*MBC)/(v*(b + c) + d)) / \
        (1 - a + a/(v*(b + c) + d)*((1 - d) + v*(2 - b - c)))

    return Mn

Case_11 ¤

Case_11(
    pB: float,
    pC: float,
    pD: float,
    r_BC_AA: float,
    r_DD_AA: float,
    MAA: float,
    MBC: float,
    MDD: float,
) -> float

Case's analytical solution for AA and DD reacting with BC, where A and B react only with C and D (A₂ + A'B' + B₂).

Alternative notation:

\[\begin{matrix} AA& +& BC & +& DD\\ \updownarrow& & \updownarrow& & \updownarrow\\ A_2& +& A'B' & +& B_2 \end{matrix}\]

The expression for the number-average molar mass is:

\[ M_n = \frac{M_{AA}+2\nu M_{BC}+\frac{\alpha+\nu (\beta-\gamma)}{\delta} M_{DD}} {1-2\alpha+2\nu (1-\beta) + \frac{\alpha+\nu (\beta-\gamma)}{\delta}} \]

where \(2\nu\) represents the ratio of BC to AA units, while \(\alpha\), \(\beta\), \(\gamma\) and \(\delta>0\) denote, respectively, the conversions of A, B, C and D groups.

References

PARAMETER DESCRIPTION
pB

Conversion of B groups.

TYPE: float

pC

Conversion of C groups.

TYPE: float

pD

Conversion of D groups.

TYPE: float

r_BC_AA

Initial molar ratio of BC/AA molecules. Unit = mol/mol.

TYPE: float

r_DD_AA

Initial molar ratio of DD/AA molecules. Unit = mol/mol.

TYPE: float

MAA

Molar mass of a reacted AA unit.

TYPE: float

MBC

Molar mass of a reacted BC unit.

TYPE: float

MDD

Molar mass of a reacted DD unit.

TYPE: float

RETURNS DESCRIPTION
float

Number-average molar mass, \(M_n\).

Examples:

Calculate Mn for a mixture with 1.01 mol of A₂ (100 g/mol), 1.5 mol of A'B' (90 g/mol) and 1.0 mol of B₂ (50 g/mol) at 99% conversion of A' groups, 98% conversion of B groups and 99.9% conversion of B' groups.

>>> from polykin.stepgrowth.solutions import Case_11
>>> Mn = Case_11(0.99, 0.999, 0.98, 1.5/1.01, 1.0/1.01, 100., 90., 50.)
>>> print(f"Mn={Mn:.0f}")
Mn=5553
Source code in src/polykin/stepgrowth/solutions.py
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
def Case_11(pB: float,
            pC: float,
            pD: float,
            r_BC_AA: float,
            r_DD_AA: float,
            MAA: float,
            MBC: float,
            MDD: float
            ) -> float:
    r"""Case's analytical solution for AA and DD reacting with BC, where A
    and B react only with C and D (A₂ + A'B' + B₂).

    Alternative notation:

    \begin{matrix}
    AA&  +&  BC &  +& DD\\
    \updownarrow&   & \updownarrow& & \updownarrow\\
    A_2&  +&  A'B' &  +& B_2
    \end{matrix}

    The expression for the number-average molar mass is:

    $$ M_n =
    \frac{M_{AA}+2\nu M_{BC}+\frac{\alpha+\nu (\beta-\gamma)}{\delta} M_{DD}}
    {1-2\alpha+2\nu (1-\beta) + \frac{\alpha+\nu (\beta-\gamma)}{\delta}} $$

    where $2\nu$ represents the ratio of BC to AA units, while $\alpha$,
    $\beta$, $\gamma$ and $\delta>0$ denote, respectively, the conversions of
    A, B, C and D groups.

    **References**

    *   Case, L.C. (1958), Molecular distributions in polycondensations
        involving unlike reactants. II. Linear distributions. J. Polym. Sci.,
        29: 455-495. https://doi.org/10.1002/pol.1958.1202912013

    Parameters
    ----------
    pB : float
        Conversion of B groups.
    pC : float
        Conversion of C groups.
    pD : float
        Conversion of D groups.
    r_BC_AA : float
        Initial molar ratio of BC/AA molecules.
        Unit = mol/mol.
    r_DD_AA : float
        Initial molar ratio of DD/AA molecules.
        Unit = mol/mol.
    MAA : float
        Molar mass of a reacted AA unit.
    MBC : float
        Molar mass of a reacted BC unit.
    MDD : float
        Molar mass of a reacted DD unit.

    Returns
    -------
    float
        Number-average molar mass, $M_n$.

    Examples
    --------
    Calculate Mn for a mixture with 1.01 mol of A₂ (100 g/mol), 1.5 mol of A'B'
    (90 g/mol) and 1.0 mol of B₂ (50 g/mol) at 99% conversion of A' groups,
    98% conversion of B groups and 99.9% conversion of B' groups.
    >>> from polykin.stepgrowth.solutions import Case_11
    >>> Mn = Case_11(0.99, 0.999, 0.98, 1.5/1.01, 1.0/1.01, 100., 90., 50.)
    >>> print(f"Mn={Mn:.0f}")
    Mn=5553
    """

    b = pB
    c = pC
    d = pD
    v = r_BC_AA/2
    a = v*(c - b) + r_DD_AA*d

    Mn = (MAA + 2*v*MBC + (a + v*(b - c))/d*MDD) / \
        (1 - 2*a + 2*v*(1 - b) + (a + v*(b - c))/d)

    return Mn

Flory_Af ¤

Flory_Af(
    f: int, MAf: float, p: float
) -> tuple[float, float, float]

Flory's analytical solution for the hopolymerization of an \(A_f\) monomer.

The expressions for the number-, mass-, and z-average molar masses are:

\[\begin{aligned} M_n &= M_{A_f}\frac{1}{1 - (f/2)p} \\ M_w &= M_{A_f}\frac{1 + p}{1 - (f-1)p} \\ M_z &= M_{A_f}\frac{(1 + p)^3 - f(3 + p)p^2}{(1 + p)[1 - (f-1)p]^2} \end{aligned}\]

where \(p\) denotes the conversion of A groups, which must respect the limit imposed by the gelation condition \(p<p_{gel}=(f-1)^{-1}\).

References

  • P. J. Flory, Molecular Size Distribution in Three Dimensional Polymers. I. Gelation, J. Am. Chem. Soc. 1941, 63, 11, 3083.
  • M. Gordon, Proc. R. Soc. London, Ser. A, 1962, 268, 240.
PARAMETER DESCRIPTION
f

Functionality.

TYPE: int

MAf

Molar mass of reacted Af monomer.

TYPE: float

p

Conversion of A groups.

TYPE: float

RETURNS DESCRIPTION
tuple[float, float, float]

Tuple of molar mass averages, (\(M_n\), \(M_w\), \(M_z\)).

Examples:

Calculate Mn, Mw and Mz for A₄ (100 g/mol) at 30% conversion of A groups.

>>> from polykin.stepgrowth.solutions import Flory_Af
>>> Mn, Mw, Mz = Flory_Af(4, 100., 0.30)
>>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}; Mz={Mz:.0f}")
Mn=250; Mw=1300; Mz=7762
Source code in src/polykin/stepgrowth/solutions.py
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
def Flory_Af(f: int,
             MAf: float,
             p: float
             ) -> tuple[float, float, float]:
    r"""Flory's analytical solution for the hopolymerization of an $A_f$
    monomer.

    The expressions for the number-, mass-, and z-average molar masses are:

    \begin{aligned}
    M_n &= M_{A_f}\frac{1}{1 - (f/2)p} \\
    M_w &= M_{A_f}\frac{1 + p}{1 - (f-1)p} \\
    M_z &= M_{A_f}\frac{(1 + p)^3 - f(3 + p)p^2}{(1 + p)[1 - (f-1)p]^2}
    \end{aligned}

    where $p$ denotes the conversion of A groups, which must respect the limit
    imposed by the gelation condition $p<p_{gel}=(f-1)^{-1}$.

    **References**

    *   P. J. Flory, Molecular Size Distribution in Three Dimensional
        Polymers. I. Gelation, J. Am. Chem. Soc. 1941, 63, 11, 3083.
    *   M. Gordon, Proc. R. Soc. London, Ser. A, 1962, 268, 240.

    Parameters
    ----------
    f : int
        Functionality.
    MAf : float
        Molar mass of reacted Af monomer.
    p : float
        Conversion of A groups. 

    Returns
    -------
    tuple[float, float, float]
        Tuple of molar mass averages, ($M_n$, $M_w$, $M_z$).

    Examples
    --------
    Calculate Mn, Mw and Mz for A₄ (100 g/mol) at 30% conversion of A groups.
    >>> from polykin.stepgrowth.solutions import Flory_Af
    >>> Mn, Mw, Mz = Flory_Af(4, 100., 0.30)
    >>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}; Mz={Mz:.0f}")
    Mn=250; Mw=1300; Mz=7762
    """

    p_gel = 1/(f - 1)
    if p >= p_gel:
        return (np.nan, np.nan, np.nan)

    Mn = MAf/(1 - (f/2)*p)
    Mw = MAf*(1 + p)/(1 - p*(f - 1))
    Mz = MAf*((1 + p)**3 - (3 + p)*f*p**2)/((1 + p)*(1 - p*(f - 1))**2)

    return (Mn, Mw, Mz)

Miller_1 ¤

Miller_1(
    nAf: float,
    nA2: float,
    nB2: float,
    f: int,
    MAf: float,
    MA2: float,
    MB2: float,
    pB1: float,
    pB2: float,
) -> tuple[float, float]

Miller and Macosko's analytical solution for Af and A₂ reacting with B₂, where the two B groups comprising the B₂ monomer react at different rates.

The expressions for the number- and mass-average molar masses are:

\[\begin{aligned} M_n &= \frac{M_{A_f}A_f + M_{A_2}A_2 + M_{B_2}B_2}{A_f + A_2 + B_2(1 - p_{B^1} - p_{B^2})} \\ M_w &= \frac{M_{A_f}A_fE(W_{A_f}) + M_{A_2}A_2E(W_{A_2}) + M_{B_2}B_2E(W_{B_2})} {M_{A_f}A_f + M_{A_2}A_2 + M_{B_2}B_2} \end{aligned}\]

where \(E(W_X)\) is the expected weight attached to a unit of type \(X\).

References

  • D. R. Miller and C. W. Macosko, Average Property Relations for Nonlinear Polymerization with Unequal Reactivity, Macromolecules 1978, 11, 4, 656-662. https://doi.org/10.1021/ma60064a008
PARAMETER DESCRIPTION
nAf

Relative mole amount of Af monomer. Unit = mol or mol/mol.

TYPE: float

nA2

Relative mole amount of A₂ monomer. Unit = mol or mol/mol.

TYPE: float

nB2

Relative mole amount of B¹B² monomer. Unit = mol or mol/mol.

TYPE: float

f

Functionality of Af.

TYPE: int

MAf

Molar mass of reacted Af monomer.

TYPE: float

MA2

Molar mass of reacted A₂ monomer.

TYPE: float

MB2

Molar mass of reacted B¹B² monomer.

TYPE: float

pB1

Conversion of B¹ groups.

TYPE: float

pB2

Conversion of B² groups.

TYPE: float

RETURNS DESCRIPTION
tuple[float, float]

Tuple of molar mass averages, (\(M_n\), \(M_w\)).

Examples:

Calculate Mn and Mw for a mixture with 0.1 mol of A₃ (150 g/mol), 0.9 mol of A₂ (100 g/mol), and 1 mol of B₂ (80 g/mol) at 95% conversion of B¹ groups and 90% conversion of B² groups.

>>> from polykin.stepgrowth.solutions import Miller_1
>>> Mn, Mw = Miller_1(0.1, 0.9, 1.0, 3, 150., 100., 80., 0.95, 0.90)
>>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
Mn=1233; Mw=5024
Source code in src/polykin/stepgrowth/solutions.py
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
def Miller_1(nAf: float,
             nA2: float,
             nB2: float,
             f: int,
             MAf: float,
             MA2: float,
             MB2: float,
             pB1: float,
             pB2: float
             ) -> tuple[float, float]:
    r"""Miller and Macosko's analytical solution for Af and A₂ reacting with
    B₂, where the two B groups comprising the B₂ monomer react at different
    rates.

    The expressions for the number- and mass-average molar masses are:

    \begin{aligned}
    M_n &= \frac{M_{A_f}A_f + M_{A_2}A_2 + M_{B_2}B_2}{A_f + A_2 + B_2(1 - p_{B^1} - p_{B^2})} \\
    M_w &= \frac{M_{A_f}A_fE(W_{A_f}) + M_{A_2}A_2E(W_{A_2}) + M_{B_2}B_2E(W_{B_2})}
                {M_{A_f}A_f + M_{A_2}A_2 + M_{B_2}B_2}
    \end{aligned}

    where $E(W_X)$ is the expected weight attached to a unit of type $X$.

    **References**

    *   D. R. Miller and C. W. Macosko, Average Property Relations for
        Nonlinear Polymerization with Unequal Reactivity, Macromolecules 1978,
        11, 4, 656-662. https://doi.org/10.1021/ma60064a008

    Parameters
    ----------
    nAf : float
        Relative mole amount of Af monomer.
        Unit = mol or mol/mol.
    nA2 : float
        Relative mole amount of A₂ monomer.
        Unit = mol or mol/mol.
    nB2 : float
        Relative mole amount of B¹B² monomer.
        Unit = mol or mol/mol.
    f : int
        Functionality of Af.
    MAf : float
        Molar mass of reacted Af monomer.
    MA2 : float
        Molar mass of reacted A₂ monomer.
    MB2 : float
        Molar mass of reacted B¹B² monomer.
    pB1 : float
        Conversion of B¹ groups.
    pB2 : float
        Conversion of B² groups.

    Returns
    -------
    tuple[float, float]
        Tuple of molar mass averages, ($M_n$, $M_w$).

    Examples
    --------
    Calculate Mn and Mw for a mixture with 0.1 mol of A₃ (150 g/mol), 0.9 mol
    of A₂ (100 g/mol), and 1 mol of B₂ (80 g/mol) at 95% conversion of B¹
    groups and 90% conversion of B² groups.
    >>> from polykin.stepgrowth.solutions import Miller_1
    >>> Mn, Mw = Miller_1(0.1, 0.9, 1.0, 3, 150., 100., 80., 0.95, 0.90)
    >>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
    Mn=1233; Mw=5024
    """

    r = (f*nAf + 2*nA2)/(2*nB2)
    pA = 0.5*(pB1 + pB2)/r
    af = f*nAf/(f*nAf + 2*nA2)

    EAout = (pA*MB2 + pB1*pB2/r*((1 - af)*MA2 + af*MAf)) / \
        (1 - pB1*pB2/r*(1 + (f - 2)*af))
    EBout = (1 - af)*MA2 + af*MAf + (1 + (f - 2)*af)*EAout
    EB1out = pB1*EBout
    EB2out = pB2*EBout

    EAf = MAf + f*EAout
    EA2 = MA2 + 2*EAout
    EBB = MB2 + EB1out + EB2out

    Mn = (MAf*nAf + MA2*nA2 + MB2*nB2)/(nAf + nA2 + nB2 - nB2*(pB1 + pB2))
    Mw = (MAf*nAf*EAf + MA2*nA2*EA2 + MB2*nB2*EBB) / \
        (MAf*nAf + MA2*nA2 + MB2*nB2)

    return (Mn, Mw)

Miller_2 ¤

Miller_2(
    nAf: float,
    nB2: float,
    f: int,
    MAf: float,
    MB2: float,
    p: FloatVectorLike,
) -> tuple[float, float]

Miller and Macosko's analytical solution for Af reacting with B₂, with first-shell substitution effect on the A's and independent reaction for B's.

The expressions for the number- and mass-average molar masses are:

\[\begin{aligned} M_n &= \frac{M_{A_f}A_f + M_{B_2}B_2}{A_f(1 - f p_A) + B_2} \\ M_w &= \frac{ 2\frac{r}{f}\left( 1 + r p_A \left( f p_A - \mu + 1 \right) \right) M_{A_f}^2 + \left( 1 + r p_A \left( \mu - 1 \right) \right) M_{B_2}^2 + 4 r p_A M_{A_f} M_{B_2} } {\left( 2\frac{r}{f} M_{A_f} + M_{B_2} \right) \left( 1 - r p_A \left(\mu - 1 \right) \right)} \end{aligned}\]

with:

\[ \mu = \frac{\sum_{i=1}^f i^2 p_i}{\sum_{i=1}^f i p_i} \]

where \(r\) is the molar ratio of A to B groups, \(p_i\) is the fraction of \(A_f\) units wich have exactly \(i\) reacted sites, and \(p_A=\sum_{i=1}^f (i/f)p_i\) is the total conversion of A groups. The latter must respect the limit imposed by the gelation condition \(p_A < [r(\mu-1)]^{-1}\).

References

  • D. R. Miller and C. W. Macosko, Substitution Effects in Property Relations for Stepwise Polyfunctional Polymerization, Macromolecules 1980 13 (5), 1063-1069. https://doi.org/10.1021/ma60077a008
PARAMETER DESCRIPTION
nAf

Relative mole amount of Af monomer. Unit = mol or mol/mol.

TYPE: float

nB2

Relative mole amount of B₂ monomer. Unit = mol or mol/mol.

TYPE: float

f

Functionality of Af.

TYPE: int

MAf

Molar mass of reacted Af monomer.

TYPE: float

MB2

Molar mass of reacted B₂ monomer.

TYPE: float

p

Vector of reaction extents \((p_1, ..., p_f)\), where \(p_i\) denotes the fraction of \(A_f\) units wich have exactly \(i\) reacted sites.

TYPE: FloatVectorLike

RETURNS DESCRIPTION
tuple[float, float]

Tuple of molar mass averages, (\(M_n\), \(M_w\)).

Examples:

Calculate Mn and Mw for a mixture with 1 mol of A₃ (100 g/mol) and 1.5 mol of B₂ (80 g/mol) at a conversion of A₃ corresponding to p=[0.1, 0.2, 0.4].

>>> from polykin.stepgrowth.solutions import Miller_2
>>> Mn, Mw = Miller_2(1., 1.5, 3, 100., 80., [0.1, 0.2, 0.4])
>>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
Mn=275; Mw=3822
Source code in src/polykin/stepgrowth/solutions.py
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
def Miller_2(nAf: float,
             nB2: float,
             f: int,
             MAf: float,
             MB2: float,
             p: FloatVectorLike,
             ) -> tuple[float, float]:
    r"""Miller and Macosko's analytical solution for Af reacting with B₂,
    with first-shell substitution effect on the A's and independent reaction
    for B's.

    The expressions for the number- and mass-average molar masses are:

    \begin{aligned}
    M_n &= \frac{M_{A_f}A_f + M_{B_2}B_2}{A_f(1 - f p_A) + B_2} \\
    M_w &= \frac{ 2\frac{r}{f}\left( 1 + r p_A \left( f p_A - \mu + 1 \right) \right) M_{A_f}^2 
    + \left( 1 + r p_A \left( \mu - 1 \right) \right) M_{B_2}^2 + 4 r p_A M_{A_f} M_{B_2} }
    {\left( 2\frac{r}{f} M_{A_f} + M_{B_2} \right) \left( 1 - r p_A \left(\mu - 1 \right) \right)}
    \end{aligned}

    with:

    $$ \mu = \frac{\sum_{i=1}^f i^2 p_i}{\sum_{i=1}^f i p_i} $$

    where $r$ is the molar ratio of A to B groups, $p_i$ is the fraction of
    $A_f$ units wich have exactly $i$ reacted sites, and 
    $p_A=\sum_{i=1}^f (i/f)p_i$ is the total conversion of A groups. The latter
    must respect the limit imposed by the gelation condition
    $p_A < [r(\mu-1)]^{-1}$.

    **References**

    *   D. R. Miller and C. W. Macosko, Substitution Effects in Property
        Relations for Stepwise Polyfunctional Polymerization, Macromolecules
        1980 13 (5), 1063-1069. https://doi.org/10.1021/ma60077a008

    Parameters
    ----------
    nAf : float
        Relative mole amount of Af monomer.
        Unit = mol or mol/mol.
    nB2 : float
        Relative mole amount of B₂ monomer.
        Unit = mol or mol/mol.
    f : int
        Functionality of Af.
    MAf : float
        Molar mass of reacted Af monomer.
    MB2 : float
        Molar mass of reacted B₂ monomer.
    p : FloatVectorLike
        Vector of reaction extents $(p_1, ..., p_f)$, where $p_i$ denotes
        the fraction of $A_f$ units wich have exactly $i$ reacted sites.

    Returns
    -------
    tuple[float, float]
        Tuple of molar mass averages, ($M_n$, $M_w$).

    Examples
    --------
    Calculate Mn and Mw for a mixture with 1 mol of A₃ (100 g/mol) and 1.5 mol
    of B₂ (80 g/mol) at a conversion of A₃ corresponding to p=[0.1, 0.2, 0.4].
    >>> from polykin.stepgrowth.solutions import Miller_2
    >>> Mn, Mw = Miller_2(1., 1.5, 3, 100., 80., [0.1, 0.2, 0.4])
    >>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
    Mn=275; Mw=3822

    """

    p = np.asarray(p)

    i = np.arange(1, f + 1, dtype=np.int32)
    sip = dot(i, p)
    m = dot(i**2, p) / sip

    pA = sip/f
    r = (f*nAf)/(2*nB2)

    if r*pA*(m - 1) < 1.:
        Mn = (MAf*nAf + MB2*nB2)/(nAf + nB2 - f*nAf*pA)

        Mw = ((2*r/f)*(1 + r*pA*(f*pA - m + 1))*MAf**2 + (1 + r*pA*(m - 1))
              * MB2**2 + 4*r*pA*MAf*MB2)/(((2*r/f)*MAf + MB2)*(1 - r*pA*(m - 1)))
    else:
        Mn = np.nan
        Mw = np.nan

    return (Mn, Mw)

Stockmayer ¤

Stockmayer(
    nA: FloatVectorLike,
    nB: FloatVectorLike,
    f: IntVectorLike,
    g: IntVectorLike,
    MA: FloatVectorLike,
    MB: FloatVectorLike,
    pB: float,
) -> tuple[float, float]

Stockmayer's analytical solution for an arbitrary mixture of A-type monomers reacting with an arbitry mixture of B-type monomers.

The expressions for the number- and mass-average molar masses are:

\[\begin{aligned} M_n &= \frac{\sum_i M_{A,i}A_i + \sum_j M_{B,j}B_j}{\sum_i A_i + \sum_j B_j -p_A\sum_i f_iA_i} \\ M_w &= \frac{p_B\frac{\sum_i M_{A,i}^2A_i}{\sum_i f_i A_i}+p_A\frac{\sum_j M_{B,j}^2B_j} {\sum_j g_j B_j}+\frac{p_Ap_B[p_A(f_e-1)M_b^2+p_B(g_e-1)M_a^2+2M_aM_b)]}{1-p_A p_B(f_e-1)(g_e-1)}} {p_B\frac{\sum_i M_{A,i}A_i}{\sum_i f_i A_i}+p_A\frac{\sum_j M_{B,j}B_j}{\sum_j g_j B_j}} \end{aligned}\]

with:

\[\begin{aligned} f_e &= \frac{\sum_i f_i^2 A_i}{\sum_i f_i A_i} \\ g_e &= \frac{\sum_j g_j^2 B_j}{\sum_j g_j B_j} \\ M_a &= \frac{\sum_i M_{A,i}f_i A_i}{\sum_i f_i A_i} \\ M_b &= \frac{\sum_j M_{B,j}g_j B_j}{\sum_j g_j B_j} \end{aligned}\]

where \(p_A\) and \(p_B\) denote, respectively, the conversion of A and B groups, which must respect the limit imposed by the gelation condition \(p_A p_B < [(f_e-1)(g_e - 1)]^{-1}\).

References

PARAMETER DESCRIPTION
nA

Vector (N) with relative mole amounts of A monomers. Unit = mol or mol/mol.

TYPE: FloatVectorLike

nB

Vector (M) with relative mole amounts of B monomers. Unit = mol or mol/mol.

TYPE: FloatVectorLike

f

Vector (N) with functionality of A monomers.

TYPE: IntVectorLike

g

Vector (M) with functionality of B monomers.

TYPE: IntVectorLike

MA

Vector (N) with molar mass of reacted A monomers.

TYPE: FloatVectorLike

MB

Vector (M) with molar mass of reacted B monomers.

TYPE: FloatVectorLike

pB

Overall conversion of B groups.

TYPE: float

RETURNS DESCRIPTION
tuple[float, float]

Tuple of molar mass averages, (\(M_n\), \(M_w\)).

Examples:

Calculate Mn and Mw for a mixture with 1 mol of A₂ (100 g/mol), 0.01 mol of A₃ (150 g/mol), 1.01 mol of B₂ (80 g/mol) and 0.03 mol of B (40 g/mol) at 99% conversion of B groups.

>>> from polykin.stepgrowth.solutions import Stockmayer
>>> Mn, Mw = Stockmayer(nA=[1., 0.01], nB=[1.01, 0.03], f=[2, 3], g=[2, 1],
...                     MA=[100., 150.], MB=[80., 40.], pB=0.99)
>>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
Mn=8951; Mw=34722
Source code in src/polykin/stepgrowth/solutions.py
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
def Stockmayer(nA: FloatVectorLike,
               nB: FloatVectorLike,
               f: IntVectorLike,
               g: IntVectorLike,
               MA: FloatVectorLike,
               MB: FloatVectorLike,
               pB: float
               ) -> tuple[float, float]:
    r"""Stockmayer's analytical solution for an arbitrary mixture of A-type
    monomers reacting with an arbitry mixture of B-type monomers.

    The expressions for the number- and mass-average molar masses are:

    \begin{aligned}
    M_n &= \frac{\sum_i M_{A,i}A_i + \sum_j M_{B,j}B_j}{\sum_i A_i + \sum_j B_j -p_A\sum_i f_iA_i} \\
    M_w &= \frac{p_B\frac{\sum_i M_{A,i}^2A_i}{\sum_i f_i A_i}+p_A\frac{\sum_j M_{B,j}^2B_j}
    {\sum_j g_j B_j}+\frac{p_Ap_B[p_A(f_e-1)M_b^2+p_B(g_e-1)M_a^2+2M_aM_b)]}{1-p_A p_B(f_e-1)(g_e-1)}}
    {p_B\frac{\sum_i M_{A,i}A_i}{\sum_i f_i A_i}+p_A\frac{\sum_j M_{B,j}B_j}{\sum_j g_j B_j}}
    \end{aligned}

    with:

    \begin{aligned}
    f_e &= \frac{\sum_i f_i^2 A_i}{\sum_i f_i A_i}  \\
    g_e &= \frac{\sum_j g_j^2 B_j}{\sum_j g_j B_j} \\
    M_a &= \frac{\sum_i M_{A,i}f_i A_i}{\sum_i f_i A_i}  \\
    M_b &= \frac{\sum_j M_{B,j}g_j B_j}{\sum_j g_j B_j}
    \end{aligned}

    where $p_A$ and $p_B$ denote, respectively, the conversion of A and B
    groups, which must respect the limit imposed by the gelation condition
    $p_A p_B < [(f_e-1)(g_e - 1)]^{-1}$.

    **References**

    *   Stockmayer, W.H. (1952), Molecular distribution in condensation
        polymers. J. Polym. Sci., 9: 69-71. https://doi.org/10.1002/pol.1952.120090106

    Parameters
    ----------
    nA : FloatVectorLike
        Vector (N) with relative mole amounts of A monomers.
        Unit = mol or mol/mol.
    nB : FloatVectorLike
        Vector (M) with relative mole amounts of B monomers.
        Unit = mol or mol/mol.
    f : IntVectorLike
        Vector (N) with functionality of A monomers.
    g : IntVectorLike
        Vector (M) with functionality of B monomers.
    MA : FloatVectorLike
        Vector (N) with molar mass of reacted A monomers.
    MB : FloatVectorLike
        Vector (M) with molar mass of reacted B monomers.
    pB : float
        Overall conversion of B groups.

    Returns
    -------
    tuple[float, float]
        Tuple of molar mass averages, ($M_n$, $M_w$).

    Examples
    --------
    Calculate Mn and Mw for a mixture with 1 mol of A₂ (100 g/mol), 0.01 mol of
    A₃ (150 g/mol), 1.01 mol of B₂ (80 g/mol) and 0.03 mol of B (40 g/mol) at
    99% conversion of B groups.
    >>> from polykin.stepgrowth.solutions import Stockmayer
    >>> Mn, Mw = Stockmayer(nA=[1., 0.01], nB=[1.01, 0.03], f=[2, 3], g=[2, 1],
    ...                     MA=[100., 150.], MB=[80., 40.], pB=0.99)
    >>> print(f"Mn={Mn:.0f}; Mw={Mw:.0f}")
    Mn=8951; Mw=34722
    """

    nA = np.asarray(nA)
    nB = np.asarray(nB)
    f = np.asarray(f)
    g = np.asarray(g)
    MA = np.asarray(MA)
    MB = np.asarray(MB)

    sMA = dot(MA, nA)
    sM2A = dot(MA**2, nA)
    sfA = dot(f, nA)
    sf2A = dot(f**2, nA)
    sMB = dot(MB, nB)
    sM2B = dot(MB**2, nB)
    sgB = dot(g, nB)
    sg2B = dot(g**2, nB)

    fe = sf2A/sfA
    ge = sg2B/sgB
    Ma = np.sum(MA*f*nA)/sfA
    Mb = np.sum(MB*g*nB)/sgB

    pA = pB*sgB/sfA

    pB_gel = sqrt(sfA/(sgB*(fe - 1)*(ge - 1)))
    if pB >= pB_gel:
        return (np.nan, np.nan)

    Mn = (sMA + sMB)/(nA.sum() + nB.sum() - pA*sfA)

    Mw = (pB*(sM2A/sfA) + pA*(sM2B/sgB) + pA*pB *
          (pA*(fe - 1)*Mb**2 + pB*(ge - 1)*Ma**2 + 2*Ma*Mb) /
          (1 - pA*pB*(fe - 1)*(ge - 1)))/(pB*(sMA/sfA) + pA*(sMB/sgB))

    return (Mn, Mw)