I'm confused about the entropy change if two gases, initially separated, are mixed together in a rigid box. I use the following
$$\Delta S_1= n_1 c_{v,1} \mathrm{ln}\left( \frac{T_f}{T_{i,1}}\right) + n_1 R \mathrm{ln}\left(\frac{V_1+V_2}{V_1}\right)\tag{A}$$
$$\Delta S_2= n_2 c_{v,2} \mathrm{ln}\left( \frac{T_f}{T_{i,2}}\right) + n_2 R \mathrm{ln}\left(\frac{V_1+V_2}{V_2}\right)\tag{B}$$
And $\Delta S=\Delta S_1+\Delta S_2$. I'm ok with this.
But I read in a textbook that I can use formulas $(\text{A})$ and $(\text{B})$ only if the two gases are different.
In the case where I have the mixture of the same gas, I must use
$$\Delta S_1= n_1 c_{v,1} \mathrm{ln}\left( \frac{T_f}{T_{i,1}}\right) - n_1 R \mathrm{ln}\left(\frac{p_f}{p_{i,1}}\right)\tag{C}$$
$$\Delta S_2= n_2 c_{v,2} \mathrm{ln}\left( \frac{T_f}{T_{i,2}}\right) - n_2 R \mathrm{ln}\left(\frac{p_f}{p_{i,2}}\right)\tag{D}$$
Otherwise, the change in entropy would be zero.
Is that correct or is there something I am missing?
If that is true, then how can that be? For instance, $(\text{A})$ and $(\text{C})$ should be equivalent as $S$ is a state function. I do not see how can there be a difference in those formulas for calculating $S$ and the reason why two of them give the correct result and the others do not.