This example gives a finite numerical witness for Euler’s identity, the famous relationship behind exp(iπ) + 1 = 0.
The program does not claim to prove the identity symbolically. Instead, it computes a reproducible approximation and checks that the residual is smaller than an explicit tolerance.
The input says how many Taylor-series terms to use and what tolerance is acceptable. The program approximates exp(iπ) using complex arithmetic. It then adds 1 and measures how far the result is from zero.
Because computers use finite arithmetic, the answer is near zero rather than exactly zero. That is why the residual and tolerance are part of the explanation.
The output shows that the computed real part is effectively -1, the imaginary part is effectively 0, and the residual magnitude is tiny. The within tolerance : true line is the finite certificate.
The trust gate verifies the configured term count, that the residual is below tolerance, and that the real and imaginary parts are close to their expected mathematical values at the chosen precision. This keeps the example honest about numerical approximation.
From the repository root:
node examples/euler_identity_certificate.js