Monday, April 30, 2012

Monthly Roundup

End of the month roundup of research in-progress. Links not to lose, etc.

FOLLOWING THESE COURSES ONLINE
  • Calculus Revisted, (Single and) Multivariable Calculus, Herbert Gross, MIT, 1971
    Fantastic lectures.  Logic cannot come and rescue us.  "Without assumption there can be no proof."  The assumptions are ours; an agreement to certain definitions and rules.  "A fact is just an assumption which has yet to be disproved."
    And for these exact reasons, passionate about mathematics.  We can choose to seek assumptions which are truthful about the physical world, which carries on with or without us.
    At last.
    {Video 8; part II, lecture 2 -- Vector Calculus}
  • Introduction to Algebraic Topology,  NJ Wildberger, University of New South Wales, 2010
       {Second Video}
  • Digital Signal Processing, Alan Oppenheim, MIT. 1970's.
        Nice shirt.      {Lecture 2}
  • The Fourier Transform and its Applications  Brad Osgood, Stanford, 2008
       {Lecture 2}
       Course materials
  • Recitation (Overview of Key Ideas), MIT.  Nice format.  Drop in on it from time to time.
  • Cryptography, David Kohel, University of Washington, 2008
    Textbook using SAGE for examples.
NEW SOFTWARE
    tutorials/publications http://www.sagenb.org/


READING
Graphics Programming Black Book, Michael Abrash, 2001
    Free .pdf downloads at www.gamedev.net
    Focus on Quake3D code

Fourier Series and Boundary Value Problems, Churchill, 1941
    Finally a readable book on Fourier series that neither dodges the math nor renders it inaccessible.  Tiny volume from c.1945, picked it up again, and it is readable at last.  Sure enough, Lebesgue integration is not necessary, just an understanding of the basic dilemma of instantaneous measure and infinite sums.  Convergence.   The diffEQ is thorny, but suprisingly well presented so far.

Knotted Doughnuts and Other Mathematical Entertainments, Martin Gardner
    Interesting problems.  Useless as a reference; Gardner doesn't solve very many of them.
    ToDo: collect solutions (and solutions in progress) in one place, and be done with it.
    Hamiltonian cycles on an n-cube problem:  e.g. http://arxiv.org/pdf/1003.4391.pdf .  This is pretty funny.  Gardner fares no better.  He counts every state of the system.  In the paper, they make up this rule for the final number: "so, the integer Hn/n! with n=3, 4, 5, 6 has exactly n-3 odd prime divisors"  {?!}  Um... guys..... the factor is prime because it's a sum.  They ran a computer for six months.  A pencil and paper are sufficient to show the prime factor in the case N=4 (which is 7) is the result of summation.  And that this addition renders the factoring pattern of the problem undetectable.

100 Great Problems of Elementary Mathematics:  Only did a few this month, but in depth.  Learning far more about problem solving from Dorrie than reading online papers (Abrash is different.  Not crazy).  Starting to realize how full of holes and excuses modern Complexity Theory is. E.g. Cormen on Strassen's Matrix-Multiply:  we don't know how "hard" matrix multiplication is.
We know exactly how 'hard' it is, because we define how we are going to multiply.  The time function is completely determined.  If I unroll multiplication into addition, then I have a fractional logarithm in my running time.  Part of an exponent comes down to multiplication:  It is not a constant.  Failing to count both parts of the fractional logarithm makes a pretty little mystery out of the time function.  That's how you know you're wrong.

AUDIO ENVIRONMENT
   Trying to linearize Audio system is exhausting and going nowhere.
ToDo: 
  1. Make drawings, sketches, sheets of paper with words all over.  The structure is not linear; it's an integrated environment.  Lay out the big picture.  Fill in the details from place to place; connections among the various components.  If it takes 100 drawings, it takes 100 drawings.  
  2. Stop worrying about people frowning and saying it isn't possible.  Stop wasting time trying to reach that person.
  3. Post audio files.  Show that it works.  People need to hear it.  
  4. Make clutch decision: programming, or Signal Systems?  Both are vast.  I prefer the math, because of the immense time investment if I don't already know it, but it might be time to start building.
  5. Contact some people.  Just do it.  If they don't care, they don't.

REFERENCE

Electric Circuit diagrams!

Sunday, April 22, 2012

Cauchy's Mean Theorem

The geometric mean of n positive numbers is less than the arithmetic mean.
(Except when all n numbers are the same, in which case the two means are equal)

 ■ The Arithmetic Mean  —  Add n numbers together, and divide by n:
          
■ The Geometric mean —   Multiply n numbers, and take the nth root:
          

In symbols, Cauchy's mean theorem states

