Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real part of complex number?

Tags:

r

I'm just learning R, so please forgive what I'm sure is a very elementary question. How do I take the real part of a complex number?

like image 327
Roy Smith Avatar asked Oct 03 '12 00:10

Roy Smith


People also ask

What is the real part?

Definition of real part : the term in a complex number (such as 2 in 2 + 3i) that does not contain the imaginary unit as a factor.

Are real numbers a part of complex numbers?

From the second definition, we can conclude that any real number is also a complex number. In addition, there can be complex numbers that are neither real nor imaginary, like 4 + 2 i 4+2i 4+2i4, plus, 2, i.

What is complex number of real numbers?

A complex number is a number that can be written in the form a + b i a + bi a+bi, where a and b are real numbers and i is the imaginary unit defined by i 2 = − 1 i^2 = -1 i2=−1. The set of complex numbers, denoted by C, includes the set of real numbers (R) and the set of pure imaginary numbers.

What is real and imaginary in complex number?

Complex numbers are the numbers that are expressed in the form of a+ib where, a,b are real numbers and 'i' is an imaginary number called “iota”. The value of i = (√-1). For example, 2+3i is a complex number, where 2 is a real number (Re) and 3i is an imaginary number (Im).


2 Answers

If you read the help file for complex (?complex), you will see a number of functions for performing complex arithmetic. The details clearly state

The functions Re, Im, Mod, Arg and Conj have their usual interpretation as returning the real part, imaginary part, modulus, argument and complex conjugate for complex values.

Therefore

Use Re:

Re(1+2i)
# 1

For the imaginary part:

Im(1+2i)
# 2

?complex will list other useful functions.

like image 64
flodel Avatar answered Oct 19 '22 08:10

flodel


Re(z)

and

Im(z)

would be the functions you're looking for.

See also http://www.johnmyleswhite.com/notebook/2009/12/18/using-complex-numbers-in-r/

like image 33
sehe Avatar answered Oct 19 '22 09:10

sehe