Re: Getting a grip on nested intervals and matrix encoding

From: Vadim Tropashko <vadimtro_at_gmail.com>
Date: Tue, 6 Jul 2010 10:28:34 -0700 (PDT)
Message-ID: <97e0f79b-8e2f-414b-a48e-54e32050129d_at_q21g2000prm.googlegroups.com>



On Jul 5, 1:38pm, creecode <creec..._at_gmail.com> wrote:
> On Jul 5, 12:25pm, Vadim Tropashko <vadim..._at_gmail.com> wrote:
>
> > > SELECT 2 AS a11, 2 - MOD ( 3, 2 ) AS a12, 1 AS a21, 1 - MOD ( 2, 1 )
> > > AS a22;
>
> > > a11 a12 a21 a22
> > > 2 1 1 1
> > select MOD(2,1) from dual;
> > MOD(2,1)
> > ----------------------
> > 0
>
> Hello Vadim,
>
> In MySql...
>
> SELECT MOD ( 2, 1 );
>
> MOD ( 2, 1 )
> ----------------
> 0
>
> So MOD works OK.
>
> My question was about the calculation of the last node in the ancestor
> chain...
>
> SELECT 2 AS a11, 2 - MOD ( 3, 2 ) AS a12, 1 AS a21, 1 - MOD ( 2, 1 )
> AS a22;
>
> a11 a12 a21 a22
> --------------------------------
> 2 1 1 1
>
> SELECT 1 - MOD ( 2, 1 );
>
> 1 - MOD ( 2, 1 )
> ---------------------
> 1
>
> Since I want zero and not one for a22 of the root node I am assuming I
> need to special case the root node in my loop.
> I'm not clear whether the formula in your book was intended to
> calculate the root node matrix or not.
>
> I'm just looking for validation that my assumption is correct and that
> I haven't screwed up somewhere.
>
> Thank you,
>
> Toodle-loooooooooooooo.................
> creecode

Oops. Actually, your question is buried in the discussion on the Errata page:

#
David Brusowankin Says:

November 8, 2007 at 4:46 am e

On page 179: finding the parent of

[7 -2]
[ ]
[4 -1]

1 mod (4, 1) = 1 0 = 1

Not 0 so the root matrix is not obtained.

Is the root a special case somehow ?

Thanks,

David
Reply
#
Vadim Tropashko Says:

November 8, 2007 at 10:08 pm e

Consider the matrix equation from the top of page 178 adapted to the matrix from your example

[2..x][n.-1][7.-2]
[....].*.[....].=.[....]
[1..y][1..0][4.-1]

(dots are used as spacers). Due to matrix multiplication law, the 3 unknowns x,y and n should satisfy the following equations:

2n + x = 7
n + y = 4

It is a system of two equations with three variable that we are solving, and modulo function is just a handy tool. In the first equation the n is multiplied by a number greater than 1. There is no ambiguity, and we get a single integer solution n=4, x=-1. The second equation, however, admits two solutions n=4, y=0 and n=5, y=-1 and the modulo function finds the wrong one (that is the one inconsistent with the first equation)!

To summarize, you are right, the modulo function is the robust means to find the parent matrix upper right element, but the lower right element is better calculated some other way. You can use linear equation as above, or even more simple, leverage the determinant constraint. Received on Tue Jul 06 2010 - 12:28:34 CDT

Original text of this message