2
$\begingroup$

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 *)

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$
    – Bob Hanlon
    Apr 10 at 20:45
  • $\begingroup$ 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 ? $\endgroup$
    – janhardo
    Apr 14 at 17:21
  • $\begingroup$ I don't understand your question. If you want to know about Trace; highlight it in Mathematica and press F1 for help. $\endgroup$
    – Bob Hanlon
    Apr 14 at 17:48
  • $\begingroup$ 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 $\endgroup$
    – janhardo
    Apr 14 at 20:15

1 Answer 1

3
$\begingroup$

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

$\endgroup$
4
  • $\begingroup$ thanks . There is a reason behind it , why "inactive" command is used. What is that reason? $\endgroup$
    – janhardo
    Apr 10 at 20:42
  • $\begingroup$ @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 $\endgroup$
    – bmf
    Apr 10 at 20:50
  • $\begingroup$ thanks, i do see the difference $\endgroup$
    – janhardo
    Apr 11 at 7:24
  • $\begingroup$ @janhardo glad I was able to help $\endgroup$
    – bmf
    Apr 11 at 12:36

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.