1. Dimension of sequences

Hello All,

A basic question about sequences.

Suppose that a "retangular sequence" is a sequence generated by using
iteratively the function repeat() beginning with an atom. Then, I think we can
say that the dimension of a retangular sequence is the number of calls to
repeat() function. (atom=dimension 0, vector=dimension 1, matrix=dimension 2,
...).

Now, let's say we have a sequence like { 1, {1,1} } which is not retangular.
Then, a question arise:

What is the dimension of a non-retangular sequence ?

a) the maximum depth of the sequence.
b) an integer number.
c) a fractal number.
d) a sequence which depends on the structure.
e) the dimension concept does not apply.
f) I don't know.
g) other.

Trying to answer that question, others more basics and related to that arise to
me (sorry if they are stupid!):

What is the dimension of the circumference ?
a) 1 , because the area of the circumference is zero. It is a curved 1D object.
b) 2 , because the circumference exists in a bidimensional space.
c) Both. It has 2 types of dimensions!

Same question for a line not closed as, for example, the form of letter "U".

Thanks for your reply,

Regards,
Fernando Bauer

new topic     » topic index » view message » categorize

2. Re: Dimension of sequences

Fernando Bauer wrote:
> 
> Hello All,
> 
> A basic question about sequences.
> 
> Suppose that a "retangular sequence" is a sequence generated by using
> iteratively
> the function repeat() beginning with an atom. Then, I think we can say that
> the dimension of a retangular sequence is the number of calls to repeat()
> function.
> (atom=dimension 0, vector=dimension 1, matrix=dimension 2, ...).
> 
> Now, let's say we have a sequence like { 1, {1,1} } which is not retangular.
> Then, a question arise:
> 
> What is the dimension of a non-retangular sequence ?
> 
> a) the maximum depth of the sequence.
> b) an integer number.
> c) a fractal number.
> d) a sequence which depends on the structure.
> e) the dimension concept does not apply.
> f) I don't know.
> g) other.

Interesting question. I think that (d) is probably the most correct answer.

The sequence is a one-dimensional sequence with a maximum depth of two. So it
depends on the structure.

I would say that "dimension" would refer to the minimum depth of the sequence's
elements. Someone who is more mathematically inclined will probably tell me how
wrong I am though.

> Trying to answer that question, others more basics and related to that arise
> to me (sorry if they are stupid!):
> 
> What is the dimension of the circumference ?
> a) 1 , because the area of the circumference is zero. It is a curved 1D
> object.
> b) 2 , because the circumference exists in a bidimensional space.
> c) Both. It has 2 types of dimensions!
> 
> Same question for a line not closed as, for example, the form of letter "U".

(c) as I answered above. A circumference in one dimension would consist of just
it's length, and would therefore be just a line. But the coordinates around the
circumference definitely have two dimensions.

> 
> Thanks for your reply,
> 
> Regards,
> Fernando Bauer


--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Dimension of sequences

Fernando Bauer wrote:
> 
> Hello All,
> 
> A basic question about sequences.
> 
> Suppose that a "retangular sequence" is a sequence generated by using
> iteratively
> the function repeat() beginning with an atom. Then, I think we can say that
> the dimension of a retangular sequence is the number of calls to repeat()
> function.
> (atom=dimension 0, vector=dimension 1, matrix=dimension 2, ...).
> 

They call it the dimension of a tensor in physics. Well there are two dimensions
because of covariant and contravariant indexes, but Euphoria ignores this.

> Now, let's say we have a sequence like { 1, {1,1} } which is not retangular.
> Then, a question arise:
> 
> What is the dimension of a non-retangular sequence ?
> 
> a) the maximum depth of the sequence.
> b) an integer number.
> c) a fractal number.
> d) a sequence which depends on the structure.
> e) the dimension concept does not apply.
> f) I don't know.
> g) other.
> 

Depends on what you wish to do with the dimension concept.
In keeping with how the dimension of a topological space is defined, I'd say
"the maximum depth" (a/).

> Trying to answer that question, others more basics and related to that arise
> to me (sorry if they are stupid!):
> 
> What is the dimension of the circumference ?
> a) 1 , because the area of the circumference is zero. It is a curved 1D
> object.
> b) 2 , because the circumference exists in a bidimensional space.
> c) Both. It has 2 types of dimensions!
> 

No, the dimension is clearly one, if only because of the scaling issue. If you
multiply the radius of a circle by c, the length of any arc on this circle is
multiplied by c, which is power(c,1), as well, so the dimension is 1. For a disc,
areas are multiplied by c squared, so discs have dimension 2. That's how
Haüsdorff's dimension is defined, because the relevant measure is the length on
circles and the area on discs.

> Same question for a line not closed as, for example, the form of letter "U".

Same answer: 1. Because there is a length, but not an area.

However, if you do the following iterative process:
1/start with a line segment
2/for each line segment in your objct, replace the middle third segment by the
other two sides of an equiklateral triangle. Try making orientation consistent.
Then the limit object has dimension... ln(4)/ln(3). It isn't either a curve any
longer - even though any finite application of algorithm above results in a curve
- nor a surface yet. Consider that you replace three segments ___ with four _/\_
.

> 
> Thanks for your reply,
> 
> Regards,
> Fernando Bauer

CChris

new topic     » goto parent     » topic index » view message » categorize

4. Re: Dimension of sequences

CChris wrote:

Hi CChris. Thanks for your reply.
> 
> Fernando Bauer wrote:
> > 
> > Hello All,
> > 
> > A basic question about sequences.
> > 
> > Suppose that a "retangular sequence" is a sequence generated by using
> > iteratively
> > the function repeat() beginning with an atom. Then, I think we can say that
> > the dimension of a retangular sequence is the number of calls to repeat()
> > function.
> > (atom=dimension 0, vector=dimension 1, matrix=dimension 2, ...).
> > 
> 
> They call it the dimension of a tensor in physics. Well there are two
> dimensions
> because of covariant and contravariant indexes, but Euphoria ignores this.
Thanks for the information, even if I don't understand what are these indices..

> 
> > Now, let's say we have a sequence like { 1, {1,1} } which is not retangular.
> > Then, a question arise:
> > 
> > What is the dimension of a non-retangular sequence ?
> > 
> > a) the maximum depth of the sequence.
> > b) an integer number.
> > c) a fractal number.
> > d) a sequence which depends on the structure.
> > e) the dimension concept does not apply.
> > f) I don't know.
> > g) other.
> > 
> 
> Depends on what you wish to do with the dimension concept.
Are you saying that there isn't an unique definition for dimension of sequences
?

> In keeping with how the dimension of a topological space is defined, I'd say
> "the maximum depth" (a/).

Then, suppose you have the following sequence:
{
 {1,1,1},
 {1},
 {1,1,1}
}

If I can view this sequence as a representation of the letter "U", using your
answer below, I can conclude that the dimension of this sequence is 1.
But in this case the maximum depth is 2 (using Ricardo Forno's MaxDepth()
definition in genfunc.e library). So, what is the dimension in this case ? 1 or
2?

> 
> > Trying to answer that question, others more basics and related to that arise
> > to me (sorry if they are stupid!):
> > 
> > What is the dimension of the circumference ?
> > a) 1 , because the area of the circumference is zero. It is a curved 1D
> > object.
> > b) 2 , because the circumference exists in a bidimensional space.
> > c) Both. It has 2 types of dimensions!
> > 
> 
> No, the dimension is clearly one, if only because of the scaling issue. If you
> multiply the radius of a circle by c, the length of any arc on this circle is
> multiplied by c, which is power(c,1), as well, so the dimension is 1. For a
> disc, areas are multiplied by c squared, so discs have dimension 2. That's how
> Haüsdorff's dimension is defined, because the relevant measure is the length
> on circles and the area on discs.
> 
> > Same question for a line not closed as, for example, the form of letter "U".
> 
> Same answer: 1. Because there is a length, but not an area.
See above its possible implication for sequences.

> 
> However, if you do the following iterative process:
> 1/start with a line segment
> 2/for each line segment in your objct, replace the middle third segment by the
> other two sides of an equiklateral triangle. Try making orientation
> consistent.
> Then the limit object has dimension... ln(4)/ln(3). It isn't either a curve
> any longer - even though any finite application of algorithm above results in
> a curve - nor a surface yet. Consider that you replace three segments ___ with
> four _/\_ .

Ok, it's the Koch curve. And if the process starts with an equilateral triangle,
it is denominated, as you know, Koch snowflake, which encloses a finite area with
an infinite perimeter. A beautiful image!

> > 
> > Thanks for your reply,
> > 
> > Regards,
> > Fernando Bauer
> 
> CChris

Regards,
  Fernando

new topic     » goto parent     » topic index » view message » categorize

5. Re: Dimension of sequences

I must disagree with Chris here.

A sequence doesn't have a 'dimension' in geometrical sense. A sequence is not a
geometric object.

Why do you need to know the 'dimension' of a sequence? I mean if you knew that a
given sequence has a dimension of 'x', what would you use 'x' for?

Are you asking the right question?

 
Fernando Bauer wrote:
> Then, suppose you have the following sequence:
> {
>  {1,1,1},
>  {1},
>  {1,1,1}
> }
> 
> If I can view this sequence as a representation of the letter "U", 
> using your answer below, I can conclude that the dimension of this
> sequence is 1.

This sequence has a length of 3 and a depth of 1, so in that sense it has two
dimensions I suppose - Length and Depth. It also has a content of 7 (the number
of atoms in total) so maybe a sequence has three dimensions? It also has a
sub-sequence of 3, so maybe a sequence has four dimensions - Length, Depth,
Content, Sub-sequence. Each of these is independant of the other so they sort of
qualify as dimensions, no? But then 'Content' is kinda like 'area' in concept so
maybe it doesn't count after all.



> > > Trying to answer that question, others more basics and related to that
> > > arise
> > > to me (sorry if they are stupid!):
> > > 
> > > What is the dimension of the circumference ?

Exactly my point. The dimension of a sequence is a meaningless concept. What are
you really trying to know about the sequence?

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

6. Re: Dimension of sequences

Jason Gade wrote:

Hi Jason! Thanks for your reply. Interesting concepts.
> 
> Fernando Bauer wrote:
> > 
> > Hello All,
> > 
> > A basic question about sequences.
> > 
> > Suppose that a "retangular sequence" is a sequence generated by using
> > iteratively
> > the function repeat() beginning with an atom. Then, I think we can say that
> > the dimension of a retangular sequence is the number of calls to repeat()
> > function.
> > (atom=dimension 0, vector=dimension 1, matrix=dimension 2, ...).
> > 
> > Now, let's say we have a sequence like { 1, {1,1} } which is not retangular.
> > Then, a question arise:
> > 
> > What is the dimension of a non-retangular sequence ?
> > 
> > a) the maximum depth of the sequence.
> > b) an integer number.
> > c) a fractal number.
> > d) a sequence which depends on the structure.
> > e) the dimension concept does not apply.
> > f) I don't know.
> > g) other.
> 
> Interesting question. I think that (d) is probably the most correct answer.
> 
> The sequence is a one-dimensional sequence with a maximum depth of two. So it
> depends on the structure.

Could you explain better with an example or show the algorithm to generate that
sequence?

> 
> I would say that "dimension" would refer to the minimum depth of the
> sequence's
> elements. 

Isn't the minimum depth of a sequence always equal to 1? Could you explain
better how you obtain this minimum depth?
I'm using the concept of depth used by Forno's genfunc.e library.

> Someone who is more mathematically inclined will probably tell me
> how wrong I am though.
> 
> > Trying to answer that question, others more basics and related to that arise
> > to me (sorry if they are stupid!):
> > 
> > What is the dimension of the circumference ?
> > a) 1 , because the area of the circumference is zero. It is a curved 1D
> > object.
> > b) 2 , because the circumference exists in a bidimensional space.
> > c) Both. It has 2 types of dimensions!
> > 
> > Same question for a line not closed as, for example, the form of letter "U".
> 
> (c) as I answered above. A circumference in one dimension would consist of
> just
> it's length, and would therefore be just a line. But the coordinates around
> the circumference definitely have two dimensions.
Do you know the names of these 2 types of dimensions?

> 
> > 
> > Thanks for your reply,
> > 
> > Regards,
> > Fernando Bauer
> 
> 
> --
> A complex system that works is invariably found to have evolved from a simple
> system that works.
> --John Gall's 15th law of Systemantics.
> 
> "Premature optimization is the root of all evil in programming."
> --C.A.R. Hoare
> 
> j.

Regards,
 Fernando Bauer
 Porto Alegre - Brazil

new topic     » goto parent     » topic index » view message » categorize

7. Re: Dimension of sequences

Derek Parnell wrote:

Hi Derek. Thanks for your reply.

> A sequence doesn't have a 'dimension' in geometrical sense. A sequence is not
> a geometric object.

A vector or a matrix aren't geometric objects in mathematics or in programming
either, however they
have a dimension, as you know.

> Why do you need to know the 'dimension' of a sequence? I mean if you knew that
> a given sequence has a dimension of 'x', what would you use 'x' for? 
It is a theoretical question. Maybe there are rules or functions (e.g.
compression factor?) that depends on this parameter. Why do the mathematicians
and physicists calculate dimensions of fractal objects?

> 
> Are you asking the right question?
I think yes, since I understand your response as option e) (the concept does not
apply to). I don't know the answer.

> 
>  
> Fernando Bauer wrote:
> > Then, suppose you have the following sequence:
> > {
> >  {1,1,1},
> >  {1},
> >  {1,1,1}
> > }
> > 
> > If I can view this sequence as a representation of the letter "U", 
> > using your answer below, I can conclude that the dimension of this
> > sequence is 1.
> 
> This sequence has a length of 3 and a depth of 1, so in that sense it has two
> dimensions I suppose - Length and Depth. It also has a content of 7 (the
> number
> of atoms in total) so maybe a sequence has three dimensions? It also has a
> sub-sequence
> of 3, so maybe a sequence has four dimensions - Length, Depth, Content,
> Sub-sequence.
> Each of these is independant of the other so they sort of qualify as
> dimensions,
> no? But then 'Content' is kinda like 'area' in concept so maybe it doesn't
> count
> after all.
Interesting.

> 
> 
> > > > Trying to answer that question, others more basics and related to that
> > > > arise
> > > > to me (sorry if they are stupid!):
> > > > 
> > > > What is the dimension of the circumference ?
> 
> Exactly my point. The dimension of a sequence is a meaningless concept.
At least, not always, since the rectangular sequences clearly have a dimension,
like an array or matrix.

> What are you really trying to know about the sequence?

Its dimension, if there is any! :)

> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

Regards,
   Fernando

new topic     » goto parent     » topic index » view message » categorize

8. Re: Dimension of sequences

Fernando Bauer wrote:
> 
> Derek Parnell wrote:
> 
> Hi Derek. Thanks for your reply.
> 
> > A sequence doesn't have a 'dimension' in geometrical sense. A sequence is
> > not
> > a geometric object.
> 
> A vector or a matrix aren't geometric objects in mathematics or in programming
> either, however they
> have a dimension, as you know.

Yes, but their 'dimension' is just a special term, which means
just number of members. And at all another thing, if, for example,
some vector describes x-y-z coordinates of some point
in some 3-dimensional space. 

> > Why do you need to know the 'dimension' of a sequence? I mean if you knew
> > that
> > a given sequence has a dimension of 'x', what would you use 'x' for? 
> It is a theoretical question. Maybe there are rules or functions (e.g.
> compression
> factor?) that depends on this parameter. Why do the mathematicians and
> physicists
> calculate dimensions of fractal objects?

There is very simple theory of Euphoria sequences in Euphoria
documentation, firsthand about EU sequences.
These sequences have 'length', and nothing more.
But any member of any sequence can be a sequence itself
with its own length.
This 'length' is just number of members.
See, 'dimension' of vector is equal to 'length' of sequence.
So, your question is not 'theoretical' one, but is just some
question about sense of some terms in Euphoria.
This is a question about multimeaning of the word 'dimension',
I think.
Another thing that EU sequences can describe any
multidimensional real and unreal objects and things,
thanks to very flexible nature of these sequences.
 
> > Are you asking the right question?
> I think yes, since I understand your response as option e) (the concept does
> not apply to). I don't know the answer.

I think, the answer may be simple enough - dimension of
Euphoria sequence is just its length.

But we must not confuse sequence itself and thing,
which is described with that sequence.

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

9. Re: Dimension of sequences

Igor Kachan wrote:
 
> But we must not confuse sequence itself and thing,
> which is described with that sequence.

It is a very rare thing so I must make mention of it ... I agree with Igor.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

10. Re: Dimension of sequences

Derek Parnell wrote:
> 
> Igor Kachan wrote:
>  
> > But we must not confuse sequence itself and thing,
> > which is described with that sequence.
> 
> It is a very rare thing so I must make mention of it ... I agree with Igor.
>

Good Luck, Derek!  smile
But maybe Fernando wants to create some new brilliant
complete mathematical theory of the Euphoria sequences, who knows.
Good Luck, Fernando!  smile

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

11. Re: Dimension of sequences

Igor Kachan wrote:

Hello Igor! Thanks for the reply.
> 
> Fernando Bauer wrote:
> > 
> > Derek Parnell wrote:
> > 
> > Hi Derek. Thanks for your reply.
> > 
> > > A sequence doesn't have a 'dimension' in geometrical sense. A sequence is
> > > not
> > > a geometric object.
> > 
> > A vector or a matrix aren't geometric objects in mathematics or in
> > programming
> > either, however they
> > have a dimension, as you know.
> 
> Yes, but their 'dimension' is just a special term, which means
> just number of members. And at all another thing, if, for example,
> some vector describes x-y-z coordinates of some point
> in some 3-dimensional space. 

I think you misunderstood what I've tried to ask. Probably you didn't read the
initial post.
Let's use Euphoria to describe better:

include genfunc.e
atom a
sequence seq1D, seq2D, seq3D
-- an atom
a = 1
-- a 1D sequence
seq1D = repeat(a, 2)
-- a 2D sequence
seq2D = repeat(seq1D, 2)
-- a 3D sequence
seq3D = repeat(seq2D, 2)

-- for rectangular sequences MaxDepth() compute the dimension
procedure ShowDimension(object o)
puts(1,"Dimension of ")
print(1, o)
printf(1," = %d\n",MaxDepth(o))
end procedure

ShowDimension(a)
ShowDimension(seq1D)
ShowDimension(seq2D)
ShowDimension(seq3D)


I think my concept of dimension is like Rank concept in the J language.
What I'm trying to ask is: What is the dimension for non-rectangular sequences?

> 
> > > Why do you need to know the 'dimension' of a sequence? I mean if you knew
> > > that
> > > a given sequence has a dimension of 'x', what would you use 'x' for? 
> > It is a theoretical question. Maybe there are rules or functions (e.g.
> > compression
> > factor?) that depends on this parameter. Why do the mathematicians and
> > physicists
> > calculate dimensions of fractal objects?
> 
> There is very simple theory of Euphoria sequences in Euphoria
> documentation, firsthand about EU sequences.
> These sequences have 'length', and nothing more.
> But any member of any sequence can be a sequence itself
> with its own length.
> This 'length' is just number of members.
> See, 'dimension' of vector is equal to 'length' of sequence.
I think my "dimension" is your "number of dimensions". See the code above.

> So, your question is not 'theoretical' one, but is just some
> question about sense of some terms in Euphoria.
> This is a question about multimeaning of the word 'dimension',
> I think.
> Another thing that EU sequences can describe any
> multidimensional real and unreal objects and things,
> thanks to very flexible nature of these sequences.
>  
> > > Are you asking the right question?
> > I think yes, since I understand your response as option e) (the concept does
> > not apply to). I don't know the answer.
> 
> I think, the answer may be simple enough - dimension of
> Euphoria sequence is just its length.
See above other concept or meaning of "dimension", which is what I'm trying to
ask about.

> 
> But we must not confuse sequence itself and thing,
> which is described with that sequence.
> 
> Regards,
> Igor Kachan
> kinz at peterlink.ru

Regards,
  Fernando

new topic     » goto parent     » topic index » view message » categorize

12. Re: Dimension of sequences

Hello Fernando!

Fernando Bauer wrote:
> 
> Igor Kachan wrote:
> 
> Hello Igor! Thanks for the reply.
> > 
> > Fernando Bauer wrote:
> > > 
> > > Derek Parnell wrote:
> > > 
> > > Hi Derek. Thanks for your reply.
> > > 
> > > > A sequence doesn't have a 'dimension' in geometrical sense. A sequence
> > > > is not
> > > > a geometric object.
> > > 
> > > A vector or a matrix aren't geometric objects in mathematics or in
> > > programming
> > > either, however they
> > > have a dimension, as you know.
> > 
> > Yes, but their 'dimension' is just a special term, which means
> > just number of members. And at all another thing, if, for example,
> > some vector describes x-y-z coordinates of some point
> > in some 3-dimensional space. 
> 
> I think you misunderstood what I've tried to ask. Probably you didn't read the
> initial post.
> Let's use Euphoria to describe better:
> 
> }}}
<eucode>
> include genfunc.e
> atom a
> sequence seq1D, seq2D, seq3D
> -- an atom
> a = 1
> -- a 1D sequence
> seq1D = repeat(a, 2)
> -- a 2D sequence
> seq2D = repeat(seq1D, 2)
> -- a 3D sequence
> seq3D = repeat(seq2D, 2)
> 
> -- for rectangular sequences MaxDepth() compute the dimension
> procedure ShowDimension(object o)
> puts(1,"Dimension of ")
> print(1, o)
> printf(1," = %d\n",MaxDepth(o))
> end procedure
> 
> ShowDimension(a)
> ShowDimension(seq1D)
> ShowDimension(seq2D)
> ShowDimension(seq3D)
> </eucode>
{{{

> 
> I think my concept of dimension is like Rank concept in the J language.
> What I'm trying to ask is: What is the dimension for non-rectangular
> sequences?

Ok, good. I do understand your concept, be sure.
But it is something new. There is no any theory under
"dimension of Euphoria sequence".

Euphoria sequence as it is is invented by Robert Craig
and has just its length.

So you are free to define some *new* & *useful* parameters
of some *specific kind* of sequences and to name these
parameters as you wish - 'dimension' or something else,
say, 'length-depth'.

I do not think, for now at least, that we have to
care if the sequence is 'rectangular' or 'non-rectangular'.
But I think that sequences can describe any rectangular
and non-rectangular objects, and dimension of that
described object, for example, may be some dimension
of this describing sequence too.

I do not know what to do with this new parameter
of a sequence, with this new term, 'dimension'.

Ok, say, dimension of some sequence is 2.
So what?

But if I have some 2 components vector, I do know
what to do with that vector.

> > > > Why do you need to know the 'dimension' of a sequence? I mean if you
> > > > knew that
> > > > a given sequence has a dimension of 'x', what would you use 'x' for? 
> > > It is a theoretical question. Maybe there are rules or functions (e.g.
> > > compression
> > > factor?) that depends on this parameter. Why do the mathematicians and
> > > physicists
> > > calculate dimensions of fractal objects?
> > 
> > There is very simple theory of Euphoria sequences in Euphoria
> > documentation, firsthand about EU sequences.
> > These sequences have 'length', and nothing more.
> > But any member of any sequence can be a sequence itself
> > with its own length.
> > This 'length' is just number of members.
> > See, 'dimension' of vector is equal to 'length' of sequence.
> I think my "dimension" is your "number of dimensions". See the code above.
> 
> > So, your question is not 'theoretical' one, but is just some
> > question about sense of some terms in Euphoria.
> > This is a question about multimeaning of the word 'dimension',
> > I think.
> > Another thing that EU sequences can describe any
> > multidimensional real and unreal objects and things,
> > thanks to very flexible nature of these sequences.
> >  
> > > > Are you asking the right question?
> > > I think yes, since I understand your response as option e) (the concept
> > > does
> > > not apply to). I don't know the answer.
> > 
> > I think, the answer may be simple enough - dimension of
> > Euphoria sequence is just its length.
> See above other concept or meaning of "dimension", which is what I'm trying
> to ask about.

Ok, I see, I do understand this other concept,
but this concept itself is just some definition
of some new term for some specific kind of sequences,
so named rectangular sequences.
But 'rectangular' sequence itself needs some
definition now, and so on.

Ok, suppose, we now have all these new definitions -
'rectangular sequence' (RS), 'non-rectangular sequence' (NRS),
'dimension of RS', 'dimension of NRS'.

So what?  What will we do with all these new terms, with
all these new notions, with all these new concepts?

Euphoria itself is very simple language without complicated
abstractions. But can describe any complicated objects
using simple concept of sequence.

> > But we must not confuse sequence itself and thing,
> > which is described with that sequence.

Well, back to above your question, I do not think that someone
already knows how to define 'dimension of NRS' and so on and
for what purpose.

Ok, try to define it yourself, why not?
But remember please, Euphoria is simple thing, first of all.

Good Luck!

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

13. Re: Dimension of sequences

Fernando Bauer wrote:
> 
> CChris wrote:
> 
> Hi CChris. Thanks for your reply.
> > 
> > Fernando Bauer wrote:
> > > 
> > > Hello All,
> > > 
> > > A basic question about sequences.
> > > 
> > > Suppose that a "retangular sequence" is a sequence generated by using
> > > iteratively
> > > the function repeat() beginning with an atom. Then, I think we can say
> > > that
> > > the dimension of a retangular sequence is the number of calls to repeat()
> > > function.
> > > (atom=dimension 0, vector=dimension 1, matrix=dimension 2, ...).
> > > 
> > 
> > They call it the dimension of a tensor in physics. Well there are two
> > dimensions
> > because of covariant and contravariant indexes, but Euphoria ignores this.
> Thanks for the information, even if I don't understand what are these
> indices..
> 
> > 
> > > Now, let's say we have a sequence like { 1, {1,1} } which is not
> > > retangular.
> > > Then, a question arise:
> > > 
> > > What is the dimension of a non-retangular sequence ?
> > > 
> > > a) the maximum depth of the sequence.
> > > b) an integer number.
> > > c) a fractal number.
> > > d) a sequence which depends on the structure.
> > > e) the dimension concept does not apply.
> > > f) I don't know.
> > > g) other.
> > > 
> > 
> > Depends on what you wish to do with the dimension concept.
> Are you saying that there isn't an unique definition for dimension of
> sequences
> ?

Well, I'm not aware that there is a definition at all, so it can be anything.
I'd use the depth (maximum nesting level) as a definition, but it depends on
what you want to measure.

For various math objects, there's a dimension; I know about 10 versions of it.
They usually agree on the simplest objects, but there are really many of them.

> 
> > In keeping with how the dimension of a topological space is defined, I'd say
> > "the maximum depth" (a/).
> 
> Then, suppose you have the following sequence:
> {
>  {1,1,1},
>  {1},
>  {1,1,1}
> }
> 
> If I can view this sequence as a representation of the letter "U", using your
> answer below, I can conclude that the dimension of this sequence is 1.
> But in this case the maximum depth is 2 (using Ricardo Forno's MaxDepth()
> definition
> in genfunc.e library). So, what is the dimension in this case ? 1 or 2?
> 

The U letter is a line - you can draw it with a pen -, so it is intrinsically of
dimension 1. However, it will never fit on a straight line, so you need to embed
it in the plane - a 2-dimensional manifold.
The 2 is for the embedding, which your sequence is. This is why the two figures
don't agree.

[Snipped]

CChris

new topic     » goto parent     » topic index » view message » categorize

14. Re: Dimension of sequences

Derek Parnell wrote:
> 
> 
> I must disagree with Chris here.
> 
> A sequence doesn't have a 'dimension' in geometrical sense. A sequence is not
> a geometric object.
> 

Of course, but it is a data structure (a tree), and has a dimension as such.
There are dimensions in many other aspects of maths than geometry.

CChris

> Why do you need to know the 'dimension' of a sequence? I mean if you knew that
> a given sequence has a dimension of 'x', what would you use 'x' for? 
> 
> Are you asking the right question?
> 
>  
> Fernando Bauer wrote:
> > Then, suppose you have the following sequence:
> > {
> >  {1,1,1},
> >  {1},
> >  {1,1,1}
> > }
> > 
> > If I can view this sequence as a representation of the letter "U", 
> > using your answer below, I can conclude that the dimension of this
> > sequence is 1.
> 
> This sequence has a length of 3 and a depth of 1, so in that sense it has two
> dimensions I suppose - Length and Depth. It also has a content of 7 (the
> number
> of atoms in total) so maybe a sequence has three dimensions? It also has a
> sub-sequence
> of 3, so maybe a sequence has four dimensions - Length, Depth, Content,
> Sub-sequence.
> Each of these is independant of the other so they sort of qualify as
> dimensions,
> no? But then 'Content' is kinda like 'area' in concept so maybe it doesn't
> count
> after all.
> 
> 
> > > > Trying to answer that question, others more basics and related to that
> > > > arise
> > > > to me (sorry if they are stupid!):
> > > > 
> > > > What is the dimension of the circumference ?
> 
> Exactly my point. The dimension of a sequence is a meaningless concept. What
> are you really trying to know about the sequence?
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

15. Re: Dimension of sequences

Hello again,


The game of chess if often referred to as having move sequences that
exist on the edge of a multi-dimensional object, so i suppose
you could say the same thing about a sequence.

My question would be say you defined the 'dimension' of a sequence
as the product of the max of all the inner sequences written out
such as 1x2x3 as is sometimes customary with arrays.  What would
you use this information for in a program?

When i did my jpeg decoder program in Euphoria i used sequences
like arrays where every level had the same length:
  s=repeat(0,10)
  s=repeat(s,4)
  s=repeat(s,9)
  s=repeat(s,5)
and this builds up a structure similar to a C style array where
every level has the same length.  The above code creates 5 
three dimensional 'arrays' that can be accessed by index.
I would have no problem calling this a 10x4x9x5 or a 5x9x4x10
'sequence', but the actual common useage seems to be to use
every element, but then again i could easily see an app that
although includes a given element, does not in fact use that
element in the program, ever, and of course the implication of
this is that an element missing altogether (only possible with 
a sequence) does not necessarily decrease the length because
the other sequences at the same level contain more elements:
  s={
      {1,2,3,4},
      {5,6,7}
    }
is still a 2x4 sequence.

If you want to get more detailed, you might have to start enumerating
every element and returning a sequence that corresponds to that
sequence.  As with the above, this would be:
  m={4,3}
I guess this would simply be a sequence with the lengths of all 
first level sequences arranged in the same structure as the
original sequence, which would still have to be perused.
Again i would have to wonder about how useful this would be unless
the sequence isnt that big.  For example, "When do i need to know
the actual structure of the sequence in full?"

Some applications would be interesting to hear about at this point.


  

Take care,
Al

E boa sorte com sua programacao Euphoria!


My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » goto parent     » topic index » view message » categorize

16. Re: Dimension of sequences

Al Getz wrote:
> 
> Hello again,
> 

Hello Al! Thanks for your comments.

> 
> The game of chess if often referred to as having move sequences that
> exist on the edge of a multi-dimensional object, so i suppose
> you could say the same thing about a sequence.
> 

Sorry, I didn't understand this.

