Archive for the Kids Category

sequence riddle

Posted in Kids, R with tags , , , , , on August 10, 2017 by xi'an

The riddle this week on The Riddler was about finding the largest sequence of integers between 1 and 100 such that each integer is only used once and always followed by a multiple or a factor. A basic R code searching at random [and programmed during a massive downpour on Skye] led to a solution of 69:

although there is no certainty this is the best p… And the solutions posted the next week showed sequences with length 77! [Interestingly, both posted solutions have a sequence starting with 87. And they seem to exploit the graph of connections between integers in a much more subtle way that my random exploration of subsequences.]

[one of] 99 stories of God

Posted in Books, Kids, pictures with tags , , , , , on August 4, 2017 by xi'an

19

When he was a boy, someone’s great-grandfather told him this story about a traveller in thirteenth-century France.

The traveller met three men pushing wheelbarrows. He asked in what work they were engaged, and he received from them the following three answers.

The first said: I toil from sunrise to sunset and all I receive for my labor is a few francs a day.

The second said: I’m happy enough to wheel this wheelbarrow, for I have not had work for many months and I have a family to feed.

The third said: I am building Chartres Cathedral.

But as a boy he had no idea what a chartres cathedral was.

Joy Williams, ninety-nine stories of God.

[Nitpicking on that sharp little tale: Francs did not become a currency in France until 1360, when it was first coined to attempt to ransom the then king of France, John II, who still died a prisoner in England.]

ghost [parameters] in the [Bayesian] shell

Posted in Books, Kids, Statistics with tags , , , , , , , on August 3, 2017 by xi'an

This question appeared on Stack Exchange (X Validated) two days ago. And the equalities indeed seem to suffer from several mathematical inconsistencies, as I pointed out in my Answer. However, what I find most crucial in this question is that the quantity on the left hand side is meaningless. Parameters for different models only make sense within their own model. Hence when comparing models parameters cannot co-exist across models. What I suspect [without direct access to Kruschke’s Doing Bayesian Data Analysis book and as was later confirmed by John] is that he is using pseudo-priors in order to apply Carlin and Chib (1995) resolution [by saturation of the parameter space] of simulating over a trans-dimensional space…

conference carbon footprint

Posted in Kids, pictures, Running, Travel, University life, Wines with tags , , , , , , , , , on August 1, 2017 by xi'an

As a local organiser of the recent BNP 11 conference in Paris, and hence involved in setting and cleaning coffee breaks and [now famous] wine&cheese poster sessions, I was rather shocked by the amount of waste generated by those events, albeit aware of the importance of the social exchanges they induced… And thus got to wonder how the impact of those conference events could be reduced. One solution is the drastic one, namely to provide exactly nothing at all during the breaks between talks and expect anyone hungry or thirsty enough to bring one own’s food or drink. Another one, as suggested by my daughter at the dinner table, is to provide Ecocups, namely reusable plastic glasses that can given to all participants at the beginning of the conference. Or sold (or rented) to those who have not brought their own mug or bottle. (Of course, this may be a poor idea in that manufacturing and shipping a hard-plastic glass that most likely will be discarded after a few days may be more damaging than producing the equivalent number of “disposable” thin plastic glasses. And in the end all this agitation is peanuts compared with the impact of flying participants to the conference. For which I have no handy solution… As biking to the conference location is a privilege very few can enjoy.) Still, and even though this puts another stone in the already rocky organisers’ garden, I wish we could adopt more positive policies at the meetings we organise and sponsor.

Le Monde puzzle [#1707]

Posted in Books, Kids, R with tags , , , , , on July 28, 2017 by xi'an

A geometric Le Monde mathematical puzzle:

  1. Given a pizza of diameter 20cm, what is the way to cut it by two perpendicular lines through a point distant 5cm from the centre towards maximising the surface of two opposite slices?
  2.  Using the same point as the tip of the four slices, what is the way to make four slices with equal arcs in four cuts from the tip again towards maximising the surface of two opposite slices?

For both questions, I did not bother with the maths but went itself to a discretisation of the disk, counting the proportion of points within two opposite slices and letting the inclination of these slices move from zero to π/2. Unsurprisingly, for the first question, the answer is π/4, given that there is no difference between both surfaces at angles 0 and π/2. My R code is as follows, using (5,0) as the tip:

M=100
surfaz=function(alpha){
surfz=0
cosal=cos(alpha);sinal=sin(alpha)
X=Y=seq(-10,10,le=M)
Xcosal=(X-5)*cosal
Xsinal=(X-5)*sinal
for (i in 1:M){
norm=sqrt(X[i]^2+Y^2)
scal1=Xsinal[i]+Y*cosal
scal2=-Xcosal[i]+Y*sinal
surfz=surfz+sum((norm<=10)*(scal1*scal2>0))}
return(4*surfz/M/M/pi)}

The second puzzle can be solved by a similar code, except that the slice area between two lines has to be determined by a cross product:

surfoz=function(alpha,ploz=FALSE){
  sinal=sin(alpha);cosal=cos(alpha)
  X=Y=seq(-10,10,le=M)
  frsterm=cosal*(10*cosal-5)+sinal*(10*sinal-5)
  trdterm=cosal*(10*cosal+5)+sinal*(10*sinal+5)
  surfz=0
  for (i in 1:M){
    norm=sqrt(X[i]^2+Y^2)
    scal1=(10*(Y[i]-5)*cosal-(10*sinal-5)*X)*frsterm
    scal2=-(-10*(Y[i]-5)*sinal-(10*cosal-5)*X)*frsterm
    scal3=(-10*(Y[i]-5)*cosal+(10*sinal+5)*X)*trdterm
    scal4=-(10*(Y[i]-5)*sinal+(10*cosal+5)*X)*trdterm
    surfz=surfz+sum((norm<=10)* 
    ((scal1>0)*(scal2>0)+
     (scal3>0)*(scal4>0)))}
 return(4*surfz/M/M/pi)}

a code that shows that all cuts lead to identical surfaces for bot sets of slices. A fairly surprising result!

 

Boots is deliberately overcharging for the morning-after pill!

Posted in Kids, pictures with tags , , , , on July 21, 2017 by xi'an

“Boots charges £28.25 for Levonelle emergency contraceptive (the leading brand) and £26.75 for its own generic version. Tesco now charges £13.50 for Levonelle and Superdrug £13.49 for a generic version. In France, the tablet costs £5.50.” The Guardian, July 20, 2017

vendanges tardives

Posted in Kids, pictures, Wines with tags , , , , on July 20, 2017 by xi'an