Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: force variable to be real

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91778] Re: force variable to be real
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sun, 7 Sep 2008 22:53:14 -0400 (EDT)
  • References: <ga0744$opl$1@smc.vnet.net>

phillman5 wrote:

> How do you force variables to be real?
> 
> I have
>                 w:=x + I 2 x z,
> and
>                 y:=Re[w]
> 
> and want the derivative of y wrt x,    x and z are Real
>                 D[y, x]
> gives
>                 Re'[x] - 2 z Im'[x z]
> 
> where I'd expect  just 1.  Or I need to evaluate Re[w] forcing x and z
> to be real, then take the derivative.

You could use *ComplexExpand[]*, which assumes that all the variables -- 
x and y in your example --  are real, in the definition of y.

   In[1]:= w := x + I 2 x z
           y := ComplexExpand[Re[w]]
           D[y, x]

   Out[3]= 1

Regards,
-- Jean-Marc


  • Prev by Date: Re: ListDensityPlot with Axes, Ticks, TicksStyle
  • Next by Date: Re: ListDensityPlot with Axes, Ticks, TicksStyle
  • Previous by thread: Re: force variable to be real
  • Next by thread: Re: force variable to be real