describe function mins that takes a non-empty of natural numbers for its argument, and has the smallest natural number in the set for its value.
i tried to use the function min which takes two integers as arguments and has the smaller of them for its value
but could not form it all together correctly :(
If you have a set {a1, a2, ... , an} of n elements then there's probably a number of ways to describe a function that finds the minimum. I'd say the simplest one to design would work as follows: 1. Compare {a1, a2} using min (which presumably finds the sign of a1-a2, but at any rate is not a difficult comparison). Label the minimum b1. 2. Compare {b1,a3} in the same...
If you have a set {a1, a2, ... , an} of n elements then there's probably a number of ways to describe a function that finds the minimum. I'd say the simplest one to design would work as follows:
1. Compare {a1, a2} using min (which presumably finds the sign of a1-a2, but at any rate is not a difficult comparison). Label the minimum b1.
2. Compare {b1,a3} in the same way -- the new minimum can be labelled as b2.
3. And so on, until finally one compares b_(n-2) with an, finds the minimum, and labels it b_(n-1) -- which ought to be the minimum of the whole set.
I think this is the most efficient way of finding the minimum and should always work, and has the advantage of being algorithmically easy to implement for any set size. I'm not 100% sure that this is what the question was after, but it seems right to me.
If, at any point, two numbers being compared are equal, then the algorithm should arbitrarily choose the first number to enter the set {bi}.
If I've designed this algorithm correctly, then on the set {a}= {53,43,64,34,223,265,7,66,6,2} then the set {b}={43,43,34,34,34,7,7,6,2} which consists of progressively small members of the set as you go along and find new minima. Hope this helps.
Thanks for clarifying things for me! when you break it down its seems easier.
can i ask for one more question
if i want to write down in axiomatic description
for example:
absolute value of an integer:
abs : Z →Z
∀n : Z •
n ≤0⇒abs n = -
Generally AB isn't the best place to ask a mathematics question because it doesn't support the notation needed -- as a result it looks like what you've written is incomplete and I can't follow it.
Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.