I am new in LaTex. I know little beyond the contents covered in the course LaTeX101X in edX. I want to prepare documents in Bengali containing mathematical and chemical equations which are usually written in English. I have found a similar discussion in this forum and followed the first two answers. The first answer by Alan Munn provided the following sample code:
\documentclass[10pt]{article}
\usepackage{polyglossia}
\setmainlanguage[numerals=Devanagari]{bengali}
\setotherlanguage{english}
\newfontfamily\englishfont[Scale=MatchLowercase]{Linux Biolinum O}
\newfontfamily\bengalifont[Script=Bengali]{Akaash}
\begin{document}
\tableofcontents
\section{ভূমিকা}
এটি একটি ইংরেজি লেখা ছোট অধ্যায় যে বাঙ্গালী এ \textenglish{Google Translate} দ্বারা অনুবাদ করা হয়েছে. এটা খুব স্পষ্ট নয় যদি সঠিক অনুবাদ বা না কিন্তু ক্রিয়াটি ফন্ট দেখাতে যথেষ্ট হওয়া উচিত.
\end{document}
The second answer by Adib Hasan provided the following sample code:
\documentclass{article}
\usepackage[banglamainfont=Kalpurush,
banglattfont=Siyam Rupali
]{latexbangla}
\begin{document}
পিথাগোরাস(Pythagoras)-এর উপপাদ্যটি হল, \textit{সমকোণী ত্রিভুজের অতিভুজের উপর অঙ্কিত
বর্গক্ষেত্রের ক্ষেত্রফল অপর দুই বাহুর উপর অঙ্কিত বর্গক্ষেত্রের ক্ষেত্রফলের সমষ্টির সমান।}
অর্থাৎ কোন সমকোণী ত্রিভুজের অতিভুজ $c$ এবং অপর দুই বাহু $a$ এবং $b$ হলে,
\[c^2=a^2+b^2\]
লক্ষ্য করুন, এখন পর্যন্ত টেক্সট প্রদর্শনের জন্য \textbf{কালপুরুষ} ফন্ট ব্যবহৃত হয়েছে।\\
\texttt{এবার, টেলিটাইপ(Teletype) টেক্সট প্রদর্শনের জন্য \textbf{সিয়াম রূপালী}
ফন্ট ব্যবহৃত হল।}\\
পুনরায় টেক্সট প্রদর্শনের জন্য \textbf{কালপুরুষ} ফন্ট ব্যবহৃত হচ্ছে।
\end{document}
When I compiled both codes same error was shown:
line 45: Fatal Package fontspec Error: The fontspec package requires either XeTeX or(fontspec) LuaTeX. \msg_fatal:nn {fontspec} {cannot-use-pdftex}
line 45: Emergency stop. \msg_fatal:nn {fontspec} {cannot-use-pdftex}
According to the error message, it seems that I should switch to XeTeX or LuaTeX. But how can I do this? Also, is it possible to write Bengali without switching to XeTeX or LuaTeX? Besides, can you give some suggestions regarding writing Bengali in LaTeX?
N.B. I use MiKTeX. The LaTeX editor, I use, is TeXstudio.

