PINE LIBRARY
Cập nhật MathComplexCore

Library "MathComplexCore"
Core functions to handle complex numbers.
set_real(complex_number, real) Set the real part of complex_number.
Parameters:
Returns: Void, Modifies complex_number.
set_imaginary(complex_number, imaginary) Set the imaginary part of complex_number.
Parameters:
Returns: Void, Modifies complex_number.
new(real, imaginary) Creates a prototype array to handle complex numbers.
Parameters:
zero() complex number "0+0i".
return float array, pseudo complex number in the form of a array [real, imaginary].
one() complex number "1+0i".
return float array, pseudo complex number in the form of a array [real, imaginary].
imaginary_one() complex number "0+1i".
return float array, pseudo complex number in the form of a array [real, imaginary].
nan() complex number "0+1i".
return float array, pseudo complex number in the form of a array [real, imaginary].
from_polar_coordinates(magnitude, phase) Create a complex number from a point's polar coordinates.
Parameters:
get_real(complex_number) Get the real part of complex_number.
Parameters:
Returns: float, Real part of the complex_number.
get_imaginary(complex_number) Get the imaginary part of complex_number.
Parameters:
Returns: float, Imaginary part of the complex number.
is_complex(complex_number) Checks that its a valid complex_number.
Parameters:
Returns: bool.
is_nan(complex_number) Checks that its empty "na" complex_number.
Parameters:
Returns: bool.
is_real(complex_number) Checks that the complex_number is real.
Parameters:
Returns: bool.
is_real_non_negative(complex_number) Checks that the complex_number is real and not negative.
Parameters:
Returns: bool.
is_zero(complex_number) Checks that the complex_number is zero.
Parameters:
Returns: bool.
equals(complex_number_a, complex_number_b) Compares two complex numbers:
Parameters:
Returns: boolean value representing the equality.
to_string(complex, format) Converts complex_number to a string format, in the form: "a+bi"
Parameters:
Returns: a string in "a+bi" format
Core functions to handle complex numbers.
set_real(complex_number, real) Set the real part of complex_number.
Parameters:
- complex_number: float array, pseudo complex number in the form of a array [real, imaginary].
- real: float, value to replace real value of complex_number.
Returns: Void, Modifies complex_number.
set_imaginary(complex_number, imaginary) Set the imaginary part of complex_number.
Parameters:
- complex_number: float array, pseudo complex number in the form of a array [real, imaginary].
- imaginary: float, value to replace imaginary value of complex_number.
Returns: Void, Modifies complex_number.
new(real, imaginary) Creates a prototype array to handle complex numbers.
Parameters:
- real: float, real value of the complex number. default=0.
- imaginary: float, imaginary number of the complex number. default=0.
return float array, pseudo complex number in the form of a array [real, imaginary].
zero() complex number "0+0i".
return float array, pseudo complex number in the form of a array [real, imaginary].
one() complex number "1+0i".
return float array, pseudo complex number in the form of a array [real, imaginary].
imaginary_one() complex number "0+1i".
return float array, pseudo complex number in the form of a array [real, imaginary].
nan() complex number "0+1i".
return float array, pseudo complex number in the form of a array [real, imaginary].
from_polar_coordinates(magnitude, phase) Create a complex number from a point's polar coordinates.
Parameters:
- magnitude: float, default=0.0, The magnitude, which is the distance from the origin (the intersection of the x-axis and the y-axis) to the number.
- phase: float, default=0.0, The phase, which is the angle from the line to the horizontal axis, measured in radians.
return float array, pseudo complex number in the form of a array [real, imaginary].
get_real(complex_number) Get the real part of complex_number.
Parameters:
- complex_number: pseudo complex number in the form of a array [real, imaginary].
Returns: float, Real part of the complex_number.
get_imaginary(complex_number) Get the imaginary part of complex_number.
Parameters:
- complex_number: pseudo complex number in the form of a array [real, imaginary].
Returns: float, Imaginary part of the complex number.
is_complex(complex_number) Checks that its a valid complex_number.
Parameters:
- complex_number: pseudo complex number in the form of a array [real, imaginary].
Returns: bool.
is_nan(complex_number) Checks that its empty "na" complex_number.
Parameters:
- complex_number: pseudo complex number in the form of a array [real, imaginary].
Returns: bool.
is_real(complex_number) Checks that the complex_number is real.
Parameters:
- complex_number: pseudo complex number in the form of a array [real, imaginary].
Returns: bool.
is_real_non_negative(complex_number) Checks that the complex_number is real and not negative.
Parameters:
- complex_number: pseudo complex number in the form of a array [real, imaginary].
Returns: bool.
is_zero(complex_number) Checks that the complex_number is zero.
Parameters:
- complex_number: pseudo complex number in the form of a array [real, imaginary].
Returns: bool.
equals(complex_number_a, complex_number_b) Compares two complex numbers:
Parameters:
- complex_number_a: float array, pseudo complex number in the form of a array [real, imaginary].
- complex_number_b: float array, pseudo complex number in the form of a array [real, imaginary].
Returns: boolean value representing the equality.
to_string(complex, format) Converts complex_number to a string format, in the form: "a+bi"
Parameters:
- complex: pseudo complex number in the form of a array [real, imaginary].
- format: string, formating to apply.
Returns: a string in "a+bi" format
Phát hành các Ghi chú
v2 - Update to types, and cleaned deprecated functionsAdded:
from(value)
Creates a new Complex number from provided value.
Parameters:
value: string . Value of real and imaginary parts.
Returns: Complex.
Updated:
new(real, imaginary)
Creates a new Complex number.
Parameters:
real: float . Real part of the complex number. default=0.
imaginary: float . Imaginary part of the complex number. default=0.
Returns: Complex.
from_polar_coordinates(magnitude, phase)
Create a complex number from polar coordinates.
Parameters:
magnitude: float, default=0.0, The magnitude, which is the distance from the origin (the intersection of the x-axis and the y-axis) to the number.
phase: float, default=0.0, The phase, which is the angle from the line to the horizontal axis, measured in radians.
Returns: Complex.
zero()
Complex number "0+0i".
Returns: Complex.
one()
Complex number "1+0i".
Returns: Complex.
imaginary_one()
Complex number "0+1i".
Returns: Complex.
nan()
Complex number with `float(na)` parts.
Returns: Complex.
is_complex(this)
Checks that its a valid complex number.
Parameters:
this: Complex Source complex number.
Returns: bool.
is_nan(this)
Checks that its empty "na" complex number.
Parameters:
this: Complex Source complex number.
Returns: bool.
is_real(this)
Checks that the complex_number is real.
Parameters:
this: Complex Source complex number.
Returns: bool.
is_real_non_negative(this)
Checks that the complex_number is real and not negative.
Parameters:
this: Complex Source complex number.
Returns: bool.
is_zero(this)
Checks that the complex_number is zero.
Parameters:
this: Complex Source complex number.
Returns: bool.
equals(this, other, eps)
Compares two complex numbers:
Parameters:
this: Complex . Source complex number.
other: Complex . Target complex number
eps: float . Precision value, default=1e-15.
Returns: boolean value representing the equality.
to_string(this, format)
Converts complex number to a string format, in the form: "a+bi"
Parameters:
this: Complex . Source complex number..
format: string, formating to apply.
Returns: string. In "a+bi" format
Removed: set_real(), set_imaginary(), get_real(), get_imaginary()
Phát hành các Ghi chú
v3 missed method on to_string().Phát hành các Ghi chú
v4 minor updateThư viện Pine
Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Xin tri ân tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Nội quy chung.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Thư viện Pine
Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Xin tri ân tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Nội quy chung.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.