The equal condition can be omitted as long as a, b, c, ... n are not all identical.

This is problem #10 in 100 Great Problems of Elementary Mathematics. Dörrie holds the sum constant and examines the product, so for practice I'll go in the reverse direction.  Suppose we have two positive numbers x and y, with x > y.   If the product xy is kept constant, what happens to the two means as x and y are brought closer together?
Introduce a new number a which satisfies

The two new numbers,  (x/a) and (ay) are sandwiched between x and y.  Their product is constant and the same as xy:
                 
What values of a satisfy (2)?  Evaluating each inequality sign separately gives the range of a:


According to Cauchy's theorem, two properties should be satisfied by a.   First, I should always have
(4.1)             ½(x/a+ay) > √xy,
except when x/a = ay.  Second when a =  x/y, then  x/a = ay, and the geometric and arithmetic mean of this number will be the same.

Aha!  I arrive at the same place Dörrie found himself: it is easier to prove a somewhat stronger result.   Instead of untangling (4.1), suppose I say,

If the left side is true, then the right is true.  But the right side says,
  • Auxiliary Theorem:  Given two pairs of numbers with the same product, the pair that is closer together will always have the smaller sum.
Is (4) true?  Simplifying the left hand side of (4):
          
Yes.  Skipping to the second property, let the distance x/a − ay go to zero.  This is the maximum value of a.  Are both the geometric and arithmetic mean of this number the same?  Let a =  x/y.  Then

Yes.
Using the same procedure, the result can be extended to n numbers.  Given a product P = xyz . . . n,  suppose not all the numbers are equal.  Choose any two numbers u ≠ v.  For convenience, I choose the largest and smallest values.   Reduce the difference (u-v) to zero as above,  replacing both u and v with w = √ uv. The product of n numbers is the same; their sum reduced, as above.

Repeat until all the numbers are identical, always choosing the greatest and least numbers.  Each step reduces the sum (and therefore the Arithmetic mean) and eliminates one difference among  the n values.  The product P is constant.  When all the numbers are identical, there is no longer a greatest and least element.  The arithmetic mean of this sequence is
nα/n = α   and the geometric mean is
α n/n = α
     Thus, for any sequence of numbers xyz . . . n of constant product P the minimum value of the arithmetic mean is achieved when the numbers are identical.  This number is the geometric mean of the original numbers.1
    Since   only when M is minimum, and  held constant, the result follows:

which is Cauchy's mean Theorem.  Now, suppose we replace a, b, c . . . however we wish, as long as their sum remains the same.  The right hand remains constant, and the left varies.  The two will be equal only when a, b, c . . . n are the same number.  Then
  • Auxiliary Theorem 2: For n numbers of constant sum, the geometric mean reaches its maximum value when all n numbers are the same. 
 Which, with a bit of noodling to be safe, is the converse of the first Auxiliary Theorem above.  Sneaky, no?  I have now met Dörrie on the other side.

EXPONENTIAL INEQUALITY
Consider a sequence of m numbers, n of which have the positive value a, and the rest equal to one:
          a, a,  . . . , a, 1, 1, . . . , 1           a > 0,  a ≠ 1
There are n a's and (m − n) 1's.  The two means are:
          
Since a ≠ 1, the numbers are not all equal, and therefore
          
Substituting λ for n/m gives


For λ > 1, flip the inequality.

...whence, upon having been put into the box and acquiring thereby the passive tense to which the greater part of his misery was owing and, that part outweighing the joyful to such a degree that of the expression relating the two it was conjectured the mathematics were differential with his share of joy -alas!- the quantity to be driven to zero, he began at that precise moment to conjecture it would be his ultimate undoing (for so it was conjectured about him and therefore & c.), and so entraining the drowsy progressive he then began to conjecture that it would not be his ultimate undoing, whereupon the fueling and fanning, oiling and wiping bringing to bear an ever increasing velocity to the transit of time, each passing second closing yet further betwixt gerund  and he the gap, at last the imperfect arrived,
he undid it and freed himself.

It was still two weeks before he would be let out of the box.
_______________________________________________________
1There are other, more efficient ways to arrive at the same result.  For example the sequence can be treated as (at most) n/2 different, nested intervals like this:
          
and on the next pass there remain (at most) n/4 distinct intervals... and so on.  Regardless of the procedure, we close in on the same number.  Is there a good way to estimate square roots hiding in here?

Wednesday, April 18, 2012

Spatialization 01: Time - Part I v2

