Archive for Mathematica

Le Monde puzzle [#1164]

Posted in Books, Kids, R with tags , , , , , , , , , , , , , on November 16, 2020 by xi'an

The weekly puzzle from Le Monde is quite similar to older Diophantine episodes (I find myself impossible to point out):

Give the maximum integer that cannot be written as 105x+30y+14z. Same question for 105x+70y+42z+30w.

These are indeed Diophantine equations and the existence of a solution is linked with Bézout’s Lemma. Take the first equation. Since 105 and 30 have a greatest common divisor equal to 3×5=15, there exists a pair (x⁰,y⁰) such that

105 x⁰ + 30 y⁰ = 15

hence a solution to every equation of the form

105 x + 30 y = 15 a

for any relative integer a. Similarly, since 14 and 15 are co-prime,

there exists a pair (a⁰,b⁰) such that

15 a⁰ + 14 b⁰ = 1

hence a solution to every equation of the form

15 a⁰ + 14 b⁰ = c

for every relative integer c. Meaning 105x+30y+14z=c can be solved in all cases. The same result applies to the second equation. Since algorithms for Bézout’s decomposition are readily available, there is little point in writing an R code..! However, the original question must impose the coefficients to be positive, which of course kills the Bézout’s identity argument. Stack Exchange provides the answer as the linear Diophantine problem of Frobenius! While there is no universal solution for three and more base integers, Mathematica enjoys a FrobeniusNumber solver. Producing 271 and 383 as the largest non-representable integers. Also found by my R code

  if((a<-sum(!!i))==sum(!!e))sol=(sum(i*e)==x) else{sol=0
    for(j in 0:(x/e[a+1]))sol=max(sol,o(c(i,j),e,x))}
a=(min(e)-1)*(max(e)-1)#upper bound
M=b=((l<-length(e)-1)*prod(e))^(1/l)-sum(e)#lower bound
for(x in a:b){sol=0
for(i in 0:(x/e[1]))sol=max(sol,o(i,e,x))

(And this led me to recover the earlier ‘Og entry on the coin problem! As of last November.) The published solution does not bring any useful light as to why 383 is the solution, except for demonstrating that 383 is non-representable and any larger integer is representable.

“a rare blend of monster raving egomania and utter batshit insanity”

Posted in Books, pictures, University life with tags , , , , , , , , , , , , on November 12, 2020 by xi'an

“I don’t object to speculation or radical proposals, even to radical, grandiose speculative proposals; I just want there to be arguments to back them up, reasons to take them seriously. I don’t object to scientists displaying personality in their work, or staking out positions in vigorous opposition to much of the opinion in their field, and engaging in heated debate; I do object to ignoring criticism and claiming credit for commonplaces, especially before popular audiences who won’t pick up on it.”

A recent post by Andrew on Stephen Wolfram’s (mega) egomania led to a much older post by Cosma Shalizi reviewing the perfectly insane 5.57 pounds of a New Kind of Science. An exhilarating review, trashing the pretentious self-celebration of a void paradigm shift advanced by Wolfram and its abyssal lack of academic rigour, showing anew that a book recommended by Bill Gates is not necessarily a great book. (Note that A New Kind of Science is available for free on-line.)

“Let me try to sum up. On the one hand, we have a large number of true but commonplace ideas, especially about how simple rules can lead to complex outcomes, and about the virtues of toy models. On the other hand, we have a large mass of dubious speculations (many of them also unoriginal). We have, finally, a single new result of mathematical importance, which is not actually the author’s. Everything is presented as the inspired fruit of a lonely genius, delivering startling insights in isolation from a blinkered and philistine scientific community.”

When I bought this monstrous book (eons before I started the ‘Og!), I did not get much further into it than the first series of cellular automata screen copies that fill page after page. And quickly if carefully dropped it by my office door in the corridor. Where it stayed for a few days until one of my colleagues most politely asked me if he could borrow it. (This happens all the time: once I have read or given up on a book I do not imagine reopening again, I put it in the coffee room or, for the least recommended books, on the floor by my door and almost invariably whoever is interested will first ask me for permission. Which is very considerate and leads to pleasant discussions on the said books. Only recently did the library set shelves outside its doors for dropping books free for the taking, but even there I sometimes get colleagues wondering [rightly] if I was the one abandoning there a particular book.)

“I am going to keep my copy of A New Kind of Science, sitting on the same shelf as Atlantis in Wisconsin, The Cosmic Forces of Mu, Of Grammatology, and the people who think the golden ratio explains the universe.”

In case the review is not enough to lighten up your day, in these gloomy times, there is a wide collection of them from the 2000’s, although most of the links have turned obsolete. (The Maths Reviews review has not.) As presumably this very post about a eighteen-years-old non-event…

Le Monde puzzle [#887ter]

Posted in Books, Kids, Statistics, University life with tags , , , , on November 27, 2014 by xi'an

Here is a graph solution to the recent combinatorics Le Monde mathematical puzzle, proposed by John Shonder:

N is a golden number if the sequence {1,2,…,N} can be reordered so that the sum of any consecutive pair is a perfect square. What are the golden numbers between 1 and 25?

Consider an undirected graph GN with N vertices labelled 1 through N. Draw an edge between vertices i and j if and only if i + j is a perfect square. Then N is golden if GN contains a Hamiltonian path — that is, if there is a connected path that visits all of the vertices exactly once.g25I wrote a program (using Mathematica, though I’m sure there must be an R library with similar functionality) that builds up G sequentially and checks at each step whether the graph contains a Hamiltonian path. The program starts with G1 — a single vertex and no edges. Then it adds vertex 2. G2 has no edges, so 2 isn’t golden.

Adding vertex 3, there is an edge between 1 and 3. But vertex 2 is unconnected, so we’re still not golden.

The results are identical to yours, but I imagine my program runs a bit faster. Mathematica contains a built-in function to test for the existence of a Hamiltonian path.

g36Some of the graphs are interesting. I include representations of G25 and G36. Note that G36 contains a Hamiltonian cycle, so you could arrange the integers 1 … 36 on a roulette wheel such that each consecutive pair adds to a perfect square.

A somewhat similar problem:

Call N a “leaden” number if the sequence {1,2, …, N} can be reordered so that the sum of any consecutive pair is a prime number. What are the leaden numbers between 1 and 100? What about an arrangement such that the absolute value of the difference between any two consecutive numbers is prime?

[The determination of the leaden numbers was discussed in a previous Le Monde puzzle post.]

National Gallery of Ireland

Posted in pictures, R, Travel with tags , , , , , , , on October 16, 2011 by xi'an

During a short if profitable visit to Dublin for a SFI meeting on Tuesday/Friday, I had the opportunity to visit the National Gallery of Ireland in my sole hour of free time (as my classy hotel was very close). The building itself is quite nice, being well-inserted between brick houses from the outside, while providing impressive height, space, and light from the inside.

The masterpiece gallery is quite small (unless I missed a floor!), if filled with masterpieces like a painting by Caillebotte I did not know.


The modern art gallery was taken by a temporary (and poorly exposed) exhibit that includes live happenings (five persons wearing monkish outfits standing around a mommy floating in mid-air), tags (!), and two interesting pieces: one was made of several tables filed with piles of books glued together and sculpted, giving an output that looked like 2-D histograms, and reminding me of the fear histograms discussed on  Statisfaction by Julyan a few days ago. (Note the Mathematica book in the last picture!) While I love books very much, I am also quite interested in sculptures involving books, like the one I saw a few years ago where the artist had grown different cereals on opened books: although it may sound like an easy trick (food for thought and all that), the result was amazing and impressive!

The second piece was a beautiful board illuminated by diodes which felts very warm and comforting, maybe in reminiscence of the maternal womb, of candles, or of myriads of galaxies, but very powerful in any case. (I usually dislike constructs involving light, like the neon sculptures of the 80’s, so I started with an a priori against it.) I could have stayed there for hours…

A ridiculous email

Posted in Books, R, Statistics with tags , , , on May 11, 2010 by xi'an

Wolfram Research presumably has a robot that sends automated email following postings on arXiv:

Your article, “Evidence and Evolution: A review”, caught the attention of one of my colleagues, who thought that it could be developed into an interesting Demonstration to add to the Wolfram Demonstrations Project.

The Demonstrations Project, launched alongside Mathematica 6 in May 2007, is a collection of over 5,000 interactive Demonstrations that cover myriad subjects, interests, and skill levels. The Demonstrations are free to download and manipulate thanks to Mathematica Player, which is also free. Building a Demonstration is a simple and straightforward process. If you have little or no experience with Mathematica, you may want to attend one of our free online seminars. In our S14 seminar, “Creating Demonstrations,” members of the Demonstrations team guide you step-by-step through the authoring process.

Your published Demonstrations will appear on the Wolfram Demonstrations Project website, which averages over 50,000 hits a week. We welcome any questions you might have, and look forward to seeing a Demonstration submission from you soon.

but they definitely got it all wrong there! They picked my book review of a philosophy of science book, Evidence and Evolution, where I complain of the lack of a true experiment..!