## Exponential Zero

25 June, 2016

guest post by David A. Tanzer

Here is a mathematical riddle.  Consider the function below, which is undefined for negative values, sends zero to one, and sends positive values to zero.   Can you come up with a nice compact formula for this function, which uses only the basic arithmetic operations, such as addition, division and powers?  You can’t use any special functions, including things like sign and step functions, which are by definition discontinuous.

In college, I ran around showing people the graph, asking them to guess the formula.  I even tried it out on some professors there, U. Penn.  My algebra prof, who was kind of intimidating, looked at it, got puzzled, and then got irritated. When I showed him the answer, he barked out: Is this exam over??!  Then I tried it out during office hours on E. Calabi, who was teaching undergraduate differential geometry.  With a twinkle in his eye, he said, why that’s zero to the x!

The graph of 0x is not without controversy.   It is reasonable that for positive x, we have that 0x is zero.  Then 0-x = 1/0x = 1/0, so the function is undefined for negative values.  But what about 00?  This question is bound to come up in the course of one’s general mathematical education, and has been the source of long, ruminative arguments.

There are three contenders for 00:  undefined, 0, and 1.  Let’s try to define it in a way that is most consistent with the general laws of exponents — in particular, that for all a, x and y, ax+y = ax ay, and a-x = 1/ax. Let’s stick to these rules, even when a, x and y are all zero.

Then 00 equals its own square, because 00 = 00 + 0 = 00 00. And it equals its reciprocal, because 00 = 0-0 = 1/00. By these criteria, 00 equals 1.

That is the justification for the above graph — and for the striking discontinuity that it contains.

Here is an intuition for the discontinuity. Consider the family of exponential curves bx, with b as the parameter.  When b = 1, you get the constant function 1.  When b is more than 1, you get an increasing exponential, and when it is between 0 and 1, you get a decreasing exponential.  The intersection of all of these graphs is the “pivot” point x = 0, y = 1.  That is the “dot” of discontinuity.

What happens to bx, as b decreases to zero?  To the right of the origin, the curve progressively flattens down to zero.  To the left it rises up towards infinity more and more steeply.  But it always crosses through the point x = 0, y = 1, which remains in the limiting curve.  In heuristic terms, the value y = 1 is the discontinuous transit from infinitesimal values to infinite values.

There are reasons, however, why 00 could be treated as indeterminate, and left undefined.  These were indicated by the good professor.

Dr. Calabi had a truly inspiring teaching style, back in the day. He spoke of Italian paintings, and showed a kind of geometric laser vision.  In the classroom, he showed us the idea of torsion using his arms to fly around the room like an airplane.  There’s even a manifold named after him, the Calabi-Yau manifold.

He went on to talk about the underpinnings of this quirky function.  First he drew attention to the function f(x,y) = xy, over the complex domain, and attempted to sketch its level sets.  He focused on the behavior of the function when x and y are close to zero.   Then he stated that every one of the level sets $L(z) = \{(x,y)|x^y = z\}$ comes arbitrarily close to (0,0).

This means that xy has a wild singularity at the origin: every complex number z is the limit of xy along some path to zero.  Indeed, to reach z, just take a path in L(z) that approaches (0,0).

To see why the level sets all approach the origin, take logs, to get ln(xy) = y ln(x) = ln(z).  That gives y = ln(z) / ln(x), which is a parametric formula for L(z).  As x goes to zero, ln(x) goes to negative infinity, so y goes to zero.  These are paths (x, ln(z)/ln(x)), completely within L(z), which approach the origin.

In making these statements, we need to keep in mind that xy is multi-valued.  That’s because xy = e y ln(x), and ln(x) is multi-valued. That is because ln(x) is the inverse of the complex exponential, which is many-to-one: adding any integer multiple of $2 \pi i$ to z leaves ez unchanged.  And that follows from the definition of the exponential, which sends a + bi to the complex number with magnitude a and phase b.

Footnote:  to visualize these operations, represent the complex numbers by the real plane.  Addition is given by vector addition.  Multiplication gives the vector with magnitude equal to the product of the magnitudes, and phase equal to the sum of the phases.   The positive real numbers have phase zero, and the positive imaginary numbers are at 90 degrees vertical, with phase $\pi / 2$.

