Showing posts with label mathematics. Show all posts
Showing posts with label mathematics. Show all posts

2018-05-05

I maded a film

Reading Devaney’s An Introduction to Chaotic Dynamical Systems, Second Edition I found the description of a solenoid (§2.5) quite interesting: It starts out as a torus, but then you repeatedly lengthen it, shrinking the radius, and fold it back on itself, much like you fold a hair tie, but with the difference that the volume is not retained, so that each folded form fits inside the previous one. I thought that it would be nice to make a recursive function to draw a solenoid to arbitrary depth, and then to make a raytraced animation of the solenoid developing. As it were, I couldn’t quite work out the proper recursive step, so the idea has been languishing for a while (like a couple of years or so).

A few weeks ago I decided that I would get a grip on myself and work out the proper function, since it was obviously simple, if nothing else so to make sure I’m not entirely senile. After a couple of nights of scratching sketches on paper I finally managed to work out the proper order of things and started to transfer data to POVRay, my preferred raytracer. And of course, since I fully subscribe to the idea that glass balls are an important feature of raytracing, I would make the solenoid out of virtual glass. It would also spin, so as to bring out the shape better (on the assumption that viewers would not have access to a stereo viewer).

I soon realised that it was inconvenient to run a C program to generate the coordinates of the object and transfer to a POVRay input file by cut-and-paste every time I wanted to tinker with anything. Happily it is possible to program directly in the POVRay scene description language, so I reimplemented the function and could then work more or less interactively in POVRay. Delaney proposes shrinking the radius of the tube by a factor 10 for each folding, but in my opinion that makes it disappear from view too fast, so I used a factor 3 instead.

My original idea was that I’d render each level and fade it out while fading in the next level, but it turned out to be rather complicated as the surface+interior computational model of POVRay doesn’t really have a concept of fading, to achieve this a large number of (non-linear) parameters have to be adjusted in synchrony. I pondered this a bit, but decided that while I might eventually work out how to do the transforms it was probably easier to instead do the fading on the resulting images, rather than the 3D models, so generated images with only a single object in each and then composited them using ImageMagick and a couple of awk scripts.

This looked OK, but I still wasn’t quite happy with the results, there should be more movement in the animation. In the end I rewrote the solenoid code a bit, so that there would be an animated transition where the next level double-coil shrinks and separates out of the previous level. On a whim I added a background texture and was happily surprised by how much this made the glassiness of the tube pop out and made its structure more distinctive. The full length video took almost a week to render, the later parts requiring about an hour per frame, as the object becomes more complex. For no particular reason I rendered the animation at PAL resolution, notionally at 25 frames/second, but that made the motion a bit too fast in my opinion, so I pulled the output framerate down to 10 fps when generating the video (with ffmpeg) from the individual frames rendered by POVRay. That could then be uploaded to YouTube:

If anyone wants the code to play around with, just ask in the comments.

2014-12-01

Still going strong

During my first course in calculus, Ambjörn the TA was going through whatever it was and I innocently asked “Isn’t this, like, fractal?” He spun around: “Yes, exactly!”, spun back towards the blackboard and proceeded, chalk blazing, to explain how the current course segment was tied to fractals, their implications for geometry and how that in turn related to other branches of mathematics, ever faster and further into ever more exotic subjects while we students could just hold on to our desks for dear life in the storm blast of imparted knowledge. Forty-five minutes later he suddenly made a double-take, checked the time, and with an embarrassed cough noted: “I think we ran over the time a bit there, let’s take the break now.”

During the break Å accused me of setting Ambjörn into self-oscillation and suggested I shut up in the future, lest we never manage to cover what was actually coming on the exam.

Well, I did pass the calculus exams, eventually even the dreaded Theory exam, though that took me five attempts (in no way an exceptional number). Still, perhaps that was more due to diligently doing all exercises and repeatedly reading the books, rather than thanks to Ambjörn’s TA efforts, which, while always entertaining and mind-opening, tended to veer off from the official subject into Deep Maths.

Eventually I became a colleague of Ambjörn’s, whose wide-ranging interests could no longer be contained within either the Department of Mathematics or that of Physics and thus had moved into Computer Science (which at the limit contains all other sciences). Passing his room would often imply getting drawn into impromptu lectures on maths and their relation to everything else in (and occasionally outside) the universe. He even stored some of his parabolic rock-melting mirrors in our lab, though we irreverently ended up using them as towel racks.

Today, Ambjörn was officially retired, though, as is the custom in academia, that simply means the end of salary, but not necessarily the end of research. So, I returned to the Alma Mater for Ambjörn’s Last Lecture, which, true to form, ranged from how to explain what weekday it will be in a million days, over homotopies of snakes on a torus, to how human culture is an integral over time.

