Re: real function argument
- To: mathgroup at smc.vnet.net
- Subject: [mg73414] Re: real function argument
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 16 Feb 2007 00:52:10 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <er1bq1$7ci$1@smc.vnet.net>
bar at ANTYSPAM.ap.krakow.pl wrote: > Hi, > I have a problrm with defining real argument > > In: f[x_]:=Re[Cos[x]+I Sin[x]] > f'[x] > > Out: -Cos[x] Im'[x]-Sin[x]Re'[x] > > In: FullSimplify[f'[x],Element[x,Reals]] > gives the same out > > Any suggestions ? > > Regards, Olaf > > Hi Olaf, More assumptions are needed to allow Re to extract Cos[x] only as the real part of the expression. (Mathematica works over the field of complex number by default.) Adding ComplexExpand into the definition of your function will do the trick. In[1]:= f[x_] := Re[Cos[x] + I*Sin[x]] f[x] f'[x] Out[2]= -Im[Sin[x]] + Re[Cos[x]] Out[3]= -Cos[x] Im'[Sin[x]] - Sin[x] Re'[Cos[x]] In[4]:= g[x_] := ComplexExpand[Re[Cos[x] + I*Sin[x]]] g[x] g'[x] Out[5]= Cos[x] Out[6]= -Sin[x] Best regards, Jean-Marc