I want to define a command \bigO where if I type something like \bigO[3]{\epsilon} it gives $\mathcal{O}(\epsilon^3)$, and if I leave out the optional argument and have \bigO{\epsilon} it defaults to $\mathcal{O}(\epsilon)$.
Currently, I have something like this: \newcommand{\bigO}[2][1]{\mathcal{O}(#2^#1)}, which works if I want the default exponent, i.e. 1, to appear explicitly. But what if I don't want 1 to appear in the exponent in the default case?