\documentclass[12pt]{article}
%\usepackage{bm}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{graphicx,color,fancyhdr}
\usepackage{float}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}[theorem]{Remark}
\newcommand{\eps}{\varepsilon}
\newcommand{\sgn}{\operatorname{sgn}}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}
\chead{Report Project 1}
\rhead{MS455/MS555}
\rfoot{\today}
\title{Project 1}
\author{Effat Ashi 1621505}
\begin{document}
\maketitle
\begin{enumerate}
\item{\textbf{The cumulative distribution function}} \\
\item{\textbf[Matlab figures]}\\
\item{\textbf{Mean and variance}}\\
\begin{equation*}
\begin{aligned}
\mu=E[x]=\int_{0}^{\infty}x\lambda e^{-{\lambda}{x}}\\
=\lambda\int_{0}^{\infty}xe^{-{\lambda}{x}}dx\\
\end{aligned}
\end{equation*}\\
Then we integrate by parts\\
\begin{equation*}
\begin{aligned}
=\lambda\left[-xe^{-{\lambda}{x}}\right]_0^\infty + \frac{1}{\lambda}\int_{0}^{\infty}e^{-{\lambda}{x}} dx\\
=\lambda\left[0+\frac{1}{\lambda}\frac{-e^{-\lambda x}{\lambda}\right]_0^\infty\\
=\lambda\frac{1}{\lambda^2}\\
=\frac{1}{\lambda}\\
\end{aligned}
\end{equation*}\\
Now we can calculate the varience from the mean\\
\begin{equation*}
\sigma^2=$$\mathbb{E}$[(x-\mu)^2]=$$\mathbb{E}$[x^2]-$$\mathbb{E}$[x^2]\\
$\mathbb{E}$[x^2]=\int_{0}^{\infty}x^2\lambda e^{-{\lambda}{x}} dx\\
=\frac{2}{\lambda^2}\\
\sigma^2=\frac{2}{\lambda^2}-\frac{1}{\lambda^2}=\frac{1}{\lambda^2}\\
\sigma=\frac{1}{\lambda}=\mu
\end{equation*}
\item{\textbf{Confidence interval}\\
\textbf{Theta=2}\\
\textbf{Matlab Codes}\\
\end{enumerate}
\begin{itemize}
\item{Histograms}\\
\item{Confidence interval}\\
\end{itemize}
\end{document}
答案1
尽管您可能想修改其格式,但这仍然能够编译。
已编辑以反映并删除其他人指出的内容:
语法使用错误
\item
(即,以下内容\item
不应被接受)\\
不鼓励在普通文本中使用,而且一般完全没有必要。您的方程式中添加了额外的对齐选项卡
&
,以利用新的对齐可能性。
除了添加aligned
到第三个方程组之外,我还按照我在对你的问题的最后评论中提到的那样做了:
\item{\textbf{Confidence interval}\\
缺少右括号;缺少右括号
\frac{-e^{-\lambda x}{\lambda}
;$
从第三个等式中删除所有符号。
这是修订后的 MWE。
\documentclass[12pt]{article}
%\usepackage{bm}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{graphicx,color,fancyhdr}
\usepackage{float}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}[theorem]{Remark}
\newcommand{\eps}{\varepsilon}
\newcommand{\sgn}{\operatorname{sgn}}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}
\chead{Report Project 1}
\rhead{MS455/MS555}
\rfoot{\today}
\title{Project 1}
\author{Effat Ashi 1621505}
\begin{document}
\maketitle
\begin{enumerate}
\item \textbf{The cumulative distribution function}
\item \textbf[Matlab figures]
\item \textbf{Mean and variance}
\begin{equation*}
\begin{aligned}
\mu=E[x]&=\int_{0}^{\infty}x\lambda e^{-{\lambda}{x}}\\
&=\lambda\int_{0}^{\infty}xe^{-{\lambda}{x}}dx\\
\end{aligned}
\end{equation*}
Then we integrate by parts
\begin{equation*}
\begin{aligned}
&=\lambda\left[-xe^{-{\lambda}{x}}\right]_0^\infty + \frac{1}{\lambda}\int_{0}^{\infty}e^{-{\lambda}{x}} dx\\
&=\lambda\left[0+\frac{1}{\lambda}\frac{-e^{-\lambda x}}{\lambda}\right]_0^\infty\\
&=\lambda\frac{1}{\lambda^2}\\
&=\frac{1}{\lambda}\\
\end{aligned}
\end{equation*}
Now we can calculate the varience from the mean
\begin{equation*}
\begin{aligned}
\sigma^2&=\mathbb{E}[(x-\mu)^2]=\mathbb{E}[x^2]-\mathbb{E}[x^2]\\
\mathbb{E}[x^2]&=\int_{0}^{\infty}x^2\lambda e^{-{\lambda}{x}} dx\\
&=\frac{2}{\lambda^2}\\
\sigma^2&=\frac{2}{\lambda^2}-\frac{1}{\lambda^2}=\frac{1}{\lambda^2}\\
\sigma&=\frac{1}{\lambda}=\mu
\end{aligned}
\end{equation*}
\item \textbf{Confidence interval}
\textbf{Theta=2}
\textbf{Matlab Codes}
\end{enumerate}
\begin{itemize}
\item Histograms
\item Confidence interval
\end{itemize}
\end{document}
答案2
我将在 OP 的另一篇(已关闭的)帖子中添加我的版本(略有不同)的代码,它需要mathtools
:
\documentclass[12pt]{article}
\usepackage{bm}%
\usepackage{mathtools, amsfonts, amssymb, amsthm} %
\usepackage{graphicx, xcolor, fancyhdr} %
\usepackage{float}
\usepackage{enumitem}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem} \newtheorem{corollary}[theorem]{Corollary} \newtheorem{assumption}[theorem]{Assumption} \newtheorem{definition}[theorem]{Definition} \newtheorem{example}[theorem]{Example} \newtheorem{exercise}[theorem]{Exercise} \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{remark}[theorem]{Remark}
\newcommand{\eps}{\varepsilon } \newcommand{\sgn}{\operatorname{sgn}}
\pagestyle{fancy} \renewcommand{\footrulewidth}{0.4pt} \chead{Report Project 1} \rhead{MS455/MS555} \rfoot{\today}
\title{Project 1} \author{Effat Ashi 1621505}
\begin{document}
\maketitle%
\[ f(x) = \begin{dcases} \frac{1}{\theta } e^{- \tfrac{x}{\theta }} & \text{for } x \geq 0 \\[0.5ex]
0 & \text{for } x < 0
\end{dcases} , \]
where $\theta$ is a positive parameter, that is $\theta > 0$.
\begin{enumerate}[label=\bfseries\arabic*. , wide] %
\item{\textbf{The cumulative distribution function}}%
To produce the CDE we need to integrate%
\begin{gather*}
f(t)=\frac{1}{\theta } e^{- \frac{t}{\theta }} \\%
\intertext{from $ 0 $ to $ x $ as the case is when $ x $ greater than $ 0 $. }%
F(x) =\int_{0}^{x}\frac{1}{\theta } e^{- \frac{t}{\theta }}\,dt . \\
\shortintertext{Set $ \lambda=\frac{1}{\theta } $. Then}%
F(x) =\int_{0}^{x}{\lambda }e^{-{t}\lambda }\,dt=1-e^{-{x}{\lambda }}=1-e^{-\frac{x}{\theta }}. \\
\shortintertext{We have} %
F(x)\in[0,1] \quad \forall x\ge0
\end{gather*}%
\ \item{\textbf{The inverse function}}\ From question 1, %
\begin{gather*}%
F(x)=1-e^{-{x}{\lambda }},\quad\ F(x)\in[0,1]\quad \forall x \ge 0 \\%
\intertext{Firstly, we write it as an equation}
y=1-e^{-x\lambda } \iff 1-y=e^{-x\lambda } \iff 1-F(x)=e^{-x\lambda }\\ %
\intertext{By taking the ln from both sides we get}%
-\lambda x=\ln(1-F(x)),\enspace \text{whence}\quad x=\smash[t]{\frac{\ln(1-F(x))}{-\lambda }}. \\[1ex]%
F(x) \in [0,1]\ 0\leq F(x)\geq 1 \Rightarrow 1-F(x)=U \in [0,1]. \\ %
\intertext{$ U $ \ is a uniform random variable and}
x=\frac{-1}{\lambda } \ln(U) %
\end{gather*} %
\item{\textbf{Matlab figures}}\ %
\ \item{\textbf{Mean and variance}}%
\begin{align*}
\mu & =E[x] =\int_{0}^{\infty}x\lambda e^{-{\lambda }{x}}\ =\lambda \int_{0}^{\infty}xe^{-{\lambda }{x}}dx \\ %
& =\lambda \left[-xe^{-{\lambda }{x}}\right]_0^\infty + \frac{1}{\lambda }\int_{0}^{\infty}e^{-{\lambda }{x}} dx \\ %
& =\lambda \left[0+\frac{1}{\lambda }\frac{-e^{-\lambda x}}{\lambda }\right]_0^\infty%
=\lambda \frac{1}{\lambda^2}\ =\frac{1}{\lambda }
\intertext{Now we can calculate the variance from the mean: }%
\sigma^2 & =\mathbb{E}[(x-\mu )^2] =\mathbb{E}[x^2]-(\mathbb{E}[x])^2%
=\int_{0}^{\infty}x^2\lambda e^{-{\lambda }{x}} dx \\ %
& =\frac{2}{\lambda^2}\ \sigma^2=\frac{2}{\lambda^2}-\frac{1}{\lambda^2}%
=\frac{1}{\lambda^2}\ \sigma=\frac{1}{\lambda }=\mu %
\end{align*} %
\item{\textbf{Confidence interval}}%
\end{enumerate} %
\end{document}