Cardano

Chemical Reactor Design Toolbox Reference Manual

ChemReactorDesign.Basic.Gas.Functions.Cardano

The function solves the cubic equation

\begin{equation*}
x^{3} + U \, x^{2} + S \, x + T = 0
\end{equation*}

Using Cardano's formula (Jürgen Gmehling and Michael Kleiber and Bärbel Kolbe and Jürgen Rarey, 2019), this type of equation can be solved analytically.

With the abbreviations

\begin{equation*}
P = \frac{3 \, S - U^{2}}{3}
\qquad
Q = \frac{2 \, U^{3}{27} - \frac{U \ S}{3} + T
\end{equation*}

the discriminant can be determined as

\begin{equation*}
D = \left( \frac{P}{3} \right)^{3} + \left( \frac{Q}{2}\right)^{2}
\end{equation*}

For \(D>0\), the equation of state has one real solution:

\begin{equation*}
z = \left[\sqrt{D}-\frac{Q}{2}\right]^{1/3}-
\frac{P}{3 \, \left[\sqrt{D}-\frac{Q}{2}\right]^{1/3}} -
\frac{U}{3}
\end{equation*}

For \(D<0\), there are three real solutions. With the abbrevations

\begin{equation*}
\Theta = \sqrt{-\frac{P^{3}}{27}} \quad \text{and} \quad
\Phi = \arc \cos \left(-\frac{Q}{2 \, \Theta} \right)
\end{equation*}

they can be written as

\begin{align*}
x_{1} = & 2 \, \Theta^{1/3} \, \cos \left(\frac{\Phi}{3} \right) \\
x_{2} = & 2 \,  \Theta^{1/3} \, \cos \left(\frac{\Phi}{3} + \frac{2 \, \pi}{3}\right) \\
x_{3} = & 2 \,  \Theta^{1/3} \, \cos \left(\frac{\Phi}{3} + \frac{4 \, \pi}{3}\right)
\end{align*}