我遇到了一个问题,但找不到答案。我想表示一个方程组,但它给了我以下错误“未识别的控制序列”。此外,在一个方程中,我的 lamdas 在输出中缺失。这些是我在 Latex 代码中的方程式:
$\frac{\partial W}{\partial x} = 0,1 - 2 \lamda \sigma_x^2 x - 2\lamda\sigma_x\sigma_y\rho_{xy}y - \mu = 0$
$\frac{\partial W}{\partial y} = 0,5 - 2 \lamda \sigma_y^2 y - 2\lamda\sigma_x\sigma_y\rho_{xy}x - \mu = 0$
$\frac{\partial W}{\partial p} = - 2p\mu = 0$
$\frac{\partial W}{\partial \lamda } = -\lamda_x^2x^2-\lamda_y^2y^2-2\lamda_x\lamda_y\rho_{xy}+\lamda_p^2 = 0$
$\frac{\partial W}{\partial \mu} = -x-y-p^2+1 = 0$
下面你可以看到我的输出。我收到了所有行的错误消息。此外,正如你在公式 4 中看到的,lamdas 在输出中缺失。我希望有人能帮我解决这个问题
答案1
根据我的评论...这里有解决方案。
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{equation}
\begin{split}
\frac{\partial W}{\partial x} &= 0,1 - 2 \lambda \sigma_x^2 x - 2\lambda\sigma_x\sigma_y\rho_{xy}y - \mu = 0\\
\frac{\partial W}{\partial y}& = 0,5 - 2 \lambda \sigma_y^2 y - 2\lambda\sigma_x\sigma_y\rho_{xy}x - \mu = 0\\
\frac{\partial W}{\partial p}& = - 2p\mu = 0\\
\frac{\partial W}{\partial \lambda}&= -\lambda_x^2x^2-\lambda_y^2y^2-2\lambda_x\lambda_y\rho_{xy}+\lambda_p^2 = 0\\
\frac{\partial W}{\partial \mu}& = -x-y-p^2+1 = 0
\end{split}
\end{equation}
\end{document}
附录1:
如果您使用siunitx
带有选项的包
\sisetup{output-decimal-marker={,}}
逗号和1或者5. 看这个例子:
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{siunitx}
\sisetup{output-decimal-marker={,}}
\begin{document}
\begin{equation}
\begin{split}
\frac{\partial W}{\partial x} &= \num{0,1} - 2 \lambda \sigma_x^2 x - 2\lambda\sigma_x\sigma_y\rho_{xy}y - \mu = 0\\
\frac{\partial W}{\partial y}& = \num{0,5} - 2 \lambda \sigma_y^2 y - 2\lambda\sigma_x\sigma_y\rho_{xy}x - \mu = 0\\
\frac{\partial W}{\partial p}& = - 2p\mu = 0\\
\frac{\partial W}{\partial \lambda}&= -\lambda_x^2x^2-\lambda_y^2y^2-2\lambda_x\lambda_y\rho_{xy}+\lambda_p^2 = 0\\
\frac{\partial W}{\partial \mu}& = -x-y-p^2+1 = 0
\end{split}
\end{equation}
\end{document}
附录2:
这里采用了非常好的用户@Mico 的建议icomma
。
\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{icomma}
\begin{document}
\begin{equation}
\begin{split}
\frac{\partial W}{\partial x} &= 0,1 - 2 \lambda \sigma_x^2 x - 2\lambda\sigma_x\sigma_y\rho_{xy}y - \mu = 0\\
\frac{\partial W}{\partial y}& = 0,5 - 2 \lambda \sigma_y^2 y - 2\lambda\sigma_x\sigma_y\rho_{xy}x - \mu = 0\\
\frac{\partial W}{\partial p}& = - 2p\mu = 0\\
\frac{\partial W}{\partial \lambda}&= -\lambda_x^2x^2-\lambda_y^2y^2-2\lambda_x\lambda_y\rho_{xy}+\lambda_p^2 = 0\\
\frac{\partial W}{\partial \mu}& = -x-y-p^2+1 = 0
\end{split}
\end{equation}
\end{document}