News aggregator

  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home/mpcollab/public_html/MPbeta1/modules/aggregator/aggregator.module on line 1386.
  • : Function split() is deprecated in /home/mpcollab/public_html/MPbeta1/modules/filter/filter.module on line 1206.
  • : Function split() is deprecated in /home/mpcollab/public_html/MPbeta1/modules/filter/filter.module on line 1206.
  • : Function split() is deprecated in /home/mpcollab/public_html/MPbeta1/modules/filter/filter.module on line 1206.
  • : Function split() is deprecated in /home/mpcollab/public_html/MPbeta1/modules/filter/filter.module on line 1206.
  • : Function split() is deprecated in /home/mpcollab/public_html/MPbeta1/modules/filter/filter.module on line 1206.
  • : Function split() is deprecated in /home/mpcollab/public_html/MPbeta1/modules/filter/filter.module on line 1206.
  • : Function split() is deprecated in /home/mpcollab/public_html/MPbeta1/modules/filter/filter.module on line 1206.
  • : Function split() is deprecated in /home/mpcollab/public_html/MPbeta1/modules/filter/filter.module on line 1206.

Making Formulas… for Everything—From Pi to the Pink Panther to Sir Isaac Newton

Wolfram Alpha - Fri, 05/17/2013 - 16:50

Here at Wolfram Research and at Wolfram|Alpha we love mathematics and computations. Our favorite topics are algorithms, followed by formulas and equations. For instance, Mathematica can calculate millions of (more precisely, for all practical purposes, infinitely many) integrals, and Wolfram|Alpha knows hundreds of thousands of mathematical formulas (from Euler’s formula and BBP-type formulas for pi to complicated definite integrals containing sin(x)) and plenty of physics formulas (e.g from Poiseuille’s law to the classical mechanics solutions of a point particle in a rectangle to the inverse-distance potential in 4D in hyperspherical coordinates), as well as lesser-known formulas, such as formulas for the shaking frequency of a wet dog, the maximal height of a sandcastle, or the cooking time of a turkey.

Recently we added formulas for a variety of shapes and forms, and the Wolfram|Alpha Blog showed some examples of shapes that were represented through mathematical equations and inequalities. These included fictional character curves:

Shape curves:

And, most popular among our users, person curves:

While these are curves in a mathematical sense, similar to say a lemniscate or a folium of Descartes, they are interesting less for their mathematical properties than for their visual meaning to humans.

After Richard’s blog post was published, a coworker of mine asked me, “How can you make an equation for Stephen Wolfram’s face?” After a moment of reflection about this question, I realized that the really surprising issue is not that there is a formula: a digital image (assume a grayscale image, for simplicity) is a rectangular array of gray values. From such an array, you could build an interpolating function, even a polynomial. But such an explicit function would be very large, hundreds of pages in size, and not useful for any practical application. The real question is how you can make a formula that resembles a person’s face that fits on a single page and is simple in structure. The formula for the curve that depicts Stephen Wolfram’s face, about one page in length, is about the size of a complicated physics formula, such as the gravitational potential of a cube.

In this post, I want to show how to generate such equations. As a “how to calculate…”, the post will not surprisingly contain a fair bit of Mathematica code, but I’ll start with some simple introductory explanations.

Assume you make a line drawing with a pencil on a piece of paper, and assume you draw only lines; no shading and no filling is done. Then the drawing is made from a set of curve segments. The mathematical concept of Fourier series allows us to write down a finite mathematical formula for each of these line segments that is as close as wanted to a drawn curve.

As a simple example, consider the series of functions yn(x),

which is a sum of sine functions of various frequencies and amplitudes. Here are the first few members of this sequence of functions:

Plotting this sequence of functions suggests that as n increases, yn(x) approaches a triangular function.

The sine function is an odd function, and as a result all of the sums of terms sin(k x) are also odd functions. If we use the cosine function instead, we obtain even functions. A mixture of sine and cosine terms allows us to approximate more general curve shapes.

Generalizing the above (-1)(k – 1)/2) k-2 prefactor in front of the sine function to the following even or odd functions,

allows us to model a wider variety of shapes:

It turns out that any smooth curve y(x) can be approximated arbitrarily well over any interval [x1, x2] by a Fourier series. And for smooth curves, the coefficients of the sin(k x) and cos(k x) terms approach zero for large k.

Now given a parametrized curve γ(t) = {γx(t), γy(t)}, we can use such superpositions of sine and cosine functions independently for the horizontal component γx(t) and for the vertical component γy(t). Using a sum of three sine functions and three cosine functions for each component,

covers a large variety of shapes already, including circles and ellipses. The next demonstration lets us explore the space of possible shapes. The 2D sliders change the corresponding coefficient in front of the cosine function and the coefficient in front of the sine function. (Download this post as a CDF to interact)

If we truncate the Fourier expansion of a curve at, say, n terms, we have 4n free parameters. In the space of all possible curves, most curves will look uninteresting, but some expansion coefficient values will give shapes that are recognizable. However, small changes in the expansion coefficients already quickly change the shapes. The following example allows a modification of the first 4 × 16 Fourier series coefficients of a curve (meaning 16 for the x direction and another 16 for the y direction). Using appropriate values for the Fourier coefficients, we obtain a variety of recognizable shapes.

And if we now take more than one curve, we already have all the ingredients needed to construct a face-like image. The following demonstration uses two eyes, two eye pupils, a nose, and a mouth.

And here is a quick demonstration of the reverse: we allow the position of a set of points (the blue crosses) that form a line to be changed and plot the Fourier approximations of this line.

Side note: Fourier series are not the only way to encode curves. We could use wavelet bases or splines, or encode the curves piecewise through circle segments. Or, with enough patience, using the universality of the Riemann zeta function, we could search for any shape in the critical strip. (Yes, any possible [sufficiently smooth] image, such as Jesus on a toast, appears somewhere in the image of the Riemann zeta function ζ(s) in the strip 0 ≤ Re(s) ≤ 1, but we don’t have a constructive way to search for it.)

To demonstrate how to find simple, Fourier series-based formulas that approximate given shapes, we will start with an example: a shape with sharp, well-defined boundaries—a short formula. More concretely, we will use a well-known formula: the Pythagorean theorem.

Rasterizing the equation gives the starting image that we will use.

It’s easy to get a list of all points on the edges of the characters using the function EdgeDetect.

Now that we have the points that form the edges, we want to join them into straight-line (or curved) segments. The following function pointListToLines carries out this operation. We start with a randomly chosen point and find all nearby points (using the function Nearest to be fast). We continue this process as long as we find points that are not too far away. We also try to continue in a “straight” manner by slightly penalizing sharp turns. To see how the curve construction progresses, we use Monitor.

For the Pythagorean theorem, we obtain 11 individual curves from the edge points.

Joining the points and coloring each segment differently shows that we obtained the expected curves: the outer boundaries of the letters, the inner boundaries of the letters a and b, the three squares, and the plus and equal signs.

