RosettaCodeData/Task/Eulers-identity/00-TASK.txt

32 lines
1.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

In mathematics, ''Euler's identity'' is the equality:
<span style="font-size:150%;font-style:bold;"><span style="font-style:italic">e<sup>i<math>\pi</math></sup></span> + 1 = 0</span>
where
e is Euler's number, the base of natural logarithms,
''i'' is the imaginary unit, which satisfies ''i''<sup>2</sup> = 1, and
<math>\pi</math> is pi, the ratio of the circumference of a circle to its diameter.
Euler's identity is often cited as an example of deep mathematical beauty. Three of the basic arithmetic operations occur exactly once each: addition, multiplication, and exponentiation. The identity also links five fundamental mathematical constants:
The number 0.
The number 1.
The number <math>\pi</math> (<math>\pi</math> = 3.14159<small>+</small>),
The number e (e = 2.71828<small>+</small>), which occurs widely in mathematical analysis.
The number ''i'', the imaginary unit of the complex numbers.
;Task
Show in your language that Euler's identity is true. As much as possible and practical, mimic the Euler's identity equation.
Most languages are limited to IEEE 754 floating point calculations so will have some error in the calculation.
If that is the case, or there is some other limitation, show
that <big>e<sup>i<math>\pi</math></sup> + 1</big> is ''approximately'' equal to zero and
show the amount of error in the calculation.
If your language is capable of symbolic calculations, show
that <big>e<sup>i<math>\pi</math></sup> + 1</big> is ''exactly'' equal to zero for bonus kudos points.
<br><br>