peacefulLizard50262

MathComplexNumbers

This is a Pine Script library for handling complex numbers without arrays. It contains several utility functions for performing various operations on complex numbers, including converting complex numbers into tuples, getting the real and imaginary parts of a complex number, adding and subtracting complex numbers, computing the conjugate, multiplying and dividing complex numbers, computing the reciprocal, the inverse, the negative, the exponential, the ceil and the radius of a complex number.

The library exports a complex data type which consists of two float values: re, the real part of the complex number, and im, the imaginary part of the complex number.

The complex_tuple function and ct function convert a complex number into a tuple, and the get_real, get_imaginary, re, and im functions return the real and imaginary parts of a complex number.

The add and subtract functions add and subtract two complex numbers, respectively, by performing the appropriate arithmetic operations on their real and imaginary parts. The conjugate function returns the complex conjugate of a given complex number, which is the same as the original number but with the sign of its imaginary part reversed. The multiply and divide functions multiply and divide two complex numbers, respectively, according to the rules of complex arithmetic. The reciprocal function computes the reciprocal or inverse of a given complex number, while the inverse function computes the inverse of a given complex number. The negative function returns the negative of a given complex number, and the exponential function computes the exponential of a given complex number. The ceil function rounds a given complex number up to a specified number of digits. The radius function computes the radius (magnitude) of a given complex number, which is defined as its distance from the origin (0,0) of the complex plane.

Perpustakaan Pine

Di dalam semangat sebenar TradingView, pengarang telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka, jadi pengaturcara-pengaturcara Pine yang lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara peribadi atau pada penerbitan-penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini di dalam penerbitan adalah ditadbir oleh Peraturan Dalaman.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Mahu gunakan perpustakaan ini?

Salin garisan ini dan tampalkan ia di dalam skrip anda.