In teaching Behavioral Economics, optimization problems require some intuition. This intuition can be opaque without calculus literacy. Below is a simulation to demonstrate that the process for constrained optimization works. It has the added benefit of showing isoquants (by colored stripes in the image below), and the strict boundary condition of the efficiency frontier.
Basic constrained optimization problems are as follows:
I have made code in R to simulate the results for a two-part optimization process. The example uses as the functional form.
x1<-runif(25000, min=0, max=y/p1)
#Checking any options inside the constraint or on the constraint
out<-mesh(x1, x2, U)
points3D(x1, x2, U, xlab=”x1″, ylab=”x2″, zlab=”Utility”, phi=-90, theta=90)
And it outputs the following plots (with minor variation). Note that the colored bands represent utility curves, isoquants. The end of the colored points represents the efficiency frontier.
The actual solution is found by:
The Lagrangian is then:
Leading to the first order conditions (derivatives of L):
Using these 3 conditions, we can find the equations:
Where, if then we can solve for the theoretical solutions:
These indeed match very closely with the real solutions.