I'm new to mathematica and I'm trying to avoid loops. The setting is the following: I have consumers with preferences (their Betas). Depending on the Beta consumers will have different preferences.
I take the upper envelope across the domain of Betas ([0,2]) and I get the breakpoints of the upper envelope.
breaks=Cases[Last/@(InitialEnvelope[\[Beta]]//PiecewiseExpand)[[1]],_?NumericQ,{2}]//Union
Which I took from: How to efficiently get breakpoints of piecewise functions.
Then I randomly extract a Beta from a distribution and compare it with the breakpoints of the upper envelope to check which is the maximal utility for that consumer.
Each time a new consumer arrives, she will change the upper envelope for the next one, and thus I need to update the breakpoints and compare them with the new Beta each time. Is there a way to update and collect the results for every step without a loop?
