## don’t wear your helmet, you could have a bike accident!

Posted in Kids, Running, Statistics, Travel with tags , , , , , , , , , , , on January 18, 2022 by xi'an

As once in a while reappears the argument that wearing a bike helmet increases one’s chances of a bike accident. In the current case, it is to argue against a French regulation proposal that helmets should be compulsory for all cyclists. Without getting now into the pros and cons of compulsory helmet laws (enforced in Argentina, Australia, and New Zealand, as well as some provinces of Canada), I see little worth in the study cited by Le Monde towards this argument. As the data is poor and poorly analysed. First, there is a significant fraction of cycling accidents when the presence of an helmet is unknown. Second, the fraction of cyclists wearing helmets is based on a yearly survey involving 500 persons in a few major French cities. The conclusion that there are three times more accidents among cyclists wearing helmets than among cyclists not wearing helmets is thus not particularly reliable. Rather than the highly debatable arguments that (a) seeing a cyclist with an helmet would reduce the caution of car or bus drivers, (b) wearing an helmet would reduce the risk aversion of a cyclist, (c) sport-cyclists are mostly wearing helmets but their bikes are not appropriate for cities (!), I would not eliminate [as the authors do] the basic argument that helmeted cyclists are on average traveling longer distances. With a probability of an accident that necessarily  increases with the distance traveled. While people renting on-the-go bikes are usually biking short distances and almost never wear helmets. (For the record, I mostly wear a [bright orange] helmet but sometimes do not when going to the nearby bakery or swimming pool… Each time I had a fall, crash or accident with a car, I was wearing an helmet and I once hit my head or rather the helmet on the ground, with no consequence I am aware of!)

## it was the spring of hope, it was the winter of despair

Posted in Kids, Travel with tags , , , , , , , , , , , on January 16, 2021 by xi'an

## shortened iterations [code golf]

Posted in Kids, pictures, Statistics, Travel with tags , , , , , , , , on October 29, 2019 by xi'an

A codegolf lazy morning exercise towards finding the sequence of integers that starts with an arbitrary value n and gets updated by blocks of four as

$a_{4k+1} = a_{4k} \cdot(4k+1)\\ a_{4k+2} = a_{4k+1} + (4k+2)\\ a_{4k+3} = a_{4k+2} - (4k+3)\\ a_{4k+4} = a_{4k+3} / (4k+4)$

until the last term is not an integer. While the update can be easily implemented with the appropriate stopping rule, a simple congruence analysis shows that, depending on n, the sequence is 4, 8 or 12 values long when

$n\not\equiv 1(4)\\ n\equiv 1(4)\ \text{and}\ 3(n-1)+4\not\equiv 0(32)\\ 3(n-1)+4\equiv 0(32)$

respectively. But sadly the more interesting fixed length solution

~=rep #redefine function
b=(scan()-1)*c(32~4,8,40~4,1,9~3)/32+c(1,1,3,0~3,6,-c(8,1,9,-71,17)/8)
b[!b%%1] #keep integers only


ends up being longer than the more basic one:

a=scan()
while(!a[T]%%1)a=c(a,d<-a[T]*T,d+T+1,e<-d-1,e/((T<-T+4)-1))
a[-T]


where Robin’s suggestion of using T rather than length is very cool as T has double meaning, first TRUE (and 1) then the length of a…

## Nature tidbits

Posted in Books, Statistics, University life with tags , , , , , , , , , , , on September 18, 2018 by xi'an