Now for each curve segment we want to find a Fourier series (of the x and y component) that approximates the segment. The typical textbook definition of the Fourier coefficients of a function f(x) are integrals of the function multiplied by cos(k x) and sin(k x). But at this point we have sets of points, not functions. To turn them into functions that we can integrate, we make a B-spline curve of each curve segment. The parametrization variable of the B-spline curve will be the integration variable. (Using B-splines instead of piecewise linear interpolations between the points will have the additional advantage of making jagged curves smoother.)

We could find the integrals needed to obtain the Fourier coefficients by numerical integration. A faster way is to use the fast Fourier transform (FFT) to get the Fourier coefficients.

To get more uniform curves, we perform one more step: re-parametrize the spline interpolated curve of the given curve segments by arclength. The function fourierComponents implements the B-spline curve making, the re-parametrization by arclength, and the FTT calculation to obtain the Fourier coefficient. We also take into account if a curve segment is open or closed to avoid Gibbs phenomena-related oscillations. (The above demonstration of approximating the pentagram nicely shows the Gibbs phenomenon in case the “Closed” checkbox is unchecked.)

For a continuous function, we expect an average decay rate of 1/k2 for the kth Fourier series coefficient. This is the case for the just-calculated Fourier series coefficient. This means that on average the 10th Fourier coefficient is only 1% in magnitude compared with the first one. This decay allows us to truncate the Fourier series at a not too high order, as we do not want to obtain formulas that are too large. This expression gives the exponent in the decay rate of the Fourier components for the a2 + b2 = c2 curve above. (The slightly lower than 2 exponent arises from the discretization points in the B-spline curves.)

Here is a log-log-plot of the absolute values of the Fourier series coefficient for the first three curves. In addition to the general trend of an approximately quadratic decay of the Fourier coefficients, we see that the magnitude of nearby coefficients often fluctuates by more than an order of magnitude.

Multiplying the Fourier coefficients by cos(k t) and sin(k t) and summing the terms gives us the desired parametrizations of the curves.

The function makeFourierSeriesApproximationManipulate visualizes the resulting curve approximations as a function of the series truncation order.

For the Pythagorean theorem, starting with a dozen ellipses, we quickly form the characters of the inequality with increasing Fourier series order.

We want a single formula for the whole equation, even if the formula is made from disjoint curve segments. To achieve this, we use the 2π periodicity of the Fourier series of each segment to plot the segments for the parameter ranges [0, 2π], [4π, 6π], [8π, 10π], …, and in the interleaving intervals (2π, 4π), (6π, 8π), …, we make the curve coordinates purely imaginary. As a result, the curve cannot be drawn there, and we obtain disjoint curve segments. Here this construction is demonstrated for the case of two circles:

The next plot shows the real and imaginary parts of the complex-valued parametrization independently. The red line shows the purely imaginary values from the parameter interval [2π, 4π].

As we want the final formula for the curves to look as short and as simple as possible, we change sums of the form a cos(k t) + b sin(k t) to A sin(k t + φ) using the function sinAmplitudeForm and round the floating-point Fourier series coefficients to nearby rationals. Instead of Piecewise, we use UnitStep in the final formula to separate the individual curve segments. The real segments we list in explicit form, and all segments that should not be drawn are encoded through the θ(sgn(sin(t/2)(1/2))) term.

Now we have everything together to write down the final parametrization {x(t), y(t)} of the typeset form of the Pythagorean theorem as a mathematical formula.

After having discussed the principal construction idea for the parametrizations, let’s look at a more fun example, say the Pink Panther. Looking at the image search results of the Bing search engine, we quickly find an image that seems desirable for a “closed form” parametrization.

Let’s use the following image:

We apply the function EdgeDetect to find all edges on the panther’s face.

Connecting the edges to curve segments yields about 20 segments. (Changing the optional second and third argument of pointListToLines, we obtain fewer or more segments.)

Here is each segment shown with a different color. We see that some closed curves arise from two joined curve segments; we could separate them by changing the second argument of pointListToLines. But for the goal of sketching a line drawing, the joined curve will work just fine.

Proceeding now as above, it is straightforward to approximate the curve segments by trigonometric series.

Plotting the series shows that with 20 terms per segment, we obtain a good representation of the Pink Panther.

As some of the segments of the panther’s face are more intricate than others, we define a function makeSegmentOrderManipulate that allows the number of terms of the Fourier series for each segment to be varied. This lets us further reduce the size of the resulting parametrizations.

We use initial settings for the number of Fourier coefficients that yield a clearly recognizable drawing of the Pink Panther.

For simple cases, we can now roll up all of the above function into a single function. The next function makeSilhouetteFourierResult takes a string as an argument. The function then 1) performs a search on Bing’s image site for this string; 2) selects an image that seems appropriate from the algorithmic point of view; 3) calculates the Fourier series; and 4) returns as the result plots of the Fourier series and an interactive version that lets us change the order of the Fourier series. For simplicity, we restrict the program to only single curves. (In the web search, we use the word “silhouette” to mostly retrieve images that are formed by just a single curve.) As the function relies on the result of an external search engine, there is no guarantee that the function will always return the wanted result.

Here are three examples showing the function at work. We build the Fourier series for a generic spider, Spiderman’s spider, a couple dancing the tango, and a mermaid. (Evaluating these functions might give different results, as the search engine results might change over time.)

So far, the initial line segments were computed from images. But we can also start with hand-drawn curves. Assume we want a formula for Isaac Newton. As I am not good at drawing faces, I cheated a bit and used the curve drawing tool to draw characteristic facial and hair curves on top of an image of Sir Isaac. (For algorithmic approaches on how to extract feature lines from faces, see the recent paper by Zhao and Zhu.) Here is the image that we will use:

Fortunately, small random wiggles in the hand-drawn curve will not matter, as they will be removed by omitting higher-order terms in the Fourier series.

To better see the hand-drawn curves, we separate the image and the lines.

This time, we have 16 segments. We build their Fourier series.

And here are again various approximation orders of the resulting curves.

We use different series orders for the various segments. For the hair, we use relatively high orders, and for the eyes relatively low orders. This will make sure that the resulting equations for the face will not be larger than needed.

Here are the first 50 approximations shown in one graphic with decreasing opacity of the curves, and with each set of corresponding curve segments shown in a different color.

This gives the following final curve for Sir Isaac’s portrait.

And this is the plotted form of the last formula.

This ends today’s discussion about how to make curves that resemble people’s faces, fictional characters, animals, or other shapes. Next time, we will discuss the endless graphics capabilities that arise from these formulas and how you can use these types of equations in a large variety of images.

To interact with the examples above, first, download the Wolfram CDF Player. Then, download this post as a Computable Document Format (CDF) file.

Categories: Cyber-Futures

Computational Knowledge of Continued Fractions

Wolfram Alpha - Thu, 05/16/2013 - 18:32

Mathematics has many faces. It deals with diverse objects such as integers, points and lines, equations, graphs, categories, thousands of different spaces (from R3 to Hilbert, Banach, Fréchet, …), and so on. Mathematics can be constructive or just prove the existence of certain structures. Wolfram|Alpha has made a good fraction of computable constructive mathematics freely available to everyone: from line through (2,3) and (4, 5) to Fréchet derivative of (integrate exp(-f(x)^2) dx from -inf to inf) wrt f(y) to fractional derivative of ln(z). Independent of the concrete objects studied, mathematical results always come in the form of axioms, definitions, theorems, lemmas, corollaries, conjectures, proofs, algorithms, identities, and formulas, supplemented by visualizations, derivations, and explanations.

