0

I have this code:

taking’ = taking  ∪  {s? → m?} 

As you can see, taking is a name for a relation where s maps to m. Above relation shows the adding procedure (union) where I am adding a new maptlet to this relation.

However, I need to get the number of s available in this relation. How can I get it? Below is what I have done

#taking = numberOfStudents

But I am not sure about this.

halfer
  • 19,824
  • 17
  • 99
  • 186
PeakGen
  • 21,894
  • 86
  • 261
  • 463
  • 1
    what language is that? – Chronial Jul 31 '13 at 10:40
  • @Chronial: This is not a programming question, but related to software design and architect. This is Z-Specification, used for scientific software development, built by Oxford university – PeakGen Aug 01 '13 at 04:23
  • Still a language (or well, at least close enough ;). I also removed most of your tags, because this question is actually only about this Z Notation. For the rest of logic the answer is `|s|`. – Chronial Aug 01 '13 at 09:56
  • @Chronial: ahh, I did not understand, you mean something like #taking = |s| ? – PeakGen Aug 01 '13 at 09:58
  • I do know anything about this Z-Stuff apart from what I just read about it on wikipedia :). But in math you use the cardinality operator |x| if you want to get the number of elements in a set. I do not know what `#taking` stands for, so I can not answer your question. – Chronial Aug 01 '13 at 10:07

1 Answers1

1

If you want to know how many different student are taking m (whatever m is)

It is easy: you need to get all possible s from taking relation and then measure the cardinality of resulting set.

Just like that:

numberOfStudents = #(\dom taking)

Where \dom is function(relation) domain will give you all the students in the relation.

nix
  • 464
  • 1
  • 5
  • 13