# Re: Getting a grip on nested intervals and matrix encoding

Date: Tue, 6 Jul 2010 10:28:34 -0700 (PDT)

On Jul 5, 1:38 pm, creecode <creec..._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
>
>
> 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

#
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
#

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 - 19:28:34 CEST

Original text of this message