Message Boards Message Boards

Define a complex number

Posted 10 years ago

Hello, I want to define a complex number like z(x,y) = x + i y But when I do some mathematical operations on this number, Mathematica program don't know that the variables x and y are real numbers

How can i enforce mathematica to deal with x and y as a real numbers not a complex numbers

I am looking for ward to receive a comment .. many thanks

POSTED BY: Ahmed Al-Ali
4 Replies

First, try using ComplexExpand:

http://reference.wolfram.com/language/ref/ComplexExpand.html

ComplexExpand expands an expression assuming the variables are Real.

Additionally, you can use the Assumptions option on many commands to tell it to assume that certain variables are Real

Assumptions ->Element[{x,y},Reals]

See: http://reference.wolfram.com/language/ref/Assumptions.html

POSTED BY: Sean Clarke
Posted 10 years ago

Hello, I want to define a complex number like z(x,y) = x + i y But when I do some mathematical operations on this number, Mathematica program don't know that the variables x and y are real numbers

How can i enforce mathematica to deal with x and y as a real numbers not a complex numbers

I am looking for ward to receive a comment .. many thanks

POSTED BY: Ahmed Al-Ali
Posted 10 years ago

Hello, I want to define a complex number like z(x,y) = x + i y But when I do some mathematical operations on this number, Mathematica program don't know that the variables x and y are real numbers

How can i enforce mathematica to deal with x and y as a real numbers not a complex numbers

I am looking for ward to receive a comment .. many thanks

POSTED BY: Ahmed Al-Ali

The solution to this problem is to introduce Assumptions on variables x and y. There is a way to formulate global assumptions or you can add the assumptions as options to Simplify or to a few other Mathematica functions. Details are best seen from the Documentation concerning Assumptions (you know the convenient access via the F1-key to the documentation?).

You may probably wonder why Mathematica does not follow the established paradigm of object oriented languages. I'm not in a position to answer this question. As it appears to me, the more recent versions of Mathematica made some steps on the way to incorporate the type-concept into the language. I would suspect that the end of this way is not yet reached.

Sorry Sean, I overlooked that you did not only write on ComplexExpand that also about Assumptions!

POSTED BY: Ulrich Mutze
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract