Skip to main content
1-Visitor
March 29, 2018
Solved

Defining complex numbers

  • March 29, 2018
  • 2 replies
  • 25199 views

Hi everybody!

Primary question is:

How could one define a complex number?

I tried it  assigning 

Re(C):= Formular1  

 Im(C):= Formular2

After that I assigned:  G:=Re(C) + Im(C)

This shouldn't be neccessary, because a complex number is defined by its components. But it is obviously neccessary. Without that a plot doesn't work.

I attach the whole working sheet and the Input data of the load in the time Domain.

Thanks in advance!

Udo

 

 

Best answer by LucMeekes

Udo,

 

The value 1i (typed just like that, first a '1' then an 'i', nothing more, nothing less !) is a predefined value, unit if you will, in Mathcad and represents what every mathematician understands as the unit of an imaginary number.

So, as Werner and myself wrote, if you type c:4+5i, you define c as a complex number with real part 4 and imaginary part 5.

However appending i to a variable name does NOT make that variable imaginary. To do that you have to multiply it with the imaginary unit, which is...... 1i.

In your example you would/should: c:=reS +ImS*1i.

Re() and Im() are predefined functions in mathcad, congruent with ordinary mathematical understanding, that take the real and imaginary part respectively of their argument. With c defined as the first example above: Re(c)=4 and Im(c)=5.

You should NOT redefine Re and Im.

 

Be patient, come here as often as you need.... and you will learn.

Success! and Frohe Ostern.
Luc

 

2 replies

25-Diamond I
March 29, 2018

To attach a Mathcad worksheet you have to put it in an archive (zip, rar, 7z,...) first because of a sever bug in the forum software used here.

To define a complex number with its components you simply type z:=2+3i or z:=2+3j. Its important that you don't type a space or a multiplication sign between the 3 and the i. If you want to use the imaginary unit alone you have to type 1i. In real Mathcad after leaving the math region the "1" is not displayed anymore, in mean Prime this unfortunately is not the case.

You should state which version of Mathcad you are using and what exactly you are trying to achieve.

Im(C) will give you the imaginary part of a complex number and by the definition this is a simple real number (it does NOT include the imaginary unit i).

UdoPeil1-VisitorAuthor
1-Visitor
March 30, 2018

Thank you Werner,

this is clear. My problem is somewhat different.

Thus I attach the worksheet as a zipped file. The needed data file will not taken into the list of attached files. it seems that only one file could be attached. Anyway, the datafile is attached at my first mail at the PTC mail-Center.

The problem occurs at the very end. All is explained or discussed there.

Discussion is written in German, I don't know, if you'll understand that. It is not impossible, because your first name is German origin...

If not, please respond shortly and I will translate it to English.

Thanks in advance and happy eastern!!

Udo

 

 

23-Emerald I
March 30, 2018

I have your version 15 file, and your data.  (You can embed the data into a version 15 file via a data table.)

 

Unfortunately my German is no better than any standard Us Citizen--almost worthless.  I attempted to work down thru your sheet and failed.  If you could translate, then maybe I can help!

 

Sorry!

23-Emerald I
March 30, 2018

Werner has given you the primer on creating and using imaginary numbers.

Attached is one simple example using your data file. (Prime 3.0)

UdoPeil1-VisitorAuthor
1-Visitor
March 30, 2018

Hi Fred,

thanks for your reply, but my problem is a different one. Please have a look at the very end of the attached worksheet there all is explained and discussed. All explanations are written in German, if you don't understand, please come back shortly, I will then translate the discussion.

If you like to run the worksheet, you need the data file. Obviously one can't attach two files thus I beg you to load the data file from my former email to PTC mail-center..

Thanks in advance an a happy eastern

Udo

 

 

23-Emerald IV
March 30, 2018

First off, as Werner explained:

LM_20180330_Complex.png

Then, at the very end of the file, you are confronted with nested arrays. the construct [256,1] tells you that the element is a vector, a matrix of (in this case) 256 elements high, one element wide.

To see the individual elements, you can instruct mathcad to 'expand nested arrays' on the 'result formatting' pop-up window. In this case I would advise against, since the display of this array will be big. Here's an example with smaller vectors:

LM_20180330_Nested.png 

You can attach more than one file to a post in this forum. But the second (and further) file(s) can only be attached by editing the existing post. That's what I did.

 

Success!
Luc