While computational access to much of algorithmic mathematics is widely available through computer software (in particular, Mathematica), semantic and computational access to theorem-like mathematics remains largely nonexistent. As a result, finding, understanding, and applying theorem-type results is still a time-consuming process for scientists both in the applied sciences and in mathematics proper. Worse still, it is typically quite difficult for nonspecialists to find and digest mathematical results in the original literature. Old notations, implicitly assumed prior knowledge, and papers in foreign languages compound the problem even more.

Here we will describe a small step in realizing a grand vision of Stephen Wolfram for computational access to all of mathematics and the dynamic use of mathematical knowledge.

The process of utilizing concrete mathematical results today effectively requires three steps:

  1. Finding relevant literature citations
  2. Obtaining printed or (ever more commonly) electronic copies of books and papers
  3. Reading, understanding, and applying the actual result

Researchers typically undertake the first step of identifying potentially relevant articles and books using Mathematical Reviews/MathSciNet, Zentralblatt, or increasingly just Google Research or Microsoft Academic Search. With abstracts and summaries of the cataloged articles and books available, these tools allow a certain preselection. Of course, at this stage it is not yet known if the selected literature will contain the particular result a scientist is seeking.

In the second step, the literature has to be retrieved. Despite great progress over the last two decades in the digitization of and free access to the older mathematical literature (see a listing of digitalized older mathematics papers and books), it is often difficult to retrieve copies of all potentially relevant materials without a subscription service (often available only to well-funded universities and research labs). If a researcher is not associated with an institution that has literature access, a single article can cost tens of dollars, and even if a researcher has access to a good library and subscription service, some articles may need to be ordered via inter-library requests, which can take a substantial amount of time to arrive.

To accomplish the third step of understanding the results (theorems, algorithms, etc.) contained in an article, a scientist must often effectively read the paper in its entirety from start to finish in order to locate and learn the notations and assumptions. Worse yet, because articles quote earlier articles, one often has to go back to the second step to retrieve these earlier articles in order to fully understand the original. This last step makes the process recursive, and one often does not have the time, patience, or resources to carry it out beyond one or two iterations. To make matters even worse, a surprisingly large number of equations, algorithms, and even theorems appearing in the published literature contain typographical errors, the discovery and correction of which can be time-consuming at best.

Bearing in mind the almost unique property of mathematical results, that they are (almost) never invalidated or become outdated (and also the fact that mathematical papers quote older papers more frequently than any other science), there is no question that something should be done to make mathematical results easier to find. Last summer, the Future World Heritage Digital Mathematics Library Symposium was held at the National Academy of Sciences (NAS) in Washington, DC, and a wide variety of talks about these subjects were presented. The efforts behind the World Heritage Digital Mathematics Library and in general behind improving accessibility of mathematical knowledge have been spearheaded by the Alfred P. Sloan Foundation.

A recent guest blog post from Ingrid Daubechies (current president of the International Mathematical Union) on Terence Tao‘s blog on the subject of a Future World Digital Mathematical Library discusses various aspects of such a digital mathematics library.

A year ago, the Wolfram Foundation obtained a one-year grant from the Sloan Foundation to prototype and build a technological infrastructure for collecting, tagging, storing, and searching a representative subset of mathematical knowledge (including definitions and theorems) and presenting it through a Wolfram|Alpha-like natural language interface. Carried out by Oleg Marichev, Todd Rowland, Michael Trott, and Eric Weisstein, the work focused on continued fractions, a subset of mathematics that is historically rich, well-defined, and nontrivial, yet at the same time manageable as a proof of concept. This work represents a new type of digital library for mathematics that can ensure preservation of historical results while at the same time promoting dissemination of mathematical knowledge.

Many results are known about continued fractions, some going back as far as the mid-seventeenth-century, and many due to historically famous mathematicians. However, without digital and computable archiving, these results risk being lost in the sands of time or reinvented/rediscovered at the hands of independent researchers. Furthermore, while continued fractions are a classical subject, their applications run the gamut from the solution of Diophantine equations to quantum computing.

The original mathematical literature will always be an important tool for working mathematicians. Once researchers have located a paper of relevance, they will often read it in its entirety. So computerized encoding of mathematical knowledge will not replace traditional mathematical literature, but rather supplement and enhance it, in particular by making the discovery and application of relevant literature results much easier than currently possible.
 

Goals

The specific goals of our project were to collect and curate mathematical content that is:

  • human- and computer-verified;
  • stored in computer-readable (and, if possible, computational) form;
  • searchable using a natural language interface;
  • linked to the original literature;
  • presented in a coherent, unified, and verified form using consistent notation and integrated definitions;
  • and interlinked in a way that reflects the rich connections and interdependence of mathematical results easily accessible to everyone at all times.

In this relatively small exploratory investigation, the main goal was to see which useful features around mathematical theorems (such as searchability, connecting them, visualizing them) were in the intersecting set of technological feasibility and practical usefulness. Our project dealt with about 10% of the circa 6,000 total published papers on continued fractions in the literature.

Nearly six years ago, Wolfram Research pioneered the encoding and use of general quantitative knowledge through its so-called Computable Data Initiative. Computable data collections such as GraphData, KnotData, PolyhedronData, and FiniteGroupData added a slew of mathematical knowledge to Mathematica.

Wolfram|Alpha has similar functionalities for mathematical functions (Bessel functions, elliptic integrals, …), curves and surfaces, probability distributions, and more.

Following this general data concept, as a part of our project we added structured data about continued fractions to Wolfram|Alpha. (While the extracted and curated continued fraction knowledge is independent of Wolfram|Alpha, Wolfram|Alpha provides a convenient way to query the material and display the results uniformly.) The data added included theorems, conjectures, identities, and algorithms about continued fractions. For various reasons, proofs were not in the initial implementation. This decision was due in part to the unfortunate fact that the estimated error rates in published proofs are substantially higher than in theorems, so the process of checking (and potentially fixing errors and plugging holes) would have added an unwanted level of complexity to the project. However, it was also due to consideration of the understanding that while proofs are central to mathematics itself, they are less relevant for the applied sciences.
 

Implementation

Recently the first version of the project was released on the Wolfram|Alpha website. The main types of knowledge provided can be categorized into the following groups:

  • theorems (and conjectures, lemma, …)
  • mathematical identities
  • definitions and concepts
  • algorithms
  • visualizations and interactive demonstrations
  • references
Theorems

The most important and well-known theorems throughout mathematics are often named after their inventors. Here are a handful of examples we have implemented that are related to continued fractions:

The results returned for these queries contain human-readable forms of the theorems, references, and some information about the people who investigated them. The various result types are hyperlinked to the extent possible (e.g., Queffelec’s theorem deals with regular continued fractions and with the Thue–Morse sequence).

