Title: Book review: Applied Math for Security
Date: 2023-06-04 23:45

[![Applied Math for Security cover]({static}/images/applied_math_security.png)](https://nostarch.com/applied-math-security)

I recently got an email [from Briana Blackwell from No Starch Press](https://nostarch.com/about)'s marketing department,
asking if I would be interested in reviewing a free copy of
the [early access](https://nostarch.com/early-access-program) 
version of [Applied Math for Security: A Pythonic Introduction to Graph Theory and Computational Geometry](https://nostarch.com/applied-math-security)
by [Daniel Reilly](https://www.linkedin.com/in/theitninja). It's basically a
showcase of what can be done with [numpy](https://numpy.org/),
[SciPy](https://scipy.org/), [pandas](https://pandas.pydata.org/),
[NetworkX](https://networkx.org/), [dlib](http://dlib.net/), … and some light
applied mathematics.

It's a self-contained book, starting with how to install Python and the
required libraries, to the code to copy-paste to get the presented results.
It showcases the usual suspects of "cools things one can do with python and some applied maths":
[Voronoi Diagrams](https://en.wikipedia.org/wiki/Voronoi_diagram),
[Graphs properties](https://en.wikipedia.org/wiki/Graph_property),
[Facial recognition](https://en.wikipedia.org/wiki/Facial_recognition_system),
[Monte Carlo](https://en.wikipedia.org/wiki/Monte_Carlo_method), …
with the entire last chapter dedicated to the [Art gallery Problem](https://en.wikipedia.org/wiki/Art_gallery_problem).

I really liked that before each chapter, ethics and a bit of historical context
of each problems were discussed, and what questions should one ask themselves
when waddling into those territories. Everything is neatly introduced and presented,
and everyone should be able to implement the algorithms, understand what's
going on and feel warm and fuzzy as everything falls into place. But this isn't
a book about security; it's a book about some cool applied maths principles,
presented as solutions to some security-related scenarios.

All mathematical formulas are dropped without any accompanying proofs,
which makes sense in the context of the book,
and sources/materials are provided at the end of the chapters for the 
curious minds anyway, but my PTSD from my university math courses was still triggered.

Unfortunately, the book still has a couple of minor shortcomings and eyebrow raising
statements:

- the Python code isn't always perfect, optimal or idiomatic, but the author explicitly
  stated that this wasn't a book about learning python, and it might
  even make reader feel smart, so I guess it's ok;
- the book sometimes felt a bit dated regarding computer security: it mentions [Armitage](https://github.com/rsmudge/armitage) (last commit in 2016),
  talks about implants behaviours from the early 00s, …
- it mentions [Stanley Milgram](https://en.wikipedia.org/wiki/Stanley_Milgram)'s
  [Small-world experiment](https://en.wikipedia.org/wiki/Small-world_experiment) (which as been debunked as pseudo-science),
  and says that it can be explained by the [Preferential Attachment](https://en.wikipedia.org/wiki/Preferential_attachment)
  (which is unrelated). This made me doubt the accuracy of the rest
  of the book;
- a clumsy parallel between potential/kinetic energy and potential/kinetic
  information. Unfortunately, [kinetic information](https://dictionary.apa.org/kinetic-information)
  is a well-defined psychology term, making the comparison confusing.

Apart from those, it's a pretty solid book.

### Conclusion

A really nice introduction to graph theory and computational
geometry for people who know a bit of Python and without a mathematical
background. I think I'd recommend it to anyone who liked the amazing
[Python for Kids](https://nostarch.com/python-kids-2nd-edition)
and want to dig deeper.

