For the English part of the blog, see Content AND Presentation.

2020-10-18 A nice exercise in metric spaces

It’s been a very long time since I posted anything math-y here (more than five years!). It certainly has something to do with the fact that I no longer work as a mathematician (even if I am part of one maths-related project, but that’s a secret). A few days ago, however, after a short discussion with a friend, I came up with a really nice exercise. Note: it is not difficult at all, quite the contrary, but I like it a lot.

Hopefully everyone reading this knows what a metric space is (and if you don’t, no offence, but this exercise is probably not meant for you). There is one interesting class of metric spaces, called the “ultrametric spaces”, where instead of the usual triangle inequality we assume that d(x,y)≤max{d(x,z),d(y,z)} for every x,y,z in the space in question. (Sorry for un-LaTeX-y formatting here, I just noticed that LaTeX fragment rendering on my blog is broken, and I don’t have time at the moment to investigate it – and we’ll need very few equations anyway.) This is a much stronger condition, and it has some rather strange consequences (like every point belonging to a ball being its center). One of the unusual properties of an ultrametric space is that “every triangle is isosceles”, that is, every triple of points has one point equidistant (“equidistant” – so grown-up!) from the other two.

And here is the exercise, coming in two parts. First of all: do there exist any metric spaces with the same property but not being ultrametric? In other words, must a metric space in which every triangle is isosceles be ultrametric? And the other question is to characterize all metric spaces where every triangle is equilateral, that is, d(x,y)=d(y,z)=d(z,x) for every x,y,z.

As I said, these exercises are trivial for any seasoned mathematician, but might be a good thing to ask students. And even though I do find them very easy, I really like them from aesthetic point of view. And – finally – I am not bound by some stupid obligations like publishing a novel (or “novel”) paper once or twice per year – so I can have fun with little toy problems like that whenever I feel like it.

Happy solving!

CategoryEnglish, CategoryBlog, CategoryMaths

Comments on this page

2020-10-12 Editing subtitles in Emacs with subed

Some time ago I bought a DVD with one of my favorite movies of all time. (I am not really a movie person, but I like to watch some film once or twice a year.) Unfortunately, the film is only available in English, and I really wanted my daughter (who doesn’t speak it yet) to watch it with me. I set out to translate all the dialog to Polish (which was quite a challenge, and I am proud to say that I managed to do that – better or worse, sometimes perhaps inevitably worse, but still).

Now what I need is to prepare subtitles for the film. It turns out that the industry standard is called srt, and – not that it is surprising – Emacs has a suitable mode.


Since subed is not on Elpa (nor on Melpa), installation is slightly more complicated than saying M-x package-install, but it is described in the readme and works perfectly. The package has support for playing the video, even looping it on the subtitle worked on, and similar cool stuff – but I didn’t test it, since I didn’t really need it. I just downloaded English subtitles from the Internet and started to put Polish translations in suitable places.

CategoryEnglish, CategoryBlog, CategoryEmacs

Comments on this page

2020-10-05 Notifying the user about the start of the track in EMMS

I bought a new record a few days ago, and of course the first thing I did was converting it to mp3 files. Then I loaded my new music into EMMS and started listening.

And then I noticed a problem – minor but annoying. I wanted to learn the titles of the tracks, but I don’t have them in the modeline (EMMS displays the title there by default, but I turned it off to save screen real estate).

Well, system notifications to the rescue. Why not make EMMS display the track information in the system notification when it starts playing? It turns out that this is something that can be done in basically two minutes:

(defun emms-notify-track-description ()
  "Use `notify-send' to show the description of the currecnt track."
   nil nil nil
   "-a" "EMMS"

(add-hook 'emms-player-started-hook #'emms-notify-track-description)

Again, this is Emacs: such little customizations can be done withing minutes. Perhaps the least obvious thing here was looking up the call-process function and finding the emms-player-started-hook variable. The former was made easy by the fact that I did something like that before and I only had to copy-paste the invocation; the latter was made easy by the fact that I just searched for variables containing the strings emms and hook.

And that’s it for today, I’m going off to listen to some music now.

CategoryEnglish, CategoryBlog, CategoryEmacs

Comments on this page