For Programmers: Free Programming Magazines  


Home > Archive > Matlab > May 2005 > imaginary unit j in C++









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author imaginary unit j in C++
D

2005-05-30, 8:59 pm

hi there,

Just messing around with some c++ code just now. In matlab if you
want to deign an algorithm that uses the imaginary unit j (sqrt(-1))
you simply insert j, right? But how do you do this in C++? If humans
can hardly comprehend the imaginary unit then how does a computer
manage to handle it?

Any views?

Thanks,

David
Titus Edelhofer

2005-05-31, 9:14 am


Hi David,
in C++ you usually use elements of the class complex. Imaginary unit would
be

complex X = complex(0,1);

Titus

"D" <dav@anon.co.uk> schrieb im Newsbeitrag
news:ef07856.-1@webx.raydaftYaTP...
> hi there,
>
> Just messing around with some c++ code just now. In matlab if you
> want to deign an algorithm that uses the imaginary unit j (sqrt(-1))
> you simply insert j, right? But how do you do this in C++? If humans
> can hardly comprehend the imaginary unit then how does a computer
> manage to handle it?
>
> Any views?
>
> Thanks,
>
> David



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com