Bình phương số phức trăn

Tổng của một số thực và một số ảo gọi là số phức. Đây là những số có thể được viết dưới dạng a + ib. trong đó a và b đều là số thực. Nó được ký hiệu là z

Giá trị của i là [√-1] hoặc có thể viết là i2 = -1

Ví dụ

  • 3+4i là một số phức, trong đó 3 là số thực [Re] và 4i là số ảo [Im]
  • 2+5i là một số phức trong đó 2 là số thực [Re] và  5i là số ảo [I'm]

Hợp của số thực và số ảo gọi là số phức

số ảo

Số không có thực gọi là số ảo. Sau khi bình phương một số ảo, nó cho kết quả âm. Số ảo được biểu diễn dưới dạng Im[].    

Thí dụ. √-3, √-7, √-11 đều là số ảo. ở đây 'i' là một số ảo được gọi là "iota"

Điều gì xảy ra khi bạn bình phương một số ảo?

Số không có thực gọi là số ảo. Sau khi bình phương một số ảo, nó cho kết quả âm. Số ảo được biểu diễn dưới dạng Im[]. Số có thể viết dưới dạng số thực nhân với đơn vị ảo i được gọi là số ảo

Thí dụ. √3i, √-4i, √-11 đều là số ảo. ở đây 'i' là một số ảo được gọi là "iota". Giá trị của i là [√-1] hoặc có thể viết là i2 = -1

Cho hai số nguyên dương A và B biểu diễn số phức Z dưới dạng Z = A + i * B, nhiệm vụ là tìm căn bậc hai của số phức đã cho

ví dụ

Đầu vào. A = 0, B =1
Đầu ra.
Căn bậc hai là.
0. 707107+0. 707107*i
-0. 707107 – 0. 707107*i

Đầu vào. A = 4, B = 0
Đầu ra.
Căn bậc hai là.
2
-2

Cách tiếp cận. Vấn đề đã cho có thể được giải quyết dựa trên các quan sát sau

  • Biết rằng căn bậc hai của một số phức cũng là một số phức
  • Sau đó xem xét căn bậc hai của số phức bằng X + i*Y, giá trị của [A + i*B] có thể được biểu thị bằng
    • A + i * B = [X + i * Y] * [X + i * Y]
    • A + i * B = X2 – Y2+ 2 * i * X * Y
  • Cân bằng giá trị của từng phần thực và phức

Từ các quan sát trên, hãy tính giá trị của X và Y bằng công thức trên và in giá trị [X + i*Y] dưới dạng giá trị căn bậc hai kết quả của số phức đã cho

Dưới đây là việc thực hiện các phương pháp trên

C++




// C++ program for the above approach

 

#include

using namespace std;

 

// Function to find the square root of

// a complex number

void complexRoot[// C++ program for the above approach0 // C++ program for the above approach1_______00 // C++ program for the above approach3

// C++ program for the above approach4

// C++ program for the above approach5// C++ program for the above approach6

// C++ program for the above approach5// C++ program for the above approach8// C++ program for the above approach9#include 0// C++ program for the above approach9#include 2

 

// C++ program for the above approach5#include 4

// C++ program for the above approach5// C++ program for the above approach9 #include 7_______18#include 9using0using1using0using3

using4using5

using6using7

// C++ program for the above approach5// C++ program for the above approach9 namespace0

 

// C++ program for the above approach5namespace2

// C++ program for the above approach5namespace4

 

// C++ program for the above approach5namespace6

// C++ program for the above approach5// C++ program for the above approach9 namespace9

// C++ program for the above approach5// C++ program for the above approach9 std;2

 

// C++ program for the above approach5std;4

// C++ program for the above approach5std;6 std;7

 

std;8std;9

std;8// Function to find the square root of1

std;8// Function to find the square root of3

// C++ program for the above approach5// Function to find the square root of5

 

// C++ program for the above approach5// Function to find the square root of7

// C++ program for the above approach5// C++ program for the above approach9 // a complex number0using0// a complex number2

 

// C++ program for the above approach5// a complex number4

// C++ program for the above approach5std;6 // a complex number7

std;8// a complex number9#include 8#include 9using0void3

std;8// C++ program for the above approach9 void6

 

std;8std;9

std;8// Function to find the square root of1

std;8complexRoot[2

 

std;8complexRoot[4

std;8// C++ program for the above approach9 complexRoot[7

std;8// C++ program for the above approach9 // C++ program for the above approach00

 

std;8std;6 // C++ program for the above approach03

 

// C++ program for the above approach04// C++ program for the above approach05

// C++ program for the above approach04// C++ program for the above approach07

// C++ program for the above approach04// C++ program for the above approach09

std;8// Function to find the square root of5

// C++ program for the above approach5// Function to find the square root of5

 

// C++ program for the above approach5// C++ program for the above approach15

// C++ program for the above approach5// C++ program for the above approach17____018

// C++ program for the above approach19// C++ program for the above approach20

 

// C++ program for the above approach5// C++ program for the above approach22 #include 9____024 // C++ program for the above approach25

std;8// C++ program for the above approach27

std;8std;6 // C++ program for the above approach30

// C++ program for the above approach04// C++ program for the above approach17// C++ program for the above approach33// C++ program for the above approach34

std;8std;6 // C++ program for the above approach37

// C++ program for the above approach04// C++ program for the above approach39

// C++ program for the above approach40// C++ program for the above approach41// C++ program for the above approach42 // C++ program for the above approach20

std;8// C++ program for the above approach45

// C++ program for the above approach04// C++ program for the above approach47

// C++ program for the above approach5// Function to find the square root of5

// Function to find the square root of5

 

// C++ program for the above approach51

// C++ program for the above approach0 // C++ program for the above approach53

// C++ program for the above approach4

// C++ program for the above approach5// C++ program for the above approach0 // C++ program for the above approach57

// C++ program for the above approach5// C++ program for the above approach59

 

// C++ program for the above approach5// C++ program for the above approach61 // C++ program for the above approach62

// Function to find the square root of5

Java




// C++ program for the above approach64

// C++ program for the above approach65 // C++ program for the above approach66

 

// C++ program for the above approach67 // C++ program for the above approach68

// C++ program for the above approach5

// C++ program for the above approach70 // C++ program for the above approach67 // C++ program for the above approach72

// C++ program for the above approach4

// C++ program for the above approach5// C++ program for the above approach9 // C++ program for the above approach76

// C++ program for the above approach5// C++ program for the above approach78 // C++ program for the above approach79______09 // C++ program for the above approach81

// C++ program for the above approach82// C++ program for the above approach9 // C++ program for the above approach84

// C++ program for the above approach5// C++ program for the above approach4

std;8// C++ program for the above approach88// C++ program for the above approach89

_______48____088// C++ program for the above approach92

// C++ program for the above approach5// C++ program for the above approach94

// Function to find the square root of5

 

// Function to find the square root of

// a complex number

// C++ program for the above approach70 void complexRoot[// C++ program for the above approach0 // C++ program for the above approach1// C++ program for the above approach0 // C++ program for the above approach3

// C++ program for the above approach4

// C++ program for the above approach5

// C++ program for the above approach5// C++ program for the above approach6

// C++ program for the above approach5#include 10____111 #include 12

 

// C++ program for the above approach5#include 4

// C++ program for the above approach5// C++ program for the above approach9 #include 17

#include 18#include 19____120#include 21

// C++ program for the above approach5// C++ program for the above approach9 #include 24#include 20 #include 26

 

// C++ program for the above approach5namespace2

// C++ program for the above approach5#include 30____111 #include 32

 

// C++ program for the above approach5namespace6

// C++ program for the above approach5// C++ program for the above approach9 #include 37____138 #include 39

// C++ program for the above approach5// C++ program for the above approach9 #include 42#include 20 #include 44

 

// C++ program for the above approach5std;4

// C++ program for the above approach5std;6 #include 49#include 50#include 51

// C++ program for the above approach5// C++ program for the above approach4

std;8

std;8std;9

std;8// Function to find the square root of1

std;8#include 30#include 11 #include 62

// C++ program for the above approach5// Function to find the square root of5

 

// C++ program for the above approach5// Function to find the square root of7

// C++ program for the above approach5// C++ program for the above approach9 #include 69____120// C++ program for the above approach34

 

// C++ program for the above approach5// a complex number4

// C++ program for the above approach5std;6 #include 76____150#include 51

// C++ program for the above approach5// C++ program for the above approach4

std;8#include 82

std;8// C++ program for the above approach9 #include 85______120 #include 87

 

std;8std;9

std;8// Function to find the square root of1

std;8#include 30#include 11 #include 95

 

std;8complexRoot[4

std;8// C++ program for the above approach9 using00#include 38 using02

std;8// C++ program for the above approach9 using05____120 using07

 

std;8std;6 using10#include 50#include 51

std;8// C++ program for the above approach4

// C++ program for the above approach04

// C++ program for the above approach04// C++ program for the above approach05

// C++ program for the above approach04// C++ program for the above approach07

// C++ program for the above approach04#include 30#include 11 using23

std;8// Function to find the square root of5

// C++ program for the above approach5// Function to find the square root of5

 

// C++ program for the above approach5// C++ program for the above approach15

// C++ program for the above approach5using31____018 using33using34using35

 

// C++ program for the above approach5// C++ program for the above approach22using38

// C++ program for the above approach5// C++ program for the above approach4

std;8using42using43using44

std;8std;6 using47____150#include 51

_______004using31____033using35

std;8std;6 using56____150#include 51

// C++ program for the above approach04using42____261using62

std;8// C++ program for the above approach45

// C++ program for the above approach04using66

// C++ program for the above approach5// Function to find the square root of5

// Function to find the square root of5

 

// C++ program for the above approach51

// C++ program for the above approach78 // C++ program for the above approach70 void using74

// C++ program for the above approach4

// C++ program for the above approach5// C++ program for the above approach0 using78#include 50using80#include 38// C++ program for the above approach34

// C++ program for the above approach5

// C++ program for the above approach5// C++ program for the above approach59

// Function to find the square root of5

// Function to find the square root of5

 

using88

Python3




using89

using90 using91// C++ program for the above approach65 using0

 

using94

using95

using96 using97

// C++ program for the above approach5

// C++ program for the above approach5namespace00

// C++ program for the above approach5namespace02____303 namespace04

 

// C++ program for the above approach5namespace06

// C++ program for the above approach5namespace08namespace03 #include 8namespace11using33 namespace13namespace14 namespace15using33 namespace17namespace14 namespace19namespace20 #include 20namespace22

// C++ program for the above approach5namespace24namespace03 namespace17namespace20 #include 9#include 20 namespace14 namespace31

 

// C++ program for the above approach5namespace33

// C++ program for the above approach5namespace35

 

// C++ program for the above approach5namespace37

// C++ program for the above approach5namespace39namespace03 namespace41#include 38 namespace14 namespace08

// C++ program for the above approach5namespace46namespace03 namespace17namespace20 #include 9#include 20 namespace14 namespace53

 

// C++ program for the above approach5namespace55

// C++ program for the above approach5std;6 namespace58namespace03 #include 50namespace61

 

std;8namespace63

std;8namespace65

std;8namespace67

 

// C++ program for the above approach5namespace69

// C++ program for the above approach5namespace71namespace03 namespace73namespace41 namespace13namespace14 namespace15using33 namespace17namespace14 namespace19namespace20 #include 20

 

// C++ program for the above approach5namespace85

// C++ program for the above approach5std;6 #include 76____150namespace61

std;8namespace71____303 #include 8namespace95

std;8namespace97namespace03 namespace17namespace20 #include 9#include 20 namespace14 std;04

 

std;8namespace63

std;8namespace65

std;8std;10

 

_______48____412

std;8std;14namespace03 namespace41#include 38 namespace14 namespace71

std;8std;21______303 namespace17namespace20 #include 9#include 20 namespace14 std;28

 

std;8std;6 std;31namespace03 #include 50namespace61

 

_______004____436

_______004____438

// C++ program for the above approach04std;40

 

// C++ program for the above approach5std;42

// C++ program for the above approach5std;44#include 9// C++ program for the above approach18#include 51

 

// C++ program for the above approach5// C++ program for the above approach22 std;50std;51 std;52

std;8std;44#include 9std;56std;57#include 50____459std;60std;61namespace03 std;63

std;8std;6 std;57____138std;68#include 50namespace61

// C++ program for the above approach04std;44#include 9std;86#include 9std;56std;57#include 38std;59std;60namespace22using33 // C++ program for the above approach42#include 51

Có hàm vuông trong Python không?

Bình phương sử dụng phương thức pow[]. Phương thức pow[] là một phương thức khác trong Python có thể dùng để bình phương một số . Phương thức này cũng nhận hai đối số theo cú pháp sau. Phương pháp này tương đương với phương pháp lũy thừa và bạn có thể chọn phương pháp nào bạn muốn sử dụng.

Căn bậc hai trong Python ở đâu?

hàm sqrt[] là một hàm có sẵn trong ngôn ngữ lập trình Python trả về căn bậc hai của bất kỳ số nào. cú pháp. môn Toán. tham số sqrt[x]. x là bất kỳ số nào sao cho x>=0 Trả về. Nó trả về căn bậc hai của số được truyền trong tham số.

Chủ Đề