কম্পিউটার টিউটোরিয়াল

C++-এ কমপ্লেক্স নম্বরের জন্য polar() ফাংশন


কমপ্লেক্স নম্বরের polar ফাংশন একটি কমপ্লেক্স সংখ্যা রিটার্ন করতে ব্যবহৃত হয়।

polar() ফাংশন C++-এ complex হেডার ফাইলে সংজ্ঞায়িত। এটি একটি কমপ্লেক্স সংখ্যার ম্যাগনিচিউড এবং ফেজ অ্যাঙ্গেল নেওয়ায় এই মানগুলো ব্যবহার করে একটি কমপ্লেক্স সংখ্যা জেনারেট করে।

সিনট্যাক্স

polar(mag, phase);

প্যারামিটার - এটি দুটি মান প্যারামিটার হিসেবে নেয়, কমপ্লেক্স সংখ্যা জেনারেট করার জন্য ফেজ এবং ম্যাগনিচিউড।

রিটার্ন ভ্যালু - ফাংশনটি একটি কমপ্লেক্স সংখ্যা রিটার্ন করে।

polar(0.2, 0.5) -> (0.175517,0.0958851)

উদাহরণ

#include<iostream> 
#include>complex.h> 
using namespace std; 

int main() {
    cout << "\t\tRUN 1\n";
    cout << "Complex number with magnitude: 5.2 and phase angle: 1.6 is ";
    cout << polar(5.2,1.6) << endl;
    cout << "\t\tRUN 2\n";
    cout << "Complex number with magnitude: 0.5 and phase angle: 0.2 is ";
    cout << polar(0.5,0.2) << endl;
    cout << "\t\tRUN 3\n";
    cout << "Complex number with magnitude: 0.2 and phase angle: 0.5 is ";
    cout << polar(0.2,0.5) << endl;
    return 0;
}

আউটপুট

RUN 1
Complex number with magnitude: 5.2 and phase angle: 1.6 is (-0.151838,5.19778)
RUN 2
Complex number with magnitude: 0.5 and phase angle: 0.2 is (0.490033,0.0993347)
RUN 3
Complex number with magnitude: 0.2 and phase angle: 0.5 is (0.175517,0.0958851)

  1. C++-এ জটিল সংখ্যার জন্য abs() ফাংশন

  2. C++-এ জটিল সংখ্যার জন্য atan() ফাংশন

  3. C++-এ জটিল সংখ্যার জন্য asin() ফাংশন

  4. C++-এ জটিল সংখ্যার জন্য acos() ফাংশন