1
$\begingroup$

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.

The dashed line is the maximum utility each customer can get

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?

$\endgroup$
  • $\begingroup$ I think the short answer is no. The only way to avoid updating after new information arrives (new β) is to have pre-calculated all the possible sequences of β's and perform a search. $\endgroup$ – user42582 Sep 17 '16 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.