I need to robustly generate the displayed equation from either
1- the coefficients of numerator and denominator defined by \NumCoeffMat
and \DenCoeffMat
, respectively
2- or the partial fraction terms defined by \PartialFraction
P.S. The coefficient of the highest order in the denominator is always positive one, so it is not given in the arrays.
Any coefficient of zero should exclude its associated order of s
from the written expression.
\documentclass{article}
\edef\NumCoeffMat{{4, 32, 62}} % numerator coefficients (i.e. numerator = 4s^2 + 32s + 62)
\edef\DenCoeffMat{{12, 47, 60}} % denominator coefficients (i.e. denominator = s^3 + 12s^2 + 47s + 60)
\def\PartialFraction{1/-3, 2/-4, 1/-5} % gain/coefficient and root (i.e. 1/(s+3) + 2/(s+4) + 1/(s+5) )
\begin{document}
\[
\frac{4\,s^2 + 32\,s + 62}{s^3 + 12\,s^2 + 47\,s + 60}
\]
\end{document}
Best Answer
Here is a general macro to write polynomials. The first argument is the indeterminate and the second is the list of coefficients
The next macro allows you to give the coefficients the way you want