> My question would be say you defined the 'dimension' of a sequence
> as the product of the max of all the inner sequences written out
> such as 1x2x3 as is sometimes customary with arrays.  What would
> you use this information for in a program?
> 

Examples:
a)A 2D sequence (a matrix) can represent a system of simultaneous linear
equations. Then, you can use your description (a x b) to find out if the system
has possibly none, one or many solutions.
b)To know if a sequence represent a square matrix. For example, to know if you
can calculate its determinant.

> When i did my jpeg decoder program in Euphoria i used sequences
> like arrays where every level had the same length:
>   s=repeat(0,10)
>   s=repeat(s,4)
>   s=repeat(s,9)
>   s=repeat(s,5)
> and this builds up a structure similar to a C style array where
> every level has the same length.

That is what I'm calling rectangular sequence. Perhaps we could call it "array
sequence".

>  The above code creates 5 
> three dimensional 'arrays' that can be accessed by index.
> I would have no problem calling this a 10x4x9x5 or a 5x9x4x10
> 'sequence', 

Ok, you can call this way, but this isn't the dimension that I was talking
about. This is the number of atoms (after you compute the product).

>but the actual common useage seems to be to use
> every element, but then again i could easily see an app that
> although includes a given element, does not in fact use that
> element in the program, ever, and of course the implication of
> this is that an element missing altogether (only possible with 
> a sequence) does not necessarily decrease the length because
> the other sequences at the same level contain more elements:
>   s={
>       {1,2,3,4},
>       {5,6,7}
>     }
> is still a 2x4 sequence.
> 

If this is true, why *can't* I sum, subtract, multiply, etc, sequences with the
same description ?
The information of the structure of the sequence is lost in that representation.
I think if you eliminate an atom of a retangular sequence (array sequence), it
can't have the same description any longer.

> If you want to get more detailed, you might have to start enumerating
> every element and returning a sequence that corresponds to that
> sequence.  As with the above, this would be:
>   m={4,3}
> I guess this would simply be a sequence with the lengths of all 
> first level sequences arranged in the same structure as the
> original sequence, which would still have to be perused.
> Again i would have to wonder about how useful this would be unless
> the sequence isnt that big.  For example, "When do i need to know
> the actual structure of the sequence in full?"
> 

To serialize sequences, which is necessary in several situations: saving and
restoring sequences to/from files, transmission of sequences via serial networks.

> Some applications would be interesting to hear about at this point.
>

Any application that uses EDS, save and restore the full structures of sequences
to/from the database.
 
> 
> Al
> 
> E boa sorte com sua programacao Euphoria!

Obrigado. Para voce tambem!

> 
> 
> My bumper sticker: "I brake for LED's"
> 

Regards,
   Fernando

new topic     » goto parent     » topic index » view message » categorize

17. Re: Dimension of sequences

Igor Kachan wrote:

Hello Igor! Thanks again for your considerations.

> 
> Hello Fernando!
> 
> Fernando Bauer wrote:
> > 
> > Igor Kachan wrote:
> > 
> > Hello Igor! Thanks for the reply.
> > > 
> > > Fernando Bauer wrote:
> > > > 
> > > > Derek Parnell wrote:
> > > > 
> > > > Hi Derek. Thanks for your reply.
> > > > 
> > > > > A sequence doesn't have a 'dimension' in geometrical sense. A sequence
> > > > > is
> not</font></i>
> > > > > a geometric object.
> > > > 
> > > > A vector or a matrix aren't geometric objects in mathematics or in
> > > > programming
> > > > either, however they
> > > > have a dimension, as you know.
> > > 
> > > Yes, but their 'dimension' is just a special term, which means
> > > just number of members. And at all another thing, if, for example,
> > > some vector describes x-y-z coordinates of some point
> > > in some 3-dimensional space. 
> > 
> > I think you misunderstood what I've tried to ask. Probably you didn't read
> > the
> > initial post.
> > Let's use Euphoria to describe better:
> > 
> > }}}
<eucode>
> > include genfunc.e
> > atom a
> > sequence seq1D, seq2D, seq3D
> > -- an atom
> > a = 1
> > -- a 1D sequence
> > seq1D = repeat(a, 2)
> > -- a 2D sequence
> > seq2D = repeat(seq1D, 2)
> > -- a 3D sequence
> > seq3D = repeat(seq2D, 2)
> > 
> > -- for rectangular sequences MaxDepth() compute the dimension
> > procedure ShowDimension(object o)
> > puts(1,"Dimension of ")
> > print(1, o)
> > printf(1," = %d\n",MaxDepth(o))
> > end procedure
> > 
> > ShowDimension(a)
> > ShowDimension(seq1D)
> > ShowDimension(seq2D)
> > ShowDimension(seq3D)
> > </eucode>
{{{

> > 
> > I think my concept of dimension is like Rank concept in the J language.
> > What I'm trying to ask is: What is the dimension for non-rectangular
> > sequences?
> 
> Ok, good. I do understand your concept, be sure.
> But it is something new. There is no any theory under
> "dimension of Euphoria sequence".
> 
> Euphoria sequence as it is is invented by Robert Craig
> and has just its length.
> 
> So you are free to define some *new* & *useful* parameters
> of some *specific kind* of sequences and to name these
> parameters as you wish - 'dimension' or something else,
> say, 'length-depth'.
> 
> I do not think, for now at least, that we have to
> care if the sequence is 'rectangular' or 'non-rectangular'.
> But I think that sequences can describe any rectangular
> and non-rectangular objects, and dimension of that
> described object, for example, may be some dimension
> of this describing sequence too.
> 
> I do not know what to do with this new parameter
> of a sequence, with this new term, 'dimension'.
> 
> Ok, say, dimension of some sequence is 2.
> So what?

Then you know that the sequence can be viewed as a matrix (a 2D array).
This is true if all non-rectangular sequences have a dimension different from
integer 2.

> 
> But if I have some 2 components vector, I do know
> what to do with that vector.

If you know what to do with that vector then you know what to do with that
matrix too.

> 
> > > > > Why do you need to know the 'dimension' of a sequence? I mean if you
> > > > > knew
> that</font></i>
> > > > > a given sequence has a dimension of 'x', what would you use 'x' for? 
> > > > It is a theoretical question. Maybe there are rules or functions (e.g.
> > > > compression
> > > > factor?) that depends on this parameter. Why do the mathematicians and
> > > > physicists
> > > > calculate dimensions of fractal objects?
> > > 
> > > There is very simple theory of Euphoria sequences in Euphoria
> > > documentation, firsthand about EU sequences.
> > > These sequences have 'length', and nothing more.
> > > But any member of any sequence can be a sequence itself
> > > with its own length.
> > > This 'length' is just number of members.
> > > See, 'dimension' of vector is equal to 'length' of sequence.
> > I think my "dimension" is your "number of dimensions". See the code above.
> > 
> > > So, your question is not 'theoretical' one, but is just some
> > > question about sense of some terms in Euphoria.
> > > This is a question about multimeaning of the word 'dimension',
> > > I think.
> > > Another thing that EU sequences can describe any
> > > multidimensional real and unreal objects and things,
> > > thanks to very flexible nature of these sequences.
> > >  
> > > > > Are you asking the right question?
> > > > I think yes, since I understand your response as option e) (the concept
> > > > does
> > > > not apply to). I don't know the answer.
> > > 
> > > I think, the answer may be simple enough - dimension of
> > > Euphoria sequence is just its length.
> > See above other concept or meaning of "dimension", which is what I'm trying
> > to ask about.
> 
> Ok, I see, I do understand this other concept,
> but this concept itself is just some definition
> of some new term for some specific kind of sequences,
> so named rectangular sequences.
> But 'rectangular' sequence itself needs some
> definition now, and so on.
> 

In the initial post I define "rectangular sequence" as:
A sequence generated by using iteratively the function repeat() beginning with
an atom".

> Ok, suppose, we now have all these new definitions -
> 'rectangular sequence' (RS), 'non-rectangular sequence' (NRS),
> 'dimension of RS', 'dimension of NRS'.

'non-rectangular sequence' (NRS) = all sequences that aren't RS.
'dimension of RS' = maximum depth of the sequence.
'dimension of NRS' = that is the question!

> 
> So what?  What will we do with all these new terms, with
> all these new notions, with all these new concepts?

First of all, they facilitate our communication, since we don't have to say that
whole definition phrase.
Second, the terms RS and NRS can represent types in Euphoria, like vector or
matrix, and so can be checked.
Some algorithms can function with one and not with other type, etc..
 
> Euphoria itself is very simple language without complicated
> abstractions. But can describe any complicated objects
> using simple concept of sequence.
> 
> > > But we must not confuse sequence itself and thing,
> > > which is described with that sequence.
> 
> Well, back to above your question, I do not think that someone
> already knows how to define 'dimension of NRS' and so on and
> for what purpose.

Maybe this answer and others can be found in Tree theory which was more studied.

> 
> Ok, try to define it yourself, why not?
> But remember please, Euphoria is simple thing, first of all.
> 
> Good Luck!

Thank you!

> 
> Regards,
> Igor Kachan
> kinz at peterlink.ru

Regards,
  Fernando

new topic     » goto parent     » topic index » view message » categorize

18. Re: Dimension of sequences

Hello Fernando!

Fernando Bauer wrote:
> 
> Igor Kachan wrote:
> >

[snipped]

> > Ok, suppose, we now have all these new definitions -
> > 'rectangular sequence' (RS), 'non-rectangular sequence' (NRS),
> > 'dimension of RS', 'dimension of NRS'.
> 
> 'non-rectangular sequence' (NRS) = all sequences that aren't RS.
> 'dimension of RS' = maximum depth of the sequence.
> 'dimension of NRS' = that is the question!

Let's see the refman.doc file now.

Robert Craig wrotes:

 "Sequences can be nested to any depth, i.e. you can have sequences within
  sequences within sequences and so on to any depth (until you run out of
  memory)." 

I see Rob cares just about *maximum* depth here, so his definition
of depht, documented in refman.doc, is strongly equivalent to your
definition of 'dimension of RS'.
Same thing, you just introduce some new term, synonym.

No?

Then, I do not think now that the 'rectangular' word is very
good for your purpose, maybe, 'regular', as some short
for 'regularly nested', is better.

> > So what?  What will we do with all these new terms, with
> > all these new notions, with all these new concepts?
> 
> First of all, they facilitate our communication, since we don't have to say
> that whole definition phrase.
> Second, the terms RS and NRS can represent types in Euphoria, like vector or
> matrix, and so can be checked.
> Some algorithms can function with one and not with other type, etc..

Ok, but for now I do not see some real place for the 'dimension' word
here. Length & Depth. These old good words are very clear in 
the specific EU context. 

> > Euphoria itself is very simple language without complicated
> > abstractions. But can describe any complicated objects
> > using simple concept of sequence.
> > 
> > > > But we must not confuse sequence itself and thing,
> > > > which is described with that sequence.
> > 
> > Well, back to above your question, I do not think that someone
> > already knows how to define 'dimension of NRS' and so on and
> > for what purpose.
> 
> Maybe this answer and others can be found in Tree theory which was
> more studied.

Maybe, but that theory is not a theory of EU sequences,
so you'll need to redifine some their terms into native
EU terms first of all, if there are needed to you
concepts in that theory.  

> 
> > 
> > Ok, try to define it yourself, why not?
> > But remember please, Euphoria is simple thing, first of all.
> > 
> > Good Luck!
> 
> Thank you!

Good Luck again!

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

19. Re: Dimension of sequences

Fernando Bauer wrote:
> 
> Al Getz wrote:
> > 
> > Hello again,
> > 
> 
> Hello Al! Thanks for your comments.
> 
> > 
> > The game of chess if often referred to as having move sequences that
> > exist on the edge of a multi-dimensional object, so i suppose
> > you could say the same thing about a sequence.
> > 
> 
> Sorry, I didn't understand this.
> 
> > My question would be say you defined the 'dimension' of a sequence
> > as the product of the max of all the inner sequences written out
> > such as 1x2x3 as is sometimes customary with arrays.  What would
> > you use this information for in a program?
> > 
> 
> Examples:
> a)A 2D sequence (a matrix) can represent a system of simultaneous linear
> equations.
> Then, you can use your description (a x b) to find out if the system has
> possibly
> none, one or many solutions.
> b)To know if a sequence represent a square matrix. For example, to know if you
> can calculate its determinant.
> 
> > When i did my jpeg decoder program in Euphoria i used sequences
> > like arrays where every level had the same length:
> >   s=repeat(0,10)
> >   s=repeat(s,4)
> >   s=repeat(s,9)
> >   s=repeat(s,5)
> > and this builds up a structure similar to a C style array where
> > every level has the same length.
> 
> That is what I'm calling rectangular sequence. Perhaps we could call it "array
> sequence".
> 
> >  The above code creates 5 
> > three dimensional 'arrays' that can be accessed by index.
> > I would have no problem calling this a 10x4x9x5 or a 5x9x4x10
> > 'sequence', 
> 
> Ok, you can call this way, but this isn't the dimension that I was talking
> about.
> This is the number of atoms (after you compute the product).
> 
> >but the actual common useage seems to be to use
> > every element, but then again i could easily see an app that
> > although includes a given element, does not in fact use that
> > element in the program, ever, and of course the implication of
> > this is that an element missing altogether (only possible with 
> > a sequence) does not necessarily decrease the length because
> > the other sequences at the same level contain more elements:
> >   s={
> >       {1,2,3,4},
> >       {5,6,7}
> >     }
> > is still a 2x4 sequence.
> > 
> 
> If this is true, why *can't* I sum, subtract, multiply, etc, sequences with
> the same description ?
> The information of the structure of the sequence is lost in that
> representation.
> I think if you eliminate an atom of a retangular sequence (array sequence),
> it can't have the same description any longer.
> 
> > If you want to get more detailed, you might have to start enumerating
> > every element and returning a sequence that corresponds to that
> > sequence.  As with the above, this would be:
> >   m={4,3}
> > I guess this would simply be a sequence with the lengths of all 
> > first level sequences arranged in the same structure as the
> > original sequence, which would still have to be perused.
> > Again i would have to wonder about how useful this would be unless
> > the sequence isnt that big.  For example, "When do i need to know
> > the actual structure of the sequence in full?"
> > 
> 
> To serialize sequences, which is necessary in several situations: saving and
> restoring sequences to/from files, transmission of sequences via serial
> networks.
> 
> > Some applications would be interesting to hear about at this point.
> >
> 
> Any application that uses EDS, save and restore the full structures of
> sequences
> to/from the database.
>  
> > 
> > Al
> > 
> > E boa sorte com sua programacao Euphoria!
> 
> Obrigado. Para voce tambem!
> 
> > 
> > My bumper sticker: "I brake for LED's"
> > 
> 
> Regards,
>    Fernando

Hi Fernando,

Ok, since you seem to have shown that there would be some use lets
look a little farther...

First off, i made a mistake when i showed the possible detailed
dimensions for the sequence
  s={
      {1,2,3,4},
      {5,6,7}
    }

which should probably be more like this:
  m={2,{4,3}}

but does this even really work for all sequences?
Also notice this will get a little hard to read too, almost
as bad as trying to find the individual lengths of the original
sub sequences and if there even are any.

I did a math program a while back that used matrixes too, and what
i did to see if one matrix was compatible with another was to test
for the two dimensions (or only one if needed).  For
  s={{1,2},{3,4},{5,6}}
the two tests would be
  v=length(s)
and
  h=length(s[1])
With this info i was able to tell if a multiplication could
be done with either a vector or another matrix, or if the
maxtrix was square, or even if the matrix was really a vector.

