The premise of Think Stats, and the other books in the Think series, is that programming is a tool for teaching and learning — and many ideas that are commonly presented in math notation can be more clearly presented in code.
I truly appreciate your work and find it consistently stimulating. Regarding this topic: I have a bias towards universality, so I believe that including essential mathematical formulae alongside the code would be beneficial. While it's fantastic for readers to learn actionable code, accompanying it with formulae will make them more comfortable when they encounter the same concepts in other resources, such as textbooks.
The universality of math notation is definitely a feature, so I see your point. About the readability of the Python, it is often a good idea to use parentheses even when they are unnecessary, so you don't rely on the reader knowing the order of operations -- but I could go either way on this one. Thanks for your comment.
I truly appreciate your work and find it consistently stimulating. Regarding this topic: I have a bias towards universality, so I believe that including essential mathematical formulae alongside the code would be beneficial. While it's fantastic for readers to learn actionable code, accompanying it with formulae will make them more comfortable when they encounter the same concepts in other resources, such as textbooks.
Also, don't you think that for readability this:
return comb(n, k) * p**k * (1 - p) ** (n - k)
works better than this:
return comb(n, k) * (p**k) * ((1 - p) ** (n - k))
?
Thank you for your work,
Carlo
The universality of math notation is definitely a feature, so I see your point. About the readability of the Python, it is often a good idea to use parentheses even when they are unnecessary, so you don't rely on the reader knowing the order of operations -- but I could go either way on this one. Thanks for your comment.