0
$\begingroup$

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

$\endgroup$
1
  • 1
    $\begingroup$ Try (Full)Simplify with the option TransformationFunctions -> {# /. (1 - 6 E^(i k) + 2^(2 i k) -> f[k]) &, Automatic} $\endgroup$
    – Coolwater
    Mar 30, 2019 at 18:41

1 Answer 1

2
$\begingroup$

Try 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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.