Going to one more dimension, you probably have this being application
specific where you know in advance that all the sub sequences are
matixes and you have to test them as any other one, except first
you have to extract the individual matrix:
  s={{1,2},{3,4},{5,6}}
  MyMatrixes={s,s,s}
  for k=1 to length(MyMatrixes) do
    Dims=Test(MyMatrixes[k])
  end for

Compare two more complex matrixes:
  s={1,{2,3},4,5}
  t={1,2,{3,4},5}

How do we indicate the dims without repeating almost the
whole sequence?
 ms={1,2,1,1}
 mt={1,1,2,1}
perhaps?

Then the matrix might be even more complex:
  s={1,{2,{3,6}},4,5}
and dims:
  m={1,{1,{2}},1,1}
and reading or parsing the dims sequence might be almost as hard
as parsing the original sequence to query its dimensions.

On the other hand, if we do define the dims as the set of
max dims we might end up with something like this:
  m={4,{2{1}}}
which is at least a bit simpler than the original sequence.

BTW, by 1x2x3 that doesnt mean multiply all the numbers to get 6,
but rather shows the dimensions in the same way that the dimensions
of C arrays.  The numbers dont get multiplied but stay separate:
  (1,2,3)

Lastly, you'd have to think about how this is going to be 
implemented in the language.  During the build of any sequence
the dimension array would have to be maintained and this would
slow down the sequence a bit more too.  You'd have to see just
how much effect this would have on the overall speed.


Take care,
Al

E boa sorte com sua programacao Euphoria!


My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » goto parent     » topic index » view message » categorize

20. Re: Dimension of sequences

Igor Kachan wrote:
> 
> Hello Fernando!

Hello Igor!

> 
> Fernando Bauer wrote:
> > 
> > Igor Kachan wrote:
> > >
> 
> [snipped]
> 
> > > Ok, suppose, we now have all these new definitions -
> > > 'rectangular sequence' (RS), 'non-rectangular sequence' (NRS),
> > > 'dimension of RS', 'dimension of NRS'.
> > 
> > 'non-rectangular sequence' (NRS) = all sequences that aren't RS.
> > 'dimension of RS' = maximum depth of the sequence.
> > 'dimension of NRS' = that is the question!
> 
> Let's see the refman.doc file now.
> 
> Robert Craig wrotes:
> 
>  "Sequences can be nested to any depth, i.e. you can have sequences within
>   sequences within sequences and so on to any depth (until you run out of
>   memory)." 
> 
> I see Rob cares just about *maximum* depth here, so his definition
> of depht, documented in refman.doc, is strongly equivalent to your
> definition of 'dimension of RS'.
> Same thing, you just introduce some new term, synonym.
> 
> No?

Ok. We can use "depth" as synonym of "dimension" as you prefer. Then my question
is:
What is the depth of a NRS? How can I obtain it? For now, I only know the depth
of a RS.

> 
> Then, I do not think now that the 'rectangular' word is very
> good for your purpose, maybe, 'regular', as some short
> for 'regularly nested', is better.
> 
Ok. But I think "rectangular" is sligthly more precise than "regular", since I
could think that the following sequence is regular:
repeat({1,{1,1}},n) where n is any integer number. And that sequence is NRS.
Well, this is only a definition problem.

> > > So what?  What will we do with all these new terms, with
> > > all these new notions, with all these new concepts?
> > 
> > First of all, they facilitate our communication, since we don't have to say
> > that whole definition phrase.
> > Second, the terms RS and NRS can represent types in Euphoria, like vector or
> > matrix, and so can be checked.
> > Some algorithms can function with one and not with other type, etc..
> 
> Ok, but for now I do not see some real place for the 'dimension' word
> here. Length & Depth. These old good words are very clear in 
> the specific EU context. 

Ok. But the Depth concept is not so clear as it seems, since nobody defined what
it is for NRS yet.

[snipped]

> Regards,
> Igor Kachan
> kinz at peterlink.ru

Regards,
  Fernando

new topic     » goto parent     » topic index » view message » categorize

21. Re: Dimension of sequences

Fernando Bauer wrote:
> 
> Igor Kachan wrote:
> > 
> > > 'non-rectangular sequence' (NRS) = all sequences that aren't RS.
> > > 'dimension of RS' = maximum depth of the sequence.
> > > 'dimension of NRS' = that is the question!
> > 
> > Let's see the refman.doc file now.
> > 
> > Robert Craig writes:
> > 
> >  "Sequences can be nested to any depth, i.e. you can have sequences within
> >   sequences within sequences and so on to any depth (until you run out of
> >   memory)." 
> > 
> > I see Rob cares just about *maximum* depth here, so his definition
> > of depht, documented in refman.doc, is strongly equivalent to your
> > definition of 'dimension of RS'.
> > Same thing, you just introduce some new term, synonym.
> > 
> > No?
> 
> Ok. We can use "depth" as synonym of "dimension" as you prefer. Then my
> question
> is:
> What is the depth of a NRS? How can I obtain it? For now, I only know the
> depth
> of a RS.

Hello, Fernando!

OK, let's use just that MaxDepth() function by Ricardo,
it seems to work properly not only on 'simple' sequences,
but on any ones, it is recursive, and gives us that
pure maximum maximorum depth of any sequence.

See please:
global function MaxDepth(object o)
    integer n, x
    if atom(o) then
       return 0
    else
       n = 0
	for i = 1 to length(o) do
	    x = MaxDepth(o[i])
	    if x > n then
		n = x
	    end if
	end for
	return n + 1
    end if
end function -- it is function by Ricardo Forno, genfunc.e lib 

? MaxDepth({{{{}}},{},{{},{{{{{{{{{{{{}}}}}}}}}}}}},{{{{{{{{}}}}}}}}})
? MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{{1}}}}}}}}}}}}},{{{{{{{{1}}}}}}}}})

 
The maximum depth is 14, all right.
Count please the '{' signs, opening the deepest sequence,
to be sure.
It seems to be a good parameter for description of a sequence.
Now a sequence has its own second dimension, and may be
considered as some 2-dimensional object, which can contain
description of any-dimentional real and unreal objects -
vectors, matrixes, tensors, lists, arrays, trees, books,
images ... etc, etc.
Sequence itself really has two own dimensions - length and depth,
I think now. So attempts to give it some *single* dimension
may be not very productive.

> > Then, I do not think now that the 'rectangular' word is very
> > good for your purpose, maybe, 'regular', as some short
> > for 'regularly nested', is better.
> > 
> Ok. But I think "rectangular" is sligthly more precise than "regular", since
> I could think that the following sequence is regular:
> repeat({1,{1,1}},n) where n is any integer number. And that sequence is NRS.
> Well, this is only a definition problem.

Ricardo names these sequences as 'simple sequences'.

> > > > So what?  What will we do with all these new terms, with
> > > > all these new notions, with all these new concepts?
> > > 
> > > First of all, they facilitate our communication, since we don't have to
> > > say
> > > that whole definition phrase.
> > > Second, the terms RS and NRS can represent types in Euphoria, like vector
> > > or
> > > matrix, and so can be checked.
> > > Some algorithms can function with one and not with other type, etc..
> > 
> > Ok, but for now I do not see some real place for the 'dimension' word
> > here. Length & Depth. These old good words are very clear in 
> > the specific EU context. 
> 
> Ok. But the Depth concept is not so clear as it seems, since nobody defined
> what it is for NRS yet.

OK, now we can calculate that Depth (good, let's name the maximum depth
as Depth) with Ricardo's function.

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

22. Re: Dimension of sequences