Although the Stern–Stolz theorem is a classic and important theorem in the theory of convergence of continued fractions, trying a Google Scholar search for Stern–Stolz theorem will show a few dozen results, and one has to read (or at least scan) the first few in order to find out what the Stern–Stolz theorem actually is. Clearly, having immediate access to the distilled version of the theorem is efficient. To make the theorems more easily and quickly understandable, and also easier to compare, we aimed for two canonicalizations:

a) Explanation of all symbols occurring in a theorem.

In the original papers, often authors first introduce some notation and then use this notation later in a theorem. So to understand the theorem, one often cannot just locally read the theorem, but must first locate the relevant notations.

b) Usage of uniform notations as much as possible.

The terms of a continued fraction [b1/a1, b2/a2, ...] are often denoted by ak and bk. But which one is the denominator and which one is the numerator depends on the continued fraction investigated. For example, the bj are the denominators in a general continued fraction, but in a regular continued fraction they are often denoted aj. Similarly, numerators and denominators of convergents are commonly denoted pj and qj in the historical literature, but Ak and Bk in more recent papers and books. In the theorems collected within this project, we canonizcalized most of the notations to make looking at more than one theorem at a time less ambiguous.

Some important theorems are encapsulated in concrete formulas:

And here are two named conjectures about continued fractions:

The majority of mathematical theorems are not prominent enough to have been explicitly named after their provers, so finding a standard or accepted name by which to refer to them can be tricky. Our implementation partially solves this problem in the case where known people are associated with a given result:

Of course, in most real-life research, one is commonly interested in finding mathematical theorems about a certain topic/concept, not in looking up a theorem by name. As a result, we also allow searching by topic:

Special classes of mathematical structures often allow for more detailed investigations. For instance, quadratic irrationals have periodic regular continued fractions expansions, and many special theorems hold for quadratic irrationals. So, one can also query for theorems that hold for certain classes of mathematical objects:

Having the theorems inside a computational system, we can utilize the computational system and check if the conditions of a certain theorem hold in concrete instances:

Sometimes theorems are generalizations of earlier found theorems or special cases of more general theorems. Or theorems are related to each other in the sense that they deal with quite related topics. As much as our limited theorem subset allowed such connections, one can query for them:

Finally, linking the theorems about continued fractions to other Wolfram|Alpha databases, such as the people database, enriches the results and literally puts a face on a certain theorem:

Mathematical Identities

While there are many integral tables (Oleg Marichev, co-author of the comprehensive five-volume Integrals and Series handbook, was a team member on this continued fraction project) and tables for sums, surprisingly there is no published comprehensive table for continued fractions. By carrying out a comprehensive literature search, we attempted to collect all known continued fraction representations. (If the reader knows of a continued fraction that we don’t have, please let us know and we would be happy to add it to our collection.) Some examples include:

As an example of issues encountered and resolved in the curation of continued fraction identities, we note that the older literature did not always pay detailed attention to branch cut issues. While one can in principle use any branch cut location that leads to “nice” identities, this nonstandard treatment should be banished in the modern world in favor of the precisely defined IEEE 754 specifications of branch cuts (section 9.2), as is done for example in Mathematica. In our curated identities, the branch cuts were carefully checked and standardized and simplify appropriately in all relevant regions of the complex plane.

To use these identities in programs, one can either utilize the copyable plaintext feature on Wolfram|Alpha or the WolframAlpha function in Mathematica. For instance, the following table summarizes the relative error for the continued fractions of π when truncating the expansion at 10 continued fraction terms:

 

Definitions and Concepts

In addition to theorems, we need appropriate phrases to define and describe various continued fraction topics. For instance, the most appropriate convergence concept for continued fractions is different from the convergence for series:

There are many different types of continued fractions that contain indeterminates:

And various operators and operations relevant for continued fractions:

Given a real number, the most straightforward way to build a continued fraction expansion is the regular continued fraction expansion. But there are many other ways to build continued fraction expansions for a given real number:

Algorithms

While Wolfram|Alpha uses a tremendous number of algorithms to answer a large variety of queries, they are all “under the hood.” Within our continued fraction project, the goal was to both implement the most important algorithms for continued fractions and to clearly and precisely describe and expose them:

One can also watch the algorithms “in action”:

Visualizations and Interactive Demonstrations

Various continued fraction theorems that deal with the distribution of continued fraction digits hold for almost all real numbers. In many cases, the concrete numbers for which these theorems do not hold cannot be explicitly enumerated, so one is naturally curious if and how, as a function of the number of terms, the statements of these theorems hold for a concrete real number. To satisfy such curiosity and to stimulate further research, we added interactive exploration tools for a subset of the theorems:

One can also make other interactive explorations, for example by viewing the beautiful constellations of nested touching circles that arise in forming the convergents of Schmidt’s continued fractions for complex numbers:

References

Mathematical Reviews and Zentralblatt offer excellent bibliographic data for an enormous number of mathematics papers. For completeness, we added cross-linking to these and other established mathematical literature sites to the papers and books present in our prototype. Within our implementation, references can be searched based on the journal in which a source paper appears:

Similarly, one can query for the papers due to a particular person:

Conclusions

This ends our short overview of the work we have done to encode mathematical knowledge relevant to continued fractions as part of a grant from the Sloan Foundation.

We welcome any suggestions for changes and additions, as well as any improvements our users may suggest. In addition to adding various additional theorems, identities, and features, we will be working on extending and making our results more useful over the next months. The most complete tables of special values and modular equations for the Ramanujan continued fraction are examples of additional material that will be added soon; see the recent blog post on the subject for more details and a showcasing of some new results we found in assembling these tables.

Categories: Cyber-Futures

A bank account if you need one

European Union - Thu, 05/16/2013 - 10:00

New measures would give all Europeans a legal right to a basic bank account anywhere in the EU – and make switching to another provider easier.

Categories: Nations

President Barroso sets out priorities for May European summit

European Union - Tue, 05/14/2013 - 10:00

Commission calls for significant progress on completing the internal energy market and tackling growing tax fraud and evasion ahead of leaders’ meeting.

Categories: Nations

Upholding your rights

European Union - Wed, 05/08/2013 - 10:00

New proposals would remove remaining obstacles to living, working and shopping anywhere in the EU.

Categories: Nations

EU economy: slowly recovering from a protracted recession

European Union - Fri, 05/03/2013 - 10:00

The economy is projected to return to growth in the second half of 2013. However, annual GDP is forecast to contract by 0.1% in the EU and 0.4% in the eurozone.

Categories: Nations

After 100 Years, Ramanujan Gap Filled

Wolfram Alpha - Wed, 05/01/2013 - 20:47

A century ago, Srinivasa Ramanujan and G. H. Hardy started a famous correspondence about mathematics so amazing that Hardy described it as “scarcely possible to believe.” On May 1, 1913, Ramanujan was given a permanent position at the University of Cambridge. Five years and a day later, he became a Fellow of the Royal Society, then the most prestigious scientific group in the world. In 1919 Ramanujan was deathly ill while on a long ride back to India, from February 27 to March 13 on the steamship Nagoya. All he had was a pen and pad of paper (no Mathematica at that time), and he wanted to write down his equations before he died. He claimed to have solutions for a particular function, but only had time to write down a few before moving on to other areas of mathematics. He wrote the following incomplete equation with 14 others, only 3 of them solved.

