Discussion:
Three new functions: a help
(too old to reply)
Nic
2006-06-22 20:39:07 UTC
Permalink
Hello,
I've the following code...
ELEMENTS = ['one' 'number' 'a' 'letter']
COMBINATIONS = []
ASSOCIATIONS = ['a' 'b'; 'a' 'c'; 'a' 'd'; 'a' 'e']
And would like to define three new functions.
1) countassociations(a,...;b,...)
2) drawgraph
3) drawgraph(a, ..., ...)

1. countassociations(a,...;b,...)
"countassociations(a,...,...;c,...,...)" function, given the strings
"a", "..." and "c", "...", should answer the following question:
how many rows in "associations" include the string "a", excluding the rows
that include also the string "c"?

Example
By writing "countassociations(a,e,f;c,d,q)" it should
count how many rows include the string "a" or "e" or "f", excluding the rows
that include also the string "c" or "d" or "q".

2. drawgraph
"drawgraph" function should execute the following command:
draw a multigraph (graph in the sense of graph theory) where all the rows
included in COMBINATIONS are represented through nodes linked through normal
lines and all the rows ASSOCIATIONS are represented through nodes linked
through dotted lines.

Example
To represent "a" "b" in COMBINATIONS we have a node for "a", a node for "b"
and a normal line linking the two nodes.
To represent "a" "b" in ASSOCIATIONS we have a node for "a", a node for "b"
and a dotted line linking the two nodes.
Thus, the node "a" will be linked to "b" through two kinds of lines: one
normal line and one dotted line.

3. drawgraph(a,...,...)
"drawgraph(a,...,...)" function is similar to "drawgraph" with one
difference.
"drawgraph" draws a graph representing all the rows included in COMBINATIONS
and ASSOCIATIONS.
"drawgraph(a,...,...)" draws a graph representing all the rows included in
COMBINATIONS and ASSOCIATIONS which contain the string "a", the string "..."
and so on.

Can you help me please to define these three functions?
Really many thanks for the support.

Best,
Nico
Asbjørn Sæbø
2006-06-23 06:24:50 UTC
Permalink
Post by Nic
I've the following code...
ELEMENTS = ['one' 'number' 'a' 'letter']
COMBINATIONS = []
ASSOCIATIONS = ['a' 'b'; 'a' 'c'; 'a' 'd'; 'a' 'e']
And would like to define three new functions.
1) countassociations(a,...;b,...)
2) drawgraph
3) drawgraph(a, ..., ...)
1. countassociations(a,...;b,...)
"countassociations(a,...,...;c,...,...)" function, given the strings
how many rows in "associations" include the string "a", excluding the rows
that include also the string "c"?
I suppose the find() function might be useful here. For each row, use
find() to check whether it contains an 'a' and then whether it also
contains a 'c'.

But you can not (I believe) have a function call looking like the one
you have scetched above. The parameters must be separated by commas,
not semicolons. If what you intended was to input a two-row matrix,
you must make a matrix of your variables by surrounding them by [].
Post by Nic
[...]
2. drawgraph
draw a multigraph (graph in the sense of graph theory) where all the rows
included in COMBINATIONS are represented through nodes linked through normal
lines and all the rows ASSOCIATIONS are represented through nodes linked
through dotted lines.
In my opinion, this starts to smell of homework.
Post by Nic
[...]
Can you help me please to define these three functions?
Really many thanks for the support.
Sure. Just show us what you have done, and where and how it does not
work.

Asbjørn
--
Asbjørn Sæbø

Q2S - Centre for Quantifiable Quality of Service in Communication Systems
http://www.q2s.ntnu.no/~asbjs/
Joseph Iacobucci
2006-06-23 10:26:55 UTC
Permalink
I would love to do your homework!

