You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
author = a_editors_of_encyclopaedia_britannica # and # a_setia_veenu # and # a_rodriguez_emily # and # a_gaur_aakanksha # and # a_matthias_meg # and # a_lotha_gloria,
934
980
title = {Leap Year},
@@ -941,7 +987,7 @@ @incollection{EOEBSRGML2024LY
941
987
@inbook{F2011TTOEAP,
942
988
author = a_filaseta_michael,
943
989
booktitle = {Math~785: Transcendental Number Theory},
944
-
title = {The Transcendence of~$e$ and~$\pi$},
990
+
title = {The Transcendence of~\numberE\ and~\numberPi},
945
991
chapter = {6},
946
992
date = {2011-21},
947
993
publisher = p_university_of_south_carolina,
@@ -1200,7 +1246,7 @@ @book{M2022RAEFPLACFWIR
1200
1246
1201
1247
@article{N1939TTOP,
1202
1248
author = a_niven_ivan,
1203
-
title = {The Transcendence of~$\pi$},
1249
+
title = {The Transcendence of~\numberPi},
1204
1250
xdata = {j_tamm},
1205
1251
volume = {46},
1206
1252
number = {8},
@@ -1515,7 +1561,7 @@ @book{PTVF2007NRTAOSC
1515
1561
title = {Numerical Recipes: The Art of Scientific Computing},
1516
1562
edition = {3},
1517
1563
date = {2007/2011},
1518
-
note = {Version~3.04},
1564
+
addendum = {Version~3.04},
1519
1565
publisher = p_cambridge_uni_press_ass,
1520
1566
address = pa_cambridge_uni_press_ass,
1521
1567
isbn = {978-0-521-88068-8},
@@ -1538,7 +1584,7 @@ @book{R1994PNACMFF
1538
1584
title = {Prime Numbers and Computer Methods for Factorization},
The set \mbox{$i..j$} with$i\leq j$containts all integer numbers in the inclusive range from~$i$ to~$j$. %
30
-
For example, \mbox{$5..9$}~is equivalent to~\mbox{$\{5, 6, 7, 8, 9\}$}.}%
29
+
with $i,j\in\integerNumbers$ and$i\leq j$is the set that contains all integer numbers in the inclusive range from~$i$ to~$j$. %
30
+
For example, \mbox{$5..9$}~is equivalent to~\mbox{$\{5, 6, 7, 8, 9\}$}}%
31
31
}%
32
32
%
33
33
%
@@ -37,3 +37,12 @@ For example, \mbox{$5..9$}~is equivalent to~\mbox{$\{5, 6, 7, 8, 9\}$}.}%
37
37
\mbox{If $f(x)={\mathcal{O}}(g(x))$,} then there exist positive numbers~$x_0\in\realNumbersP$ and~$c\in\realNumbersP$ such that~\mbox{$f(x)\leq c*g(x)\forall x\geq x_0$}~\cite{B1894DAZDVPB,L1909HDLVDVDP}. %
38
38
In other words, ${\mathcal{O}}(g(x))$~describes an upper bound for function growth}%
39
39
%
40
+
\newSymbol{numberPi}{\ensuremath{\pi}}{$\pi$}{%
41
+
is the ratio of the circumference~$U$ of a circle and its diameter~$d$, i.e., $\pi=U/d$. %
42
+
$\pi\in\realNumbers$ is an irrational and transcendental number~\cite{N1939TTOP,APM1991TOEAP,F2011TTOEAP}, which is approximately~$\pi\approx3.141\decSep592\decSep653\decSep589\decSep793\decSep238\decSep462\decSep643$. %
43
+
In \python, it is provided by the \pythonilIdx{math} module as constant \pythonilIdx{pi} with value~\pythonilIdx{3.141592653589793}}%
44
+
%
45
+
\newSymbol{numberE}{\ensuremath{e}}{e}{%
46
+
is Euler's number~\cite{E1737DFCD,E1985AEOCF}, the base of the natural logarithm. %
47
+
$e\in\realNumbers$ is an irrational and transcendental number~\cite{APM1991TOEAP,F2011TTOEAP}, which is approximately~$e\approx2.718\decSep281\decSep828\decSep459\decSep045\decSep235\decSep360$. %
48
+
In \python, it is provided by the \pythonilIdx{math} module as constant \pythonilIdx{e} with value~\pythonilIdx{2.718281828459045}}%
Copy file name to clipboardExpand all lines: text/main/basics/simpleDataTypesAndOperations/float/float.tex
+8-8
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
\begin{sloppypar}%
9
9
In an ideal world, we would have a similar feature also for real numbers.
10
10
However, such a thing cannot be practically implemented.
11
-
You will certainly remember the numbers $\pi\approx3.141\decSep592\decSep653\decSep590\dots$ and $e\approx2.718\decSep281\decSep828\decSep459\dots$ from highschool maths.
11
+
You will certainly remember the numbers $\numberPi\approx3.141\decSep592\decSep653\decSep590\dots$ and $e\approx2.718\decSep281\decSep828\decSep459\dots$ from highschool maths.
12
12
They are transcendental~\cite{N1939TTOP,APM1991TOEAP,F2011TTOEAP}, i.e., their fractional digits never end and nobody has yet detected an orderly pattern in them.
13
13
Since these numbers are \inQuotes{infinitely long,} we would require infinitely much memory to store them \emph{if} we wanted to represent them \emph{exactly}.
14
14
So we don't and neither does \python.
@@ -112,24 +112,24 @@
112
112
We always need to keep this in mind.%
113
113
\end{sloppypar}%
114
114
%
115
-
Let us recall our initial example of the transcendental irrational numbers~$\pi$ and~$e$.
115
+
Let us recall our initial example of the transcendental irrational numbers~\numberPi\and~\numberE.
116
116
Certainly, these are very important constants that would be used in many computations.
117
117
We can make them accessible in our code by importing them from the \pythonilIdx{math} module.\footnote{%
118
118
We will learn about these mechanism in detail later on.}
119
119
This can be done by typing \pythonil{from math import pi, e}\pythonIdx{import}\pythonIdx{from}\pythonIdx{math}.
120
120
When we then type \pythonilIdx{pi} and \pythonilIdx{e}, we can get to see their value in floating point representations: \pythonil{3.141592653589793} and \pythonil{2.718281828459045}, respectively.
121
121
Again, these are not the exact values, but they are as close as we can get in this format.
122
122
123
-
Of course, $\pi$ and~$e$ alone are not that much useful.
123
+
Of course, \numberPi\and~\numberE\alone are not that much useful.
124
124
If you reach back into your highschool days again, you will remember many interesting functions that are related to them.
125
125
Let us import a few of them, again from the \pythonilIdx{math} module, via \pythonil{from math import sin, cos, tan, log}\pythonIdx{sin}\pythonIdx{cos}\pythonIdx{tan}\pythonIdx{log}.
126
126
I think you can guess what these functions do.
127
127
128
-
From highschool, you may remember that~$\sin{\frac{\pi}{4}}=\frac{\sqrt{2}}{2}$ and thus~$\sin^2{\frac{\pi}{4}}=0.5$.
128
+
From highschool, you may remember that~$\sin{\frac{\numberPi}{4}}=\frac{\sqrt{2}}{2}$ and thus~$\sin^2{\frac{\numberPi}{4}}=0.5$.
129
129
Let us compute this in \python\ by doing \pythonil{sin(0.25 * pi) ** 2}\pythonIdx{sin}.
130
130
Surprisingly, we get \pythonil{0.4999999999999999} instead of \pythonil{0.5}.
131
131
The reason is again the limited precision of \pythonilIdx{float}, which cannot represent~$\frac{\sqrt{2}}{2}$ exactly.
132
-
Similarly, $\cos{\frac{\pi}{3}}=\frac{1}{2}$ but \pythonil{cos(pi / 3)}\pythonIdx{cos} yields \pythonil{0.5000000000000001} and $\tan{\frac{\pi}{4}}$ expressed as \pythonil{tan(pi / 4)}\pythonIdx{tan} returns \pythonil{0.9999999999999999} instead of~$1$.
132
+
Similarly, $\cos{\frac{\numberPi}{3}}=\frac{1}{2}$ but \pythonil{cos(pi / 3)}\pythonIdx{cos} yields \pythonil{0.5000000000000001} and $\tan{\frac{\numberPi}{4}}$ expressed as \pythonil{tan(pi / 4)}\pythonIdx{tan} returns \pythonil{0.9999999999999999} instead of~$1$.
133
133
Then again, these values are incredibly close to the exact results.
134
134
They are off by \emph{less than~$10^{-15}$} so for all practical concerns, they are close enough.
135
135
Sometimes, we even get the accurate result, e.g., when computing $\ln(e^{10})$ by evaluating \pythonil{log(e ** 10)}\pythonIdx{log}, which results in~\pythonil{10.0}.
@@ -371,8 +371,8 @@
371
371
As another example, let us again import the natural logarithm function \pythonilIdx{log} and the Euler's constant~\pythonilIdx{e} from the \pythonilIdx{math} module by doing \pythonil{from math import e, log}\pythonIdx{from}\pythonIdx{math}\pythonIdx{import}.
372
372
We now can compute the natural logrithm from the largest possible \pythonilIdx{float} via \pythonil{log(1.7976931348623157e+308)}.
373
373
We get \pythonil{709.782712893384}.
374
-
Raising~$e$ to this power by doing \pythonil{e ** 709.782712893384} leads to the slightly smaller number~\pythonil{1.7976931348622053e+308} due to the limited precision of the \pythonilIdx{float} type.
375
-
However, if we try to raise~$e$ to a slightly larger power, and, for example, try to do \pythonil{e ** 709.782712893385}, we again face an \pythonilIdx{OverflowError}.
374
+
Raising~\numberE\to this power by doing \pythonil{e ** 709.782712893384} leads to the slightly smaller number~\pythonil{1.7976931348622053e+308} due to the limited precision of the \pythonilIdx{float} type.
375
+
However, if we try to raise~\numberE\to a slightly larger power, and, for example, try to do \pythonil{e ** 709.782712893385}, we again face an \pythonilIdx{OverflowError}.
376
376
377
377
We can also try to divide~1 by the largest \pythonilIdx{float} and do \pythonil{1 / 1.7976931348623157e+308}\pythonIdx{/}.
378
378
The result is the very small number \pythonil{5.562684646268003e-309}.
@@ -443,7 +443,7 @@
443
443
Very large integer numbers are, however, something of a corner case {\dots} they do not happen often.
444
444
445
445
Real numbers in~\realNumbers\ are a whole different beast.
446
-
They include irrational numbers like~$\sqrt{2}$ and transcendental numbers like~$\pi$.
446
+
They include irrational numbers like~$\sqrt{2}$ and transcendental numbers like~\numberPi.
447
447
These numbers are needed \emph{often} and they have infinitely many fractional digits.
448
448
Thus, there is no way to exactly represent them in computer memory exactly.
449
449
Another problem is that we may need both very large numbers like~$10^{300}$ and very small numbery like~$10^{-300}$.
Copy file name to clipboardExpand all lines: text/main/basics/simpleDataTypesAndOperations/str/str.tex
+1-1
Original file line number
Diff line number
Diff line change
@@ -222,7 +222,7 @@
222
222
%
223
223
\begin{sloppypar}%
224
224
We can also access constants and variables from within the \pgls{fstring}.
225
-
Let us again import the constant~$\pi$ from the \pythonilIdx{math} module by doing \pythonil{from math import pi}\pythonIdx{from}\pythonIdx{math}\pythonIdx{import}\pythonIdx{pi}.
225
+
Let us again import the constant~\numberPi\from the \pythonilIdx{math} module by doing \pythonil{from math import pi}\pythonIdx{from}\pythonIdx{math}\pythonIdx{import}\pythonIdx{pi}.
226
226
We can print it as string by typing \pythonil{f"pi is approximately \{pi\}."} into the \python\ console.
227
227
The result is the string \pythonil{"pi is approximately 3.141592653589793."}%
0 commit comments