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

  • Thread starter Thread starter Swamp Thing
  • Start date Start date
  • Tags Tags
    Derivative
AI Thread Summary
Mathematica struggles with differentiating the "Re[]" function when applying the chain rule, particularly in examples involving complex exponentials. Users seek a method to automatically differentiate functions defined with "Re[]" without manual reformulation. The discussion highlights the need for a two-step calculation approach, where the real part of a complex function is simplified before differentiation. A suggested solution involves using "ComplexExpand" to achieve the desired differentiation result. The conversation emphasizes the importance of finding elegant and automated solutions in symbolic computation.
Swamp Thing
Insights Author
Messages
1,028
Reaction score
763
TL;DR Summary
Wolfram tries to apply the chain rule and gets stuck simplifying Re'[something]
Consider these two examples:
D[ Re[ Exp[ I*t ] ], t ]
1636515381176.png


D[Re[Exp[I*t]],t] /. t-> 0.5
1636515439574.png


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:
Physics news on Phys.org
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 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]
 
  • Informative
Likes Swamp Thing

Similar threads

Replies
4
Views
3K
Replies
5
Views
2K
Replies
5
Views
2K
Replies
3
Views
3K
Replies
5
Views
2K
Replies
2
Views
1K
Back
Top