QUESTION 1
  •  Let S be an object at distances d1, d2  from microphones L and R, at angle Θ with respect to a reference line, at azimuthal angle Φ, and facing θ', φ' (local orientation).  
    Let L', R' be a pair of stereo speakers, and O' the listener.
    Let  f(t) = ( x(t),  y(t),  z(t) )    be an arbitrary, vector-valued space curve.

    How can the recording be manipulated so that, when broadcast from L' and R', the apparent location and orientation of S relative to the listener follow the directed path f(t)? 
____________________________
In signal processing, to align elements in space, we must manipulate time.   So I need to solve the relationships with respect to time.  We have:

                               Recording:   E           Playback:
                        Microphones   L, R         d         Speakers    L', R'
                        Listener          O' (implied)     i        Listener      O
                        Source            S    t        Source       S'   (implied)  

I changed the table to reflect the proper relationship between Source and Listener:  The relationship is essential:
 At any one time either the Listener or the Source is virtual.
     -When recording, the Source is real, the Listener is virtual.
     -At playback, the Source is virtual, the Listener real.


Solution, Part I
The general solution in three dimensions can be given directly, in Vector Calculus.
Fig. 1 - Arbitrary Path in Space


Let f(t) be a directed path in 3-dimensional space:

For each value of t there is a corresponding position vector S (shown in blue),


The tangent vector at any point (shown for S in turquoise) follows the usual definition of the derivative, evaluated componentwise:


The normalized (unit) tangent vector:


Where


The source may move at arbitrary speeds along its path; it may change direction.  I would also like to know distance traveled along the path, and relate it to time.  The arc length of the curve is given by:

 In Fig. 1, the integral would be over the interval ≤ t ≤ d.  
Lowercase s is the usual letter to denote arc length.  This is not the position vector S, which gives the x, y, z coordinates of the Source at any point along the curve.  The difference should be clear from context.  I will always write the position vector in bold.

Differentiating (6) gives the differential of arc length, called the arc 'element', ds:


By (5),  ds = |f'(t)| is always positive, so the integral s is nondecreasing.  This makes sense; as the total distance traveled, s increases whenever the object moves, even if the curve doubles back on itself.  (A good Odometer is an arc length function: It's 250 miles from Seattle to Ashland, even if I drive in reverse.)   As a continuous, nondecreasing function,  s has a unique inverse.  That is, we can give time t as function of distance s.

I find this tricky, so I break it down into five steps:
   ■ Differentiate f(t):  find f'(t),  tct ≤ td
   ■ Calculate |f'(t)|  
   ■ Integrate the arc length using (6)
   ■ This will give s as a function of t.   Now solve for t.  The result will be a function t(s).
   ■ Substitute this value of t back into f(t), turning it into a function of s.  Don't forget the bounds:


Note that g(s) gives the position of the Source as a function of distance traveled (arc length).  Time is no longer part of the equation.  Also note that the form is coordinate-system agnostic.

Because the unit measure of  g(s) is distance, its derivative is the unit tangent vector T in (4):


From here a navigation system for arbitrary changes of orientation in space can be defined.  However, the next step for this problem is to assemble the information presented, and clean up the mess left from section I. The equal-time-curves are important, and need to be presented clearly.

For now, I will leave off by giving the relationship between S, R and L:
L + A = S
R + B = S

Whew! That's better.  It's like a little advertisement for vectors.
Pointy hat-people! O hats. The sums of your motion in space;  bliss.

Tuesday, April 10, 2012

Spatialization 01: Time - Part I

  {Under Construction}                                                                         To Version II→
QUESTION 1
  •  Let S be an object at distances d1, d2  from microphones L and R, at angle Θ with respect to a reference line, at azimuthal angle Φ, and facing θ', φ' (local orientation).  
    Let L', R' be a pair of stereo speakers, and O' the listener.
    Let r(t) = (x(t),  y(t),  z(t))  be an arbitrary, vector-valued space curve.

    How can the recording be manipulated so that, when broadcast from L' and R', the apparent location and orientation of S relative to the listener follow the directed path r(t)? 
____________________________
 This is a question about time.
A wave disturbance, or signal, propagates outward from the source at a constant speed in a medium.  All other properties of waves and signals depend upon this relationship:  distance from the source and time are in direct proportion.

If we have not accounted for the source in our image (recording) as a function of time (distance) and direction, we are unable to reliably place it in relation to other objects in space or transform its location.

The first task, then, is to establish continuity of time:

Question 1.1:
  • Given a source S, microphones L, R and observer O;Given speakers L', R', and listener O', and implied source S
    What are the relationships among the above eight quantities with respect to time?
There are sources, microphones, speakers, and observers.  No reference is made to mixing.  We have:

                                     Recording:         Playback:
                              Microphones  L, R           Speakers    L', R'
                              Observer       O     Listener      O'
                              Source           S     Source       S'   (implied)  

