I have an expression
$\sqrt{1-6e^{ik}+e^{2ik}}$
I want to simplify this expression by defining
$f(k) \equiv 1-6e^{ik}+e^{2ik}$
So that my output will be
$\sqrt{f(k)}$
Thanks
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityTry this code which will do what you want.
Sqrt[1 - 6 Exp[I k] + Exp[2 I k]] /. {1 - 6 Exp[I k] + Exp[2 I k] -> f[k]}
There are other ways to do this in Mathematica, but I think this is the simplest.
(Full)Simplify
with the optionTransformationFunctions -> {# /. (1 - 6 E^(i k) + 2^(2 i k) -> f[k]) &, Automatic}
$\endgroup$