TransWikia.com

i want to give equation number to multi-line equations

TeX - LaTeX Asked by memi on September 2, 2021

am trying to group the equations then give them 1 number as group

  begin{align*}
     &  sigma_w^2(t)=q_1(t)sigma_1^2(t)+q_2(t)sigma_2^2(t)
         & text{where} 
      & q_1(t)=sum_{i=1}^{t}P(i)  :& : q_1(t)=sum_{i=t+1}^{I}P(i)
    
     & mu_1(t)= sum_{i=1}^{t}frac{iP(i)}{q_1(t)} : & : mu_2(t)= sum_{i=t+1}^{I}frac{iP(i)}{q_2(t)}
    
     & sigma_1^2(t)=sum_{i=1}^{t}[i-mu_1(t)]^2 frac{P(i)}{q_1(t)} : & : sum_{i=t+1}^{I}[i-mu_1(t)]^2 frac{P(i)}{q_2(t)}
    label{EqOtsu}
    end{align*}

enter image description here

2 Answers

You can use the aligned enivoment instead of align. aligned can be used inside an equation.

Thus the multi line expression can be obtained with:

begin{equation}
  begin{aligned}
     &  sigma_w^2(t)=q_1(t)sigma_1^2(t)+q_2(t)sigma_2^2(t)
         & text{where} 
      & q_1(t)=sum_{i=1}^{t}P(i)  :& : q_1(t)=sum_{i=t+1}^{I}P(i)
    
     & mu_1(t)= sum_{i=1}^{t}frac{iP(i)}{q_1(t)} : & : mu_2(t)= sum_{i=t+1}^{I}frac{iP(i)}{q_2(t)}
    
     & sigma_1^2(t)=sum_{i=1}^{t}[i-mu_1(t)]^2 frac{P(i)}{q_1(t)} : & : sum_{i=t+1}^{I}[i-mu_1(t)]^2 frac{P(i)}{q_2(t)}
    label{EqOtsu}
 end{aligned}
end{equation}  

enter image description here

Answered by Guido on September 2, 2021

Your readers would have a hard time in understanding what the unique number refers to; I suggest using subequations.

documentclass{article}
usepackage{amsmath}

begin{document}

begin{subequations}label{EqOtsu}
begin{equation}
sigma_w^2(t)=q_1(t)sigma_1^2(t)+q_2(t)sigma_2^2(t) tag{ref{EqOtsu}}
end{equation}
where
begin{gather}
q_1(t)=sum_{i=1}^{t}P(i)
quad&quad
q_1(t)=sum_{i=t+1}^{I}P(i)

mu_1(t)=sum_{i=1}^{t}frac{iP(i)}{q_1(t)}
quad&quad
mu_2(t)= sum_{i=t+1}^{I}frac{iP(i)}{q_2(t)}

sigma_1^2(t)=sum_{i=1}^{t}[i-mu_1(t)]^2 frac{P(i)}{q_1(t)}
quad&quad
sigma_2^2(t)=sum_{i=t+1}^{I}[i-mu_1(t)]^2 frac{P(i)}{q_2(t)}
end{gather}
end{subequations}

end{document}

enter image description here

Answered by egreg on September 2, 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