1
$\begingroup$

How to make mathematica gives the imaginary part of a certain complex function in the form of trigonometric functions such as sin(s-t) and cos(s-t)?

Clear["Global`*"];
et[s_] := Cos[s] + I Sin[s];
etp[s_] := I et[s];
A[s_] := (et[s])^3;
NM[s_, t_] := Im[A[s]/A[t] etp[t]/(et[t] - et[s])];

From the coding, I only manage to get answer

Re[(Cos[s] + I Sin[s])^3/((Cos[t] + I Sin[t])^2 
(-Cos[s] + Cos[t] - I Sin[s] + I Sin[t]))]

which is not real expression because still have I. I don't understand why the Im[] doesn't work. Later on I have more complicated function

et[s_]:=(3+2 Cos[2s])(Cos[s] + I Sin[s])
$\endgroup$
3
$\begingroup$

Have a look at ComplexExpand

Clear["Global`*"];
et[s_] := Cos[s] + I Sin[s];
etp[s_] := I et[s];
A[s_] := (et[s])^3;
NM[s_, t_] := Im[A[s]/A[t] etp[t]/(et[t] - et[s])];

Let's call your expression e then

e = Re[(Cos[s] + 
      I Sin[s])^3/((Cos[t] + I Sin[t])^2 (-Cos[s] + Cos[t] - 
       I Sin[s] + I Sin[t]))]

Re[(Cos[s] + I Sin[s])^3/((Cos[t] + I Sin[t])^2 (-Cos[s] + Cos[t] - I Sin[s] + I Sin[t]))]

This has only wrapped your expression in Re For further work you need to identify which terms are real and which are imaginary. ComplexExpand does this with the default assumption that unidentified symbols are real.

ComplexExpand[e] // Simplify

-(1/2) - Cos[s - t] - Cos[2 (s - t)]

Simplify is not necessary but without it you get a very long expression. Hope that helps.

$\endgroup$
2
$\begingroup$
Clear["Global`*"];
et[s_] = Cos[s] + I Sin[s];
etp[s_] = I et[s];
A[s_] = (et[s])^3;

NM[s_, t_] = 
 Im[A[s]/A[t] etp[t]/(et[t] - et[s])] // ComplexExpand // FullSimplify

(* -Cos[2*s - 2*t] - Cos[s - t] - 1/2 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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