Complex Type क्या है
Complex numbers के दो parts होते हैं, एक everyday part और एक imaginary part, दो coordinates वाले एक treasure map की तरह। R इनके साथ directly math कर सकता है, जो science और engineering में useful है।
In this page:
Syntax
z <- 3+2i
Re(z)
Im(z)
Complex Type
R complex type के साथ natively complex numbers support करता है, a+bi की तरह लिखे गए imaginary unit के लिए i इस्तेमाल करते हुए, जैसे 3+4i।
Standard arithmetic operators complex numbers पर directly काम करते हैं। यह दूसरे basic types से कम commonly इस्तेमाल होता है लेकिन scientific और engineering computation के लिए पूरी तरह built in है।
Note:
Mod() एक complex number की magnitude compute करता है, और Re()/Im() इसके real और imaginary parts extract करते हैं।उदाहरण: Complex Type
z <- 3 + 4i
cat(class(z), "\n")
cat("Magnitude:", Mod(z), "\n")
cat("Real part:", Re(z), "Imaginary part:", Im(z), "\n")
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
3 + 4iकी बजाय3 + i4या3 + 4*iलिखना, जो fail होता है क्योंकिiको directly number के बाद आना ज़रूरी है।- यह उम्मीद करना कि
sqrt(-1)1iदेगा, जब यह एक warning के साथNaNreturn करता है जब तक आपsqrt(as.complex(-1))इस्तेमाल न करें। - complex numbers को
<या>से compare करना, जो एक error है क्योंकि इनका कोई order नहीं।
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: