Skip to content

polykin.copolymerization¤

radical_fractions_multi ¤

radical_fractions_multi(
    f: FloatVectorLike, k: FloatSquareMatrix
) -> FloatVector

Calculate the radical fractions for a multicomponent system.

In a multicomponent system, the radical fractions \(p_i\) can be determined by solving the following set of linear algebraic equations:

\[ \sum_{j\ne i}^N k_{ij} p_i f_j = \sum_{j\ne i}^N k_{ji} p_j f_i \]

where \(k_{ij}\) are the cross-propagation rate coefficients and \(f_i\) are the monomer compositions. Note that the homo-propagation rate coefficients \(k_{ii}\) do not appear in the equations. For this reason, radical fractions cannot be evaluated from reactivity ratios alone.

PARAMETER DESCRIPTION
f

Vector of instantaneous monomer compositions, \(f_i\).

TYPE: FloatVectorLike(N)

k

Matrix of cross-propagation rate coefficients. The diagonal elements \(k_{ii}\) are not used.

TYPE: FloatSquareMatrix(N, N)

RETURNS DESCRIPTION
FloatVector(N)

Vector of radical fractions, \(p_i\).

See also

Examples:

>>> from polykin.copolymerization import radical_fractions_multi
>>> import numpy as np

Define the cross-propagation coefficient matrix.

>>> k = np.zeros((3, 3))
>>> k[0, 1] = 500.
>>> k[1, 0] = 50.
>>> k[0, 2] = 30.
>>> k[2, 0] = 200.
>>> k[1, 2] = 300.
>>> k[2, 1] = 40.

Evaluate the radical fractions at f1=0.5, f2=0.3, f3=0.2.

>>> f = [0.5, 0.3, 0.2]
>>> p = radical_fractions_multi(f, k)
>>> p
array([0.25012791, 0.47956341, 0.27030868])
Source code in src/polykin/copolymerization/multicomponent.py
325
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
def radical_fractions_multi(f: FloatVectorLike,
                            k: FloatSquareMatrix,
                            ) -> FloatVector:
    r"""Calculate the radical fractions for a multicomponent system.

    In a multicomponent system, the radical fractions $p_i$ can be determined
    by solving the following set of linear algebraic equations:

    $$ \sum_{j\ne i}^N k_{ij} p_i f_j = \sum_{j\ne i}^N k_{ji} p_j f_i $$

    where $k_{ij}$ are the cross-propagation rate coefficients and $f_i$ are
    the monomer compositions. Note that the homo-propagation rate coefficients
    $k_{ii}$ do not appear in the equations. For this reason, radical fractions
    cannot be evaluated from reactivity ratios alone.

    Parameters
    ----------
    f : FloatVectorLike (N)
        Vector of instantaneous monomer compositions, $f_i$.
    k : FloatSquareMatrix (N, N)
        Matrix of cross-propagation rate coefficients. The diagonal elements
        $k_{ii}$ are not used.

    Returns
    -------
    FloatVector (N)
        Vector of radical fractions, $p_i$.

    See also
    --------
    * [`radical_fractions_ternary`](radical_fractions_ternary.md):
      specific method for terpolymer systems.

    Examples
    --------
    >>> from polykin.copolymerization import radical_fractions_multi
    >>> import numpy as np

    Define the cross-propagation coefficient matrix.
    >>> k = np.zeros((3, 3))
    >>> k[0, 1] = 500.
    >>> k[1, 0] = 50.
    >>> k[0, 2] = 30.
    >>> k[2, 0] = 200.
    >>> k[1, 2] = 300.
    >>> k[2, 1] = 40.

    Evaluate the radical fractions at f1=0.5, f2=0.3, f3=0.2.
    >>> f = [0.5, 0.3, 0.2]
    >>> p = radical_fractions_multi(f, k)
    >>> p
    array([0.25012791, 0.47956341, 0.27030868])
    """
    f = np.asarray(f)

    A = k.T * f[:, np.newaxis]
    x = A.sum(axis=0)
    np.fill_diagonal(A, A.diagonal() - x)
    A[-1, :] = 1.
    b = np.zeros(A.shape[0])
    b[-1] = 1.
    p = np.linalg.solve(A, b)

    return p