Within months, he passed away, probably from hepatic amoebiasis. His final notebook was sent by the University of Madras to G. H. Hardy, who in turn gave it to mathematician G. N. Watson. When Watson died in 1965, the college chancellor found the notebook in his office while looking through papers scheduled to be incinerated. George Andrews rediscovered the notebook in 1976, and it was finally published in 1987. Bruce Berndt and Andrews wrote about Ramanujan’s Lost Notebook in a series of books (Part 1, Part 2, and Part 3). Berndt said, “The discovery of this ‘Lost Notebook’ caused roughly as much stir in the mathematical world as the discovery of Beethoven’s tenth symphony would cause in the musical world.”

In his book analyzing Ramanujan’s results, Berndt notes the existence of a solution for , but follows with, “We do not record the value here, because it is not particularly elegant.” As we will show below, a solution exists as elegant as other values found by Ramanujan himself.

What does the equation mean? We start by comparing arithmetic sequences to geometric sequences.

Arithmetic: 1 + 2 + 3 + … + n.

Geometric: a1 + a2 + a3 + … + an.

For each type, we can predict behaviors with such things as partial sum formulas. Another form of arithmetic progression, in the realm of continued fractions, is the following:

where symbol corresponds to the Mathematica function ContinuedFractionK.

The geometric version of continued fractions is known as the Rogers–Ramanujan function R. There is a related Rogers–Ramanujan function S (after Leonard James Rogers, who published papers with Ramanujan in 1919). In the lost notebook, F(q) represents S(q).

R(q) is a continued fraction of the form:

and similarly for S(q). (The presence of the prefactor makes various formulas nicer.) More formal definitions are as follows:

These functions are related by . Many published works mention S(q) = -R(-q), but that’s incorrect due to branch cuts. We can also define R and S in a way that can be evaluated more quickly through q-Pochhammer symbols.

Here are pictures of the behavior of the R function on the unit disk in the complex plane. Values returned can be complex, so these pictures show the imaginary, real, argument, and absolute values (Im, Re, Arg, and Abs) of the function R(q). The unit circle itself is the natural boundary of analyticity and has a dense set of singularities of the function R(q). As one can see, the Roger–Ramanujan functions are beautiful, not just due to their mathematical properties, but also visually.

The functions R and S are two of the few named functions devoted to continued fractions. Recently, we’ve been collecting theorems and formulas for R and S, including the uncompleted ones in this piece of Ramanujan’s original “lost” notebook. That line at the end is equivalent to .

Many of these have been found since Ramanujan wrote them down. All of these are readily solved with Mathematica. We list the values together with the first known solvers, with solutions by Oleg Marichev being first realized by Mathematica.

Bruce Berndt noted, “The value of can be determined by using the value of along with a famous modular equation connecting R(q5) with R(q). We do not record the value here, because it is not particularly elegant.”

With Simplify, RootReduce, and many other Mathematica functions, large equations can be boiled down to their most elegant form. Ramanujan used chalk and his mind to simplify most of his results—the long results he erased from his slate, but the elegant results he wrote down. It seems likely to us that Ramanujan actually did know the elegant solution, or at least a method to find it, he just didn’t have the time to write it down. Here’s a method we used. First, calculate a numerical value for the point of interest. Second, conjecture a closed algebraic form for this number. Third, express the algebraic number as nested radicals. Finally, check the conjectured form with many digits of accuracy.

Then we check that the numerical value of the conjectured form is the same as the value of the function. The values agree to at least 10000 places.

Since both of these are algebraic numbers with elegant representations, this is a rather convincing check. And the method can easily be generalized to find many more, so far unknown, values for S(q), and similarly for R(q).

An actual proof can be accomplished using modular equations. This is the modular equation of order 5 for S:

We use the previously known value for for S(q5) and solve for S(q) to obtain a value for .

Clearing denominators, we obtain the above form of the result.

Ramanujan’s equations are related to work we’ve done recently to add a lot of continued fraction knowledge to Wolfram|Alpha. In a future blog we will expand on the new capabilities, such as the input continued fraction K (1, n, {n, 1, inf}).

We also put together a list of hundreds of exact values in the “Ramanujan R and S” interactive Demonstration.

“Not particularly elegant”—never a good thing to say about Ramanujan. We’re glad we were able to show that Ramanujan had something elegant in mind.

Download this post as a Computable Document Format (CDF) file.

Categories: Cyber-Futures

Celebrating Europe – open day on 4 May

European Union - Wed, 05/01/2013 - 10:00

Europe’s open day is a time to reflect on the EU’s achievements – and look at how to make it work better for everyone. Join in the debates, events and activities for all ages.

Categories: Nations

Bringing down barriers to working in another EU country

European Union - Mon, 04/29/2013 - 10:00

New proposals would make it even easier for Europeans to go and work in another EU country.

Categories: Nations

Get Real with Wolfram|Alpha—Computing Roots

Wolfram Alpha - Fri, 04/26/2013 - 17:48

Some common questions from the many student users of Wolfram|Alpha include “Isn’t cbrt(-8) = -2?” and “Why doesn’t the plot of the cube root include the negative part?” The answers are that -2 is just one of the three cube roots of -8, and that Mathematica, the computational engine of Wolfram|Alpha, has always chosen the principal root, which is complex valued. More generally, odd roots of negative numbers are typically assumed to be complex. You can see this in the output of (-8)^(1/3).

Note that the principal value of about 1 + 0.723i is indeed a complex number. In addition, all 3rd roots of -8 are displayed, as are their positions in the complex plane.

It should be mentioned that there are very good reasons to use the principal root in higher mathematics, as this is considered to be the proper way to extend the root functions into the complex number system. With the release of Version 9 of Mathematica, however, there are also new, real-valued functions for computing roots, and these are incorporated naturally into Wolfram|Alpha. One way to access these new functions is to select the “Use the real-valued root instead” option below the input bar as shown in the previous example. Alternatively, we can access Mathematica‘s CubeRoot function, for example, by typing “cube root” instead of using the power ^(1/3), as in the previous example.

Note that the result is, indeed, -2, and that some of the information specific to complex numbers is missing. We do still receive the information indicating how this relates to all the roots, however. A shorthand way to enter the real cube root is “cbrt”. We can obtain a lot of information on this function like so:

Note that the plots extend over the whole real line, and that the domain and range computations reflect this. Of course, we can access other odd roots as well. For example, we might specify that we want the real-valued 11th root of -12.

Just as with cube roots, there’s a handy shorthand called surd. This is particularly useful if you want to use a real root as part of a more complicated computation, as in our final example.

We hope you like this new functionality, and keep it real!

Categories: Cyber-Futures

Internet broadcasting – public consultation

European Union - Thu, 04/25/2013 - 10:00

Video streaming over the internet has given people more choice of TV programmes and movies – we need your thoughts on an EU approach so everyone can benefit.

Categories: Nations

Data Science of the Facebook World

Wolfram Alpha - Wed, 04/24/2013 - 18:26