Igor Kachan wrote:
> 
> Fernando Bauer wrote:
> > 
> > Igor Kachan wrote:
> > > 
> > > > 'non-rectangular sequence' (NRS) = all sequences that aren't RS.
> > > > 'dimension of RS' = maximum depth of the sequence.
> > > > 'dimension of NRS' = that is the question!
> > > 
> > > Let's see the refman.doc file now.
> > > 
> > > Robert Craig writes:
> > > 
> > >  "Sequences can be nested to any depth, i.e. you can have sequences within
> > >   sequences within sequences and so on to any depth (until you run out of
> > >   memory)." 
> > > 
> > > I see Rob cares just about *maximum* depth here, so his definition
> > > of depht, documented in refman.doc, is strongly equivalent to your
> > > definition of 'dimension of RS'.
> > > Same thing, you just introduce some new term, synonym.
> > > 
> > > No?
> > 
> > Ok. We can use "depth" as synonym of "dimension" as you prefer. Then my
> > question
> > is:
> > What is the depth of a NRS? How can I obtain it? For now, I only know the
> > depth
> > of a RS.
> 
> Hello, Fernando!
> 
> OK, let's use just that MaxDepth() function by Ricardo,
> it seems to work properly not only on 'simple' sequences,
> but on any ones, it is recursive, and gives us that
> pure maximum maximorum depth of any sequence.
> 
> See please:
> }}}
<eucode>
> global function MaxDepth(object o)
>     integer n, x
>     if atom(o) then
>        return 0
>     else
>        n = 0
> 	for i = 1 to length(o) do
> 	    x = MaxDepth(o[i])
> 	    if x > n then
> 		n = x
> 	    end if
> 	end for
> 	return n + 1
>     end if
> end function -- it is function by Ricardo Forno, genfunc.e lib 
> 
> ? MaxDepth({{{{}}},{},{{},{{{{{{{{{{{{}}}}}}}}}}}}},{{{{{{{{}}}}}}}}})
> ? MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{{1}}}}}}}}}}}}},{{{{{{{{1}}}}}}}}})
> </eucode>
{{{
 
> The maximum depth is 14, all right.
> Count please the '{' signs, opening the deepest sequence,
> to be sure.
> It seems to be a good parameter for description of a sequence.
> Now a sequence has its own second dimension, and may be
> considered as some 2-dimensional object, which can contain
> description of any-dimentional real and unreal objects -
> vectors, matrixes, tensors, lists, arrays, trees, books,
> images ... etc, etc.
> Sequence itself really has two own dimensions - length and depth,
> I think now. So attempts to give it some *single* dimension
> may be not very productive.
> 
> > > Then, I do not think now that the 'rectangular' word is very
> > > good for your purpose, maybe, 'regular', as some short
> > > for 'regularly nested', is better.
> > > 
> > Ok. But I think "rectangular" is sligthly more precise than "regular", since
> > I could think that the following sequence is regular:
> > repeat({1,{1,1}},n) where n is any integer number. And that sequence is NRS.
> > Well, this is only a definition problem.
> 
> Ricardo names these sequences as 'simple sequences'.
> 
> > > > > So what?  What will we do with all these new terms, with
> > > > > all these new notions, with all these new concepts?
> > > > 
> > > > First of all, they facilitate our communication, since we don't have to
> > > > say
> > > > that whole definition phrase.
> > > > Second, the terms RS and NRS can represent types in Euphoria, like
> > > > vector or
> > > > matrix, and so can be checked.
> > > > Some algorithms can function with one and not with other type, etc..
> > > 
> > > Ok, but for now I do not see some real place for the 'dimension' word
> > > here. Length & Depth. These old good words are very clear in 
> > > the specific EU context. 
> > 
> > Ok. But the Depth concept is not so clear as it seems, since nobody defined
> > what it is for NRS yet.
> 
> OK, now we can calculate that Depth (good, let's name the maximum depth
> as Depth) with Ricardo's function.
> 
> Regards,
> Igor Kachan
> kinz at peterlink.ru

Eu sequences model trees with atomic labels allowed, and mandatory, only on leaf
nodes.
For instance, {1,{2,3},4} is the same as
root -> node1, node2, node3
node1: 1
node2 -> node4, node5
node3: 4
node4: 2
node5: 3

with hopefully obvious meaning of such a description of a tree.

Now google for some litterature on trees. You'lll see that most specific form of
trees define their own dimension, depth or height.
Concepts that can be defined always include:
* the depth of a tree, which is the height of its root;
* the depth of a node in a tree, which is its distance to the root (ie the
number of edges to go from the node to the root);
* the height of a node, which is the length of the longest path from the node to
a leaf node in its subtree.

The length of a sequence is simply the number of children of the root. This has
not much importance in tree theory, but is essential for _some_ sorts of them,
namely strings of arbitrary things, among which trees. It has been chosen to
build this special notion in the language, and to leave out the more general
ones. Other trees will have their own notion of depth or somsuch, which depends
on the speifics of the layout an uses of the given family of trees.
So yes, sequences don't have a single dimension, although some sorts of
sequences do have a more intinsic kind of dimension. Strings are an example, for
which the length is the "natural" dimension.

CChris

new topic     » goto parent     » topic index » view message » categorize

23. Re: Dimension of sequences

CChris wrote:
> 
> Igor Kachan wrote:
> > 
> > Fernando Bauer wrote:
> > > 
> > > Igor Kachan wrote:
> > > > 
> > > > > 'non-rectangular sequence' (NRS) = all sequences that aren't RS.
> > > > > 'dimension of RS' = maximum depth of the sequence.
> > > > > 'dimension of NRS' = that is the question!
> > > > 
> > > > Let's see the refman.doc file now.
> > > > 
> > > > Robert Craig writes:
> > > > 
> > > >  "Sequences can be nested to any depth, i.e. you can have sequences
> > > >  within
> > > >   sequences within sequences and so on to any depth (until you run out
> > > >   of
> > > >   memory)." 
> > > > 
> > > > I see Rob cares just about *maximum* depth here, so his definition
> > > > of depht, documented in refman.doc, is strongly equivalent to your
> > > > definition of 'dimension of RS'.
> > > > Same thing, you just introduce some new term, synonym.
> > > > 
> > > > No?
> > > 
> > > Ok. We can use "depth" as synonym of "dimension" as you prefer. Then my
> > > question
> > > is:
> > > What is the depth of a NRS? How can I obtain it? For now, I only know the
> > > depth
> > > of a RS.
> > 
> > Hello, Fernando!
> > 
> > OK, let's use just that MaxDepth() function by Ricardo,
> > it seems to work properly not only on 'simple' sequences,
> > but on any ones, it is recursive, and gives us that
> > pure maximum maximorum depth of any sequence.
> > 
> > See please:
> > }}}
<eucode>
> > global function MaxDepth(object o)
> >     integer n, x
> >     if atom(o) then
> >        return 0
> >     else
> >        n = 0
> > 	for i = 1 to length(o) do
> > 	    x = MaxDepth(o[i])
> > 	    if x > n then
> > 		n = x
> > 	    end if
> > 	end for
> > 	return n + 1
> >     end if
> > end function -- it is function by Ricardo Forno, genfunc.e lib 
> > 
> > ? MaxDepth({{{{}}},{},{{},{{{{{{{{{{{{}}}}}}}}}}}}},{{{{{{{{}}}}}}}}})
> > ? MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{{1}}}}}}}}}}}}},{{{{{{{{1}}}}}}}}})
> > </eucode>
{{{
 
> > The maximum depth is 14, all right.
> > Count please the '{' signs, opening the deepest sequence,
> > to be sure.
> > It seems to be a good parameter for description of a sequence.
> > Now a sequence has its own second dimension, and may be
> > considered as some 2-dimensional object, which can contain
> > description of any-dimentional real and unreal objects -
> > vectors, matrixes, tensors, lists, arrays, trees, books,
> > images ... etc, etc.
> > Sequence itself really has two own dimensions - length and depth,
> > I think now. So attempts to give it some *single* dimension
> > may be not very productive.
> > 
> > > > Then, I do not think now that the 'rectangular' word is very
> > > > good for your purpose, maybe, 'regular', as some short
> > > > for 'regularly nested', is better.
> > > > 
> > > Ok. But I think "rectangular" is sligthly more precise than "regular",
> > > since
> > > I could think that the following sequence is regular:
> > > repeat({1,{1,1}},n) where n is any integer number. And that sequence is
> > > NRS.
> > > Well, this is only a definition problem.
> > 
> > Ricardo names these sequences as 'simple sequences'.
> > 
> > > > > > So what?  What will we do with all these new terms, with
> > > > > > all these new notions, with all these new concepts?
> > > > > 
> > > > > First of all, they facilitate our communication, since we don't have
> > > > > to say
> > > > > that whole definition phrase.
> > > > > Second, the terms RS and NRS can represent types in Euphoria, like
> > > > > vector
> or</font></i>
> > > > > matrix, and so can be checked.
> > > > > Some algorithms can function with one and not with other type, etc..
> > > > 
> > > > Ok, but for now I do not see some real place for the 'dimension' word
> > > > here. Length & Depth. These old good words are very clear in 
> > > > the specific EU context. 
> > > 
> > > Ok. But the Depth concept is not so clear as it seems, since nobody
> > > defined
> > > what it is for NRS yet.
> > 
> > OK, now we can calculate that Depth (good, let's name the maximum depth
> > as Depth) with Ricardo's function.
> > 
> > Regards,
> > Igor Kachan
> > kinz at peterlink.ru
> 
> Eu sequences model trees with atomic labels allowed, and mandatory, only on
> leaf nodes.
> For instance, {1,{2,3},4} is the same as
> root -> node1, node2, node3
> node1: 1
> node2 -> node4, node5
> node3: 4
> node4: 2
> node5: 3
> 
> with hopefully obvious meaning of such a description of a tree.
> 
> Now google for some litterature on trees. You'lll see that most specific form
> of trees define their own dimension, depth or height.
> Concepts that can be defined always include:
> * the depth of a tree, which is the height of its root;

OK, I like this theory very much as math at all, some good
thing to get crazy, if you do not have or do not like vodka, sorry.  smile

Why do they need these topsyturvy trees, Cris?

I can understand depth of a root and height of a tree,
but not on the contrary.
  
> * the depth of a node in a tree, which is its distance to the root (ie the
> number
> of edges to go from the node to the root);
> * the height of a node, which is the length of the longest path from the node
> to a leaf node in its subtree.

Same thing, very-very demonstrative concept.  smile

> The length of a sequence is simply the number of children of the root. This
> has not much importance in tree theory, but is essential for _some_ sorts of
> them, namely strings of arbitrary things, among which trees. It has been
> chosen
> to build this special notion in the language, and to leave out the more
> general
> ones. Other trees will have their own notion of depth or somsuch, which
> depends
> on the speifics of the layout an uses of the given family of trees.
> So yes, sequences don't have a single dimension, although some sorts of
> sequences
> do have a more intinsic kind of dimension. Strings are an example, for which
> the length is the "natural" dimension.

OK, but depth of a string exists and is 1. So sequence seems to be
some 2-dimensional object anyway and always.

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

24. Re: Dimension of sequences

Igor Kachan wrote:
> 
> CChris wrote:
> > 
> > Igor Kachan wrote:
> > > 
> > > Fernando Bauer wrote:
> > > > 
> > > > Igor Kachan wrote:
> > > > > 
> > > > > > 'non-rectangular sequence' (NRS) = all sequences that aren't RS.
> > > > > > 'dimension of RS' = maximum depth of the sequence.
> > > > > > 'dimension of NRS' = that is the question!
> > > > > 
> > > > > Let's see the refman.doc file now.
> > > > > 
> > > > > Robert Craig writes:
> > > > > 
> > > > >  "Sequences can be nested to any depth, i.e. you can have sequences
> > > > >  within
> > > > >   sequences within sequences and so on to any depth (until you run out
> > > > >   of
> > > > >   memory)." 
> > > > > 
> > > > > I see Rob cares just about *maximum* depth here, so his definition
> > > > > of depht, documented in refman.doc, is strongly equivalent to your
> > > > > definition of 'dimension of RS'.
> > > > > Same thing, you just introduce some new term, synonym.
> > > > > 
> > > > > No?
> > > > 
> > > > Ok. We can use "depth" as synonym of "dimension" as you prefer. Then my
> > > > question
> > > > is:
> > > > What is the depth of a NRS? How can I obtain it? For now, I only know
> > > > the depth
> > > > of a RS.
> > > 
> > > Hello, Fernando!
> > > 
> > > OK, let's use just that MaxDepth() function by Ricardo,
> > > it seems to work properly not only on 'simple' sequences,
> > > but on any ones, it is recursive, and gives us that
> > > pure maximum maximorum depth of any sequence.
> > > 
> > > See please:
> > > }}}
<eucode>
> > > global function MaxDepth(object o)
> > >     integer n, x
> > >     if atom(o) then
> > >        return 0
> > >     else
> > >        n = 0
> > > 	for i = 1 to length(o) do
> > > 	    x = MaxDepth(o[i])
> > > 	    if x > n then
> > > 		n = x
> > > 	    end if
> > > 	end for
> > > 	return n + 1
> > >     end if
> > > end function -- it is function by Ricardo Forno, genfunc.e lib 
> > > 
> > > ? MaxDepth({{{{}}},{},{{},{{{{{{{{{{{{}}}}}}}}}}}}},{{{{{{{{}}}}}}}}})
> > > ?
> > > MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{{1}}}}}}}}}}}}},{{{{{{{{1}}}}}}}}})
> > > </eucode>
{{{
 
> > > The maximum depth is 14, all right.
> > > Count please the '{' signs, opening the deepest sequence,
> > > to be sure.
> > > It seems to be a good parameter for description of a sequence.
> > > Now a sequence has its own second dimension, and may be
> > > considered as some 2-dimensional object, which can contain
> > > description of any-dimentional real and unreal objects -
> > > vectors, matrixes, tensors, lists, arrays, trees, books,
> > > images ... etc, etc.
> > > Sequence itself really has two own dimensions - length and depth,
> > > I think now. So attempts to give it some *single* dimension
> > > may be not very productive.
> > > 
> > > > > Then, I do not think now that the 'rectangular' word is very
> > > > > good for your purpose, maybe, 'regular', as some short
> > > > > for 'regularly nested', is better.
> > > > > 
> > > > Ok. But I think "rectangular" is sligthly more precise than "regular",
> > > > since
> > > > I could think that the following sequence is regular:
> > > > repeat({1,{1,1}},n) where n is any integer number. And that sequence is
> > > > NRS.
> > > > Well, this is only a definition problem.
> > > 
> > > Ricardo names these sequences as 'simple sequences'.
> > > 
> > > > > > > So what?  What will we do with all these new terms, with
> > > > > > > all these new notions, with all these new concepts?
> > > > > > 
> > > > > > First of all, they facilitate our communication, since we don't have
> > > > > > to
> say</font></i>
> > > > > > that whole definition phrase.
> > > > > > Second, the terms RS and NRS can represent types in Euphoria, like
> > > > > > vector
> > or</font></i>
> > > > > > matrix, and so can be checked.
> > > > > > Some algorithms can function with one and not with other type, etc..
> > > > > 
> > > > > Ok, but for now I do not see some real place for the 'dimension' word
> > > > > here. Length & Depth. These old good words are very clear in 
> > > > > the specific EU context. 
> > > > 
> > > > Ok. But the Depth concept is not so clear as it seems, since nobody
> > > > defined
> > > > what it is for NRS yet.
> > > 
> > > OK, now we can calculate that Depth (good, let's name the maximum depth
> > > as Depth) with Ricardo's function.
> > > 
> > > Regards,
> > > Igor Kachan
> > > kinz at peterlink.ru
> > 
> > Eu sequences model trees with atomic labels allowed, and mandatory, only on
> > leaf nodes.
> > For instance, {1,{2,3},4} is the same as
> > root -> node1, node2, node3
> > node1: 1
> > node2 -> node4, node5
> > node3: 4
> > node4: 2
> > node5: 3
> > 
> > with hopefully obvious meaning of such a description of a tree.
> > 
> > Now google for some litterature on trees. You'lll see that most specific
> > form
> > of trees define their own dimension, depth or height.
> > Concepts that can be defined always include:
> > * the depth of a tree, which is the height of its root;
> 
> OK, I like this theory very much as math at all, some good
> thing to get crazy, if you do not have or do not like vodka, sorry.  smile
> 
> Why do they need these topsyturvy trees, Cris?
> 

They are the most common objects in decision theory (think of a chess computer
program) or in searching/retrieval problems (remember the contest Derek had
hosted a couple years ago?). And many others, but hese may be the most obvious.

> I can understand depth of a root and height of a tree,
> but not on the contrary.
> 

This has to do with our habit to read a sheet of paper from top to bottom, which
is why the root is usually on top smile
  
> > * the depth of a node in a tree, which is its distance to the root (ie the
> > number
> > of edges to go from the node to the root);
> > * the height of a node, which is the length of the longest path from the
> > node
> > to a leaf node in its subtree.
> 
> Same thing, very-very demonstrative concept.  smile
> 
> > The length of a sequence is simply the number of children of the root. This
> > has not much importance in tree theory, but is essential for _some_ sorts of
> > them, namely strings of arbitrary things, among which trees. It has been
> > chosen
> > to build this special notion in the language, and to leave out the more
> > general
> > ones. Other trees will have their own notion of depth or somsuch, which
> > depends
> > on the speifics of the layout an uses of the given family of trees.
> > So yes, sequences don't have a single dimension, although some sorts of
> > sequences
> > do have a more intinsic kind of dimension. Strings are an example, for which
> > the length is the "natural" dimension.
> 
> OK, but depth of a string exists and is 1. So sequence seems to be
> some 2-dimensional object anyway and always.
> 
2,3,27,... depending on the exact notion of dimension you need. A sequence 
whose elements may freely be atoms or not has dimension 1, and strings are
special cases of them. Otherwise, as I said, the concept is not uniquely defined,
and the value for the dimension is always 2 or more.

CChris


> Regards,
> Igor Kachan
> kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

25. Re: Dimension of sequences

CChris wrote:
> 
> Igor Kachan wrote:
> > 
> > CChris wrote:
> > > 
> > > Igor Kachan wrote:
> > > > 
> > > > Fernando Bauer wrote:
> > > > > 
> > > > > Igor Kachan wrote:
> > > > > >

[snip]
 
> > > Eu sequences model trees with atomic labels allowed, and mandatory, only
> > > on
> > > leaf nodes.
> > > For instance, {1,{2,3},4} is the same as
> > > root -> node1, node2, node3
> > > node1: 1
> > > node2 -> node4, node5
> > > node3: 4
> > > node4: 2
> > > node5: 3
> > > 
> > > with hopefully obvious meaning of such a description of a tree.
> > > 
> > > Now google for some litterature on trees. You'lll see that most specific
> > > form
> > > of trees define their own dimension, depth or height.
> > > Concepts that can be defined always include:
> > > * the depth of a tree, which is the height of its root;
> > 
> > OK, I like this theory very much as math at all, some good
> > thing to get crazy, if you do not have or do not like vodka, sorry.  smile
> > 
> > Why do they need these topsyturvy trees, Cris?
> > 
> 
> They are the most common objects in decision theory (think of a chess computer
> program) or in searching/retrieval problems (remember the contest Derek had
> hosted a couple years ago?). And many others, but hese may be the most
> obvious.
> 
> > I can understand depth of a root and height of a tree,
> > but not on the contrary.
> > 
> 
> This has to do with our habit to read a sheet of paper from top to bottom,
> which is why the root is usually on
> top smile
>   
> > > * the depth of a node in a tree, which is its distance to the root (ie the
> > > number
> > > of edges to go from the node to the root);
> > > * the height of a node, which is the length of the longest path from the
> > > node
> > > to a leaf node in its subtree.
> > 
> > Same thing, very-very demonstrative concept.  smile
> > 
> > > The length of a sequence is simply the number of children of the root.
> > > This
> > > has not much importance in tree theory, but is essential for _some_ sorts
> > > of
> > > them, namely strings of arbitrary things, among which trees. It has been
> > > chosen
> > > to build this special notion in the language, and to leave out the more
> > > general
> > > ones. Other trees will have their own notion of depth or somsuch, which
> > > depends
> > > on the speifics of the layout an uses of the given family of trees.
> > > So yes, sequences don't have a single dimension, although some sorts of
> > > sequences
> > > do have a more intinsic kind of dimension. Strings are an example, for
> > > which
> > > the length is the "natural" dimension.
> > 
> > OK, but depth of a string exists and is 1. So sequence seems to be
> > some 2-dimensional object anyway and always.
> > 
> 2,3,27,... depending on the exact notion of dimension you need. A sequence 
> whose elements may freely be atoms or not has dimension 1, and strings are
> special
> cases of them. Otherwise, as I said, the concept is not uniquely defined, and
> the value for the dimension is always 2 or more.

Here, in Russia, we use 2 words for these things:
"izmerenie" -- it is just single "dimension"
and
"razmernost'" --  it is common number of dimensions, "dimensionality".
So I'd prefer to say that any sequence has dimensionality 2,
and its dimensions are named as "length" and "depth".
But this 2-dimensional sequence can describe and contain
multi-dimensional objects.
Anyway, in machine memory, it is just 1-dimensional *range* of
addresses.

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

26. Re: Dimension of sequences

Igor Kachan wrote:
> 
> CChris wrote:
> > 
> > Igor Kachan wrote:
> > > 
> > > CChris wrote:
> > > > 
> > > > Igor Kachan wrote:
> > > > > 
> > > > > Fernando Bauer wrote:
> > > > > > 
> > > > > > Igor Kachan wrote:
> > > > > > >
> 
> [snip]
>  
> > > > Eu sequences model trees with atomic labels allowed, and mandatory, only
> > > > on
> > > > leaf nodes.
> > > > For instance, {1,{2,3},4} is the same as
> > > > root -> node1, node2, node3
> > > > node1: 1
> > > > node2 -> node4, node5
> > > > node3: 4
> > > > node4: 2
> > > > node5: 3
> > > > 
> > > > with hopefully obvious meaning of such a description of a tree.
> > > > 
> > > > Now google for some litterature on trees. You'lll see that most specific
> > > > form
> > > > of trees define their own dimension, depth or height.
> > > > Concepts that can be defined always include:
> > > > * the depth of a tree, which is the height of its root;
> > > 
> > > OK, I like this theory very much as math at all, some good
> > > thing to get crazy, if you do not have or do not like vodka, sorry.  smile
> > > 
> > > Why do they need these topsyturvy trees, Cris?
> > > 
> > 
> > They are the most common objects in decision theory (think of a chess
> > computer
> > program) or in searching/retrieval problems (remember the contest Derek had
> > hosted a couple years ago?). And many others, but hese may be the most
> > obvious.
> > 
> > > I can understand depth of a root and height of a tree,
> > > but not on the contrary.
> > > 
> > 
> > This has to do with our habit to read a sheet of paper from top to bottom,
> which is why the root is usually on</font></i>
> > top smile
> >   
> > > > * the depth of a node in a tree, which is its distance to the root (ie
> > > > the
> number</font></i>
> > > > of edges to go from the node to the root);
> > > > * the height of a node, which is the length of the longest path from the
> > > > node
> > > > to a leaf node in its subtree.
> > > 
> > > Same thing, very-very demonstrative concept.  smile
> > > 
> > > > The length of a sequence is simply the number of children of the root.
> > > > This
> > > > has not much importance in tree theory, but is essential for _some_
> > > > sorts of
> > > > them, namely strings of arbitrary things, among which trees. It has been
> > > > chosen
> > > > to build this special notion in the language, and to leave out the more
> > > > general
> > > > ones. Other trees will have their own notion of depth or somsuch, which
> > > > depends
> > > > on the speifics of the layout an uses of the given family of trees.
> > > > So yes, sequences don't have a single dimension, although some sorts of
> > > > sequences
> > > > do have a more intinsic kind of dimension. Strings are an example, for
> > > > which
> > > > the length is the "natural" dimension.
> > > 
> > > OK, but depth of a string exists and is 1. So sequence seems to be
> > > some 2-dimensional object anyway and always.
> > > 
> > 2,3,27,... depending on the exact notion of dimension you need. A sequence 
> > whose elements may freely be atoms or not has dimension 1, and strings are
> > special
> > cases of them. Otherwise, as I said, the concept is not uniquely defined,
> > and
> > the value for the dimension is always 2 or more.
> 
> Here, in Russia, we use 2 words for these things:
> "izmerenie" -- it is just single "dimension"
> and
> "razmernost'" --  it is common number of dimensions, "dimensionality".
> So I'd prefer to say that any sequence has dimensionality 2,
> and its dimensions are named as "length" and "depth".

This looks ok to me, except that the length is really a very special case.

> But this 2-dimensional sequence can describe and contain
> multi-dimensional objects.
> Anyway, in machine memory, it is just 1-dimensional *range* of
> addresses.
> 

Exactly. So the "length" of a general sequence would be the total number of
nodes it holds. The current definition of length() is very adequate for linear
trees - one root with length(s) children, the nature of which is not taken into
account -. For general trees, however, it barely makes sense.

CChris

> Regards,
> Igor Kachan
> kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

27. Re: Dimension of sequences

CChris wrote:
> 
> Igor Kachan wrote:
> > 
> > CChris wrote:
> > > 
> > > Igor Kachan wrote:
> > > > 
> > > > CChris wrote:
> > > > > 
> > > > > Igor Kachan wrote:
> > > > > > 
> > > > > > Fernando Bauer wrote:
> > > > > > > 
> > > > > > > Igor Kachan wrote:
> > > > > > > >
> > 
> > [snip]
> >  
> > > > > Eu sequences model trees with atomic labels allowed, and mandatory,
> > > > > only
> on</font></i>
> > > > > leaf nodes.
> > > > > For instance, {1,{2,3},4} is the same as
> > > > > root -> node1, node2, node3
> > > > > node1: 1
> > > > > node2 -> node4, node5
> > > > > node3: 4
> > > > > node4: 2
> > > > > node5: 3
> > > > > 
> > > > > with hopefully obvious meaning of such a description of a tree.
> > > > > 
> > > > > Now google for some litterature on trees. You'lll see that most
> > > > > specific
> form</font></i>
> > > > > of trees define their own dimension, depth or height.
> > > > > Concepts that can be defined always include:
> > > > > * the depth of a tree, which is the height of its root;
> > > > 
> > > > OK, I like this theory very much as math at all, some good
> > > > thing to get crazy, if you do not have or do not like vodka, sorry.  smile
> > > > 
> > > > Why do they need these topsyturvy trees, Cris?
> > > > 
> > > 
> > > They are the most common objects in decision theory (think of a chess
> > > computer
> > > program) or in searching/retrieval problems (remember the contest Derek
> > > had
> > > hosted a couple years ago?). And many others, but hese may be the most
> > > obvious.
> > > 
> > > > I can understand depth of a root and height of a tree,
> > > > but not on the contrary.
> > > > 
> > > 
> > > This has to do with our habit to read a sheet of paper from top to bottom,
> > which is why the root is usually on</font></i>
> > > top smile
> > >   
> > > > > * the depth of a node in a tree, which is its distance to the root (ie
> > > > > the
> > number</font></i>
> > > > > of edges to go from the node to the root);
> > > > > * the height of a node, which is the length of the longest path from
> > > > > the
> node</font></i>
> > > > > to a leaf node in its subtree.
> > > > 
> > > > Same thing, very-very demonstrative concept.  smile
> > > > 
> > > > > The length of a sequence is simply the number of children of the root.
> > > > > This
> > > > > has not much importance in tree theory, but is essential for _some_
> > > > > sorts
> of</font></i>
> > > > > them, namely strings of arbitrary things, among which trees. It has
> > > > > been
> chosen</font></i>
> > > > > to build this special notion in the language, and to leave out the
> > > > > more
> general</font></i>
> > > > > ones. Other trees will have their own notion of depth or somsuch,
> > > > > which
> depends</font></i>
> > > > > on the speifics of the layout an uses of the given family of trees.
> > > > > So yes, sequences don't have a single dimension, although some sorts
> > > > > of
> sequences</font></i>
> > > > > do have a more intinsic kind of dimension. Strings are an example, for
> > > > > which
> > > > > the length is the "natural" dimension.
> > > > 
> > > > OK, but depth of a string exists and is 1. So sequence seems to be
> > > > some 2-dimensional object anyway and always.
> > > > 
> > > 2,3,27,... depending on the exact notion of dimension you need. A sequence
> > >
> > > whose elements may freely be atoms or not has dimension 1, and strings are
> > > special
> > > cases of them. Otherwise, as I said, the concept is not uniquely defined,
> > > and
> > > the value for the dimension is always 2 or more.
> > 
> > Here, in Russia, we use 2 words for these things:
> > "izmerenie" -- it is just single "dimension"
> > and
> > "razmernost'" --  it is common number of dimensions, "dimensionality".
> > So I'd prefer to say that any sequence has dimensionality 2,
> > and its dimensions are named as "length" and "depth".
> 
> This looks ok to me, except that the length is really a very special case.
> 
> > But this 2-dimensional sequence can describe and contain
> > multi-dimensional objects.
> > Anyway, in machine memory, it is just 1-dimensional *range* of
> > addresses.
> > 
> 
> Exactly. So the "length" of a general sequence would be the total number of
> nodes it holds. The current definition of length() is very adequate for linear
> trees - one root with length(s) children, the nature of which is not taken
> into
> account -. For general trees, however, it barely makes sense.
 
OK, let's see what is every atom in some complicated sequence.
I think, that every atom can be, so to say, one of the dimensions
or coordinates of some multi-dimensional object, described by that
given sequence.
So the common number of atoms of some given sequence is very
interesting thing - it gives us sometimes the number of
dimensions of the described object! 
We can name this parameter with some suitable word to
characterize, so to say, a volume of a sequence, or its
capacity or something.
It is not the sum of all lengths, it is number of atoms,
and a function for calculation of this number may be
very simple.
 
Well, I'll be out of town several days, sorry...

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

28. Re: Dimension of sequences

Hello Igor!

Igor Kachan wrote:
> 
> Fernando Bauer wrote:
> > 
> > Igor Kachan wrote:
> > > 
> > > > 'non-rectangular sequence' (NRS) = all sequences that aren't RS.
> > > > 'dimension of RS' = maximum depth of the sequence.
> > > > 'dimension of NRS' = that is the question!
> > > 
> > > Let's see the refman.doc file now.
> > > 
> > > Robert Craig writes:
> > > 
> > >  "Sequences can be nested to any depth, i.e. you can have sequences within
> > >   sequences within sequences and so on to any depth (until you run out of
> > >   memory)." 
> > > 
> > > I see Rob cares just about *maximum* depth here, so his definition
> > > of depht, documented in refman.doc, is strongly equivalent to your
> > > definition of 'dimension of RS'.
> > > Same thing, you just introduce some new term, synonym.
> > > 
> > > No?
> > 
> > Ok. We can use "depth" as synonym of "dimension" as you prefer. Then my
> > question
> > is:
> > What is the depth of a NRS? How can I obtain it? For now, I only know the
> > depth
> > of a RS.
> 
> Hello, Fernando!
> 
> OK, let's use just that MaxDepth() function by Ricardo,
> it seems to work properly not only on 'simple' sequences,
> but on any ones, it is recursive, and gives us that
> pure maximum maximorum depth of any sequence.
Ok. This is a possibility, and was the first reply posted by CChris to define
the dimension of NRS.
But, for now, I'm not sure.
> 
> See please:
> }}}
<eucode>
> global function MaxDepth(object o)
>     integer n, x
>     if atom(o) then
>        return 0
>     else
>        n = 0
> 	for i = 1 to length(o) do
> 	    x = MaxDepth(o[i])
> 	    if x > n then
> 		n = x
> 	    end if
> 	end for
> 	return n + 1
>     end if
> end function -- it is function by Ricardo Forno, genfunc.e lib 
> 
> ? MaxDepth({{{{}}},{},{{},{{{{{{{{{{{{}}}}}}}}}}}}},{{{{{{{{}}}}}}}}})
> ? MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{{1}}}}}}}}}}}}},{{{{{{{{1}}}}}}}}})
> </eucode>
{{{
 
> The maximum depth is 14, all right.
> Count please the '{' signs, opening the deepest sequence,
> to be sure.
> It seems to be a good parameter for description of a sequence.
> Now a sequence has its own second dimension, and may be
> considered as some 2-dimensional object, which can contain
> description of any-dimentional real and unreal objects -
> vectors, matrixes, tensors, lists, arrays, trees, books,
> images ... etc, etc.
> Sequence itself really has two own dimensions - length and depth,
> I think now. So attempts to give it some *single* dimension
> may be not very productive.

Just to make clear, this concept of 2-dimensional object, or dimensionality 2 as
you define, is a higher abstract concept, and is not my original definition of
"dimension" which is your Depth.

> 
> > > Then, I do not think now that the 'rectangular' word is very
> > > good for your purpose, maybe, 'regular', as some short
> > > for 'regularly nested', is better.
> > > 
> > Ok. But I think "rectangular" is sligthly more precise than "regular", since
> > I could think that the following sequence is regular:
> > repeat({1,{1,1}},n) where n is any integer number. And that sequence is NRS.
> > Well, this is only a definition problem.
> 
> Ricardo names these sequences as 'simple sequences'.

No. Ricardo defines "simple sequences" as "sequences formed only by atoms"
(depth=1). The sequence repeat({1,{1,1}},n) has sub-sequences therefore it's not
a simple sequence.
A simple sequence is always a RS, but not always a RS is a simple sequence.

> 
> > > > > So what?  What will we do with all these new terms, with
> > > > > all these new notions, with all these new concepts?
> > > > 
> > > > First of all, they facilitate our communication, since we don't have to
> > > > say
> > > > that whole definition phrase.
> > > > Second, the terms RS and NRS can represent types in Euphoria, like
> > > > vector or
> > > > matrix, and so can be checked.
> > > > Some algorithms can function with one and not with other type, etc..
> > > 
> > > Ok, but for now I do not see some real place for the 'dimension' word
> > > here. Length & Depth. These old good words are very clear in 
> > > the specific EU context. 
> > 
> > Ok. But the Depth concept is not so clear as it seems, since nobody defined
> > what it is for NRS yet.
> 
> OK, now we can calculate that Depth (good, let's name the maximum depth
> as Depth) with Ricardo's function.
But then think about this (bad) analogy:
If someone ask you about the depth of the Pacific Ocean, then you would say the
maximum depth of it, since you have defined this way. However we know that its
depth depends on the place.
(notice that this depth is not our discussed concept of Depth).
> 
> Regards,
> Igor Kachan
> kinz at peterlink.ru

Regards,
   Fernando

new topic     » goto parent     » topic index » view message » categorize

29. Re: Dimension of sequences

Igor Kachan wrote:
> 
> CChris wrote:
> > 
> > Igor Kachan wrote:
> > > 
> > > CChris wrote:
> > > > 
> > > > Igor Kachan wrote:
> > > > > 
> > > > > CChris wrote:
> > > > > > 
> > > > > > Igor Kachan wrote:
> > > > > > > 
> > > > > > > Fernando Bauer wrote:
> > > > > > > > 
> > > > > > > > Igor Kachan wrote:
> > > > > > > > >
> > > 
> > > [snip]
> > >  
> > > > > > Eu sequences model trees with atomic labels allowed, and mandatory,
> > > > > > only
> > on</font></i>
> > > > > > leaf nodes.
> > > > > > For instance, {1,{2,3},4} is the same as
> > > > > > root -> node1, node2, node3
> > > > > > node1: 1
> > > > > > node2 -> node4, node5
> > > > > > node3: 4
> > > > > > node4: 2
> > > > > > node5: 3
> > > > > > 
> > > > > > with hopefully obvious meaning of such a description of a tree.
> > > > > > 
> > > > > > Now google for some litterature on trees. You'lll see that most
> > > > > > specific
> > form</font></i>
> > > > > > of trees define their own dimension, depth or height.
> > > > > > Concepts that can be defined always include:
> > > > > > * the depth of a tree, which is the height of its root;
> > > > > 
> > > > > OK, I like this theory very much as math at all, some good
> > > > > thing to get crazy, if you do not have or do not like vodka, sorry. 
> > > > > smile
> > > > > 
> > > > > Why do they need these topsyturvy trees, Cris?
> > > > > 
> > > > 
> > > > They are the most common objects in decision theory (think of a chess
> > > > computer
> > > > program) or in searching/retrieval problems (remember the contest Derek
> > > > had
> > > > hosted a couple years ago?). And many others, but hese may be the most
> > > > obvious.
> > > > 
> > > > > I can understand depth of a root and height of a tree,
> > > > > but not on the contrary.
> > > > > 
> > > > 
> > > > This has to do with our habit to read a sheet of paper from top to
> > > > bottom,
> > > which is why the root is usually on</font></i>
> > > > top smile
> > > >   
> > > > > > * the depth of a node in a tree, which is its distance to the root
> > > > > > (ie
> the</font></i>
> > > number</font></i>
> > > > > > of edges to go from the node to the root);
> > > > > > * the height of a node, which is the length of the longest path from
> > > > > > the
> > node</font></i>
> > > > > > to a leaf node in its subtree.
> > > > > 
> > > > > Same thing, very-very demonstrative concept.  smile
> > > > > 
> > > > > > The length of a sequence is simply the number of children of the
> > > > > > root.
> This</font></i>
> > > > > > has not much importance in tree theory, but is essential for _some_
> > > > > > sorts
> > of</font></i>
> > > > > > them, namely strings of arbitrary things, among which trees. It has
> > > > > > been
> > chosen</font></i>
> > > > > > to build this special notion in the language, and to leave out the
> > > > > > more
> > general</font></i>
> > > > > > ones. Other trees will have their own notion of depth or somsuch,
> > > > > > which
> > depends</font></i>
> > > > > > on the speifics of the layout an uses of the given family of trees.
> > > > > > So yes, sequences don't have a single dimension, although some sorts
> > > > > > of
> > sequences</font></i>
> > > > > > do have a more intinsic kind of dimension. Strings are an example,
> > > > > > for
> which</font></i>
> > > > > > the length is the "natural" dimension.
> > > > > 
> > > > > OK, but depth of a string exists and is 1. So sequence seems to be
> > > > > some 2-dimensional object anyway and always.
> > > > > 
> > > > 2,3,27,... depending on the exact notion of dimension you need. A
> > > > sequence
> > > > whose elements may freely be atoms or not has dimension 1, and strings
> > > > are
> special</font></i>
> > > > cases of them. Otherwise, as I said, the concept is not uniquely
> > > > defined, and
> > > > the value for the dimension is always 2 or more.
> > > 
> > > Here, in Russia, we use 2 words for these things:
> > > "izmerenie" -- it is just single "dimension"
> > > and
> > > "razmernost'" --  it is common number of dimensions, "dimensionality".
> > > So I'd prefer to say that any sequence has dimensionality 2,
> > > and its dimensions are named as "length" and "depth".
> > 
> > This looks ok to me, except that the length is really a very special case.
> > 
> > > But this 2-dimensional sequence can describe and contain
> > > multi-dimensional objects.
> > > Anyway, in machine memory, it is just 1-dimensional *range* of
> > > addresses.
> > > 
> > 
> > Exactly. So the "length" of a general sequence would be the total number of
> > nodes it holds. The current definition of length() is very adequate for
> > linear
> > trees - one root with length(s) children, the nature of which is not taken
> > into
> > account -. For general trees, however, it barely makes sense.
>  
> OK, let's see what is every atom in some complicated sequence.
> I think, that every atom can be, so to say, one of the dimensions
> or coordinates of some multi-dimensional object, described by that
> given sequence.
> So the common number of atoms of some given sequence is very
> interesting thing - it gives us sometimes the number of
> dimensions of the described object!

A possibility is with this type of structure: {A1,{A2,{A3,{...}}...}.
Example: {1,{2,{3,{4}}}}
 
> We can name this parameter with some suitable word to
> characterize, so to say, a volume of a sequence, or its
> capacity or something.
> It is not the sum of all lengths, it is number of atoms,
> and a function for calculation of this number may be
> very simple.
function NumberOfAtoms(object o)
integer n
   if atom(o) then return 1 end if
   n = 0
   for i=1 to length(o) do
      n += NumberOfAtoms(o[i])
   end for
   return n
end function
<\eucode>
>  
> Well, I'll be out of town several days, sorry...
> 
> Regards,
> Igor Kachan
> kinz at peterlink.ru

Regards, Fernando }}}

new topic     » goto parent     » topic index » view message » categorize

30. Re: Dimension of sequences

Hello Al,

Al Getz wrote:
> 
> Fernando Bauer wrote:
> > 
> > Al Getz wrote:
> > > 
> > > Hello again,
> > > 
> > 
> > Hello Al! Thanks for your comments.
> > 
> > > 
> > > The game of chess if often referred to as having move sequences that
> > > exist on the edge of a multi-dimensional object, so i suppose
> > > you could say the same thing about a sequence.
> > > 
> > 
> > Sorry, I didn't understand this.
> > 
> > > My question would be say you defined the 'dimension' of a sequence
> > > as the product of the max of all the inner sequences written out
> > > such as 1x2x3 as is sometimes customary with arrays.  What would
> > > you use this information for in a program?
> > > 
> > 
> > Examples:
> > a)A 2D sequence (a matrix) can represent a system of simultaneous linear
> > equations.
> > Then, you can use your description (a x b) to find out if the system has
> > possibly
> > none, one or many solutions.
> > b)To know if a sequence represent a square matrix. For example, to know if
> > you
> > can calculate its determinant.
> > 
> > > When i did my jpeg decoder program in Euphoria i used sequences
> > > like arrays where every level had the same length:
> > >   s=repeat(0,10)
> > >   s=repeat(s,4)
> > >   s=repeat(s,9)
> > >   s=repeat(s,5)
> > > and this builds up a structure similar to a C style array where
> > > every level has the same length.
> > 
> > That is what I'm calling rectangular sequence. Perhaps we could call it
> > "array
> > sequence".
> > 
> > >  The above code creates 5 
> > > three dimensional 'arrays' that can be accessed by index.
> > > I would have no problem calling this a 10x4x9x5 or a 5x9x4x10
> > > 'sequence', 
> > 
> > Ok, you can call this way, but this isn't the dimension that I was talking
> > about.
> > This is the number of atoms (after you compute the product).
> > 
> > >but the actual common useage seems to be to use
> > > every element, but then again i could easily see an app that
> > > although includes a given element, does not in fact use that
> > > element in the program, ever, and of course the implication of
> > > this is that an element missing altogether (only possible with 
> > > a sequence) does not necessarily decrease the length because
> > > the other sequences at the same level contain more elements:
> > >   s={
> > >       {1,2,3,4},
> > >       {5,6,7}
> > >     }
> > > is still a 2x4 sequence.
> > > 
> > 
> > If this is true, why *can't* I sum, subtract, multiply, etc, sequences with
> > the same description ?
> > The information of the structure of the sequence is lost in that
> > representation.
> > I think if you eliminate an atom of a retangular sequence (array sequence),
> > it can't have the same description any longer.
> > 
> > > If you want to get more detailed, you might have to start enumerating
> > > every element and returning a sequence that corresponds to that
> > > sequence.  As with the above, this would be:
> > >   m={4,3}
> > > I guess this would simply be a sequence with the lengths of all 
> > > first level sequences arranged in the same structure as the
> > > original sequence, which would still have to be perused.
> > > Again i would have to wonder about how useful this would be unless
> > > the sequence isnt that big.  For example, "When do i need to know
> > > the actual structure of the sequence in full?"
> > > 
> > 
> > To serialize sequences, which is necessary in several situations: saving and
> > restoring sequences to/from files, transmission of sequences via serial
> > networks.
> > 
> > > Some applications would be interesting to hear about at this point.
> > >
> > 
> > Any application that uses EDS, save and restore the full structures of
> > sequences
> > to/from the database.
> >  
> > > 
> > > Al
> > > 
> > > E boa sorte com sua programacao Euphoria!
> > 
> > Obrigado. Para voce tambem!
> > 
> > > 
> > > My bumper sticker: "I brake for LED's"
> > > 
> > 
> > Regards,
> >    Fernando
> 
> Hi Fernando,
> 
> Ok, since you seem to have shown that there would be some use lets
> look a little farther...
Ok. But just to be clear: you are talking about structure of sequences, and my
original question is about "dimension" of sequences (or "Depth" as Igor prefers).

