三次方程式逐步求解的格式改進

三次方程式逐步求解的格式改進

\amsmath和中\tasks,提供了求三次方程式 3 根的逐步求解過程。

請您協助解決 2 個問題:

  1. 將每個問題中 2 個立方根之間的水平間距減小到大約 2-3 毫米:

在此輸入影像描述

  1. 插入標註(左列和右列)以識別產生根的第一個因子。也,將黃色突出顯示的因素加粗

在此輸入影像描述

謝謝你! mwe在下面

\documentclass[12pt]{exam}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{framed} %box para
\usepackage{multicol}
\usepackage{tasks}
\usepackage{xcolor}
\usepackage[margin=0.5in]{geometry}

%\usepackage{bm}%bold equation
\setlength{\parindent}{0pt} % removes paragraph indentation

\pagestyle{head}
\header{Algegra II: Assignment: 10-C Solving Polynomial Equations}
       {}
       {Due 03/12/2023} 

\newcommand{\pagetop}{%
  %\makebox[\textwidth]%{Name:\enspace\hrulefill}\par
  \vspace{4mm}
  \fbox{\fbox{\parbox{\dimexpr\textwidth-4\fboxsep-4\fboxrule}{
    \textbf {Solve each polynomial equation by factoring. Find all real and/or  imaginary/complex roots. Simplify answers.}
    %\par
    %\bigskip

  }}}\par
  \vspace{0.5mm}
}
\setlength{\jot}{1em}
%define highlighting

