\documentclass[openany,9pt]{book}
\makeatletter\@addtoreset{footnote}{page}\makeatother
\usepackage{mathrsfs}
\usepackage{perpage}
%\Makeperpage[1]{footnote}
\usepackage{fancybox}
\usepackage{fancyhdr}
\usepackage[all]{xy}
\usepackage{setspace}
\usepackage{makeidx}
\makeindex
\usepackage{xepersian}
\settextfont[Scale=1]{XB Niloofar}
\setdigitfont[Scale=1]{Parsi Digits}
\linespread{4}
\setromantextfont{Junicode}

%here comes fancy definitions%%%%%%%%%%%%%%
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase.
\renewcommand{\chaptermark}[1]{%
        \markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
        \markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[RO]{\slshape\leftmark}
\fancyhead[LE]{\slshape\rightmark}
\fancyhead[LO,RE]{\slshape \thepage}
\renewcommand{\headrulewidth}{1pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\thesection}{\thechapter.\arabic{section}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheorem{theorem}{قضیه}
\newtheorem{lemma}[theorem]{لم}
\newtheorem{proposition}[theorem]{گزاره}
\newtheorem{corollary}[theorem]{نتیجه}

\theoremstyle{definition}
\newtheorem*{definition}{تعریف}
\newtheorem{remark}{ملاحظه}
\newtheorem*{example}{مثال}
\renewcommand\proofname{برهان}

%%Mathematical Operators

\newcommand{\HH}{\mathbb{H}}
\newcommand{\LL}{\mathbb{L}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\ZZ}{\mathbb{Z}}

\newcommand{\ba}{\mathbf{a}}
\newcommand{\bb}{\mathbf{b}}
\newcommand{\bc}{\mathbf{c}}
\newcommand{\bx}{\mathbf{x}}
\newcommand{\by}{\mathbf{y}}
\newcommand{\bz}{\mathbf{z}}


\newcommand\calA{{\mathcal A}}
\newcommand\calC{{\mathcal C}}
\newcommand\calI{{\mathcal I}}
\newcommand\calL{{\mathcal L}}
\newcommand\calP{{\mathcal P}}
\newcommand\calR{{\mathcal R}}

\newcommand{\scrB}{\mathscr{B}}
\newcommand{\scrC}{\mathscr{C}}
\newcommand{\scrD}{\mathscr{D}}
\newcommand{\scrE}{\mathscr{E}}
\newcommand{\scrT}{\mathscr{T}}

\newcommand\rmT{\mathrm{T}}
\newcommand\rmD{\mathrm{D}}
\newcommand\rmd{\mathrm{d}}
\newcommand\rmB{\mathrm{B}}

\DeclareMathOperator{\sign}{sign}
\DeclareMathOperator{\alt}{Alt}
\DeclareMathOperator{\Bd}{Bd}
\DeclareMathOperator{\Int}{Int}
\DeclareMathOperator{\Ext}{Ext}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\curl}{curl}
\DeclareMathOperator{\divergence}{div}
\DeclareMathOperator{\im}{Image}
\DeclareMathOperator{\grad}{grad}
\DeclareMathOperator{\diam}{diam}
\DeclareMathOperator{\width}{width}
\DeclareMathOperator{\supp}{Supp}
\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\cl}{Cl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\To}{\longrightarrow}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\numberwithin{figure}{chapter}
\numberwithin{equation}{chapter}
\numberwithin{table}{subsection}
\onehalfspace

\begin{document}
\title{\textbf{}}
\author{\textbf{}\\
\textbf{ }}
\date{}
\maketitle
%\newpage
\tableofcontents
%\listoffigures
%\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{ مقدمه}
%\begin{equation*}
\section{انتگرال}
\begin{align*}
\int T_n (x)dx &=\begin{cases}
T_1 (x)& \quad n = 0\\ \\
\frac{1}{4} \Big(T_2 (x)+ T_0 (x)\Big)& \quad n=1\\ \\
\dfrac{T_{n+1} (x)}{n+1}- \dfrac{T_{n-1} (x)}{n-1} & \quad n\geq 2
\end{cases}\\ \\
\int U_n (x)dx&=\begin{cases}
T_1 (x)& \,\,\qquad  \quad n = 0\\ \\
\frac{1}{2} \Big(T_2 (x)+ T_0 (x)\Big)& \,\, \qquad  \quad n=1\\ \\
\dfrac{T_{n+1} (x)}{n+1} & \,\, \qquad  \quad n\geq 2
\end{cases}
\end{align*}
%\end{equation*}

\indexincontents
\printindex
\end{document}