> 
> First off, i made a mistake when i showed the possible detailed
> dimensions for the sequence
>   s={
>       {1,2,3,4},
>       {5,6,7}
>     }
> 
> which should probably be more like this:
>   m={2,{4,3}}
> 
> but does this even really work for all sequences?
> Also notice this will get a little hard to read too, almost
> as bad as trying to find the individual lengths of the original
> sub sequences and if there even are any.
> 
> I did a math program a while back that used matrixes too, and what
> i did to see if one matrix was compatible with another was to test
> for the two dimensions (or only one if needed).  For
>   s={{1,2},{3,4},{5,6}}
> the two tests would be
>   v=length(s)
> and
>   h=length(s[1])
> With this info i was able to tell if a multiplication could
> be done with either a vector or another matrix, or if the
> maxtrix was square, or even if the matrix was really a vector.
> 
> Going to one more dimension, you probably have this being application
> specific where you know in advance that all the sub sequences are
> matixes and you have to test them as any other one, except first
> you have to extract the individual matrix:
>   s={{1,2},{3,4},{5,6}}
>   MyMatrixes={s,s,s}
>   for k=1 to length(MyMatrixes) do
>     Dims=Test(MyMatrixes[k])
>   end for
> 
> Compare two more complex matrixes:
>   s={1,{2,3},4,5}
>   t={1,2,{3,4},5}
> 
> How do we indicate the dims without repeating almost the
> whole sequence?
>  ms={1,2,1,1}
>  mt={1,1,2,1}
> perhaps?
Using your concept of dim, I think it's more correct:
ms = {a,2,a,a}
mt = {a,a,2,a}

