TransWikia.com

How can I improve displaying repetitive equations

TeX - LaTeX Asked by Jasper on August 23, 2021

I’m looking to improve my report quality by making equations more clear. As the equations I’m stating are repetitive a couple of times throughout the report I thought it would be better to use matrix notation.

Currently the equations look like this:

begin{align}
    dCA_{p,1} =  - &1 cdot A - 2 cdot B + 3 cdot C nonumber
                 + &4 cdot A cdot B + 5 cdot A^2 - 6 cdot C ^2label{eq:dCA_p_1_2}
    dCA_{m,1} =  &8 cdot A - 9 cdot B + 5 cdot C nonumber
                - &5 cdot A cdot B - 4 cdot A^2 + 1 cdot B^2label{eq:dCA_m_1_2}
                - &3 cdot C ^2nonumber
    dCA_{l,1} =  &3 - 3 cdot A - 2 cdot B - 3 cdot C  + 3 cdot Dnonumber
                + &5 cdot Acdot B - 3 cdot Acdot D label{eq:dCA_l_1_2}
                - &1 cdot Bcdot D - 2 cdot C cdot D + 3 cdot B^2nonumber
                + &2 cdot C ^2 + 6 cdot D^2nonumber
end{align}

One can clearly notice the repetitive parameters A , B , C and D. Therefore I tried the following approach:

begin{equation}
  left( begin{array}{c}
    dCA_{p,1}
    dCA_{m,1}
    dCA_{l,1}  end{array}right)
  =
  left(begin{array}{cccccccccccccc}
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 
  end{array}right)   
  left(begin{array}{c}
      A
      B
      C
      D
      Acdot B
      Acdot C
      Acdot D
      Bcdot C
      Bcdot D
      Ccdot D
      A^2
      B^2
      C^2
      D^2 end{array}right)
end{equation}

This output is however very wide and long. Already with single rounded numbers. Actual numbers would be a 4 digit number, for example: 2.314.


Is the last approach the way to go or are there other possibilities? Maybe there is a way to reduce the length by rewriting the squared signs in another way. I’m not sure how accomplish this.

Replacing the array with pmatrix gives a slightly slimmer expression, yet still very wide…

begin{equation}
  left( begin{array}{c}
    dCA_{p,1}
    dCA_{m,1}
    dCA_{l,1}  end{array}right)
  =
  begin{pmatrix}
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 
  end{pmatrix}   left(begin{array}{c}
      A
      B
      C
      D
      Acdot B
      Acdot C
      Acdot D
      Bcdot C
      Bcdot D
      Ccdot D
      A^2
      B^2
      C^2
      D^2 end{array}right)
end{equation}

As proposed by Mico, as far as i understood:

begin{equation}
  begin{pmatrix}
    dCA_{p,1}
    dCA_{m,1}
    dCA_{l,1}  
  pmatrix{pmatrix}
  =
  begin{pmatrix}
    1 & 2 & 3 & 4  
    1 & 2 & 3 & 4  
    1 & 2 & 3 & 4  
  end{pmatrix}   
  begin{pmatrix}
      A
      B
      C
      D
   end{pmatrix}
   +   
   begin{pmatrix}
        1 & 2 & 3 & 4 & 5 & 6 
        1 & 2 & 3 & 4 & 5 & 6 
        1 & 2 & 3 & 4 & 5 & 6  
   end{pmatrix}   
   begin{pmatrix}
   Acdot B
   Acdot C
   Acdot D
   Bcdot C
   Bcdot D
   Ccdot D
   begin{pmatrix} 
   +  
   begin{pmatrix}
    1 & 2 & 3 & 4  
    1 & 2 & 3 & 4  
    1 & 2 & 3 & 4  
   end{pmatrix}   
   begin{pmatrix}
   A^2
   B^2
   C^2   
   D^2 
   begin{pmatrix}
end{equation}

2 Answers

I would like to suggest a variant of your idea to use matrix algebra to display the equations. However, instead of displaying a (3x14) matrix and a (14x1) column vector, one could display three smaller matrices of order (3x4), (3x6), and (3x4) and column vectors of length 4, 6, and 4, respectively, to capture the linear, bilinear, and quadratic terms in A, B, C, and D.

