Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: how to solve this problem?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95107] Re: [mg95059] how to solve this problem?
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 6 Jan 2009 04:13:54 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Clear[x, y];

z = x + I*y;

Assuming[{Element[{x, y}, Reals]}, Simplify[Re[z]]]

x

Assuming[{Element[{x, y}, Reals]}, Simplify[Im[z]]]

y

Or something like

Clear[defineReal];

SetAttributes[defineReal, Listable];

defineReal[x_Symbol] := Module[{},
   x /: Re[x] = x;
   x /: Im[x] = 0;]

defineReal[{x, y}];

Re[z]

x

Im[z]

y



Bob Hanlon


On Mon, Jan 5, 2009 at 7:05 AM , Ising wrote:

> Hi:
> I want to define the variables x and y are real at first,then:
> z=x+I*y;
> Re[z]=x
> Im[z]=y
> Using "Assumptions" "Assuming"? But i don not know how to use it. Is
> there other ways to get that?
> I know in another system, it is easy, as in
> assume(x,real,y,real); So what is in Mathematica?
> Thanks!


  • Prev by Date: Re: Azimuth in Mathematica
  • Next by Date: RE: Azimuth in Mathematica
  • Previous by thread: Re: how to solve this problem?
  • Next by thread: Re: how to solve this problem?