More than a million people have now used our Wolfram|Alpha Personal Analytics for Facebook. And as part of our latest update, in addition to collecting some anonymized statistics, we launched a Data Donor program that allows people to contribute detailed data to us for research purposes.

A few weeks ago we decided to start analyzing all this data. And I have to say that if nothing else it’s been a terrific example of the power of Mathematica and the Wolfram Language for doing data science. (It’ll also be good fodder for the Data Science course I’m starting to create.)

We’d always planned to use the data we collect to enhance our Personal Analytics system. But I couldn’t resist also trying to do some basic science with it.

I’ve always been interested in people and the trajectories of their lives. But I’ve never been able to combine that with my interest in science. Until now. And it’s been quite a thrill over the past few weeks to see the results we’ve been able to get. Sometimes confirming impressions I’ve had; sometimes showing things I never would have guessed. And all along reminding me of phenomena I’ve studied scientifically in A New Kind of Science.

So what does the data look like? Here are the social networks of a few Data Donors—with clusters of friends given different colors. (Anyone can find their own network using Wolfram|Alpha—or the SocialMediaData function in Mathematica.)

So a first quantitative question to ask is: How big are these networks usually? In other words, how many friends do people typically have on Facebook? Well, at least for our users, that’s easy to answer. The median is 342—and here’s a histogram showing the distribution (there’s a cutoff at 5000 because that’s the maximum number of friends for a personal Facebook page):

But how typical are our users? In most respects—so far as we can tell—they seem pretty typical. But there are definitely some differences. Like here’s the distribution of the number of friends not just for our users, but also for their friends (there’s a mathematical subtlety in deriving this that I’ll discuss later):

And what we see is that in this broader Facebook population, there are significantly more people who have almost no Facebook friends. Whether such people should be included in samples one takes is a matter of debate. But so long as one looks at appropriate comparisons, aggregates, and so on, they don’t seem to have a huge effect. (The spike at 200 friends probably has to do with Facebook’s friend recommendation system.)

So, OK. Let’s ask for example how the typical number of Facebook friends varies with a person’s age. Of course all we know are self-reported “Facebook ages”. But let’s plot how the number of friends varies with that age. The solid line is the median number of friends; successive bands show successive octiles of the distribution.

After a rapid rise, the number of friends peaks for people in their late teenage years, and then declines thereafter. Why is this? I suspect it’s partly a reflection of people’s intrinsic behavior, and partly a reflection of the fact that Facebook hasn’t yet been around very long. Assuming people don’t drop friends much once they’ve added them one might expect that the number of friends would simply grow with age. And for sufficiently young people that’s basically what we see. But there’s a limit to the growth, because there’s a limit to the number of years people have been on Facebook. And assuming that’s roughly constant across ages, what the plot suggests is that people add friends progressively more slowly with age.

But what friends do they add? Given a person of a particular age, we can for example ask what the distribution of ages of the person’s friends is. Here are some results (the jaggedness, particularly at age 70, comes from the limited data we have):

And here’s an interactive version, generated from CDF:

 

The first thing we see is that the ages of friends always peak at or near the age of the person themselves—which is presumably a reflection of the fact that in today’s society many friends are made in age-based classes in school or college. For younger people, the peak around the person’s age tends to be pretty sharp. For older people, the distribution gets progressively broader.

We can summarize what happens by plotting the distribution of friend ages against the age of a person (the solid line is the median age of friends):

There’s an anomaly for the youngest ages, presumably because of kids under 13 misreporting their ages. But apart from that, we see that young people tend to have friends who are remarkably close in age to themselves. The broadening as people get older is probably associated with people making non-age-related friends in their workplaces and communities. And as the array of plots above suggests, by people’s mid-40s, there start to be secondary peaks at younger ages, presumably as people’s children become teenagers, and start using Facebook.

So what else can one see about the trajectory of people’s lives? Here’s the breakdown according to reported relationship status as a function of age:

And here’s more detail, separating out fractions for males and females (“married+” means “civil union”, “separated”, “widowed”, etc. as well as “married”):

There’s some obvious goofiness at low ages with kids (slightly more often girls than boys) misreporting themselves as married. But in general the trend is clear. The rate of getting married starts going up in the early 20s—a couple of years earlier for women than for men—and decreases again in the late 30s, with about 70% of people by then being married. The fraction of people “in a relationship” peaks around age 24, and there’s a small “engaged” peak around 27. The fraction of people who report themselves as married continues to increase roughly linearly with age, gaining about 5% between age 40 and age 60—while the fraction of people who report themselves as single continues to increase for women, while decreasing for men.

I have to say that as I look at the plots above, I’m struck by their similarity to plots for physical processes like chemical reactions. It’s as if all those humans, with all the complexities of their lives, still behave in aggregate a bit like molecules—with certain “reaction rates” to enter into relationships, marry, etc.

Of course, what we’re seeing here is just for the “Facebook world”. So how does it compare to the world at large? Well, at least some of what we can measure in the Facebook world is also measured in official censuses. And so for example we can see how our results for the fraction of people married at a given age compare with results from the official US Census:

I’m amazed at how close the correspondence is. Though there are clearly some differences. Like below age 20 kids on Facebook are misreporting themselves as married. And on the older end, widows are still considering themselves married for purposes of Facebook. For people in their 20s, there’s also a small systematic difference—with people on Facebook on average getting married a couple of years later than the Census would suggest. (As one might expect, if one excludes the rural US population, the difference gets significantly smaller.)

Talking of the Census, we can ask in general how our Facebook population compares to the US population. And for example, we find, not surprisingly, that our Facebook population is heavily weighted toward younger people:

OK. So we saw above how the typical number of friends a person has depends on age. What about gender? Perhaps surprisingly, if we look at all males and all females, there isn’t a perceptible difference in the distributions of number of friends. But if we instead look at males and females as a function of age, there is a definite difference:

Teenage boys tend to have more friends than teenage girls, perhaps because they are less selective in who they accept as friends. But after the early 20s, the difference between genders rapidly dwindles.

What effect does relationship status have? Here’s the male and female data as a function of age:

In the older set, relationship status doesn’t seem to make much difference. But for young people it does. With teenagers who (mis)report themselves as “married” on average having more friends than those who don’t. And with early teenage girls who say they’re “engaged” (perhaps to be able to tag a BFF) typically having more friends than those who say they’re single, or just “in a relationship”.

Another thing that’s fairly reliably reported by Facebook users is location. And it’s common to see quite a lot of variation by location. Like here are comparisons of the median number of friends for countries around the world (ones without enough data are left gray), and for states in the US:

There are some curious effects. Countries like Russia and China have low median friend counts because Facebook isn’t widely used for connections between people inside those countries. And perhaps there are lower friend counts in the western US because of lower population densities. But quite why there are higher friend counts for our Facebook population in places like Iceland, Brazil and the Philippines—or Mississippi—I don’t know. (There is of course some “noise” from people misreporting their locations. But with the size of the sample we have, I don’t think this is a big effect.)

In Facebook, people can list both a “hometown” and a “current city”. Here’s how the probability that these are in the same US state varies with age:

