u-替代积分

u-替代积分

我正在使用 u 代换求解积分。但是,当我编译代码时,显示代换的框没有放在正确的位置。而且,当我继续求解该问题时,框内输入了另一个具有新边界的积分。

\documentclass[12pt]{article}
\usepackage{authblk}
\usepackage{setspace}
\doublespacing% For double space
\usepackage{subeqnarray}
\usepackage{graphicx,epstopdf}
\usepackage[framed , numbered]{matlab-prettifier}% For MATLAB code
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{xcolor}
\usepackage{bigstrut}
\usepackage{tikz}

\renewcommand{\qedsymbol}{$\blacksquare$}

\usepackage{nccmath}% For adding Mathematical commands
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page margins as needed
\newcommand{\diff}{\mathop{}\!d}
\newcommand{\innerp}[2]{\left\langle #1 \vert #2 \right\rangle}
\usetikzlibrary{tikzmark,calc}
\begin{document}

\begin{proof}  
$$ a_n\cos(nx)+b_n\sin(nx) $$
$$ = \Big[\frac{1}{\pi}\int_{-\pi}^{\pi}f(t)\cos(nt)dt\Big]\cos(nx)+\Big[\frac{1}{\pi}\int_{-\pi}^{\pi}f(t)\sin(nt)dt\Big]\sin(nx) $$
$$ = \frac{1}{\pi}\int_{-\pi}^{\pi}f(t)\Big[\cos(nt)\cos(nx)+\sin(nt)\sin(nx)\Big]dt $$
$$ = \frac{1}{\pi}\int_{-\pi}^{\pi}f(t)\cos\big(n(t-x)\big)dt $$
$$ = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(t)dt+\frac{1}{\pi}\sum_{n=1}^{N}\int_{-\pi}^{\pi}f(t)\cos\big(n(t-x)\big)dt $$
$$ = \frac{1}{\pi}\int_{-\pi}^{\pi}f(t)\Big[\frac{1}{2}+\sum_{n=1}^{N}\cos\big(n(t-x)\big)\Big]dt $$
\begin{align*}
 = \frac{1}{\pi}\displaystyle\int_{-\pi}^{\pi}f(t)D_N(t-x)dt 
\end{align*}
\begin{tikzpicture}[overlay, remember picture]
\coordinate (x) at ($(pic cs:eqt)+(1,0)$);
\draw (x)--($(x)+(3,0)$);
\draw[red] (x) node[above right] {Substitution};
\draw ($(x)+(3,0)$) node[right,draw,fill=white!50] {% 
$\begin{aligned}
    u&=t-x,\\
    du&= dt
\end{aligned}$};
\end{tikzpicture}
$$ = \frac{1}{\pi}\int_{-\pi-x}^{\pi-x}f(x+u)D_N(u)du = \frac{1}{\pi}\int_{-pi}^{pi}f(x+t)D_N(t)dt 
$$
$$ = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(x+t)\frac{\sin\big((N+\frac{1}{2})t\big)}{\sin(\frac{1}{2}t)}dt $$

\end{proof}
\end{document}

答案1

我必须承认,我认为 tikz 机制没有必要。我也不会$$ ... $$在 LaTeX 文档中使用。请参阅为什么\[ ... \]优于$$ ... $$对这一点进行更深入的讨论。

相反,我会使用一个align*环境来容纳整个方程序列,并将各个方程对齐&符号上。“替换...”插入语需要不是被包裹在\intertext指令中。

在此处输入图片描述

\documentclass[12pt]{article}
%% Remark: I've streamlined your preamble as much as possible

\usepackage[nodisplayskipstretch]{setspace}
\doublespacing % For double space

\usepackage{amssymb,amsmath,amsthm}
\renewcommand{\qedsymbol}{$\blacksquare$}
\newcommand\intpp{\int_{-\pi}^{\pi}} % handy shortcut macro

\usepackage{xcolor}
\usepackage[english]{babel}
\usepackage[a4paper,margin=2.5cm]{geometry} 

\begin{document}
\allowdisplaybreaks % allow page breaks in long displays
\begin{proof}  
\begin{align*}
a_n&\cos(nx)+b_n\sin(nx) \\
&= \biggl[\frac{1}{\pi}\intpp f(t)\cos(nt)\,dt\biggr]\cos(nx)
  +\biggl[\frac{1}{\pi}\intpp f(t)\sin(nt)\,dt\biggr]\sin(nx) \\
&= \frac{1}{\pi}\intpp f(t)\bigl[\cos(nt)\cos(nx)+\sin(nt)\sin(nx)\bigr]dt\\
&= \frac{1}{\pi}\intpp f(t)\cos\bigl(n(t-x)\bigr)\,dt \\
&= \frac{1}{2\pi}\intpp f(t)\,dt
  +\frac{1}{\pi}\sum_{n=1}^{N}\intpp f(t)\cos\bigl(n(t-x)\bigr)\,dt \\
&= \frac{1}{\pi}\intpp f(t)
   \biggl[\frac{1}{2}+\sum_{n=1}^{N}\cos\bigl(n(t-x)\bigr)\biggr]dt \\
&= \frac{1}{\pi}\intpp f(t)D_N(t-x)\,dt \\
&  \qquad
   \textcolor{red}{\textup{Substitution}}
   \quad
   \boxed{\begin{aligned}
               u&=t-x,\\
              du&=dt
          \end{aligned}} \\
&= \frac{1}{\pi}\int_{-\pi-x}^{\pi-x}f(x+u)D_N(u)\,du \\
&= \frac{1}{\pi}\intpp f(x+t)D_N(t)\,dt \\
&= \frac{1}{2\pi}\intpp f(x+t)\,
   \frac{\sin\bigl((N+\frac{1}{2})t\bigr)}{\sin\bigl(\frac{1}{2}t\bigr)}\,dt 
   \qquad\qedhere
\end{align*}
\end{proof}
\end{document}

相关内容