Anyone who’s ever calculated the chances of winning at craps may remember being surprised by how fair the game is.
(Spoiler Warning If you haven’t calculated these odds but feel you might enjoy the challenge, you should do so before reading on, because I’m about to spoil it for you rather thoroughly in the name of exploring a more general case. A full solution may also be found in the rather excellent book, Fifty Challenging Problems in Probability with Solutions.
Complex Numbers in R, Part II
This post is part of a series on complex number functionality in the R programming language. You may want to read Part I before continuing if you are not already comfortable with the basics.
In Part I of this series, we dipped our toes in the water by explicitly creating some complex numbers and showing how they worked with the most basic mathematical operators, functions, and plots.
In this second part, we’ll take a more in-depth look at some scenarios where complex numbers arise naturally – where they are less of a choice an more of a necessity.
Complex Numbers in R, Part I
R, like many scientific programming languages, has first-class support for complex numbers. And, just as in most other programming languages, this functionality is ignored by the vast majority of users.
Yet complex numbers can often offer surprisingly elegant formulations and solutions to problems. I want to convince you that familiarizing yourself with R’s excellent complex number functionality is well worth the effort and will pay off tenfold in two different ways: first by showing you how they are so amazingly useful you’ll want to go out of your way to use them, and then by showing you how they are so common and fundamental to modern analysis that you couldn’t avoid them if you wanted to.