Closed lindapelzer closed 3 years ago
No problem that the question is a bit late.
The code that you used was:
price_m = optimize.fsolve(lambda x: profit(x,valuations,number_of_goods),130)
fsolve
tries to find a value for x
such that profit
equals 0. But this is not what we are looking for here.
We want to maximize profits (minimize minus profits); hence code should be something like:
price_m = optimize.fmin(lambda x: -profit(x,valuations,number_of_goods),130)
Does this give better results?
Yes it did! Thanks.
Hi,
Sorry for the late request on this assignment, but in the last question I won't succeed in returning the profit maximizing price. I did the following:
I tried: price_m = optimize.fsolve(lambda x: profit(x,valuations,number_of_goods),130) print("{0: .2f}".format(price_m[0])) -> this gave a price of 0, which does not match with the graph (price of about 130) nor my intuition.