What we see is pretty much what one would expect. For some fraction of the population, there’s a certain rate of random moving, visible here for young ages. Around age 18, there’s a jump as people move away from their “hometowns” to go to college and so on. Later, some fraction move back, and progressively consider wherever they live to be their “hometown”.

One can ask where people move to and from. Here’s a plot showing the number of people in our Facebook population moving between different US states, and different countries:

There’s a huge range of demographic questions we could ask. But let’s come back to social networks. It’s a common observation that people tend to be friends with people who are like them. So to test this we might for example ask whether people with more friends tend to have friends who have more friends. Here’s a plot of the median number of friends that our users have, as a function of the number of friends that they themselves have:

And the result is that, yes, on average people with more friends tend to have friends with more friends. Though we also notice that people with lots of friends tend to have friends with fewer friends than themselves.

And seeing this gives me an opportunity to discuss a subtlety I alluded to earlier. The very first plot in this post shows the distribution of the number of friends that our users have. But what about the number of friends that their friends have? If we just average over all the friends of all our users, this is how what we get compares to the original distribution for our users themselves:

It seems like our users’ friends always tend to have more friends than our users themselves. But actually from the previous plot we know this isn’t true. So what’s going on? It’s a slightly subtle but general social-network phenomenon known as the “friendship paradox”. The issue is that when we sample the friends of our users, we’re inevitably sampling the space of all Facebook users in a very non-uniform way. In particular, if our users represent a uniform sample, any given friend will be sampled at a rate proportional to how many friends they have—with the result that people with more friends are sampled more often, so the average friend count goes up.

It’s perfectly possible to correct for this effect by weighting friends in inverse proportion to the number of friends they have—and that’s what we did earlier in this post. And by doing this we determine that in fact the friends of our users do not typically have more friends than our users themselves; instead their median number of friends is actually 229 instead of 342.

It’s worth mentioning that if we look at the distribution of number of friends that we deduce for the Facebook population, it’s a pretty good fit to a power law, with exponent -2.8. And this is a common form for networks of many kinds—which can be understood as the result of an effect known as “preferential attachment”, in which as the network grows, nodes that already have many connections preferentially get more connections, leading to a limiting “scale-free network” with power-law features.

But, OK. Let’s look in more detail at the social network of an individual user. I’m not sufficiently diligent on Facebook for my own network to be interesting. But my 15-year-old daughter Catherine was kind enough to let me show her network:

There’s a dot for each of Catherine’s Facebook friends, with connections between them showing who’s friends with whom. (There’s no dot for Catherine herself, because she’d just be connected to every other dot.) The network is laid out to show clusters or “communities” of friends (using the Wolfram Language function FindGraphCommunities). And it’s amazing the extent to which the network “tells a story”. With each cluster corresponding to some piece of Catherine’s life or history.

Here’s a whole collection of networks from our Data Donors:

No doubt each of these networks tells a different story. But we can still generate overall statistics. Like, for example, here is a plot of how the number of clusters of friends varies with age (there’d be less noise if we had more data):

Even at age 13, people typically seem to have about 3 clusters (perhaps school, family and neighborhood). As they get older, go to different schools, take jobs, and so on, they accumulate another cluster or so. Right now the number saturates above about age 30, probably in large part just because of the limited time Facebook has been around.

How big are typical clusters? The largest one is usually around 100 friends; the plot below shows the variation of this size with age:

And here’s how the size of the largest cluster as a fraction of the whole network varies with age:

What about more detailed properties of networks? Is there a kind of “periodic table” of network structures? Or a classification scheme like the one I made long ago for cellular automata?

The first step is to find some kind of iconic summary of each network, which we can do for example by looking at the overall connectivity of clusters, ignoring their substructure. And so, for example, for Catherine (who happened to suggest this idea), this reduces her network to the following “cluster diagram”:

Doing the same thing for the Data Donor networks shown above, here’s what we get:

In making these diagrams, we’re keeping every cluster with at least 2 friends. But to get a better overall view, we can just drop any cluster with, say, less than 10% of all friends—in which case for example Catherine’s cluster diagram becomes just:

And now for example we can count the relative numbers of different types of structures that appear in all the Data Donor networks:

And we can look at how the fractions of each of these structures vary with age:

What do we learn? The most common structures consist of either two or three major clusters, all of them connected. But there are also structures in which major clusters are completely disconnected—presumably reflecting facets of a person’s life that for reasons of geography or content are also completely disconnected.

For everyone there’ll be a different detailed story behind the structure of their cluster diagram. And one might think this would mean that there could never be a general theory of such things. At some level it’s a bit like trying to find a general theory of human history, or a general theory of the progression of biological evolution. But what’s interesting now about the Facebook world is that it gives us so much more data from which to form theories.

And we don’t just have to look at things like cluster diagrams, or even friend networks: we can dig almost arbitrarily deep. For example, we can analyze the aggregated text of posts people make on their Facebook walls, say classifying them by topics they talk about (this uses a natural-language classifier written in the Wolfram Language and trained using some large corpora):

Each of these topics is characterized by certain words that appear with high frequency:

And for each topic we can analyze how its popularity varies with (Facebook) age:

It’s almost shocking how much this tells us about the evolution of people’s typical interests. People talk less about video games as they get older, and more about politics and the weather. Men typically talk more about sports and technology than women—and, somewhat surprisingly to me, they also talk more about movies, television and music. Women talk more about pets+animals, family+friends, relationships—and, at least after they reach child-bearing years, health. The peak time for anyone to talk about school+university is (not surprisingly) around age 20. People get less interested in talking about “special occasions” (mostly birthdays) through their teens, but gradually gain interest later. And people get progressively more interested in talking about career+money in their 20s. And so on. And so on.

Some of this is rather depressingly stereotypical. And most of it isn’t terribly surprising to anyone who’s known a reasonable diversity of people of different ages. But what to me is remarkable is how we can see everything laid out in such quantitative detail in the pictures above—kind of a signature of people’s thinking as they go through life.

Of course, the pictures above are all based on aggregate data, carefully anonymized. But if we start looking at individuals, we’ll see all sorts of other interesting things. And for example personally I’m very curious to analyze my own archive of nearly 25 years of email—and then perhaps predict things about myself by comparing to what happens in the general population.

Over the decades I’ve been steadily accumulating countless anecdotal “case studies” about the trajectories of people’s lives—from which I’ve certainly noticed lots of general patterns. But what’s amazed me about what we’ve done over the past few weeks is how much systematic information it’s been possible to get all at once. Quite what it all means, and what kind of general theories we can construct from it, I don’t yet know.

But it feels like we’re starting to be able to train a serious “computational telescope” on the “social universe”. And it’s letting us discover all sorts of phenomena. That have the potential to help us understand much more about society and about ourselves. And that, by the way, provide great examples of what can be achieved with data science, and with the technology I’ve been working on developing for so long.

Categories: Cyber-Futures

See the World Differently: Filters for Color Blindness, Dog Vision, Comic Book Effects

Wolfram Alpha - Thu, 04/18/2013 - 17:39

I love dogs; they are the best. I find that they are suitable not only as companions, but as friends and confidants. That said, as much as I might anthropomorphize them, I do genuinely wish I could see the world in their eyes. Now, with Wolfram|Alpha, I can—and so can you.