where a = dim of an atom. (a!= 0) because the dim of {} is zero.

> 
> Then the matrix might be even more complex:
>   s={1,{2,{3,6}},4,5}
> and dims:
>   m={1,{1,{2}},1,1}
> and reading or parsing the dims sequence might be almost as hard
> as parsing the original sequence to query its dimensions.
> 
> On the other hand, if we do define the dims as the set of
> max dims we might end up with something like this:
>   m={4,{2{1}}}
> which is at least a bit simpler than the original sequence.
> 
> BTW, by 1x2x3 that doesnt mean multiply all the numbers to get 6,
> but rather shows the dimensions in the same way that the dimensions
> of C arrays.  The numbers dont get multiplied but stay separate:
>   (1,2,3)
Yes. I said that because in Euphoria 1x2x3 is an expression which results in an
atom.
Then it would be more correct to say, for example, {1,2,3} in this case.

> 
> Lastly, you'd have to think about how this is going to be 
> implemented in the language.  During the build of any sequence
> the dimension array would have to be maintained and this would
> slow down the sequence a bit more too.  You'd have to see just
> how much effect this would have on the overall speed.
> 
> 
> Al
> 
> E boa sorte com sua programacao Euphoria!
> 
> 
> My bumper sticker: "I brake for LED's"
> 

Regards,
   Fernando

new topic     » goto parent     » topic index » view message » categorize

31. Re: Dimension of sequences

Fernando Bauer wrote:
> Al Getz wrote:

You guys need to trim your posts better! That's a lot of quoted text just
for a few lines of response. :)

new topic     » goto parent     » topic index » view message » categorize

32. Re: Dimension of sequences

c.k.,

I think that of the two possibilities, too much or too little trimming,
too MUCH trimming is the worst:  a reader can always skip *past* the
"too much text", but they can NOT read what's not there.

Dan Moyer

c.k.lester wrote:
> 
> Fernando Bauer wrote:
> > Al Getz wrote:
> 
> You guys need to trim your posts better! That's a lot of quoted text just
> for a few lines of response. :)

new topic     » goto parent     » topic index » view message » categorize

33. Re: Dimension of sequences

response
full
for
below
see

> c.k.lester wrote:
> > 
> > Fernando Bauer wrote:
> > > Al Getz wrote:
> > 
> > You guys need to trim your posts better! ...

Dan Moyer wrote:
> I think that of the two possibilities, too much or too little trimming, ...

However, there is actually a third possibility, that of appropriate trimming.
Getting rid of stuff that is no longer in context is a good thing.

Also, top posting is such an uncomfortable style of responding, no?
-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

34. Re: Dimension of sequences

Derek Parnell wrote:
> 
> response
> full
> for
> below
> see
> 
> > c.k.lester wrote:
> > > 
> > > Fernando Bauer wrote:
> > > > Al Getz wrote:
> > > 
> > > You guys need to trim your posts better! ...
> 
> Dan Moyer wrote:
> > I think that of the two possibilities, too much or too little trimming, ...
> 
> However, there is actually a third possibility, that of appropriate trimming.
> Getting rid of stuff that is no longer in context is a good thing. 

Agreed.

> 
> Also, top posting is such an uncomfortable style of responding, no?

Yep, you're right, sorry, I forgot sad

Dan

> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

35. Re: Dimension of sequences

Fernando Bauer wrote:
> 
> Ok. But just to be clear: you are talking about structure of sequences, and
> my original question is about "dimension" of sequences (or "Depth" as Igor
> prefers).
> 
> 
> Regards,
>    Fernando

Hi Fernando,


I guess what i was implying was that in order to have the dimensions
you need to know the structure, unless you accept the product
of max lengths to be the dimensions.
The game of chess analogy is very similar to the sequence and if you
want to read more about this there should be something on the web.



Take care,
Al

E boa sorte com sua programacao Euphoria!


My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » goto parent     » topic index » view message » categorize

36. Re: Dimension of sequences

Hello Fernando!

Fernando Bauer wrote:
> 
> Hello Igor!
> 
> Igor Kachan wrote:
> >

[snip]
 
> > 
> > See please:
> > }}}
<eucode>
> > global function MaxDepth(object o)
> >     integer n, x
> >     if atom(o) then
> >        return 0
> >     else
> >        n = 0
> > 	for i = 1 to length(o) do
> > 	    x = MaxDepth(o[i])
> > 	    if x > n then
> > 		n = x
> > 	    end if
> > 	end for
> > 	return n + 1
> >     end if
> > end function -- it is function by Ricardo Forno, genfunc.e lib 
> > 
> > ? MaxDepth({{{{}}},{},{{},{{{{{{{{{{{{}}}}}}}}}}}}},{{{{{{{{}}}}}}}}})
> > ? MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{{1}}}}}}}}}}}}},{{{{{{{{1}}}}}}}}})
> > </eucode>
{{{
 
> > The maximum depth is 14, all right.
> > Count please the '{' signs, opening the deepest sequence,
> > to be sure.
> > It seems to be a good parameter for description of a sequence.
> > Now a sequence has its own second dimension, and may be
> > considered as some 2-dimensional object, which can contain
> > description of any-dimentional real and unreal objects -
> > vectors, matrixes, tensors, lists, arrays, trees, books,
> > images ... etc, etc.
> > Sequence itself really has two own dimensions - length and depth,
> > I think now. So attempts to give it some *single* dimension
> > may be not very productive.
> 
> Just to make clear, this concept of 2-dimensional object, or dimensionality
> 2 as you define, is a higher abstract concept, and is not my original
> definition
> of "dimension" which is your Depth.

I do not think that it is more abstract, it is very clear, if
you'll just draw a sequence as the pretti_print() draws or as
it is drawn below? for example:
?
MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{1,{1},1}}}}}}}}}}}},1,{{{{{{{{1}}}}}}}}})
-- --{                                                                   }
--    {     },{1},{                                 },1,{               }
--     {   }       {1},{                           }     {             }
--      {1}             {                         }       {           }
--                       {                       }         {         }
--                        {                     }           {       }
--                         {                   }             {     }
--                          {                 }               {   }
--                           {               }                 {1}
--                            {             }
--                             {           }
--                              {         }
--                               {1,   ,1}
--                                  {1}

or:

-- --{                         }
--   { },{1},{           },1,{ }
--   { }     {1},{       }   { }
--   {1}         {       }   { }
--               {       }   { }
--               {       }   { }
--               {       }   { }
--               {       }   { }
--               {       }   {1}
--               {       }
--               {       }
--               {       }
--               {1,   ,1}
--                  {1}


It is something like to just icicles or stalactites.
Did you see the icicles in Brasilia?   smile

And these dimensions are very demonstative, not abstract at all.
They are just dimensions of some sheet of paper, needed to draw
this graphical representation of some sequence.

But you'll need not only the *maximum* depth, but also the
*maximum* length. The maximum length can be on any depth,
not only on depth 1. The function for calculating of
maximum length may be very simple.

[snip]
 
> > > > Then, I do not think now that the 'rectangular' word is very
> > > > good for your purpose, maybe, 'regular', as some short
> > > > for 'regularly nested', is better.
> > > > 
> > > Ok. But I think "rectangular" is sligthly more precise than "regular",
> > > since
> > > I could think that the following sequence is regular:
> > > repeat({1,{1,1}},n) where n is any integer number. And that sequence is
> > > NRS.
> > > Well, this is only a definition problem.
> > 
> > Ricardo names these sequences as 'simple sequences'.
> 
> No. Ricardo defines "simple sequences" as "sequences formed only by atoms"
> (depth=1).
> The sequence repeat({1,{1,1}},n) has sub-sequences therefore it's not a simple
> sequence.
> A simple sequence is always a RS, but not always a RS is a simple sequence.

Ok, no matter, the Ricardo's function works properly with any
sequence, so if it is "simple" or it is "complicated" really
is not a question.

> > OK, now we can calculate that Depth (good, let's name the maximum depth
> > as Depth) with Ricardo's function.
> But then think about this (bad) analogy:
> If someone ask you about the depth of the Pacific Ocean, then you would say
> the maximum depth of it, since you have defined this way. However we know that
> its depth depends on the place.
> (notice that this depth is not our discussed concept of Depth).

Good analogy, not bad, I always can say that the depth of the Pacific Ocean
is *down to about* 11000 meters.

But if I'll know the Depth of the Pacific Ocean, I do know the
dimensions of a sheet of paper to draw the depth profiles of
that ocean.

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

37. Re: Dimension of sequences

