Repository navigation
Cpx (class)
Cpx is a static subclass of the Complex class. Cpx allows for Complex functions to be implemented external to the Complex class. People familiar with C++ might find the implemented functions functionally similar to friend functions. Cpx stands for "complex". It's intentionally short so that calls to it are quick and take up little screen real estate.
The purpose of this tab is so that, if someone wants to create a math heavy function, they can create a class which extends Cpx and declare the function inside that class. That way, they can just casually say "sin(inp)" or "exp(number)" within that chunk of code. However, if for any reason, the programmer is unable to declare it in such a way (for instance, maybe they have to declare the function within another class which strictly cannot extend Cpx), the short name still gives minimal hassle in implementation.
The unlimited input add and mul functions are implemented exclusively in this class, as well as all arithmetic functions whereby all inputs are parameters (that is, no instances come before the function). Such functions might prove to be helpful, such as if the programmer wants to subtract a complex from a double or compute the quotient between a double and a complex respectively. The Cpx class also defines a few external constructors, such as Complex (without "new") or iTimes (which allows one to define a new complex number with no real part). It also has a function which casts a String to a Complex, and a few functions to define instances of complex equal to specific constants, such as zero(), one(), two(), and mOne() (which stands for minus one).