2

Two substitutions fail, so do I forget some earlier steps?

For

Cos[x] == Sin[(1/2)*Pi + x] /. x -> (1/2)*x = true

I don't get the final answer, but only true.

Cos[(1/2)*x] == Sin[(1/2)*Pi + (1/2)*x] (final answer)

A second derivation case :

Sin[x] == 2*Cos[x/2]*Sin[x/2] /. Cos[(1/2)*x] -> Sin[(1/2)*Pi + (1/2)*x] (*no substition possible *)

bmf
  • 15,157
  • 2
  • 26
  • 63
janhardo
  • 659
  • 3
  • 12
  • Look at the output of Trace[Cos[x] == Sin[(1/2)*Pi + x] /. x -> (1/2)*x]. Note that the initial equation evaluates to True before the replacement ever comes into play. – Bob Hanlon Apr 10 '22 at 20:45
  • Thanks, Trace shows the initial equation evaluates to True before the replacement , so no need to come up for MMA with a another evaluation then. How this list exactly works i don't know yet. Is it not possible to force MMA to evaluate only the replacement ? – janhardo Apr 14 '22 at 17:21
  • I don't understand your question. If you want to know about Trace; highlight it in Mathematica and press F1 for help. – Bob Hanlon Apr 14 '22 at 17:48
  • Thanks, can imagine that my question is not understandable. Evalueting the expression is not a good idea seems, so with command Inactive you can prevent that – janhardo Apr 14 '22 at 20:15

1 Answers1

3

Use Inactive

Inactive@(Cos[x] == Sin[(1/2)*Pi + x]) /. x -> (1/2)*x

trig1

Sin[x] == 2*Cos[x/2]*Sin[x/2] /. 
 Cos[(1/2)*x] -> Inactive@Sin[(1/2)*Pi + (1/2)*x]

trig2

bmf
  • 15,157
  • 2
  • 26
  • 63
  • thanks . There is a reason behind it , why "inactive" command is used. What is that reason? – janhardo Apr 10 '22 at 20:42
  • @janhardo in a notebook try to run Sin[(1/2)*Pi + (1/2)*x] and Inactive@Sin[(1/2)*Pi + (1/2)*x]. You will see that Mathematica makes the first Cos[x/2] automatically -no Factor, Simplify, Reduce etc. The other remains as it is; it is Inactive. You can always Activate the expression at the end and get a True statement – bmf Apr 10 '22 at 20:50
  • thanks, i do see the difference – janhardo Apr 11 '22 at 07:24
  • @janhardo glad I was able to help – bmf Apr 11 '22 at 12:36