Files
freeCodeCamp/guide/arabic/python/complex-numbers/index.md
Randell Dawson d6a160445e Convert single backtick code sections to triple backtick code sections for Arabic Guide articles (13 of 15) (#36240)
* fix: converted single to triple backticks13

* fix: added prefix

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: removed language in wrong place

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: add language postfix

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: removed language in wrong place

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
2019-06-20 18:07:24 -05:00

61 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Python Complex Numbers
localeTitle: أرقام بيثون معقدة
---
الأعداد المركبة لها جزء حقيقي وهمي ، يمثل كل منها رقم نقطة عائمة.
يمكن إنشاء الجزء التخيلي من رقم مركب باستخدام حرفي تخيلي ، وينتج عن ذلك رقمًا معقدًا بجزء حقيقي من `0.0` :
```python
>>> a = 3.5j
>>> type(a)
<class 'complex'>
>>> print(a)
3.5j
>>> a.real
0.0
>>> a.imag
3.5
```
لا يوجد حرفي لإنشاء رقم مركب بأجزاء حقيقية وغير وهمية. لإنشاء رقم مجمع حقيقي غير صفري ، أضف حرفيًا خياليًا إلى رقم نقطة عائمة:
```python
>>> a = 1.1 + 3.5j
>>> type(a)
<class 'complex'>
>>> print(a)
(1.1+3.5j)
>>> a.real
1.1
>>> a.imag
3.5
```
أو استخدام [منشئ المعقد](https://docs.python.org/3/library/functions.html#complex) .
```python
class complex([real[, imag]])
```
يمكن أن تكون الوسيطات المستخدمة في استدعاء المُنشئ المعقد من نوع رقمي (بما في ذلك `complex` ) لأي من المعلمتين:
```python
>>> complex(1, 1)
(1+1j)
>>> complex(1j, 1j)
(-1+1j)
>>> complex(1.1, 3.5)
(1.1+3.5j)
>>> complex(1.1)
(1.1+0j)
>>> complex(0, 3.5)
3.5j
```
A `string` يمكن أن تستخدم أيضا حجة. لا يُسمح بوسيطة ثانية إذا تم استخدام سلسلة كوسيطة
```python
>>> complex("1.1+3.5j")
(1.1+3.5j)
```