3
$\begingroup$

I am working with real functions but FullSimplify and Simplify express them as complex terms. I assume this is because the LeafCount is smaller if some real terms are expressed as complex terms.

I have been looking for an ExcludedForms option for Simplify but it does not seem to have one for making complex expressions become real.

Here is an example I am working on:

      rhs = -((2 L Sin[
     t ω] (Cos[α] - Cosh[α] + 
      Sin[α] Sinh[α]) F)/(α (Sin[α] - 
      Sinh[α])));
sol = q[t] /. 
   First@DSolve[{q''[t] + ωn^2 q[t] == 1/Subscript[M, n] rhs, 
      q[0] == 0, q'[0] == 0}, q[t], t];
sol2 = FullSimplify[sol]

With output

   (2 I F L (ωn Sin[t ω] - ω Sin[
     t ωn]) (Sin[(1/2 + I/2) α] - 
   Sinh[(1/2 + I/
       2) α])^2)/(α ωn (-ω + ωn) (\
ω + ωn) (Sin[α] - Sinh[α]) Subscript[M, n]
 )

Note the complex I's in the output

If I take the complex part and do

ComplexExpand[
  I (Sin[(1/2 + I/2) α] - 
     Sinh[(1/2 + I/2) α])^2 ] // Simplify

Then I get this real expression

2 (Cosh[α/2] Sin[α/2] - Cos[α/2] Sinh[α/2])^2

However, if I do ComplexExpand on the whole expression

ComplexExpand[sol2]

I get this Big expression

and I have lost my simple form.

Is there an option for Simplify and FullSimplify that suppresses the use of complex forms? Of course if the expression were complex one would need to see the complex form.

Thanks

$\endgroup$
2
  • $\begingroup$ @chris How would you write the ComplexityFunction to avoid expressing real terms as complex? The Map approach is an improvement; thanks. $\endgroup$
    – Hugh
    Oct 16, 2020 at 16:40
  • $\begingroup$ @chris ComplexExpand /@ sol2 is much better. Thank you. $\endgroup$
    – Hugh
    Oct 16, 2020 at 16:44

1 Answer 1

4
$\begingroup$

You can either write

ComplexExpand /@ sol2 

enter image description here

or

FullSimplify[ComplexExpand /@ sol2, Trig -> False]

enter image description here

whichever you find most appropriate for your purpose.

$\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.