What does transcendental mean, with reference to std::complex?
This is a discussion on What does transcendental mean? within the C++ Programming forums, part of the General Programming Boards category; What does transcendental mean, with reference to std::complex?...
What does transcendental mean, with reference to std::complex?
Transcendental numbers over a specified field F are those numbers that are not the roots of any polynomial (which by definition must be finite in order) with coefficients in the field (that is, the polynomial ring F[x]). Any other number (one which is a solution of such a polynomial) is called algeraic.
I know that is ridiculously incomprehensible, so here are some examples:
The rational numbers (called Q) defined as those numbers of the form a/b where a, b are integers and b != 0 form a field (that is, you can add, subtract, multiply, divide, commute the addition and multiplication, and distribute multiplication over addition; the normal properties which you learn in mid-school/high-school algebra).
So, clearly, sqrt(2) is not in the field Q as it is not rational. sqrt(2) is, however, algebraic over Q since it satisfies the polynomial x^2 - 2 = 0.
Now, take pi. It is both irrational, and, as it turns out, transcendental over Q. The proof is long and complicated, but suffice it to say, pi satisfies no such polynomial as in the previous example of sqrt(2).
Now, the real numbers contain all of the transcendentals and so, the complex numbers do as well. It is, however, impossible to represent an irrational number in finite memory, and since all transcendentals (over the rationals) are irrational (by definition), they cannot be represented in finite memory either.
My apologies about the complexity of the answer. If it doesn't make sense, let me know, and I can post a clarified definition (or perhaps someone else better at articulating this sort of thing).
Cheers.
As an answer to your second question. They don't really have anything directly to do with std::complex other than they could exist as complex numbers, but you can only approximate them with that class (or any other, for that matter).
Cheers.
Thanks for the reply. I'm sorry if my question wasn't clear. Allow me to ellaborate on what I meant by my question with regard to the complex class.
According to the C++ documentation I have, the non-member function:
template<class T> complex<T> cos (const complex<T>&);
is 'transcendental'. Whereas:
template<class T> complex<T> polar (const T&, const T&);
is not.
What does this mean?
I ask because I notice when I call transcendental functions with a complex<long double> type, the result is only accurate to double precision and the lowest order digits are spurious.
But when I call a non-transcendental function, the result is accurate to full long double precision.
I am not using VC++, so I have proper 80bit long double types and my compiler generally supports long double math.
But I am wondering what significance 'transcendental' may have with regard to how my math library implements 'transcendental' functions, as it appears that complex<long double> values are being down-cast to complex<double> within transcendental calls, but not with non-transcendental ones.
Does any of that make sense?
Okay, that makes sense. The answer, actually, is roughly the same. Basically, it means that there is no algebraic formula for the function, and so you have to rely on it's properties (algebraic, geometric, and special cases) to calculate its value.
Thanks Zach.