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_harris_charles_r # and # a_millman_jarrod_k # and # a_van_der_walt_stefan # and # a_gommers_ralf # and # a_virtanen_pauli # and # a_cornapeau_david # and # a_wieser_eric # and # a_taylor_julian # and # a_berg_sebastian # and # a_smith_nathaniel_j # and # a_kern_robert # and # a_picus_matti # and # a_hoyer_stephan # and # a_van_kerkwijk_marten_h # and # a_brett_matthew # and # a_haldane_allan # and # a_fernandez_del_rio_jaime # and # a_wiebe_mark # and # a_peterson_pearu # and # a_gerard_marchant_pierre # and # a_sheppart_kevin # and # a_reddy_tyler # and # a_warren_weckesser # and # a_abbasi_hameer # and # a_gohlke_christoph # and # a_oliphant_travis_e,
762
+
author = a_harris_charles_r # and # a_millman_jarrod_k # and # a_van_der_walt_stefan # and # a_gommers_ralf # and # a_virtanen_pauli # and # a_cornapeau_david # and # a_wieser_eric # and # a_taylor_julian # and # a_berg_sebastian # and # a_smith_nathaniel_j # and # a_kern_robert # and # a_picus_matti # and # a_hoyer_stephan # and # a_van_kerkwijk_marten_h # and # a_brett_matthew # and # a_haldane_allan # and # a_fernandez_del_rio_jaime # and # a_wiebe_mark # and # a_peterson_pearu # and # a_gerard_marchant_pierre # and # a_sheppart_kevin # and # a_reddy_tyler # and # a_weckesser_warren # and # a_abbasi_hameer # and # a_gohlke_christoph # and # a_oliphant_travis_e,
726
763
title = {Array programming with \numpy},
727
764
xdata = {j_n},
728
765
volume = {585},
@@ -847,6 +884,36 @@ @book{P2021HOMLPAVWP
847
884
isbn = {9781484274101}
848
885
}
849
886
887
+
@techreport{PEP8,
888
+
title = {Style Guide for Python Code},
889
+
author = a_van_rossum_guido # and # a_warsaw_barry # and # a_coghlan_alyssa,
890
+
xdata = {rep_pep},
891
+
number = {8},
892
+
date = {2001-07-05},
893
+
url = {https://peps.python.org/pep-0008},
894
+
urldate = {2024-07-27}
895
+
}
896
+
897
+
@techreport{PEP257,
898
+
title = {Docstring Conventions},
899
+
author = a_goodger_david # and # a_van_rossum_guido,
author = a_paszke_adam # and # a_gross_sam # and # a_massa_francisco # and # a_lerer_adam # and # a_bradbury_james # and # a_chanan_gregory # and # a_killeen_trevor # and # a_lin_zeming # and # a_gimelshein_natalia # and # a_antiga_luca # and # a_desmaison_alban # and # a_klopf_andreas # and # a_yang_edward_z # and # a_devito_zachary # and # a_raison_martin # and # a_tejani_alykhan # and # a_chilamkurthy_sasank # and # a_steiner_benoit # and # a_fang_lu # and # a_bai_junjie # and # a_chintala_soumith,
852
919
title = {\pytorch: An Imperative Style, High-Performance Deep Learning Library},
@@ -940,6 +1007,26 @@ @inbook{PSF2024TSTS
940
1007
urldate = {2024-07-25},
941
1008
}
942
1009
1010
+
@inbook{PTVF2007EAAS,
1011
+
title = {1.1~Error, Accuracy, and Stability},
1012
+
chapter = {1~Preliminaries},
1013
+
pages = {8--12},
1014
+
crossref = {PTVF2007NRTAOSC}
1015
+
}
1016
+
1017
+
@book{PTVF2007NRTAOSC,
1018
+
author = a_press_william_h # and # a_teukolsky_saul_a # and # a_vetterling_william_t # and # a_flannery_brian_p,
1019
+
title = {Numerical Recipes: The Art of Scientific Computing},
1020
+
edition = {3},
1021
+
date = {2007/2011},
1022
+
note = {Version~3.04},
1023
+
publisher = p_cambridge_uni_press_ass,
1024
+
address = pa_cambridge_uni_press_ass,
1025
+
isbn = {978-0-521-88068-8},
1026
+
url = {https://numerical.recipes/book.html},
1027
+
urldate = {2024-07-27},
1028
+
}
1029
+
943
1030
@article{PVGMTGBPWDVPCBPD2011SMLIP,
944
1031
author = a_pedregosa_fabian # and # a_varoquaux_gael # and # a_gramfort_alexandre # and # a_michel_vincent # and # a_thirion_bertrand # and # a_grisel_olivier # and # a_blondel_mathieu # and # a_prettenhofer_peter # and # a_weiss_ron # and # a_dubourg_vincent # and # a_vanderplas_jake # and # a_passos_alexandre # and # a_cornapeau_david # and # a_brucher_matthieu # and # a_perrot_matthieu # and # a_duchesnay_edouard,
945
1032
title = {\scikitlearn: Machine Learning in \python},
@@ -981,16 +1068,6 @@ @article{S1988WPCHD
981
1068
pages = {117},
982
1069
}
983
1070
984
-
@book{S2016P4LSI,
985
-
author = a_smith_eric_v,
986
-
title = {PEP~498 -- Literal String Interpolation},
author = a_virtanen_pauli # and # a_gommers_ralf # and # a_oliphant_travis_e # and # a_haberland_matt # and # a_reddy_tyler # and # a_cornapeau_david # and # a_burovski_evgeni # and # a_peterson_pearu # and # a_warren_weckesser # and # a_bright_jonathan # and # a_van_der_walt_stefan # and # a_brett_matthew # and # a_wilson_joshua # and # a_millman_jarrod_k # and # a_mayorov_nikolay # and # a_nelson_andrew_r_j # and # a_jones_eric # and # a_kern_robert # and # a_larson_eric # and # a_carey_cj # and # a_polat_ilhan # and # a_feng_yu # and # a_moore_eric_w # and # a_vanderplas_jake # and # a_laxalde_denis # and # a_perktold_josef # and # a_cimran_robert # and # a_henriksen_ian # and # a_quinter_ea # and # a_harris_charles_r # and # a_archibald_anne_m # and # a_ribeiro_antonio_h # and # a_pedregosa_fabian # and # a_van_mulbregt_paul # and # a_scipy_1,
1151
+
author = a_virtanen_pauli # and # a_gommers_ralf # and # a_oliphant_travis_e # and # a_haberland_matt # and # a_reddy_tyler # and # a_cornapeau_david # and # a_burovski_evgeni # and # a_peterson_pearu # and # a_weckesser_warren # and # a_bright_jonathan # and # a_van_der_walt_stefan # and # a_brett_matthew # and # a_wilson_joshua # and # a_millman_jarrod_k # and # a_mayorov_nikolay # and # a_nelson_andrew_r_j # and # a_jones_eric # and # a_kern_robert # and # a_larson_eric # and # a_carey_cj # and # a_polat_ilhan # and # a_feng_yu # and # a_moore_eric_w # and # a_vanderplas_jake # and # a_laxalde_denis # and # a_perktold_josef # and # a_cimran_robert # and # a_henriksen_ian # and # a_quinter_ea # and # a_harris_charles_r # and # a_archibald_anne_m # and # a_ribeiro_antonio_h # and # a_pedregosa_fabian # and # a_van_mulbregt_paul # and # a_scipy_1,
1075
1152
title = {\scipy~1.0:~Fundamental Algorithms for Scientific Computing in \python},
Due to the periodicity of the trigonometric functions, $\arccos{\cos{-0.3}}$ is~$0.3$ and \pythonil{acos(cos(-0.3))}\pythonIdx{acos}\pythonIdx{cos} results in~\pythonil{0.30000000000000016}.
140
141
For $\arctan{\tan{1}}$ we even get the exact result \pythonil{1.0} by computing \pythonil{atan(tan(1))}\pythonIdx{atan}\pythonIdx{tan}.%
142
+
%
143
+
\bestPractice{floatImprecise}{%
144
+
Always assume that any \pythonilIdx{float} value is imprecise. %
145
+
Never expect it to be exact~\cite{PTVF2007EAAS,BHK2006NS}.%
146
+
}%
147
+
%
148
+
Due to the limited precision, it could be that you add two numbers $c=a+b$ but then find that $c-a\neq b$, because some digit was lost. %
149
+
This is obvious when adding a very small number to a very large number.
150
+
We only have about 15~digits, so doing something like~$10^{20} + 1$ will usually work out to just be~$10^{20}$ in floating point arithmetics~\cite{PTVF2007EAAS}.
151
+
But digits could also be lost when adding numbers of roughly the same scale, because their sum could just be larger so that the 15-digit-window shifts such that the least-significant digit falls off~\cite{BHK2006NS}{\dots}%
Notice that the result of this division operator is always a floating point number, even if the number itself is an integer.
58
58
59
+
\bestPractice{intDivision}{Always be careful with which division operator you use for \pythonilIdx{int}s. If you need an integer result, make sure to use \pythonilIdx{//}. Remember that \pythonilIdx{/} always returns a \pythonilIdx{float} (and see \cref{bp:floatImprecise}), even if the result is a whole number.}
60
+
59
61
Now above we have said that \pythonil{33 // 4} yields the integer~\pythonil{8}.
60
62
The remainder of this operation can be computed using the \pgls{modulodiv} operator \expandafter\pythonilIdx{\%}, i.e., by typing \pythonil{33 \% 4}, which yields~\pythonil{1}.
61
63
We also find that \expandafter\pythonil{34 \% 4} yields~\pythonil{2}, \expandafter\pythonil{35 \% 4} gives us~\pythonil{3}, and \expandafter\pythonil{36 \% 4} is~\pythonil{0}.
0 commit comments