\newcommand{\hll}[1]{\colorbox{yellow}{$\displaystyle #1$}}

\begin{document}
\pagetop

\settasks{
    after-item-skip=3em,    after-skip=2cm,
    label-width=2em,
    item-indent=3em,
    label=(\arabic*),
    column-sep=2em
}
\begin{tasks}(2)
%Prob #1
\task \(\begin{aligned}[t]
&x^3-216=0 \\
& \hspace{2em}\begin{aligned}[t]
&\sqrt[3]{x^3} =3
&\sqrt[3]{216} =6\\
&\hll {(x-6)}(x^2+6x+6^2)\\
&\hll{(x-6)}(x^2+6x+36)\\
&a = 1; b = 6; c = 36\\
&x=\frac{-(b)\pm\sqrt{(b^2)-4(a)(c)}}{2(a)}\\
&x=\frac{-(6)\pm\sqrt{(6^2)-4(1)(36)}}{2(1)}\\
&x=\frac{-6\pm\sqrt{-144}}{2}\\
&x=\frac{-(6)\pm\sqrt{(6^2)-4(1)(36)}}{2(1)}\\
&x=\frac{-6\pm\sqrt{-108}}{2}\\
&x=\frac{-6\pm 6i\sqrt{3}}{2}\\
&x=\frac{2(-3\pm 3i\sqrt{3})}{2}\\
&x=\-3\pm 3i\sqrt{3}&x=6\\
\end{aligned}
\end{aligned}\)
%Problem #2
\task \(\begin{aligned}[t]
&8x^3 +125 \\
& \hspace{2em}\begin{aligned}[t]
&\sqrt[3]{8x^3} =2x
&\sqrt[3]{125} =5\\
&\hll{(2x+5)}(4x^2-10x+5^2)\\
&\hll{(2x+5)}(4x^2-10x+25)\\
&a = 4; b = -10; c = 25\\
&x=\frac{-(b)\pm\sqrt{(b^2)-4(a)(c)}}{2(a)}\\
&x=\frac{-(-10)\pm\sqrt{(-10^2)-4(4)(25)}}{2(4)}\\
&x=\frac{10\pm\sqrt{-300}}{8}\\
&x=\frac{10\pm 10i\sqrt{3}}{8}\\
&x=\frac{2(5\pm 5i\sqrt{3})}{8}\\
&x=\frac{5\pm 5i\sqrt{3})}{4}&x=-\frac{-5}{2}\\
\end{aligned}
\end{aligned}\)
%Problem #3

\end{tasks}
\end{document}```

答案1

讓我們分部分來說:

  1. 對於簡單的間距,我們可以使用命令\quad\qquad在間距中保持一定的標準化,在您的情況下,使用\qquad是最好的做法。

  2. 為了創建帶有警告框的黃色框,我創建了一個新命令來分配兩個條目:\callout{#1}{#2}.第一個條目#1是以黃色突出顯示的方程項,而第二個條目#2是方程式的其餘部分,不會突出顯示。需要評論的一件重要事情是需要指令,在本例中是[2.2em]在換行符之前。透過舉例就更清楚了。

套餐

\documentclass[12pt]{exam}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{framed} % box para
\usepackage{multicol}
\usepackage{tasks}
\usepackage{xcolor}
\usepackage[margin=0.5in]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts} % To create the call out boxes

新指令

\newcommand*{\callout}[2]{\hspace{-5em}
\tikz[baseline=(X)] \node[shape = rectangle callout, 
    fill=white, 
    draw= black, 
    minimum width=4.5em,
    rounded corners,
    callout relative pointer={(+0.55,-0.45)}, 
    font = {\sffamily},
    ] (X) {${\scriptsize\begin{matrix}\textrm{1st root/} \\ \textrm{solution}\end{matrix}}$};%
\tikz[baseline=(X.base)] \node[rectangle, fill=yellow, inner sep=1mm] (Y) at ([yshift = -2.2em]X) {$#1$};%
\tikz[baseline=(X.base)] \node[] at (Y.east) {$#2$};%
 }

新指令無垂直間距指令

 \begin{tasks}(2)
 % Problem 1:
 \task \(
 \begin{aligned}[t]
    & x^3-216 = 0 \\
    & \hspace{2em}
    \begin{aligned}[t]
        & \sqrt[3]{x^3} = 3 \qquad \sqrt[3]{216} = 6 \\
        & \hll{(x-6)}(x^2+6x+6^2) \\%[-2.2em]
        % Do not space here:        ^
        & \callout{(x-6)}{(x^2+6x+36)} \\
    \end{aligned}
 \end{aligned}
 \)
 \end{tasks}

使用此程式碼,輸出具有以下空格: 在此輸入影像描述

垂直間距指令內的新指令

但是,如果我們包含這些指令:

 \begin{tasks}(2)
 % Problem 1:
 \task \(
 \begin{aligned}[t]
    & x^3-216 = 0 \\
    & \hspace{2em}
    \begin{aligned}[t]
        & \sqrt[3]{x^3} = 3 \qquad \sqrt[3]{216} = 6 \\
        & \hll{(x-6)}(x^2+6x+6^2) \\[-2.2em]
        % Do not space here:        ^
        & \callout{(x-6)}{(x^2+6x+36)} \\
    \end{aligned}
 \end{aligned}
 \)
 \end{tasks}

我們得到這個: 在此輸入影像描述

關於這個新命令的一點評論

我添加了一條註釋,不要將雙欄\\和指令隔開[-2.2em],這是因為這些指令不適用於此空間。

完整程式碼

最後,我將發布所有程式碼和相應的輸出:

\documentclass[12pt]{exam}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{framed} %box para
\usepackage{multicol}
\usepackage{tasks}
\usepackage{xcolor}
\usepackage[margin=0.5in]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts}

\newcommand*{\callout}[2]{\hspace{-5em}
    \tikz[baseline=(X)] \node[shape = rectangle callout, 
        fill=white, 
        draw= black, 
        minimum width=4.5em,
        rounded corners,
        callout relative pointer={(+0.55,-0.45)}, 
        font = {\sffamily},
        ] (X) {${\scriptsize\begin{matrix}\textrm{1st root/} \\ \textrm{solution}\end{matrix}}$};%
    \tikz[baseline=(X.base)] \node[rectangle, fill=yellow, inner sep=1mm] (Y) at ([yshift = -2.2em]X) {$#1$};%
    \tikz[baseline=(X.base)] \node[] at (Y.east) {$#2$};%
}

%\usepackage{bm}%bold equation
\setlength{\parindent}{0pt} % removes paragraph indentation

\pagestyle{head}
\header{Algebra II: Assignment: 10-C Solving Polynomial Equations}
       {}
       {Due 03/12/2023} 

\newcommand{\pagetop}{%
  %\makebox[\textwidth]%{Name:\enspace\hrulefill}\par
  \vspace{4mm}
  \fbox{\fbox{\parbox{\dimexpr\textwidth-4\fboxsep-4\fboxrule}{
    \textbf {Solve each polynomial equation by factoring. Find all real and/or  imaginary/complex roots. Simplify answers.}
    %\par
    %\bigskip

  }}}\par
  \vspace{0.5mm}
}
\setlength{\jot}{1em}
%define highlighting

\newcommand{\hll}[1]{\colorbox{yellow}{$\displaystyle #1$}}

\begin{document}
\pagetop

\settasks{
    after-item-skip=3em,    after-skip=2cm,
    label-width=2em,
    item-indent=3em,
    label=(\arabic*),
    column-sep=2em
}

\begin{tasks}(2)
    % Problem 1:
    \task \(
    \begin{aligned}[t]
        & x^3-216 = 0 \\
        & \hspace{2em}
        \begin{aligned}[t]
            & \sqrt[3]{x^3} = 3 \qquad \sqrt[3]{216} = 6 \\
            & \hll{(x-6)}(x^2+6x+6^2) \\[-2.2em]
            % Do not space here:        ^
            & \callout{(x-6)}{(x^2+6x+36)} \\
            & a = 1; b = 6; c = 36 \\
            & x = \frac{-(b)\pm\sqrt{(b^2)-4(a)(c)}}{2(a)} \\
            & x = \frac{-(6)\pm\sqrt{(6^2)-4(1)(36)}}{2(1)} \\
            & x = \frac{-6\pm\sqrt{-144}}{2} \\
            & x = \frac{-(6)\pm\sqrt{(6^2)-4(1)(36)}}{2(1)} \\
            & x = \frac{-6\pm\sqrt{-108}}{2} \\
            & x = \frac{-6\pm 6i\sqrt{3}}{2} \\
            & x = \frac{2(-3\pm 3i\sqrt{3})}{2} \\
            & x = \-3\pm 3i\sqrt{3} \qquad x=6 \\
        \end{aligned}
    \end{aligned}
    \)
    % Problem #2
    \task 
    \(\begin{aligned}[t]
        & 8x^3 +125 \\
        & \hspace{2em}
        \begin{aligned}[t]
            & \sqrt[3]{8x^3} = 2x \qquad \sqrt[3]{125} = 5 \\
            & \hll{(2x+5)}(4x^2-10x+5^2) \\[-2.2em]
            & \callout{(2x+5)}{(4x^2-10x+25)} \\
            & a = 4; b = -10; c = 25 \\
            & x = \frac{-(b)\pm\sqrt{(b^2)-4(a)(c)}}{2(a)} \\
            & x = \frac{-(-10)\pm\sqrt{(-10^2)-4(4)(25)}}{2(4)} \\
            & x = \frac{10\pm\sqrt{-300}}{8} \\
            & x = \frac{10\pm 10i\sqrt{3}}{8} \\
            & x = \frac{2(5\pm 5i\sqrt{3})}{8} \\
            & x = \frac{5\pm 5i\sqrt{3})}{4} \qquad x=-\frac{-5}{2} \\
        \end{aligned}
    \end{aligned}
    \)
    % Problem 3
\end{tasks}

\end{document}

![在此輸入影像描述

相關內容