For a specific (x,y), how many values does xy have?  Well, ln(x) has a countable number of values, all differing by integer multiples of $2 \pi i$.  This generally induces a countable number of values for xy.  But if y is rational, they  collapse down to a finite set.  When y = 1/n, for example, the values of y ln(x) are spaced apart by $2 \pi i / n$, and when these get pumped back through the exponential function, we find only n distinct values for x 1/n — they are the nth roots of x.

So, to speak of the limit of xy along a path, and of the partition of $\mathbb{C}^2$ into level sets, we need to work within a branch of xy.   Each branch induces a different partition of $\mathbb{C}^2$.  But for every one of these partitions, it holds true that all of the level sets approach the origin.  That follows from the formula for the level set L(z), which is y = ln(z) / ln(x).  As x goes to zero, every branch of ln(x) goes to negative infinity.  (Exercise:  why?)  So y also goes to zero.  The branch affects the shape of the paths to the origin, but not their existence.

Here is a qualitative description of how the level sets fit together:  they are like spokes around the origin, where each spoke is a curve in one complex dimension.  These curves are 1-D complex manifolds, which are equivalent to  two-dimensional surfaces in $\mathbb{R}^4$.  The partition comprises a two-parameter family of these surfaces, indexed by the complex value of xy.

What can be said about the geometry and topology of this “wheel of manifolds”?  We know they don’t intersect.  But are they “nicely” layered, or twisted and entangled?  As we zoom in on the origin, does the picture look smooth, or does it have a chaotic appearance, with infinite fine detail?  Suggestive of chaos is the fact that the gradient

$\nabla x^y = (y x^{y-1}, \ln(y) x^y) = (y/x, \ln(y)) x^y$

is also “wildly singular” at the origin.

These questions can be explored with plotting software.  Here, the artist would have the challenge of having only two dimensions to work with, when the “wheel” is really a structure in four-dimensional space.  So some interesting cross-sections would have to be chosen.

Exercises:

• Speak about the function bx, where b is negative, and x is real.
• What is $0^\pi$, and why?
• What is $0^i$?

Moral: something that seems odd, or like a joke that might annoy your algebra prof, could be more significant than you think.  So tell these riddles to your professors, while they are still around.

## The Stochastic Resonance Program (Part 2)

28 August, 2014

guest post by David Tanzer

Last time we introduced the concept of stochastic resonance. Briefly, it’s a way that noise can amplify a signal, by giving an extra nudge that helps a system receiving that signal make the jump from one state to another. Today we’ll describe a program that demonstrates this concept. But first, check it out:

No installation required! It runs as a web page which allows you to set the parameters of the model and observe the resulting output signal. It has a responsive behavior, because it runs right in your browser, as javascript.

There are sliders for controlling the amounts of sine wave and noise involved in the mix. As explained in the previous article, when we set the wave to a level not quite sufficient to cause the system to oscillate between states, and we add in the right amount of noise, stochastic resonance should kick in:

The program implements a mathematical model that runs in discrete time. It has two stable states, and is driven by a combination of a sine forcing function and a noise source.

The code builds on top of a library called JSXGraph, which supports function plotting, interactive graphics, and data visualization.

### Running the program

If you haven’t already, go try the program. On one plot it shows a sine wave, called the forcing signal, and a chaotic time-series, called the output signal.

There are four sliders, which we’ll call Amplitude, Frequency, Noise and Sample-Path.

• The Amplitude and Frequency sliders control the sine wave. Try them out.

• The output signal depends, in a complex way, on the sine wave. Vary Amplitude and Frequency to see how they affect the output signal.

• The amount of randomization involved in the process is controlled by the Noise slider. Verify this.

• Change the Sample-Path slider to alter the sequence of random numbers that are fed to the process. This will cause a different instance of the process to be displayed.

Now try to get stochastic resonance to kick in…

### Going to the source

Time to look at the blueprints. It’s easy.

• Open the model web page. The code is now running in your browser.

• While there, run your browser’s view-source function. For Firefox on the Mac, click Apple-U. For Firefox on the PC, click Ctrl-U.

• You should see the html file for the web page itself.

• See the “script” directives at the head of this file. Each one refers to javascript program on the internet. When the browser sees it, the program is fetched and loaded into the browser’s internal javascript interpreter. Here are the directives:

http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default

http://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.93/jsxgraphcore.js

http://./StochasticResonanceEuler.js

http://./normals.js


The first one loads MathJax, which is a formula-rendering engine. Next comes JSXGraph, a library that provides support for plotting and interactive graphics. Next, StochchasticResonanceEuler.js is the main code for the model, and finally, normals.js provides random numbers.

