Skip to content

polykin.copolymerization¤

inst_copolymer_binary ¤

inst_copolymer_binary(
    f1: Union[float, FloatArrayLike],
    r1: Union[float, FloatArray],
    r2: Union[float, FloatArray],
) -> Union[float, FloatArray]

Calculate the instantaneous copolymer composition using the Mayo-Lewis equation.

For a binary system, the instantaneous copolymer composition \(F_i\) is related to the comonomer composition \(f_i\) by:

\[ F_1=\frac{r_1 f_1^2 + f_1 f_2}{r_1 f_1^2 + 2 f_1 f_2 + r_2 f_2^2} \]

where \(r_i\) are the reactivity ratios. Although the equation is written using terminal model notation, it is equally applicable in the frame of the penultimate model if \(r_i \rightarrow \bar{r}_i\).

References

PARAMETER DESCRIPTION
f1

Molar fraction of M1.

TYPE: float | FloatArrayLike

r1

Reactivity ratio of M1, \(r_1\) or \(\bar{r}_1\).

TYPE: float | FloatArray

r2

Reactivity ratio of M2, \(r_2\) or \(\bar{r}_2\).

TYPE: float | FloatArray

RETURNS DESCRIPTION
float | FloatArray

Instantaneous copolymer composition, \(F_1\).

See also

Examples:

>>> from polykin.copolymerization import inst_copolymer_binary

An example with f1 as scalar.

>>> F1 = inst_copolymer_binary(f1=0.5, r1=0.16, r2=0.70)
>>> print(f"F1 = {F1:.3f}")
F1 = 0.406

An example with f1 as list.

>>> F1 = inst_copolymer_binary(f1=[0.2, 0.6, 0.8], r1=0.16, r2=0.70)
>>> F1
array([0.21487603, 0.45812808, 0.58259325])
Source code in src/polykin/copolymerization/binary.py
21
22
23
24
25
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
@jit
def inst_copolymer_binary(f1: Union[float, FloatArrayLike],
                          r1: Union[float, FloatArray],
                          r2: Union[float, FloatArray]
                          ) -> Union[float, FloatArray]:
    r"""Calculate the instantaneous copolymer composition using the
    [Mayo-Lewis](https://en.wikipedia.org/wiki/Mayo%E2%80%93Lewis_equation)
     equation.

    For a binary system, the instantaneous copolymer composition $F_i$ is
    related to the comonomer composition $f_i$ by:

    $$ F_1=\frac{r_1 f_1^2 + f_1 f_2}{r_1 f_1^2 + 2 f_1 f_2 + r_2 f_2^2} $$

    where $r_i$ are the reactivity ratios. Although the equation is written
    using terminal model notation, it is equally applicable in the frame of the
    penultimate model if $r_i \rightarrow \bar{r}_i$.

    **References**

    *   [Mayo & Lewis (1944)](https://doi.org/10.1021/ja01237a052)

    Parameters
    ----------
    f1 : float | FloatArrayLike
        Molar fraction of M1.
    r1 : float | FloatArray
        Reactivity ratio of M1, $r_1$ or $\bar{r}_1$.
    r2 : float | FloatArray
        Reactivity ratio of M2, $r_2$ or $\bar{r}_2$.

    Returns
    -------
    float | FloatArray
        Instantaneous copolymer composition, $F_1$.

    See also
    --------
    * [`inst_copolymer_ternary`](inst_copolymer_ternary.md):
      specific method for terpolymer systems.
    * [`inst_copolymer_multi`](inst_copolymer_multi.md):
      generic method for multicomponent systems.

    Examples
    --------
    >>> from polykin.copolymerization import inst_copolymer_binary

    An example with f1 as scalar.
    >>> F1 = inst_copolymer_binary(f1=0.5, r1=0.16, r2=0.70)
    >>> print(f"F1 = {F1:.3f}")
    F1 = 0.406

    An example with f1 as list.
    >>> F1 = inst_copolymer_binary(f1=[0.2, 0.6, 0.8], r1=0.16, r2=0.70)
    >>> F1
    array([0.21487603, 0.45812808, 0.58259325])

    """
    f1 = np.asarray(f1)
    f2 = 1 - f1
    return (r1*f1**2 + f1*f2)/(r1*f1**2 + 2*f1*f2 + r2*f2**2)