This setup should give you enough space to use "real" coefficients, not just signed integers.

Whatever else you end up doing, I'd recommend losing the cdot terms.

(Aside: I provide no guarantee that I transcribed the coefficients correctly in the matrices shown below!)

enter image description here

documentclass{article}
usepackage{mathtools} % for 'pmatrix*' env.
setcounter{MaxMatrixCols}{14}
newcommandvn[1]{textit{#1}}
begin{document}

begin{equation}
begin{split}
  begin{pmatrix}
    dvn{CA}_{p,1}
    dvn{CA}_{m,1}
    dvn{CA}_{l,1}  
  end{pmatrix}
  &=
  begin{pmatrix*}[r]
   -1 & -2 &  3 & 0 
    8 & -9 &  5 & 0 
   -3 & -2 & -3 & 3  
  end{pmatrix*}  
  begin{pmatrix}
    A  B  C  D
  end{pmatrix} 
  &quad+
  begin{pmatrix*}[r]
    4 & 0 &  0 & 0 &  0 &  0 
   -5 & 0 &  0 & 0 &  0 &  0 
    0 & 0 &  0 & 0 & -1 & -2 
  end{pmatrix*}  
  begin{pmatrix}
    A B  A C  A D  B C  B D  C D
  end{pmatrix} 
  &quad+
  begin{pmatrix*}[r]
   5 & 0 & -6 &  0 
   0 & 0 & -3 &  0 
   0 & 0 &  2 &  6 
  end{pmatrix*}    
  begin{pmatrix}
      A^2  B^2  C^2  D^2 
  end{pmatrix}
end{split}
end{equation}
end{document}

Correct answer by Mico on August 23, 2021

The actual matrix would be too sparse to be useful in reading. I'd exploit the natural division of the terms into three categories: linear, product of two distinct variables, squares.

Typesetting vertically the fifteen-row matrix is too space consuming.

documentclass{article}
usepackage{amsmath}

setcounter{MaxMatrixCols}{15}

begin{document}

begin{align}
dCA_{p,1} &= - A - 2 B + 3 C notag 
          &qquad + 4 A B notag 
          &qquad + 5 A^2 - 6 C ^2 label{eq:dCA_p_1_2}
[1ex]
dCA_{m,1} &= 8 A - 9 B + 5 C notag 
          &qquad - 5 A B notag 
          &qquad - 4 A^2 + 1 B^2 - 3 C ^2 label{eq:dCA_m_1_2}
[1ex]
dCA_{l,1} &=  3 - 3 A - 2 B - 3 C  + 3 D notag 
          &qquad + 5 AB - 3 AD - BD - 2 C D notag 
          &qquad + 3 B^2 + 2 C^2 + 6 D^2 label{eq:dCA_l_1_2}
end{align}

begin{equation}
  begin{pmatrix}
  dCA_{p,1}
  dCA_{m,1}
  dCA_{l,1}
  end{pmatrix}
  = MT
end{equation}
where
begin{align*}
M &= begin{pmatrix}
     % 0    A    B    C    D   AB   AC   AD   BC   BD   CD   A2   B2   C2   D2
       0 & -1 & -2 &  3 &  0 &  4 &  0 &  0 &  0 &  0 &  0 &  5 &  0 &  0 &  0 
       0 &  8 & -9 &  5 &  0 & -5 &  0 &  0 &  0 &  0 &  0 & -4 &  1 & -3 &  0 
       3 & -3 & -2 & -3 &  3 &  5 &  0 & -3 &  0 & -1 & -2 &  0 &  3 &  2 &  6
  end{pmatrix}

T &=
     addtolength{arraycolsep}{-2pt}
     begin{pmatrix}
     1 & A & B & C & D & AB & AC & AD & BC & BD & CD & A^2 & B^2 & C^2 & D^2
     end{pmatrix}^T
end{align*}
are the necessary matrices.

end{document}

enter image description here

Answered by egreg on August 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP