Added By: Feedage Forager | |
Language: | |
Tags: | |
audio complex numbers complex fractions grapher imaginary math number numbers grapher numbers play plot synthesis unfortunately | |
Rate this Feed |
Comments (0) |
Feed Details and Statistics |
Updated: 2016-05-12T20:06:53+02:00
2013-01-05T00:00:00+01:00
A tale of numbers that like to turn "Take the universe and grind it down to the finest powder and sieve it through the finest sieve and then show me one atom of justice, one molecule of mercy. And yet," Death waved a hand, "And yet you act as if there is some ideal order in the world, as if there is some… some rightness in the universe by which it may be judged." – The Hogfather, Discworld, Terry Pratchett class='mathbox' height='600' src='/files/fold-a-julia/mb-0-teaser.html?22e389c1' /> Mathematics has a dirty little secret. Okay, so maybe it's not so dirty. But neither is it little. It goes as follows: Everything in mathematics is a choice. You'd think otherwise, going through the modern day mathematics curriculum. Each theorem and proof is provided, each formula bundled with convenient exercises to apply it to. A long ladder of subjects is set out before you, and you're told to climb, climb, climb, with the promise of a payoff at the end. "You'll need this stuff in real life!", they say, oblivious to the enormity of this lie, to the fact that most of the educated population walks around with "vague memories of math class and clear memories of hating it." Rarely is it made obvious that all of these things are entirely optional—that mathematics is the art of making choices so you can discover what the consequences are. That algebra, calculus, geometry are just words we invented to group the most interesting choices together, to identify the most useful tools that came out of them. The act of mathematics is to play around, to put together ideas and see whether they go well together. Unfortunately that exploration is mostly absent from math class and we are fed pre-packaged, pre-digested math pulp instead. And so it also goes with the numbers. We learn about the natural numbers, the integers, the fractions and eventually the real numbers. At each step, we feel hoodwinked: we were only shown a part of the puzzle! As it turned out, there was a 'better' set of numbers waiting to be discovered, more comprehensive than the last. Along the way, we feel like our intuition is mostly preserved. Negative numbers help us settle debts, fractions help us divide pies fairly, and real numbers help us measure diagonals and draw circles. But then there's a break. If you manage to get far enough, you'll learn about something called the imaginary numbers, where it seems sanity is thrown out the window in a variety of ways. Negative numbers can have square roots, you can no longer say whether one number is bigger than the other, and the whole thing starts to look like a pointless exercise for people with far too much time on their hands. I blame it on the name. It's misleading for one very simple reason: all numbers are imaginary. You cannot point to anything in the world and say, "This is a 3, and that is a 5." You can point to three apples, five trees, or chalk symbols that represent 3 and 5, but the concepts of 3 and 5, the numbers themselves, exist only in our heads. It's only because we are taught them at such a young age that we rarely notice. $$ 3 - 5 = \,? $$ $$ 4\;/\; 6 = \,? $$ $$ \sqrt{50} = \,? $$ $$ \sqrt{-4} = \,? $$ Questions that required us to invent new numbers in order to answer them consistently. So when mathematicians finally encountered numbers that acted just a little bit different, they couldn't help but call them fictitious and imaginary, setting the wrong tone for generations to follow. Expectations got in the way of seeing what was truly there, and it took decades before the results were properly understood. Now, this is not some esoteric point about a mathematical curiosity. These imaginary numbers—called complex numbers when combined with our ordinary real numbers—are essential to quantum physics, electromagnetism, and many more fields. They are naturally suited to describe anything that turns, waves, ripples, combines or interferes, with itself or with others. But it was also their unique structure that allowed Benoit Mandelbrot to create [...]2009-08-12T00:00:00+02:00
HTML5 gives us a couple new toys to play with, such as
Enter the JavaScript audio synth. It generates a handful of samples using very basic time-domain synthesis, wraps them up in a WAVE file header and embeds them in
My final attempt was to generate tons of periodic audio loops only a couple of ms long, and to play them back with looping turned on while altering each tag's volume in real time, hence doing a sort of additive wavetable synthesis. Unfortunately, looping is not a fully supported feature, and the only browser I found that does it (Safari) doesn't loop seamlessly at all.
All in all, my first brush with the
2008-09-24T00:00:00+02:00
Of all the free extras that Mac OS X has, Grapher has to be one of the coolest. This little app, hidden away in the Applications/Utilities folder, is a powerful graphing tool for mathematical equations and data sets. As you might expect from Apple, it typesets symbolic math beautifully and produces smooth, anti-aliased graphs. But this isn't just a little tech demo to showcase some of OS X's technologies: Grapher's features blow away your crusty old TI-83, and it comes with its own set of surprises. For example, not only can you save graphs as PDF or EPS, but it can export animations and even doubles as a LaTeX formula editor. In fact, it does so much that its main weakness is the documentation, which only covers the very basics. The best way to learn Grapher is to look at the handful of included examples, although it might take you a while to find out how to replicate them from scratch. The other day I needed to quickly graph a couple of things involving complex numbers, and it seemed that Grapher was doing some very freaky shit. Either that, or my math was really rusty. It turned out I'm not as stupid as I thought, and there are some weird caveats with using complex numbers in Grapher. Oddly, there is very little information online about it, so I figured for future reference, I should document the workarounds I discovered. Let's dive in. Fuck MS Paint, I've got math to do. Refresher To type formulas into Grapher, you can use the symbol palette, available in the Window menu, or type away using various keyboard shortcuts: Type ^ for exponents, _ for indices, / for fractions. Grapher understands exponents and other notations, for example the Bessel functions Jn(x). Use the arrow keys to move around the equation: in and out of parentheses, exponents, fractions, etc. Pay attention to the cursor to see where you're typing. Type out greek letter names for the symbols: alpha, omega, pi. Common mathematical constants work: e, π, i. The very useful 'Copy LaTeX expression' command is hidden away in the editor's right-click menu. Using complex numbers At first sight, complex numbers 'just work'. Using i as the imaginary unit, you can use numbers like 1 + 2i or plot graphs like y=eix. You can use the Re() and Im() operators to explicitly extract the real or imaginary part of a complex number and use abs() and arg() to extract the modulus and argument. If an expression's result is complex, Grapher will only plot the real part. This last bit is where things get tricky, because this silent casting of complex numbers to reals also sometimes happens in intermediate values. Silent truncation Let's plot a complex parametric curve directly using formulas of the form x + iy=.... As an example, let's look at this: These equations are using Euler's formula ei·x = cos x + i·sin x to plot a half circle each. The only difference between the two formulas is that the second one is passing its value through the (useless) function f(t). Now if we replace ei·x with 1/ei·x = e–i·x = cos x – i·sin x and change f(t) to 1/t, all that should happen is that the graph is mirrored vertically. Instead, this happens: The blue circle segment is drawn as a broken horizontal line. What's happening is that Grapher is treating the definition f(t) = 1/t as if it said f(t) = 1/Re(t). In other words, it is truncating the complex input of f(t) to a real number. To fix this, you need to replace the variable t with complex(t). This complex() function is listed in the built-in definitions list in the Help menu, but lacks any documentation. With this fix applied, the graph will plot as expected: Further tests reveal that complex(t) is in fact equivalent to writing out Re(t) + i·Im(t), thus manually recomposing the complex number from its own real and imaginary parts. If it weren't for the existence of the complex() helper, one might consider this issue a bug. The way it is now, it seems this behaviour is somewhat intentional. Moral of the [...]