That’s Agatha with her puppies. She is my friend. Agatha has a propensity to play in the garden, and one of her favorite things—seriously, it is so cute—is to wrestle a ladybug off a plant and onto her nose. What does a ladybug look like to Agatha?

It’s like a more blurry, less distinguished version of what we see. It’s a good thing that dogs have noses that are far more sensitive than humans’, huh?

I’ve always wanted to go to Ecuador with Agatha, in part because I understand the country itself is beautiful, but really it’s because I have a fascination with mountain tapirs. They are the sort of animal that isn’t really a dog, goat, or elephant, but sort of wishes it was all of them at the same time. How would Agatha see a mountain tapir compared to how I do?

Fascinating stuff, right?

Outside of dreaming of worldly adventures, I force Agatha to listen to a lot of Lady Gaga. My fondness of her is not necessarily a reflection of Wolfram|Alpha as a company, although certainly it appears to be a mainstream view that Lady Gaga has a comical edge about her—the edge of glory. So this is what she would look like if she were in a comic book:

Speaking of Lady Gaga listeners, my friend and coworker Keith suffers from red-green color blindness. I literally have no idea what that must be like. So let’s find out what it’s like, using an image of a traffic light for comparison.

Using Wolfram|Alpha, you can analyze images (including those from a URL) to see how dogs see the world, what it’s like to be red-green color blind, how something would look in a comic strip, and more. Importantly, you can even see how a dog might see the world of mathematics:

Categories: Cyber-Futures

Climate change: planning for disasters

European Union - Thu, 04/18/2013 - 10:00

Strategy would coordinate EU countries’ responses to the impact of global warming on local communities.

Categories: Nations

Introducing the Wolfram Plants Reference App

Wolfram Alpha - Tue, 04/16/2013 - 18:05

My mother always loved gardening, and when I was growing up I enjoyed taking long strolls with her while she told me what all the different flowers were. She knew a lot about plants, but I remember sometimes asking her a question—like what was a plant’s taxonomic structure, or its optimal height compared to its average height—and she didn’t know what to say. Well, that’s why we’ve come up with the Wolfram Plants Reference App, available on iOS and PC. This app is for you, mom!

Like any Wolfram app, the Wolfram Plants Reference App offers a huge amount of functionality so that you can research or analyze thousands of plants. There’s quite a large number of subject areas, so let’s explore some of them, starting with Physical Information. This allows us to either explore a single plant or compare multiple plants at the same time—we can either select from a list of over 150 common plants or type in the name of any plant we wish to look at.

Many of the app’s subject areas include additional parameters that you can choose from. For example, let’s select Growth.

On this screen, we have four choices—Basic Growth Information, Growth Requirements, Growth Location, and Mature Height Comparison. Let’s select Growth Location, itself a source of further options, and then go with Distribution.

The Wolfram Plants Reference App is useful for more than just basic comparisons, however. There’s a bevy of scientific information as well. You can, for example, juxtapose the morphology and physiology of different plants:

Or you can compute the taxonomic network for either single or multiple plants:

Whether you’re a professional horticulturalist, a scientist, a student, or a gardener (like my mom), the Wolfram Plants Reference App—available on iOS—is the ideal source for acquiring and computing knowledge about plants.

Categories: Cyber-Futures

Drive One down the Fairway with Wolfram|Alpha’s Golf Data

Wolfram Alpha - Thu, 04/11/2013 - 19:10

The 77th Masters Tournament begins today at Augusta National Golf Club. Many commentators think Tiger Woods is poised to score his fifth win (his last was in 2005), but strong challengers abound.

How does Tiger’s performance so far this year stack up against this year’s performance by Bubba Watson, the 2012 Masters winner, and Louis Oosthuizen, the 2012 runner-up? Louis has the edge in driving accuracy while Bubba has a slight lead hitting greens in regulation. But when it comes to prize money, so far there’s no contest:

But of course, winning a $1-million-plus purse at the Masters could close that gap for Bubba or Louis (or send Tiger even further into the lead).

There’s a lot more to explore in Wolfram|Alpha’s golf data—and you can easily chart any player’s performance over past seasons, find leaders for any stat of interest, or check final tournament leader boards.

Grab yourself an Arnold Palmer this weekend as you enjoy golf’s first major. And, while Wolfram|Alpha can’t help you with your golf game, we can certainly tell you the facts.

Categories: Cyber-Futures

Bravo to EU's best young translators 2012!

European Union - Thu, 04/11/2013 - 10:00

The 27 winners of the EU's annual translation contest receive their awards today in Brussels.

Categories: Nations

Introducing Wolfram Course Assistant Apps on Android Devices

Wolfram Alpha - Wed, 04/10/2013 - 16:27

Now available on Android devices via the Google Play store, the Wolfram Algebra Course Assistant and Wolfram Calculus Course Assistant are part of the equation for academic success.

In addition to harnessing the computational power of Wolfram|Alpha, the Wolfram Algebra and Wolfram Calculus Course Assistant Apps offer a slick and intuitive user interface. For students taking these courses for the first time, or those who need some assistance on specific algebra and calculus problems, these apps are powerful computational tools. For example, you can use our custom keyboard to input complex equations and get step-by-step solutions to tough algebra problems:

Or solve indefinite integrals complete with plots and alternate forms:

Android devices are better than ever now that users can make use of Wolfram|Alpha-powered apps. Stay tuned—the Wolfram Algebra and Wolfram Calculus Course Assistant Apps are the first of many more to come.

Categories: Cyber-Futures

Help for green shoppers

European Union - Wed, 04/10/2013 - 10:00

EU-wide standards for environmental claims would increase trust in the growing market for green products and allow shoppers to make informed choices.

Categories: Nations

Analyzing Tornadoes and Volcanoes—Get the Facts with Wolfram|Alpha

Wolfram Alpha - Thu, 04/04/2013 - 18:56

It’s tornado season in some parts of the United States, and while longtime users of Wolfram|Alpha are probably aware of our ability to analyze earthquake data, we weren’t able to say much about tornadoes. Now, utilizing data from from NOAA’s Storm Prediction Center, Wolfram|Alpha can answer questions about tornado activity in the US from 1950 to 2011 (with data for 2012 coming soon). For good measure, we’ve also added data on worldwide volcanic eruptions to our knowledge base.

Missouri receives a fair amount of tornado activity—St. Louis and its surroundings seem to experience an F1 tornado every year, and an F4 every few decades:

You can also query about tornadoes of a certain magnitude, within any particular region. For example:

With this upgraded functionality, you can ask about tornado activity over a specific range of dates. How many F5 tornadoes have occurred after 1950?

With additional data from NOAA’s database of significant volcanic events, you can also ask Wolfram|Alpha about volcanic activity in any “hot spot” in the world. For example, ask about a latitude, longitude, and a given radius:

Give a named location and a time frame:

Or make use of superlatives:

Whether your interest in volcanoes and tornadoes is mere curiosity or a sincere academic devotion, you can analyze them in detail with Wolfram|Alpha.

Categories: Cyber-Futures
Syndicate content