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
Copy file name to clipboardExpand all lines: blog/2018/03/pifonts.md
+78-75Lines changed: 78 additions & 75 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,6 @@
1
-
@def rss_pubdate = Date(2018, 3, 14)
2
-
@def rss = """ Some π-ography | Although we've known about "Archimedes' constant" for a few millennia, we've been referring to it as the Greek letter π only since the 1700s. Patricia Rothman [suggested](https://www.historytoday.com/patricia-rothman/william-jones-and-his-circle-man-who-invented-pi) that the following page *could* c... """
3
-
@def published = "14 March 2018"
4
-
@def title = "Some Π-ography"
1
+
@def title = "Some π-ography"
5
2
@def author = "Cormullion"
6
-
@def hascode = true
7
-
3
+
@def published = "14 March 2018"
8
4
9
5
Although we've known about "Archimedes' constant" for a few millennia, we've been referring to it as the Greek letter π only since the 1700s. Patricia Rothman [suggested](https://www.historytoday.com/patricia-rothman/william-jones-and-his-circle-man-who-invented-pi) that the following page *could* contain one of the earliest uses of the Greek character to indicate the concept. It's from a mathematics text book written by William Jones and published in 1706:
10
6
@@ -22,22 +18,22 @@ But although Jones was one of the first, he wasn't influential enough to inspire
22
18
23
19
Julia embraces the Unicode standard [enthusiastically](https://docs.julialang.org/en/latest/manual/unicode-input/), so it's very easy to use the appropriate Greek (and other Unicode) letters in your code. In the REPL, for example, type `\pi TAB` to insert the Unicode character `U+03C0`:
(although `pi` will still work, if you'd prefer). In Julia version 0.7, π and other mathematical constants such as Euler's ℯ (2.7182818284590) live in the `Base.MathConstants` module.
37
33
38
34
As always in Julia, you can usually see how the magic is performed:
We usually use the `U+03C0` π from the Unicode block for Greek and Coptic text glyphs (Coptic was the Greek-based script adopted by the Egyptians to replace hieroglyphs), but there are other π symbols intended mainly for mathematical use. The following snippet of Julia code tries to show all the lower-case Unicode π symbols:
48
44
49
-
```
45
+
```julia
50
46
morepi = [
51
47
(0x3c0, "\\pi", "GREEK SMALL LETTER PI")
52
48
(0x213c, "\\bbpi", "DOUBLE-STRUCK SMALL PI") # v0.7
@@ -81,9 +77,11 @@ Some tedious experimentation suggests that the search is to some extent alphabet
81
77
82
78
By the way, these alternative symbols for π such as `\mitpi` don't evaluate as 3.14..., so you can use them—as William Jones did—as general purpose symbols. For example, if you work with prime numbers you could use one of them to indicate the [prime-counting function](https://en.wikipedia.org/wiki/Prime-counting_function). Or you could just confuse yourself with the following:
83
79
84
-
julia> 𝜋 = 3
85
-
julia> 2𝜋
86
-
6
80
+
```julia-repl
81
+
julia> 𝜋 = 3
82
+
julia> 2𝜋
83
+
6
84
+
```
87
85
88
86
### The phonogram symbol Ⓟ
89
87
@@ -95,52 +93,55 @@ Not all fonts contain a suitable Greek π at `U+03C0`. A few expensive fonts suc
95
93
96
94
Can we use Julia to find all the different designs of π? My first attempt at this challenge uses [Fontconfig.jl](https://github.com/JuliaGraphics/Fontconfig.jl) to produce a list of installed fonts, and [Luxor.jl](https://github.com/JuliaGraphics/Luxor.jl) to draw them in a table. It at least gives a glimpse of the variety of designs available, and illustrates some of the issues. Fonts that provide a zero-width glyph are skipped, meaning the table winds up being smaller than originally planned.
You probably won't have to manually remove oddments like Bodoni Ornaments or Topaz from the font list as I had to...
140
141
141
-
<!-- -->
142
+

142
143
143
-

144
+
<!-- -->
144
145
145
146
It would be better if I manually curated the candidates rather than used this automatically-generated font list: there are way too many "default" designs from various system and language-specific fonts that simply fill the slot with a basic design, rather than interpret the shape according to the font's theme. And the font list produced by `fontconfig` doesn't look in all the font libraries, so it's an incomplete list.
146
147
@@ -154,35 +155,37 @@ I like the small version from Dalliance; it's nicely old-school, where "old-scho
154
155
155
156
It occurred to me to ask "what is the average of π?", or "what would it look like if all the πs were displayed at the same time?". Using the same font list generation as before, I ran this:
0 commit comments