{NOTE: I am dedicated to making this material accessible.
However, solving the Geometry and trig rapidly became too cumbersome.
I have moved the entire problem to Vector Calculus.
The updated version is here.}

I begin with a simple arrangement (particular case).   Place two omnidirectional microphones six feet apart.  Place the observer so that O, L, R  form an equilateral triangle.  For convenience, call this distance (6ft) the unit length:


For playback, place the listener O' at O, and the speakers L', R' at the same positions as the microphones:

Being the usual definition of a well-placed pair of stereo speakers, and listener.

Let S be a distance a from L, and lie on the straight line through O and L.  Assume S can be treated as a point source for small differences of angle. {In real life there is no such thing as a point source.}
Fig. 1 - Spaced Stereo Pair

Additional fixed values:

Now we may,

I. Given Any Value of a, Determine the Remaining Relationships
By the Pythagorean Theorem,


The Angles:

By the Laws of Sines and Cosines for ΔSLR,


I do not yet know what values I will need later.  Mousing over the image shows a number of supplementary points whose measures may, or may not, prove useful.  They are:


The first diagram made it easier to derive values.  I suspect the following measures to be more useful:
Fig. 2 Angles out of the speaker axis.

Specifically,
a)  k is the point where the signal will arrive at R at a right angle to the speaker orientation.
b)  φ gives the angle out alignment to this perpendicular. In the diagram, the corresponding angle for L is temporarily fixed at π/2.

Why so many points and triangles?  I'm feeling out the problem.  Ultimately, I want to use those measures which are most easily computed, and give the orientation of the object with respect to the microphones, speakers, and listener.  There are a number of references that might be useful. For example, the area of the small triangle Δpnq, and orientation, are easy to calculate.  Who couldn't use a compact triangle in a known position relative to the player, from which timing and phase of audio samples could be projected?


II.  Moving Object Perceived From Two Distinct, Fixed Points
NOTICE:
 Newton's Calculus Will Be Taken For Granted.
Generally, I seek a 3-Dimensional system for assisting spatial imaging; I intend to induce perturbations in the stereo field at playback, using a similar technique to the normal map.  In this case, the precomputed map will represent the field surrounding the listener.  Playhead position, changing in time, can be calculated from such a map, using only the position vectors of objects in the game world, as they are updated.

That is, assuming such a map is possible.  
Let us say that it is.  How might we go about its definition and construction?

Consider the diagram below.
A sound source recorded at L is rebroadcast at L'.
What is the relationship between the signal broadcast from the speaker (L') and the one which crossed the microphone (L), emanating from S?
Fig 3 - Equal-time curves

The lines connecting the intersections of circles around L and S are part of a directional field: the function is a family of quadratic equations.

If k is the speed of sound in an elastic medium (like air!), then kt is the distance the sound has traveled from the source after t seconds.  The radius of any circle around L or S can be written as kt, for some value of t.    I need slightly more than this.  I want to triangulate: to compare the timing of signals among three (or more) points.  For example,  among  L, S and  tin Fig 3.  

If tm is an object traveling along the line through tn, it moves an equal distance away (toward) both L and S in the same time.  
       
Any other path will change the timing among the three.   To describe a point such as tm, we need an equation which does not assume we are at an equal distance (time) from both L and S.   Let
       
I treat S as the origin.   At t=0, the radii of the circles are  r1 = kt, r2 = kt2, a constant offset for each radius which may be set separately, and thus define a value for t which satisfies both. ( For past and future times and rectification I am not yet sure if additional constants are necessary.)
I don't want to solve this system.  The rotation turns the algebra into spaghetti.  So I'll solve a different one, and rotate it.

First, move the origin to the midpoint between the foci S and L.  
       
{diagram}
Next, rotate LS to coincide with the x-axis.  No need for elegance:
       
If the global positions of L and S are not in memory, (if S' is the new S:
    (*)=  foo;
for example) then I will need a proper transform.  
I now have this:

{diagram}

L'' and S'' lie on the x-axis, a distance a on opposite sides of the origin.  Now the equations are
       
The symmetry makes the hyperbolas significantly easier to parameterize.  I may need different representations, so I have solved for several.  A Very Large Amount of ordinary Algebra produces the following equalities:

Discrete, rectangular vector components:
     

Quadratic family (x and y, no t).
     
Radii:
{To Do}
In the quadratic, comparison of k2δ2 and 4a2 gives the type of curve:
       
If I use the quadratic form, β cannot be divided without defining y(1/β) = 0  for (kd)2 =  4a2.  For arbitrary rotation of the system, the the third case is the straight line connecting points S and L.

Now, to return to Fig.1 and 2, and release the constraints on angle...

                                                                                      To Version II→