r/AskComputerScience • u/Gassus-Hermippean • Jul 09 '21
Is there a comprehensive, CS-oriented book of common mathematical functions and operations and ways they can be implemented?
Let me first preface this question by saying I am not exactly sure what it is I am after.
I am looking for a book (or, generally, an overview) collating some mathematical operations and functions (and the algorithms that give them) and different ways they can be evaluated, computed, approximated and implemented. For example, in discussing trigonometric funcions, it would give series expansions that one could use to calculate the sine and cosine.
I am not looking for something like Eagle & Durand's Handbook of Mathematical Functions, and maybe not even the NIST Handbook of Mathematical Functions; is there an equivalent to NIST's handbook that approaches the algorithms and functions from a more CS or programming-oriented standpoint?
4
u/Gassus-Hermippean Jul 10 '21
I checked out Numerical Recipes and Matters Computational from my library (suggestions courtesy of /u/pan_am_pilot and /u/AlexCoventry), and also ended up checking out Handbook of Series for Scientists and Engineers for a more mathematical overview. Other books I'll have to check out later/these coming days (esp. from u/fizixer, your recommendation will come in handy—now I know what I need to search). Thank you everyone for the answers so far, this is more than enough to get me started!
3
u/kibblerz Jul 09 '21
Not a book, but an app with easy to understand visualizations that a child could understand. Super helpful
2
u/Gassus-Hermippean Jul 10 '21 edited Jul 10 '21
I downloaded it and, sadly, this isn't near anything I want. I don't have a problem with the theoretical concepts of these algorithms, and regardless of mathematics it only has Euclid's GCD algorithm and a (paywalled) primality test explanation. "Baby's first stack/linked list/PKC explanation" is sadly not what I generally want/need.
1
u/kibblerz Jul 12 '21
Ahh, I've been using the app just to learn the concepts, and then learning implementations with leetcode. I've been using Golang to practice the implementations since it's fairly low level which allows a deeper understanding of how it all works.
1
u/Gassus-Hermippean Jul 12 '21
I wouldn't call a garbage-collected object-oriented language with no pointer arithmetic "low level".
1
u/kibblerz Jul 13 '21
Tech has advanced enough to where pointer arithmetic really isn't that necessary. Plus it improves garbage collection capabilities. But you can use pointer arithmetic in Golang with the "unsafe" package, but that's unsafe.. lol
Golang may not be as low level as C++ or C, but there's really no need for it to be. It's still a low-level language IMO.
1
u/Gassus-Hermippean Jul 21 '21
Tech has advanced enough to where pointer arithmetic really isn't that necessary
Perhaps, but they're practically baked into the architecture of a CPU and its addressing models and memory access.
It's still a low-level language IMO.
Out of curiosity, what does "low-level" mean for you? One man's shirt is another's gown, but for me a low-level language has to introduce little abstraction between the workings of the machine and the language. If Go performs garbage collection and obfuscates pointer arithmetic, engages a multiplexing scheduler and extensive runtime etc. it's already sitting on a much thicker pillow than C will. GCCGo allows you to remove a layer of stuffing, but there's still more than C programmers will get out of the box. This paper by Cutler et al. specifically contrasts Go as a high-level language versus C.
1
u/kibblerz Jul 23 '21
I’m actually a DevOps/full stack engineer. So compared to the usual tools/languages I work with it is low level. It’s all a matter of perspective IMO
1
u/Gassus-Hermippean Jul 23 '21
I see your point of view now, yeah. For me, working on legacy C code and even outright assembly at times, Go is far in the clouds; but for you it's much closer to the metal than what you're usually looking at day-to-day. Thanks for the explanation!
1
Jul 10 '21
What's your goal in reading the book?
3
u/Gassus-Hermippean Jul 10 '21
General information about the thought processes behind implementing mathematical functions, some less theoretical and more practical information about some commonly seen functions etc?
Basically, things that reading a purely theoretical mathematics book discussing functional properties cannot tell me, such as general implementation concerns etc, but also what reading a standard library's implementation code doesn't show.
1
2
u/fizixer Jul 10 '21 edited Jul 10 '21
My friend, what you're looking for is CSE (computational science & engineering).
The first step to CSE is something like Heath's Scientific Computing 2nd Edition.
1
0
Jul 09 '21
[deleted]
3
u/Gassus-Hermippean Jul 10 '21
Thank you, I will have a look today since it's offered by my library.
7
u/MrHanoixan Jul 09 '21
Came here to say this as well. It's a tome, and probably still the first place CS grad students go when trying to figure out how to implement a math concept from scratch.
Edit: If you want to get deeper into the underlying mathematics, the Princeton Companion to Mathematics makes a nice... companion.
2
u/fizixer Jul 10 '21
Careful! this book is kinda untouchable because of the licensing and permissions involved in using the code from it.
OP needs to develop awareness of the general area of CSE (computational science & engineering) and NA (numerical analysis). There are plenty of quality texts on that topic, and a good programmer can type up, implement the relevant algos and data-structures in their favorite programming language (of course, none other than python + numpy, scipy, matplotlib) without any problem.
17
u/Avereniect Jul 09 '21
There is a book called Matters Computational - Ideas, Algorithms, Code which more or less seems to fit the description of what you're after. It covers some clever ways to implement various common mathematical operations from simple arithmetic operations like exponentiation to things like Fourier transforms. The book features example code written in a small, C-like subset of C++.