Several algorithm depend on randomized choice of element.
Currently we have ramdom() for finite domains and random(n)
for integers, but in other cases choice is more or less ad hoc.
I think we should have a new category, like:
)abbrev category RCHOICE RandomChoice
RandomChoice : Category == with
random_element : Integer -> Union(%, "failed")
++ random_element(n) generates random element
++ with values in some set having of order \spad{n}
++ elements and with probability distribution that is
++ roughly uniform on this set. Returns failed if
++ \spad{%} has less than \spad{n} elements.
The idea is that unlike say simulations we do not need perfectly
uniform distribution (and given that support of distribution
is unspecified claim of exact uniformity would have little
meaning), which may simplify implementation. Also, we can
not magically enlarge finite domains, so if users requent
choice from more elements than available the only possibility
is to fail.
AFAICS this condition will propagate resonably well trough
type towers. In particular we can give generic definition for
all finite domains and easily propagate it from infinite
domains to bigger infinite domains.
Natural name for operation would be 'random', but it may
conflict with existing 'random(n)' in some domains. ATM
I do not see if such conflict leads to troubles or is just
harmless, so I opted for different name.
Comments?
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.