Derivative, i.e. D[ ] , of Re [ something ]

  • Topic: Mathematica 
  • Thread starter Swamp Thing
  • Start date
  • Tags Tags
    Derivative
2 replies · 2K views · last reply
Swamp Thing
Insights Author
Messages
1,080
Reaction score
852
TL;DR
Wolfram tries to apply the chain rule and gets stuck simplifying Re'[something]
Consider these two examples:
D[ Re[ Exp[ I*t ] ], t ]
Small rendered formula showing i e^(i t) Re(e^(i t)), with the Re(e^(i t)) term written as a shaded box.


D[Re[Exp[I*t]],t] /. t-> 0.5
Mathematica output showing (-0.479426 + 0.877583 i) Re'[0.877583 + 0.479426 i], where Re' denotes the derivative of Re.


Mathematica seems to get stuck differentiating the "Re[ ]" function after (rather naively) applying the chain rule. This is a trivial example, but we might have a more complicated function defined like :-
myFn [ t _ ]:= Re [(* stuff *)]
... and we would like to find D [ myFn [ t ] ], t] without extra manual reformulation.

How can we do that elegantly and automatically?
 
Last edited:
Can either Wolfram or Mathematica do the calculation in two steps? I.e., by first calculating ##Re(e^{it})## and then differentiating that result?
Either of these should be able to simplify ##Re(e^{it})##, which is just ##\cos(t)##.
 
  • Like
Likes   Reactions: member 428835 and jim mcnamara
Mark44 said:
Can either Wolfram or Mathematica do the calculation in two steps? I.e., by first calculating ##Re(e^{it})## and then differentiating that result?
Either of these should be able to simplify ##Re(e^{it})##, which is just ##\cos(t)##.
I'd do it like this, which worked for me, giving the desired output ##-\sin(t)##:

f[t_] = Exp[I t];
D[ComplexExpand[Re[f[t]]], t]