• In the source window, click on the link for StochasticResonanceEuler.js — and you’ve reached the source!

### Anatomy of the program

The program implements a stochastic difference equation, which defines the changes in the output signal as a function of its current value and a random noise value.

It consists of the following components:

1. Interactive controls to set parameters
2. Plot of the forcing signal

3. Plot of the output signal

4. A function that defines a particular SDE

5. A simulation loop, which renders the output signal.

The program contains seven functions. The top-level function is initCharts. It dispatches to initControls, which builds the sliders, and initSrBoard, which builds the curve objects for the forcing function and the output signal (called “position curve” in the program). Each curve object is assigned a function that computes the (x,t) values for the time series, which gets called whenever the input parameters change. The function that is assigned to the forcing curve computes the sine wave, and reads the amplitude and frequency values from the sliders.

The calculation method for the output signal is set to the function mkSrPlot, which performs the simulation. It begins by defining a function for the deterministic part of the derivative:

deriv = Deriv(t,x) = SineCurve(t) + BiStable(x),

Then it constructs a “stepper” function, through the call Euler(deriv, tStep). A stepper function maps the current point (t,x) and a noise sample to the next point (t’,x’). The Euler stepper maps

((t,x), noiseSample)

to

(t + tStep, x + tStep * Deriv(t,x) + noiseSample).

The simulation loop is then performed by the function sdeLoop, which is given:

• The stepper function

• The noise amplitude (“dither”)

• The initial point (t0,x0)

• A randomization offset

• The number of points to generate

The current point is initialized to (t0,x0), and then the stepper is repeatedly applied to the current point and the current noise sample. The output returned is the sequence of (t,x) values.

The noise samples are normally distributed random numbers stored in an array. They get scaled by the noise amplitude when they are used. The array contains more values than are needed. By changing the starting point in the array, different instances of the process are obtained.

### Making your own version of the program

Now let’s tweak the program to do new things.

First let’s make a local copy of the program on your local machine, and get it to run there. Make a directory, say /Users/macbookpro/stochres. Open the html file in the view source window. Paste it into the file /Users/macbookpro/stochres/stochres.html. Next, in the view source window, click on the link to StochasticResonanceEuler.js. Paste the text into /Users/macbookpro/stochres/StochasticResonanceEuler.js.

Now point your browser to the file, with the URL file:///Users/macbookpro/stochres/stochres.html. To prove that you’re really executing the local copy, make a minor edit to the html text, and check that it shows up when you reload the page. Then make a minor edit to StochasticResonanceEuler.js, say by changing the label text on the slider from “forcing function” to “forcing signal.”

### Programming exercises

Now let’s get warmed up with some bite-sized programming exercises.

1. Change the color of the sine wave.
• Change the exponent in the bistable polynomial to values other than 2, to see how this affects the output.

• Add an integer-valued slider to control this exponent.

• Modify the program to perform two runs of the process, and show the output signals in different colors.

• Modify it to perform ten runs, and change the output signal to display the point-wise average of these ten runs.

• Add an input slider to control the number of runs.

• Add another plot, which shows the standard deviation of the output signals, at each point in time.

• Replace the precomputed array of normally distributed random numbers with a run-time computation that uses a random number generator. Use the Sample-Path slider to seed the random number generator.

• When the sliders are moved, explain the flow of events that causes the recalculation to take place.

• ### A small research project

What is the impact of the frequency of the forcing signal on its transmission through stochastic resonance?

• Make a hypothesis about the relationship.

• Check your hypothesis by varying the Frequency slider.

• Write a function to measure the strength of the output signal at the forcing frequency. Let sinwave be a discretely sampled sine wave at the forcing frequency, and coswave be a discretely sampled cosine wave. Let sindot = the dot product of sinwave and the output signal, and similarly for cosdot. Then the power measure is sindot2 + cosdot2.

• Modify the program to perform N trials at each frequency over some specified range of frequency, and measure the average power over all the N trials. Plot the power as a function of frequency.

• The above plot required you to fix a wave amplitude and noise level. Choose five different noise levels, and plot the five curves in one figure. Choose your noise levels in order to explore the range of qualitative behaviors.

• Produce several versions of this five-curve plot, one for each sine amplitude. Again, choose your amplitudes in order to explore the range of qualitative behaviors.