I regretted Honeybuns wasn’t there to get some kind of idea of where I come from, intellectually, but the OBCM was there and afterwards we had a nice chat about teaching and geometric modelling over a cuppa.

2012-01-28

Getting around to it

Chaos and fractals were hot stuff in the 1980s and I spent quite a bit of time on the subject—at one point Cliff Pickover, a thoroughly nice person, sent me a large package of material by mail. So, one of the first courses I signed up for as a grad student was Chaotic Dynamical Systems. In the event, I had to drop the course, along with several other maths courses—my work was to be in other areas and the textbook ended up on my shelf for unread books.

The other day I decided to pick it up again and see what I’d missed out on. One thing was clear: I might have been able to do the exercises when I was a first-year student, but by now most of my calculus was just hazy memories. And indeed, in contrast with most of my other literature on the subject, this was a book about proper maths, rather than computer graphics, and spent most of its space on proving various theorems about seemingly simple functions, but which exhibited chaotic behaviour. Still, even if my understanding is patchy these days, I’ve been going through the book, picking up concepts and ideas.

In the book was still the receipt from when I bought it and as I was reading on the train home the other day I listened with half an ear to the two girls sitting next to me talking about their studies. The one just next to me turned out to be a first-year student at my alma mater and the continued conversation revealed she had been born just a couple of days after I bought the book I was finally reading. It’s so hard to keep up.

2011-12-18

Seriously geeky comics

You really have to know your maths to get the jokes over at Spiked math, but you can always get hints in the comments section.

2010-01-03

Fractional post

In retrospect I shouldn't have been, but I was still a bit surprised to find that the Romans did not deal in integers only, but also used a form of fractions. In order to support Western Cultural Heritage there is a tool to help you convert terrorist Arabic fractions to Roman ones.

2009-04-13

She's all right

A song I've been looking for since it aired here in the early 1990s: “She's all right” with the Chipmunks. Marsha is impressively broadly skilled but what on Earth is the notation on Simon's blackboard? (2:17–2:44)

2009-03-14

Not significant

With regards to the recent school shooting in Winnenden, there was some question whether the perpetrator had primarily aimed at women, as 11 out of 15 victims were female. In case you wonder, as I did, Table D in Nonparametric Statistics for the Behavioral Sciences indicates that the probability of this distribution being random is 5.9%, i e it's not statistically significant at the 5%-level.

2009-01-01

Happy at the New Year

After Christmas celebrations Honeybuns returned to more southern and less snowy climes and there was much rejoicing.

We went to see the gingerbread houses at the Museum of Architecure but eventually ended up in the exhibition on architecture in Barcelona. We noted that just as for modern art, fashionable architects can't just present a neat idea, but have to surround it with grandiose and pompous verbiage. (Possibly they think computer scientists insist on presenting simple ideas with lots of impenetrable jargon, but that's a completely different matter.)

The sub-exhibition on Antoni Gaudí and his work on Sagrada Familia was much centred around his geometrical inventions, both enabling simpler construction methods (so why has it taken so long to build the place then?) and allowing a lighter structure, both in terms of mass and photons.

This would have been an excellent opportunity for some interactive exhibits, letting the audience play around with generatrices and see for themselves how they form various surfaces as they are moved along given paths. I strongly suspect the general audience probably isn't conversant with terms like “hyperbolic paraboloid”. The exhibition catalogue did contain a bit more explanation, but then again, should you have to shell out another 250 SEK just to get the labels under the exhibits explained? So, a good math teaching opportunity wasted.

On New Years' Eve we dressed up in our finest and prepared a candle-lit dinner for two (garlic mushrooms on toast, saffron fusilli with herb-and-lemon sauce and wild strawberry cider), Honeybuns musingly noting that the pleasantness of a festive evening apparently is unrelated to its alcohol content.

Honeybuns and I
Long shutter time and short self-timer makes for fuzzy pictures.

After dinner we changed out of our finery and bundled up in ski pants, scarves and thumb gloves to brave the elements at Skansen where Jan Malmsjö read Nyårsklockan as tradition requires. The fireworks were very beautiful and not too loud from where we were standing.

The huge crowd then moved back into the city, and we had to zigzag to avoid drunk revellers, smashed champagne bottles and thrown firecrackers. SL was running all available busses and trams to move people and even the underground trains out to the suburbs were running at rush-hour frequency to my great relief, especially considering the puke pools on the platform.

We were home again around 02:00 and finished off the night with saffron buns and aurora glögg. The latter was a pleasant surprise, the spices were just a subtle addition to a smooth blackcurrant flavour with a hint of bilberry.

When we woke up again, the sun shone in through the bedroom window.

2008-04-27

Maligned mathematics

