## around the table

Posted in Books, pictures, R, Statistics with tags , , , , , , , , , , on December 2, 2020 by xi'an

The Riddler has a variant on the classical (discrete) random walk around a circle where every state (but the starting point) has the same probability 1/(n-1) to be visited last. Surprising result that stems almost immediately from the property that, leaving from 0, state a is visited couterclockwise before state b>a is visited clockwise is b/a+b. The variant includes (or seems to include) the starting state 0 as counting for the last visit (as a return to the origin). In that case, all n states, including the origin, but the two neighbours of 0, 1, and n-1, have the same probability to be last. This can also be seen on an R code that approximates (inner loop) the probability that a given state is last visited and record how often this probability is largest (outer loop):

w=0*(1:N)#frequency of most likely last
for(t in 1:1e6){
o=0*w#probabilities of being last
for(v in 1:1e6)#sample order of visits
o[i]=o[i<-1+unique(cumsum(sample(c(-1,1),300,rep=T))%%N)[N]]+1
w[j]=w[j<-order(o)[N]]+1}

However, upon (jogging) reflection, the double loop is a waste of energy and

o=0*(1:N)
for(v in 1:1e8)
o[i]=o[i<-1+unique(cumsum(sample(c(-1,1),500,rep=T))%%N)[N]]+1

should be enough to check that all n positions but both neighbours have the same probability of being last visited. Removing the remaining loop should be feasible by considering all subchains starting at one of the 0’s, since this is a renewal state, but I cannot fathom how to code it succinctly. A more detailed coverage of the original problem (that is, omitting the starting point) was published the Monday after publication of the riddle on R bloggers, following a blog post by David Robinson on Variance Explained.

R codegolf challenge: is there a way to shorten the above R for loop in a single line command?!

## a journal of the plague year [confined reviews]

Posted in Books, pictures, Travel, Wines with tags , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , on May 23, 2020 by xi'an

Watched TV series His Dark Materials produced for the BBC, which is much much better than the earlier film, as the actors are all fabulous—first and foremost Lyra, but also Ma Costa, the Gyptian Muter Courage—, the gypsy community is given a much stronger role, the characters are deep and complex, as eg Mrs and Mr Coulter, both ready to sacrifice kids for the greater “good” without appearing as absolute monsters! The special effects are a wee bit deficient as often with BBC productions but not enough to make a case. Although I sort of cringed each time a bear moved!

Read The Voyage of the Jerle Shannara trilogy by Terry Brooks, which I noticed standing on my son’s bookshelves. The original Shannara Trilogy was one of the very first fantasy books I read in English in my undergrad years (after Lord of the Rings of course and possibly The Chronicles of Thomas Covenant), which did not leave me with an everlasting feeling of superlative literature, to say the least. This avatar of the original Sword of Shannara trilogy did nothing to improve my feelings as the plot is lazy at best, with super-powered villains suddenly acting, last second deus ex machina rescues, endless internal debates, heavy hints at treacheries and double-treacheries, and, worst of all!, intrusion of 20th century technology, e.g., computers, AIs and robots, that the far future characters make sense of. Only suitable for a time of lockdown and even then… I should have left it on the bookshelf! Incidentally, one fight scene against a cyborg was highly reminiscent of the black knight scene in Holy Grail!

Watched by chance Tarantino’s Reservoir Dogs. For the first time. And was totally un-impressed. Highly pretentious construction falling flat from being a modern reconstruction of antique dramas, endless dialogues (which could have been cut by half if removing all the occurrences of fucking from them), boring and threadbare story, and artificial characters that essentially make no sense. I cannot fathom why this film is so highly ranked..! (And even less to witness it being compared with Rashomon!)

Read [part] of Jin Yong’s Legends of the Condor Heroes (射鵰英雄傳) but, lockdown or not, I simply could not finish it. Despite its fantasy approach to Chinese martial arts, which I usually enjoy (at least in planes!), and some proximity with the Judge Dee stories by van Gulik, the story felt very contrived and somewhat out of reach, plus [not yet] Genghis Khan being depicted in a fairly positive way [at least in the part I read]. Too irrealist for my reading buds, I presume…

Cooked plenty of new dishes, thanks to the delivery of weekly farmer boxes, from radish stems & buckwheat pancakes to celery roots purées, to fregola sarda (leftovers from ISBA 2016!) con acciughe, to chard gratins, to pea pod and cauliflower core soups, to flaxseed bread and buckwheat naans (as we ran out of wheat flour). We also managed to use and survive most of the out-of-date cans and bags that had stood forgotten in the back of our cupboard… Not visiting a supermarket for two months was actually most pleasant, living very nicely from the above mentioned farmer boxes and the occasional delivery from a cheesemonger, and supplementing weekly visits to the baker with attempts at home made bread.

Read Matha Well’s Murderbot diaries, my first read on a Kindle!, for free courtesy of Tor. Starting with All Systems Red, which won the 2017 Nebula Award for Best Novella, the 2018 Hugo Award for Best Novella, the 2018 Locus Award, and the American Library Association‘s Alex Award. Very good if somewhat classical (Blade Runner anyone?!) trope of the rogue robot turned autonomous and human, so human! This is a sequence of novellas which means a fast-paced story and an efficient style. (Including a less exciting third novella, due to a lazy scenario.) More mind-candy à la John Scalzi than profound literature but quite enjoyable for a quick read during lunch or tea break! But which induced me to buy the first and incoming novel in the series,  Network Effect. (To be commented in a subsequent entry…)

Leading to (re)read the Interdependency trilogy by John Scalzi, the last volume in the series being just out. Very lazy buildup, in the traditional spirit of a few people driving the future of the entire Universe, with unlimited resources and unrestricted hacking abilities, but with funny dialogues, as usual with Scalzi. In this binge (re)read, I actually realised the frustrating intricacies of Kindle ordering as (i) I could not use my amazon.com account and hence none of my associate gains (ii) I could not merge several amazon.fr accounts and (iii) prices varied a lot between using directly the Kindle and ordering from amazon.fr…

And even growing some salads and radishes over the two months and eating them before the end of the lockdown, as the weather in Paris was quite mild most of the time. Although it meant a daily-basis fight with slugs. The arugula did not resist that well, though…

Reading Tade Thompson’s Rosewater for more than a month, having trouble keeping my concentration as the story goes in loops and not a particularly well settled plot. With a central idea of an alien race taking over humanity a few cells at a time. Which reminded me of Greg Bear’s Blood Music I read during the first year of my PhD. The book has some appeal, from being located in Nigeria 30 years from now to America having completely vanished from the map after Trump pulled the ultimate drawbridge. It won the 2019 Arthur Clarke Award after all! But I found it too hard to complete to even consider embarking upon the next two volumes on the trilogy…

## so long and thanks for the rabbit, Terry Jones!

Posted in Statistics with tags , , , , , , , on February 16, 2020 by xi'an

## end of the game

Posted in Books, Kids, pictures with tags , , , , , , , , , , , , , , on May 28, 2019 by xi'an