(* The Relationship Between Ramsey Pricing and Optimal Nonlinear Pricing *) < x[[i]]]; price = Array[p, 4]; entry = Array[e, 4]; objective = Plus @@ (IndirectUtility[price, demandsystem4] - price Demands[price, demandsystem4] - E1[price, demandsystem4]); vars = price; ineq = {}; eq = {Profit1[price, E1[price, demandsystem4], demandsystem4, costfunction9]}; KTMax[objective, vars, ineq, eq] O2[x_, d_DemandSystem] := Module[{quant, outlay, soln}, quant = Array[q, Length[x]]; outlay = Array[o, Length[x]]; soln = First[Solve[(# == 0) & /@ Join[IR2[quant, outlay, d], DIC2[quant, outlay, d]], outlay]]; (outlay /. soln) /. q[i_] :> x[[i]]]; quant = Array[q, 4]; outlay = Array[o, 4]; objective = Plus @@ (Utility[quant, demandsystem4] - O2[quant, demandsystem4]); vars = quant; ineq = {}; eq = {Profit2[quant, O2[quant, demandsystem4], demandsystem4, costfunction9]}; KTMax[objective, vars, ineq, eq]