Statistics is for me the archetype of science, to work with incomplete data and decide what conclusions we are justified to draw from them. Doing statistics properly is non-trivial, requiring both knowledge and skill, but misused statistics are all too common. Accordingly many tend to treat statistics as if they were just an issue of making up arguments for pre-determined conclusions.

Red Top once quipped:
Statistics is the science that says that if a person has one foot in the freezer and the other on a hob, he will on average be fairly comfortable.

Now this is an example of misusing statistics. Consider: If the example refers to temperature, a freezer would have a temperature of approx 250 K, a hob plate up to approx 600 K. Averaging the two temperatures would give 425 K, tissue-damagingly hot, so the conclusion is false.
(We do not know the heat content of the freezer and hob, respectively, but we can assume that if they are plugged in, the heat-conduction of the feet can be ignored.)

So, is the example to be taken as averaging “too cold” and “too hot”? Since these are (fuzzy) categories, they can't be averaged, so the conclusion is meaningless.

More meaningful for our wide-legged test person would perhaps be measurements of comfort level. The validity and repeatability of these measures can be questioned, but in principle we can get numeric values to work with, so-and-so much for one foot and such-and-such for the other. However, as both are on the “discomfort” side of the scale (per the problem statement), thus averaging out to discomfort, the conclusion is false again.

Remember kids: Always do your stats carefully and do not assume that you can use tests for normal distributed data on any data.

2008-03-12

It must be all the fish they eat

Mafalda once noted that you hardly ever hear about Norway in world news as dried fish isn't as newsworthy as wars. Now the Global Peace Index has shown that, indeed, Norway is the most peaceful country on Earth. (And Iraq is the least peaceful, surprise, surprise.)

Well, having strolled around in Oslo, even late at night, I can well believe that and certainly the Norwegians deserve the distinction, but I can't help but think a bit more about how the measurement has been made. It is scientific in the sense that the scoring is presented and the motivations for the choices of parameters given. The authors note that there is a certain level of arbitrariness in assigning scores.

I'd like to pick on a few of these arbitrarities.

Neither the Vatican, San Marino, Liechtenstein, Luxemburg, Monaco nor Andorra have been included, nor are Niau, Tuvalu, Cocos Islands or Surinam. Maybe they were considered to be too small to count, but if so, that does say something about reasons for peacefulness. (And Afghanistan, Belarus, and Eritrea have not been included either.)

Much of the ranking depends on the nations' scores on various 5-level scales. Having a discretised scale introduces various quantification errors. Ideally I should now have done a perturbation analysis to see if changing a score by a single unit would change the ordering between, say, Norway and New Zealand (the current number two on the peacefulness list), but I have not been able to find the exact weighting formula that has been used. (Possibly it is given somewhere on the site, but not sufficiently obviously to me.) The methodology section indicates that various numbers have been “banded” into these discretised scores. It's not obvious why one would want to do that, as retaining continuous data would give higher data quality, in that we would not be throwing information away. Furthermore, if any of these variables are assessments, rather than quantised continuous data, then we are abusing the numbers.

To wit: Using the numbers, say, 1–5 to grade something introduces an ordinal scale: we can say that “1” is better than “2”, but we cannot really tell if the difference between “1” and “2” is equal to the difference between “3” and “4”. That's why computing grade point averages really is bogus, it's not a well-defined operation. For that you would need at least an interval scale, where we are guaranteed the each step is the same size as any other step.

So the moral is: if Flight of the Conchords are more peaceful than KLM then you may not have been qualified for university.

2007-10-27

Knowledge is power!

British educational television has always impressed me greatly, both in that it is well done and in that it is sent on prime time as a matter of course. So it's only perfectly fitting that BBC should produce excellent educational television parodies as well, to wit: Look Around You

Start with the first episode, on Maths:

2007-05-17

My TI-53



MarkCC has posted about innumeracy, to be specific, the misuse of terms in a mathematical context. This is of course something that is interesting in its own right—just the other day I heard a sales manager claim that sales of a product category had increased by 250%, rather than to 250% (of the index) and insisted it was correct even when I pointed out the error—but more importantly the discussion reminded me of my old Texas Instruments TI-53. I got it for my birthday, it must have been when I was in 9th grade. Pocket calculators were quite unusual at the time, but my father had a thing for gadgets and for once he had hit on something useful. This was a great toy. I read through the relatively thick but small (so it'd fit in the same box as the calculator) manual and soon had figured out how to program the calculator.

This was magic. I could easily compute functions and plot them on squared paper and got some kind of intuition for how they worked. I used my TI-53 almost all through high school, where it was invaluable, and with the constant use it eventually wore out, the keyboard sensors failing. It got an appropriate funeral: I opened it up to see what it looked like inside and then soldered off the surface-mounted processor. Eventually I sewed it to the breast of my student overall, where it still sits today.

2007-03-31

Finite Simple Group of Order Two

Songs like this always make me happy.