Fernando Bauer wrote:
> 
> Igor Kachan wrote:
> > 
> > > > Here, in Russia, we use 2 words for these things:
> > > > "izmerenie" -- it is just single "dimension"
> > > > and
> > > > "razmernost'" --  it is common number of dimensions, "dimensionality".
> > > > So I'd prefer to say that any sequence has dimensionality 2,
> > > > and its dimensions are named as "length" and "depth".
> > > 
> > > This looks ok to me, except that the length is really a very special case.
> > > 
> > > > But this 2-dimensional sequence can describe and contain
> > > > multi-dimensional objects.
> > > > Anyway, in machine memory, it is just 1-dimensional *range* of
> > > > addresses.
> > > > 
> > > 
> > > Exactly. So the "length" of a general sequence would be the total number
> > > of
> > > nodes it holds. The current definition of length() is very adequate for
> > > linear
> > > trees - one root with length(s) children, the nature of which is not taken
> > > into
> > > account -. For general trees, however, it barely makes sense.
> >  
> > OK, let's see what is every atom in some complicated sequence.
> > I think, that every atom can be, so to say, one of the dimensions
> > or coordinates of some multi-dimensional object, described by that
> > given sequence.
> > So the common number of atoms of some given sequence is very
> > interesting thing - it gives us sometimes the number of
> > dimensions of the described object!
> 
> A possibility is with this type of structure: {A1,{A2,{A3,{...}}...}.
> Example: {1,{2,{3,{4}}}}

Ok, there may be many examples for different objects, I think.
The thing is that the author of the described object wants
to tell us how many parameters of his object can be
*considered as dimensions*.

> > We can name this parameter with some suitable word to
> > characterize, so to say, a volume of a sequence, or its
> > capacity or something.
> > It is not the sum of all lengths, it is number of atoms,
> > and a function for calculation of this number may be
> > very simple.
> }}}
<eucode>
> function NumberOfAtoms(object o)
> integer n
>    if atom(o) then return 1 end if
>    n = 0
>    for i=1 to length(o) do
>       n += NumberOfAtoms(o[i])
>    end for
>    return n
> end function
> <\eucode>
It works for me nicely, thanks!

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

38. Re: Dimension of sequences

Hello Igor!

Igor Kachan wrote:
> 
> Hello Fernando!
> 
> Fernando Bauer wrote:
> > 
> > Hello Igor!
> > 
> > Igor Kachan wrote:
> > >
> 
> [snip]
>  
> > > 
> > > See please:
> > > }}}
<eucode>
> > > global function MaxDepth(object o)
> > >     integer n, x
> > >     if atom(o) then
> > >        return 0
> > >     else
> > >        n = 0
> > > 	for i = 1 to length(o) do
> > > 	    x = MaxDepth(o[i])
> > > 	    if x > n then
> > > 		n = x
> > > 	    end if
> > > 	end for
> > > 	return n + 1
> > >     end if
> > > end function -- it is function by Ricardo Forno, genfunc.e lib 
> > > 
> > > ? MaxDepth({{{{}}},{},{{},{{{{{{{{{{{{}}}}}}}}}}}}},{{{{{{{{}}}}}}}}})
> > > ?
> > > MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{{1}}}}}}}}}}}}},{{{{{{{{1}}}}}}}}})
> > > </eucode>
{{{
 
> > > The maximum depth is 14, all right.
> > > Count please the '{' signs, opening the deepest sequence,
> > > to be sure.
> > > It seems to be a good parameter for description of a sequence.
> > > Now a sequence has its own second dimension, and may be
> > > considered as some 2-dimensional object, which can contain
> > > description of any-dimentional real and unreal objects -
> > > vectors, matrixes, tensors, lists, arrays, trees, books,
> > > images ... etc, etc.
> > > Sequence itself really has two own dimensions - length and depth,
> > > I think now. So attempts to give it some *single* dimension
> > > may be not very productive.
Ok. Thanks to your fantastic picture below, now I understand your concept!

> > 
> > Just to make clear, this concept of 2-dimensional object, or dimensionality
> > 2 as you define, is a higher abstract concept, and is not my original
> > definition
> > of "dimension" which is your Depth.
> 
> I do not think that it is more abstract, it is very clear, if
> you'll just draw a sequence as the pretti_print() draws or as
> it is drawn below? for example:
> }}}
<eucode>
> ?
> MaxDepth({{{{1}}},{1},{{1},{{{{{{{{{{{1,{1},1}}}}}}}}}}}},1,{{{{{{{{1}}}}}}}}})
> -- --{                                                                   }
> --    {     },{1},{                                 },1,{               }
> --     {   }       {1},{                           }     {             }
> --      {1}             {                         }       {           }
> --                       {                       }         {         }
> --                        {                     }           {       }
> --                         {                   }             {     }
> --                          {                 }               {   }
> --                           {               }                 {1}
> --                            {             }
> --                             {           }
> --                              {         }
> --                               {1,   ,1}
> --                                  {1}
> 
> or:
> 
> -- --{                         }
> --   { },{1},{           },1,{ }
> --   { }     {1},{       }   { }
> --   {1}         {       }   { }
> --               {       }   { }
> --               {       }   { }
> --               {       }   { }
> --               {       }   { }
> --               {       }   {1}
> --               {       }
> --               {       }
> --               {       }
> --               {1,   ,1}
> --                  {1}
> </eucode>
{{{

> 
Very elucidative pictures! Now, I understand your concept of dimensionality 2.
Maybe we could call it Igor's plane? Kachan's plane?
And, as you said, it can represent all the sequences!

Now, following your reasoning:
1) a sequence can contain description of any-dimensional real and unreal objects
- vectors, matrixes, tensors, lists, arrays, trees, books,images ... etc, etc.
2) all sequences can be represented in the Kachan's plane.
3) Kachan's plane can be represented in a sheet of paper.
Then:
- Any-dimensional real and unreal objects can be represented in a sheet of
  paper!
or maybe:
  - Universe can be represented in a sheet of paper!!

Now, I can't even imagine something as abstract as this!! smile
(abstract= "the concentrated essence of a larger whole")
This concept is so wide-ranging that I don't know if it has some use, since all
the sequences have the same dimension 2.

> It is something like to just icicles or stalactites.
> Did you see the icicles in Brasilia?   smile
So far, I didn't. :)

> 
> And these dimensions are very demonstative, not abstract at all.
> They are just dimensions of some sheet of paper, needed to draw
> this graphical representation of some sequence.
Ok. Your picture shows this very well!

[snipped]

>  
> Regards,
> Igor Kachan
> kinz at peterlink.ru

I appreciated very much your view about this.
I still have another approach about the "dimension of sequences", but before I
post it, I want to implement it in Euphoria.
The line of reasoning is: a NRS is a set of RS where each one has a known
integer dimension. Then, the dimension of a NRS is a sequence formed by that
dimensions.

Thanks,
  Fernando

new topic     » goto parent     » topic index » view message » categorize

39. Re: Dimension of sequences

Hello Fernando!

 Fernando Bauer wrote:
    Igor Kachan wrote:
[snip]
> > }}}
<eucode> 
> > -- --{                         }
> > --   { },{1},{           },1,{ }
> > --   { }     {1},{       }   { }
> > --   {1}         {       }   { }
> > --               {       }   { }
> > --               {       }   { }
> > --               {       }   { }
> > --               {       }   { }
> > --               {       }   {1}
> > --               {       }
> > --               {       }
> > --               {       }
> > --               {1,   ,1}
> > --                  {1}
> > </eucode>
{{{

> > 
> Very elucidative pictures! Now, I understand your concept of dimensionality
> 2.
> Maybe we could call it Igor's plane? Kachan's plane?
> And, as you said, it can represent all the sequences!

Let's call it Length-Depth Diagram, LDD.     smile

> Now, following your reasoning:
> 1) a sequence can contain description of any-dimensional real and unreal
> objects
> - vectors, matrixes, tensors, lists, arrays, trees, books,images ... etc, etc.
> 2) all sequences can be represented in the Kachan's plane.
> 3) Kachan's plane can be represented in a sheet of paper.
> Then:
>   - Any-dimensional real and unreal objects can be represented in a sheet of
> paper! 
> or maybe:
>   - Universe can be represented in a sheet of paper!!

It is not that big news, all our old good books consist
just of sheets of paper, and they represent not only
Universe, but much more, sometimes.    smile
Same about sequences.

> Now, I can't even imagine something as abstract as this!! smile
> (abstract= "the concentrated essence of a larger whole")
> This concept is so wide-ranging that I don't know if it has some use,
> since all the sequences have the same dimension 2.

Good, the question about the dimensionality of sequences themselves
seems to be answered, it is just 2, and these two dimensions can be
considered as maximum length, Length, and maximum depth, Depth.

But Length of Euphoria sequence is limited by the current Euphoria
integer.
For Depth, seems to be same limit, machine memory at least.

[snip] 
 
> I appreciated very much your view about this.
> I still have another approach about the "dimension of sequences", but before
> I post it, I want to implement it in Euphoria.
> The line of reasoning is: a NRS is a set of RS where each one has a known
> integer
> dimension. Then, the dimension of a NRS is a sequence formed by that
> dimensions.

OK, interesting, the specific structure of a sequence is involved.
Let's wait.

Good Luck!

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

40. Re: Dimension of sequences

<snip>
> >   - Universe can be represented in a sheet of paper!!
> 
> It is not that big news, all our old good books consist
> just of sheets of paper, and they represent not only
> Universe, but much more, sometimes.    smile
> Same about sequences.
<snip>

Universe is so small, compared against other things...
For example: How many different pictures may be represented on the screen you
have in front of your eyes?
This code tryied to show this number, but it failed. So I modified it:

atom x, z
-- x = power(256.0 * 256.0 * 256.0, 1024.0 * 768.0)
-- printf(1, "%g\n", x)
z = log(256.0 * 256.0 * 256.0) * 1024.0 * 768.0
printf(1, "%g\n", z)

Best regards.

new topic     » goto parent     » topic index » view message » categorize

41. Re: Dimension of sequences

Hello Igor!

[snipped]
> 
> Good, the question about the dimensionality of sequences themselves
> seems to be answered, it is just 2, and these two dimensions can be
> considered as maximum length, Length, and maximum depth, Depth.
> 
> But Length of Euphoria sequence is limited by the current Euphoria
> integer.
> For Depth, seems to be same limit, machine memory at least.
> 
> [snip] 
>  
> > I appreciated very much your view about this.
> > I still have another approach about the "dimension of sequences", but before
> > I post it, I want to implement it in Euphoria.
> > The line of reasoning is: a NRS is a set of RS where each one has a known
> > integer
> > dimension. Then, the dimension of a NRS is a sequence formed by that
> > dimensions.
> 
> OK, interesting, the specific structure of a sequence is involved.
> Let's wait.
> 
> Good Luck!
> 
> Regards,
> Igor Kachan
> kinz at peterlink.ru

Here is my current implementation of "dimension of sequences" involving its
structure:
function Dimension(object o)
integer ini
object base
sequence s

   if atom(o) then return 0 end if
   if length(o)=0 then return 1 end if
   if length(o)=1 then return 1+Dimension(o[1]) end if   
   s = {}
   ini = 1
   o = o = o
   base = o[1]
   for i = 2 to length(o) do
      if not equal(base, o[i]) then
         if i > ini+1 then 
            s = append(s,1+Dimension(base))
         else
            s = append(s,Dimension(base))
         end if
         base = o[i]
         ini = i
      end if
   end for
   if ini = 1          then return 1+Dimension(o[1]) end if
   if ini = length(o)  then return append(s,Dimension(o[ini])) end if
   return append(s,1+Dimension(o[ini]))
end function

procedure ShowDimension(object o)
puts(1,"Dimension of ")
print(1, o)
puts(1," = ")
print(1,Dimension(o))
puts(1,"\n")
end procedure

object obj
-- Create an object formed by rectangular sequences with incremental dimension
obj = {1}
for i = 2 to 4 do
   obj = append(obj, repeat(obj[i-1],1))
end for

for i=1 to length(obj) do
   ShowDimension(obj[i])
end for

ShowDimension(1)
ShowDimension({})
ShowDimension({2})
ShowDimension({3,4})
ShowDimension({5,{6}})
ShowDimension({7,{8},9})
ShowDimension({10,{11},{12}})
ShowDimension({13,{14,15}})
ShowDimension({{16,17},{18,19}})
ShowDimension({{20,21},{22}})
ShowDimension({23,{24,{{25,26},{27,28}}}})
ShowDimension({1,{1},{1,1},{1,1,1},{1,1},{1},1})
ShowDimension({1,{1},{1},{1,1},{1,1},{{1,1},{1,1},{1,1}}})
ShowDimension({obj[1],obj[2],obj[3],obj[4]})
ShowDimension({obj[4],obj[3],obj[2],obj[1]})
ShowDimension({obj[1],{obj[2],{obj[3],{obj[4]}}},obj[1]})

for i = 1 to length(obj) do
   for j = 1 to length(obj) do
      for k = 1 to length(obj) do
         ShowDimension({obj[i], obj[j], obj[k]})
      end for
   end for
end for


Thanks to everyone who has contributed to this topic!
Regards,
  Fernando

new topic     » goto parent     » topic index » view message » categorize

42. Re: Dimension of sequences

Fernando Bauer wrote:

> 
> Hello Igor!
> 
> [snipped]
> > [snipped]

Hello Fernando!

> > OK, interesting, the specific structure of a sequence is involved.
> > Let's wait.
> > 
> 
> Here is my current implementation of "dimension of sequences" involving its
> structure:
> }}}
<eucode>
> function Dimension(object o)
> integer ini
> object base
> sequence s
> 
>    if atom(o) then return 0 end if
>    if length(o)=0 then return 1 end if
>    if length(o)=1 then return 1+Dimension(o[1]) end if   
>    s = {}
>    ini = 1
>    o = o = o
>    base = o[1]
>    for i = 2 to length(o) do
>       if not equal(base, o[i]) then
>          if i > ini+1 then 
>             s = append(s,1+Dimension(base))
>          else
>             s = append(s,Dimension(base))
>          end if
>          base = o[i]
>          ini = i
>       end if
>    end for
>    if ini = 1          then return 1+Dimension(o[1]) end if
>    if ini = length(o)  then return append(s,Dimension(o[ini])) end if
>    return append(s,1+Dimension(o[ini]))
> end function
> 
> procedure ShowDimension(object o)
> puts(1,"Dimension of ")
> print(1, o)
> puts(1," = ")
> print(1,Dimension(o))
> puts(1,"\n")
> end procedure
> 
> object obj
> -- Create an object formed by rectangular sequences with incremental dimension
> obj = {1}
> for i = 2 to 4 do
>    obj = append(obj, repeat(obj[i-1],1))
> end for
> 
> for i=1 to length(obj) do
>    ShowDimension(obj[i])
> end for
> 
> ShowDimension(1)
> ShowDimension({})
> ShowDimension({2})
> ShowDimension({3,4})
> ShowDimension({5,{6}})
> ShowDimension({7,{8},9})
> ShowDimension({10,{11},{12}})
> ShowDimension({13,{14,15}})
> ShowDimension({{16,17},{18,19}})
> ShowDimension({{20,21},{22}})
> ShowDimension({23,{24,{{25,26},{27,28}}}})
> ShowDimension({1,{1},{1,1},{1,1,1},{1,1},{1},1})
> ShowDimension({1,{1},{1},{1,1},{1,1},{{1,1},{1,1},{1,1}}})
> ShowDimension({obj[1],obj[2],obj[3],obj[4]})
> ShowDimension({obj[4],obj[3],obj[2],obj[1]})
> ShowDimension({obj[1],{obj[2],{obj[3],{obj[4]}}},obj[1]})
> 
> for i = 1 to length(obj) do
>    for j = 1 to length(obj) do
>       for k = 1 to length(obj) do
>          ShowDimension({obj[i], obj[j], obj[k]})
>       end for
>    end for
> end for
> </eucode>
{{{

> 
> Thanks to everyone who has contributed to this topic!

I'm sorry I was off line all those days, and will try your
new current implementation for "dimension" next week, if I
have some spare time for it.

But your initial question about dimension seems to be answered
already, you do have your own vision and solution of the problem
about "NRS dimension" now, so let's finish this thread, OK?

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu