Comment by adrian_b

1 month ago

It should be noted that the number e = 2.71828 ... does not have any importance in practice, its value just satisfies the curiosity to know it, but there is no need to use it in any application.

The transcendental number whose value matters (being the second most important transcendental number after 2*pi = 6.283 ...) is ln 2 = 0.693 ... (and the value of its inverse log2(e), in order to avoid divisions).

Also for pi, there is no need to ever use it in computer applications, using only 2*pi everywhere is much simpler and 2*pi is the most important transcendental number, not pi.

This comment is quite strange to me. e is the base of the natural logarithm. so ln 2 is actually log_e (2). If we take the natural log of 2, we are literally using its value as the base of a logarithm.

Does a number not matter "in practice" even if it's used to compute a more commonly use constant? Very odd framing.

  • The number "e" itself is never needed in any application.

    It is not used for computing the value of ln(2) or of log2(e), which are computed directly as limits of some convergent series.

    As I have said, there is no reason whatsoever for knowing the value of e.

    Moreover, there is almost never a good choice to use the exponential function or the hyperbolic logarithm function (a.k.a. natural logarithm, but it does not really deserve the name "natural").

    For any numeric computations, it is preferably to use everywhere the exponential 2^x and the binary logarithm. With this choice, the constant ln 2 or its inverse appears in formulae that compute derivatives or integrals.

    People are brainwashed in school into using the exponential e^x and the hyperbolic logarithm, because this choice was more convenient for symbolic computations done with pen on paper, like in the 19th century.

    In reality, choosing to have the proportionality factor in the derivative formula as "1" instead of "ln 2" is a bad choice. The reason is that removing the constant from the derivative formula does not make it disappear, but it moves it into the evaluation of the function and in any application much more evaluations of the functions must be done than computations of derivative or integral formulae.

    The only case when using e^x may bring simplifications is in symbolic computations with complex exponentials and complex logarithms, which may be needed in the development of mathematical models for some linear systems that can be described by linear systems of ordinary differential equations or of linear equations with partial derivatives. Even then, after the symbolic computation produces a mathematical model suitable for numeric computations it is more efficient to convert all exponential or logarithmic functions to use only 2^x and binary logarithms.

    • From your other responses in this thread, it looks like you do concede that e is useful in symbolic computation, and others use the phraseology "how the function is implemented", which is quite a silly thing to say in a classical math context, but not in a computational context.

      I didn't understand immediately that you were talking about using values related to e in a computational context. But your comment about "brainwashing" seems a bit off. Are you saying that programmers bring e and ln with them into code when more effective constants exist for the same end? That's probably true. But brainwashing is far too strong, since things need to be taught in the correct order in math in order for each next topic to make sense. e really only comes in when learning derivative rules where it's explained "e is a number where when used as the base in an exponential function, that function's derivative is itself." Math class makes no pretense that you ought to use any of it to inform how you write code, so the brainwashing accusation seems off to me.

> It should be noted that the number e = 2.71828 ... does not have any importance in practice, its value just satisfies the curiosity to know it, but there is no need to use it in any application.

In calculations like compound financial interest, radioactive decay and population growth (and many others), e is either applied directly or derived implicitly.

> ... 2*pi is the most important transcendental number, not pi.

Gotta agree with this one.

  • When using the exponential e^x or the natural logarithm, the number "e" is never used. Only ln 2 or its inverse are used inside the function evaluations, for argument range reduction.

    In radioactive decay and population growth it is much simpler conceptually to use 2^x, not e^x, which is why this is done frequently even by people who are not aware that the computational cost of 2^x is lower and its accuracy is greater.

    In compound financial interest using 2^x would also be much more natural than the use of e^x, but in financial applications tradition is usually more important than any actual technical arguments.

    • > When using the exponential e^x or the natural logarithm, the number "e" is never used. Only ln 2 or its inverse are used inside the function evaluations, for argument range reduction.

      That is only true in the special case of computing a half-life. In the general case, e^x is required. When computing a large number of cases and to avoid confusion, e^x is the only valid operator. This is particularly true in compound interest calculations, which would fall apart entirely without the presence of e^x and ln(x).

      > In radioactive decay and population growth it is much simpler conceptually to use 2^x, not e^x

      See above -- it's only valid if a specific, narrow question is being posed.

      > In compound financial interest using 2^x would also be much more natural than the use of e^x

      That is only true to answer a specific question: How much time to double a compounded value? For all other cases, e^x is a requirement.

      If your position were correct, if 2^x were a suitable replacement, then Euler's number would never have been invented. But that is not reality.

      2 replies →

It took me quite a bit to figure out what you're trying to say here.

