Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Complex Numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47448] Re: Complex Numbers
  • From: Jon Harrop <jdh30 at cam.ac.uk>
  • Date: Mon, 12 Apr 2004 03:45:02 -0400 (EDT)
  • Organization: University of Cambridge
  • References: <c5b0tc$7lc$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Alejandro Vizcarra wrote:
> I always have problems when dealing with complex numbers.  How can i
> work with Mathematica in such a way that every expression will
> be considered real unless it is declared explicitly complex (like a = 3 +
> 4 I ) ?

The best recommendation that I can make is to routinely simplify expressions
using something like:

In  := assume = Im[a] == 0 && Im[b] == 0;
In  := FullSimplify[-Im[Sin[a + b]] + Re[Cos[a + b]], assume]
Out := Cos[a + b]

But this requires FullSimplify rather than Simplify and FullSimplify is very
time consuming on large expressions.

An alternative is to define up-values associated with the variables to
declare that their real parts are themselves and their imaginary parts are
zero, rather than keeping and passing my "assume" variable around:

In  := Re[a] ^= a; Im[a] ^= 0; Re[b] ^= b; Im[b] ^= 0;
In  := FullSimplify[-Im[Sin[a + b]] + Re[Cos[a + b]]]
Out := Cos[a + b]

But I have a hunch that this won't be as powerful at simplifying the
expressions as the "assume" approach.

I do not know of any way to manifestly declare something as being
real-valued. I believe this would be a bad idea anyway, as the current
method enforces mathematical rigour. Whilst checking a proof for my PhD
thesis, for example, Mathematica's pedantry led me to make two of my
assumptions explicit. Although the assumptions may have been "obvious" to a
human reader, it can be nice to have that kind of pedantry. :)

HTH.

Cheers,
Jon.


  • Prev by Date: When Is Precision[ ] $MachinePrecision, And When Is It Not?
  • Next by Date: Format Style
  • Previous by thread: RE: Complex Numbers
  • Next by thread: Re: Complex Numbers