Have you even started to think about how you would approach this problem?
--
Joseph Iacobucci
Post by Nic
Hello,
I've the following code...
ELEMENTS = ['one' 'number' 'a' 'letter']
COMBINATIONS = []
ASSOCIATIONS = ['a' 'b'; 'a' 'c'; 'a' 'd'; 'a' 'e']
And would like to define three new functions.
1) countassociations(a,...;b,...)
2) drawgraph
3) drawgraph(a, ..., ...)
1. countassociations(a,...;b,...)
"countassociations(a,...,...;c,...,...)" function, given the strings
how many rows in "associations" include the string "a", excluding the rows
that include also the string "c"?
Example
By writing "countassociations(a,e,f;c,d,q)" it should
count how many rows include the string "a" or "e" or "f", excluding the rows
that include also the string "c" or "d" or "q".
2. drawgraph
draw a multigraph (graph in the sense of graph theory) where all the rows
included in COMBINATIONS are represented through nodes linked through normal
lines and all the rows ASSOCIATIONS are represented through nodes linked
through dotted lines.
Example
To represent "a" "b" in COMBINATIONS we have a node for "a", a node for "b"
and a normal line linking the two nodes.
To represent "a" "b" in ASSOCIATIONS we have a node for "a", a node for "b"
and a dotted line linking the two nodes.
Thus, the node "a" will be linked to "b" through two kinds of lines: one
normal line and one dotted line.
3. drawgraph(a,...,...)
"drawgraph(a,...,...)" function is similar to "drawgraph" with one
difference.
"drawgraph" draws a graph representing all the rows included in COMBINATIONS
and ASSOCIATIONS.
"drawgraph(a,...,...)" draws a graph representing all the rows included in
COMBINATIONS and ASSOCIATIONS which contain the string "a", the string "..."
and so on.
Can you help me please to define these three functions?
Really many thanks for the support.
Best,
Nico
Nic
2006-06-23 10:42:53 UTC
Permalink
Thanks for the message.
I've not yet started to think about how to approach this problem.
I'm a new Octave user and confess that don't have many programming skills.
I'm a Philosopher working in Abstract Mathematics and since am collaborating
with a Robotics Lab here in Milan, I need to define a software for knowledge
representation in a Robot using Octave. For this reason, I need to define a
little package useful for the construction of this software ("Knowledge
representation" package for Octave).
In this package, there will be different new functions useful to construct
softwares for "knowledge representation" in Robotics as in other AI fields.
These three proposed functions will be part of the package.
I don't have the necessary programming skills to develop it with proficiency
in a reasonable time, so if someone want to cooperate, I'll be more than
happy. Of course, the package will be then distributed freely and in public
domain.
What do you think?
Best,
Nico
Post by Joseph Iacobucci
I would love to do your homework!
Have you even started to think about how you would approach this problem?
--
Joseph Iacobucci
Post by Nic
Hello,
I've the following code...
ELEMENTS = ['one' 'number' 'a' 'letter']
COMBINATIONS = []
ASSOCIATIONS = ['a' 'b'; 'a' 'c'; 'a' 'd'; 'a' 'e']
And would like to define three new functions.
1) countassociations(a,...;b,...)
2) drawgraph
3) drawgraph(a, ..., ...)
1. countassociations(a,...;b,...)
"countassociations(a,...,...;c,...,...)" function, given the strings
how many rows in "associations" include the string "a", excluding the rows
that include also the string "c"?
Example
By writing "countassociations(a,e,f;c,d,q)" it should
count how many rows include the string "a" or "e" or "f", excluding the rows
that include also the string "c" or "d" or "q".
2. drawgraph
draw a multigraph (graph in the sense of graph theory) where all the rows
included in COMBINATIONS are represented through nodes linked through normal
lines and all the rows ASSOCIATIONS are represented through nodes linked
through dotted lines.
Example
To represent "a" "b" in COMBINATIONS we have a node for "a", a node for "b"
and a normal line linking the two nodes.
To represent "a" "b" in ASSOCIATIONS we have a node for "a", a node for "b"
and a dotted line linking the two nodes.
Thus, the node "a" will be linked to "b" through two kinds of lines: one
normal line and one dotted line.
3. drawgraph(a,...,...)
"drawgraph(a,...,...)" function is similar to "drawgraph" with one
difference.
"drawgraph" draws a graph representing all the rows included in COMBINATIONS
and ASSOCIATIONS.
"drawgraph(a,...,...)" draws a graph representing all the rows included in
COMBINATIONS and ASSOCIATIONS which contain the string "a", the string "..."
and so on.
Can you help me please to define these three functions?
Really many thanks for the support.
Best,
Nico
Asbjørn Sæbø
2006-06-23 11:02:27 UTC
Permalink
Post by Nic
Thanks for the message.
I've not yet started to think about how to approach this problem.
[...]
Then you should definitely start by doing that first.
Post by Nic
I'm a new Octave user and confess that don't have many programming skills.
Skills can be acquired.
Post by Nic
[...]
I don't have the necessary programming skills to develop it with proficiency
in a reasonable time, so if someone want to cooperate, I'll be more than
happy. Of course, the package will be then distributed freely and in public
domain.
What do you think?
I, for one, prefer to give advice and help to those who actually make
an effort themselves. Simply doing other peoples work for them is not
of very much value, neither for me nor them.


(And by the way: The custom here on USENET ("news") is to cut
un-necessary old text and put one's comments _below_ that which one is
replying to.)


Asbjørn
--
Asbjørn Sæbø

Q2S - Centre for Quantifiable Quality of Service in Communication Systems
http://www.q2s.ntnu.no/~asbjs/
Nic
2006-06-23 11:59:18 UTC
Permalink
Post by Asbjørn Sæbø
I, for one, prefer to give advice and help to those who actually make
an effort themselves. Simply doing other peoples work for them is not
of very much value, neither for me nor them.
Actually I don't agree with your consideration.
This project (new package for Octave) is public and open source.
By developing it you're not working for me, but you're working for all the
people who can be interested in using Octave for Knowledge Representation in
Artificial Intelligence.
Furthermore I won't be the author of the project, but the authors will be
all the people who have worked in it.
Post by Asbjørn Sæbø
Skills can be acquired.
This is obvious.
But if you cooperate with other people by sharing your own knolwedge the
final result could be better, in terms of time and quality. For me, solving
the "three functions" problem requires more or less one month, since I don't
have skills in Octave, but a general familiarity. So, I have to learn the
language and then to try to define the package.
For a computer scientist, doing this operation requires more or less one
hour.
If you need to plan a good "knowledge representation" in a robot, maybe I
can do this in one hour. On the contrary, a person who don't have skills in
this field would do the same operation in one month.
So, I think that cooperate and share the knowledge is always the best
choice.
But this is only a point of view of course.

Best,
Nico

Loading...