The importance of e is that it's the natural base of exponents and logarithms, the one that makes an otherwise constant factor disappear. If you're using a different base b, you generally need to adjust by exp(b) or ln(b), neither of which requires computing or using e itself (instead requiring a function call that's using minimax-generated polynomial coefficients for approximation).

The importance of π or 2π is that the natural periodicity of trigonometric functions is 2π or π (for tan/cot). If you're using a different period, you consequently need to multiply or divide by 2π, which means you actually have to use the value of the constant, as opposed to calling a library function with the constant itself.

Nevertheless, I would say that despite the fact that you would directly use e only relatively rarely, it is still the more important constant.

What an odd thing to say. I find that it shows up all the time (and don't find myself using 2pi any more than pi).

  • Pi not multiplied by 2 has only one application, which is ancient. For most objects, it is easier to measure directly the diameter than the radius. Then you can compute the circumference by multiplying with Pi.

    Except for this conversion from directly measured diameters, one rarely cares about hemicycles, but about cycles.

    The trigonometric functions with arguments measured in cycles are more accurate and faster to compute. The trigonometric functions with arguments measured in radians have simpler formulae for derivatives and primitives. The conversion factor between radians and cycles is 2Pi, which leads to its ubiquity.

    While students are taught to use the trigonometric functions with arguments measured in radians, because they are more convenient for some symbolic computations, any angle that is directly measured is never measured in radians, but in fractions of a cycle. The same is true for any angle used by an output actuator. The methods of measurement with the highest precision for any physical quantity eventually measure some phase angle in cycles. Even the evaluations of the trigonometric functions with angles measured in radians must use an internal conversion between radians and cycles, for argument range reduction.

    So the use of the 2*Pi constant is unavoidable in almost any modern equipment or computer program, even if many of the uses are implicit and not obvious for whoever does not know the detailed implementations of the standard libraries and of the logic hardware.

    If trigonometric functions with arguments measured in radians are used anywhere, then conversions between radians in cycles must exist, either explicit conversions or implicit conversions.

    If only trigonometric functions with arguments measured in cycles are used, then some multiplications with 2Pi or its inverse appear where derivatives or primitives are computed.

    In any application that uses trigonometric functions millions of multiplications with 2Pi may be done every second. In contrast, a multiplication by Pi could be needed only at most at the rate at which one could measure the diameters of some physical objects for which there would be a reason to want to know their circumference.

    Because Pi is needed so much more rarely, it is simpler to just have a constant Pi_2 to be used in most cases and for the rare case of computing a circumference from the diameter to use Pi_2*D/2,

    • > The trigonometric functions with arguments measured in cycles are more accurate and faster to compute.

      Please expand on this. Surely if that were the case, numerical implementations would first convert a radian input to cycles before doing whatever polynomial/rational approximation they like, but I've never seen one like that.

      > Because Pi is needed so much more rarely, it is simpler to just have a constant Pi_2 to be used in most cases and for the rare case of computing a circumference from the diameter to use Pi_2*D/2,

      Well of course, that's why you have (in C) M_PI, M_PI2, and so on (and in some dialects M_2PI).

      2 replies →

>but there is no need to use it in any application.

Applications such as planes flying, sending data through wires, medical imaging (or any of a million different direct applications) do not count, I assume?

Your naivety about what makes the world function is not an argument for something being useless. The number appearing in one of the most important algorithms should give you a hint about how relevant it is https://en.wikipedia.org/wiki/Fast_Fourier_transform

  • I am sorry, but comments like this are caused by the naivety of not knowing how the function evaluations are actually implemented.

    None of the applications mentioned by you need to use the exponential e^x or the natural logarithm, all can be done using the exponential 2^x and the binary logarithm. The use of the less efficient and less accurate functions remains widespread only because of bad habits learned in school, due to the huge inertia that affects the content of school textbooks.

    The fast Fourier transform is written as if it would use e^x, but that has been misleading for you, because it uses only trigonometric functions, so it is irrelevant for discussing whether "e" or "ln 2" is more important, because neither of these 2 transcendental constants is used in the Fast Fourier Transform.

    Moreover, FFT is an example for the fact that it is better to use trigonometric functions with the arguments measured in cycles, i.e. functions of 2*Pi*x, instead of the worse functions with arguments measured in radians, because with arguments expressed in cycles the FFT formulae become simpler, all the multiplicative constants explicitly or implicitly involved in the FFT direct and inverse computations being eliminated.

    A function like cos(2*Pi*x) is simpler than cos(x), despite what the conventional notation implies, because the former does not contain any multiplication with 2*Pi, but the latter contains a multiplication with the inverse of 2*Pi, for argument range reduction.

    • I think that perhaps people are conflating the fourier transform (FT) with the fast fourier transform.

      It's true that the FFT does not use either of the transcendental numbers e or ln(2), but that's because the FFT does not use transcendental numbers at all! (Roots of unity, sure, but those are algebraic)

      > all the multiplicative constants explicitly or implicitly involved in the FFT direct and inverse computations being eliminated.

      Doesn't that basically get you a Hadamard transform?

      1 reply →

    • >I am sorry, but comments like this are caused by the naivety of not knowing how the function evaluations are actually implemented.

      I am sorry, but comments like this are caused by the naivety of not knowing a single things about mathematics.

      Do you not understand that mathematics is not just about implementation, but about forming models of reality? The idea of trying to model a physical system while pretending that e.g. the solution of the differential equations x'=x does not matter is just idiotic.

      The idea that just because some implementation can avoid a certain constant, that this constant is irrelevant is immensely dumb and tells me that you lack basic mathematical education.

Uuuuuum no?

e^(ix) = cos(x) + isin(x). In particular e^(ipi) = -1

(1 + 1/n)^n = e. This is part of what makes e such a uniquely useful exponent base.

Not applied enough? What about:

d/dx e^x = e^x. This makes e show up in the solutions of all kinds of differential equations, which are used in physics, engineering, chemistry...

The Fourier transform is defined as integral e^(iomega*t) f(t) dt.

And you can't just get rid of e by changing base, because you would have to use log base e to do so.

Edit: how do you escape equations here? Lots of the text in my comment is getting formatted as italics.

  • Guessing the original comment hasn't taken complex analysis or has some other oriented view point into geometry that gives them satisfaction but these expressions are one of the most incredible and useful tools in all of mathematics (IMO). Hadn't seen another comment reinforcing this so thank you for dropping these.

    Cauchy path integration feels like a cheat code once you fully imbibe it.

    Got me through many problems that involves seemingly impossible to memorize identities and re-derivation of complex relations become essentially trivial

    • Complex exponentials and complex logarithms are useful in some symbolic computations, those involving formulae for derivatives or primitives, and this is indeed the only application where the use of e^x and natural logarithm is worthwhile.

      However, whenever your symbolic computation produces a mathematical model that will be used for numeric computations, i.e. in a computer program, it is more efficient to replace all e^x exponentials and natural logarithms with 2^x exponentials and binary logarithms, instead of retaining the complex exponentials and logarithms and evaluating them directly.

      At the same time, it is also preferable to replace the trigonometric functions of arguments measured in radians with trigonometric functions of arguments measured in cycles (i.e. functions of 2*Pi*x).

      This replacement eliminates the computations needed for argument range reduction that otherwise have to be made at each function evaluation, wasting time and reducing the accuracy of the results.

  • > Edit: how do you escape equations here? Lots of the text in my comment is getting formatted as italics.

    Just escape any asterisks in your post that you want rendered as asterisks: this: \* gives: *.

  • Even when you use the exponential e^x and the hyperbolic logarithm a.k.a. natural logarithm (which are useful only in symbolic computations and are inferior for any numeric computation), you never need to know the value of "e". The value itself is not needed for anything. When evaluating e^x or the hyperbolic logarithm you need only ln 2 or its inverse, in order to reduce the argument of the functions to a range where a polynomial approximation can be used to compute the function.

    Moreover, you can replace any use of e^x with the use of 2^x, which inserts ln(2) constants in various places, (but removes ln 2 from the evaluations of exponentials and logarithms, which results in a net gain).

    If you use only 2^x, you must know that its derivative is ln(2) * 2^x, and knowing this is enough to get rid of "e" anywhere. Even in derivation formulae, in actual applications most of the multiplications with ln 2 can be absorbed in multiplications with other constants, as you normally do not have 2^x expressions that are derived, but 2^(a*x), where you do ln(2)*a at compile time.

    You start with the formula for the exponential of an imaginary argument, but there the use of "e" is just a conventional notation. The transcendental number "e" is never used in the evaluation of that formula and also none of the numbers produced by computing an exponential or logarithm of real numbers are involved in that formula.

    The meaning of that formula is that if you take the expansion series of the exponential function and you replace in it the argument with an imaginary argument you obtain the expansion series for the corresponding trigonometric functions. The number "e" is nowhere involved in this.

    Moreover, I consider that it is far more useful to write that formula in a different way, without any "e":

    1^x = cos(2Pi*x) + i * sin(2Pi*x)

    This gives the relation between the trigonometric functions with arguments measured in cycles and the unary exponential, whose argument is a real number and whose value is a complex number of absolute value equal to 1, and which describes the unit circle in the complex plane, for increasing arguments.

    This formula appears more complex only because of using the traditional notation. If you call cos1 and sin1 the functions of period 1, then the formula becomes:

    1^x = cos1(x) + i * sin1(x)

    The unary exponential may appear weirder, but only because people are habituated from school with the exponential of imaginary arguments instead of it. None of these 2 functions is weirder than the other and the use of the unary exponential is frequently simpler than of the exponential of imaginary arguments, while also being more accurate (no rounding errors from argument range reduction) and faster to compute.

    • I want to add that any formula that contains exponentials of real arguments, e^x, and/or exponentials of imaginary arguments, e^(i*x), can be rewritten by using only binary exponentials, 2^x, and/or unary exponentials, 1^x, both having only real arguments.

      With this substitution, some formulae become simpler and others become more complicated, but, when also considering the cost of the function evaluations, an overall greater simplicity is achieved.

      In comparison with the "e" based exponentials, the binary exponential and the unary exponential and their inverses have the advantage that there are no rounding errors caused by argument range reduction, so they are preferable especially when the exponents can be very big or very small, while the "e" based exponentials can work fine for exponents guaranteed to be close to 0.