$x =$number of 19 in sets

$y =$number of 21-in sets

$c_x =$ cost of manufacturing 19 in sets

$c_y =$ cost of manufacturing 21 in sets

$c_{tot} =$ total cost

$s_x =$ selling price of 19 in sets

$s_y =$ selling price of 21 in sets

$R =$ revenue

$P =$ profit

$x\geq 0, y\geq 0$

$c_x = 195x$

$c_y = 225y$

$c_{tot} = 400,000 + c_x +c_y$

$s_x = 339-0.01x -0.003y$

$s_y = 399 - 0.01y - 0.004x$

$R = x\cdot s_x + y\cdot s_y$

$P = R - c_{tot}$

Maximize P

In [1]:

cx(x, y) = 195*x cy(x, y) = 225*y ctot(x,y) = 400000 + cx(x,y) + cy(x,y) sx(x, y) = 339 - 0.01*x -0.003*y# sellin price of 19-inch sy(x, y) = 399 -0.01*y - 0.004*x R(x, y) = x*sx(x, y) + y*sy(x, y) P(x, y) = R(x,y) - ctot(x,y)

In [2]:

contour_plot(P(x,y),(x, 0, 10000),(y,0, 10000))

We find all points $(x,y)$ with $\frac{dP}{dx} =0$ and $\frac{dP}{dy} =0$

In [3]:

eq = solve([diff(P(x,y),x)==0, diff(P(x,y),y)==0],x,y)

In [4]:

show(eq)

$\left[\left[x = \left(\frac{554000}{117}\right), y = \left(\frac{824000}{117}\right)\right]\right]$

In [5]:

n(eq[0][0].rhs())

4735.04273504274

In [6]:

n(eq[0][1].rhs())

7042.73504273504

In [7]:

P(eq[0][0].rhs(),eq[0][1].rhs())

553641.025641026

sensitivity of $x$ and $y$ to the elasticity of the 19 in sets and 21 inch sets

In [8]:

sxa(x,y,a) = 339 - a*x -0.003*y Ra(x,y,a) = x*sxa(x, y,a) + y*sy(x, y) Pa(x,y,a) = Ra(x,y,a) - ctot(x,y)

In [9]:

eq_1 = solve([diff(Pa(x,y,a),x)==0,diff(Pa(x,y,a),y)==0,],x,y)

In [10]:

show(eq_1)

$\left[\left[x = \frac{1662000}{40000 \, a - 49}, y = \frac{48000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49}\right]\right]$

In [11]:

xa = eq_1[0][0].rhs()

In [12]:

show(xa)

$\frac{1662000}{40000 \, a - 49}$

In [13]:

sxa(a)= xa.diff(a)*a/xa show(sxa(.01))

$-1.13960113960114$

Our computations suggest that we should expect a 1.14% decrease in manufacturing of 19 in monitors for every 1% increase in the elasticity coefficient for 19 in monitors.

In [14]:

ya = eq_1[0][1].rhs()

In [15]:

show(ya)

$\frac{48000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49}$

In [16]:

sya(a)= ya.diff(a)*a/ya show((sya(.01)))

$0.268165850690123$

Our computations suggest that we should expect a 2.7% decrease in manufacturing of 21 in monitors for every 1% increase in the elasticity coefficient for 21 in monitors.

In [17]:

pmax(a) = Pa(xa,ya,a)

In [18]:

show(pmax)

$a \ {\mapsto}\ -\frac{144000.000000000 \, {\left(7250 \, a - 21\right)} {\left(\frac{160.000000000000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49} + \frac{2216.00000000000}{40000 \, a - 49} - 133.000000000000\right)}}{40000 \, a - 49} - \frac{10800000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49} - \frac{4.98600000000000 \times 10^{6} \, {\left(\frac{48.0000000000000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49} + \frac{554000.000000000 \, a}{40000 \, a - 49} - 113.000000000000\right)}}{40000 \, a - 49} - \frac{324090000}{40000 \, a - 49} - 400000$

In [19]:

spmax = pmax.diff(a)*a/pmax spmax(0.01)

-0.404966912932827

In [20]:

diff(Pa(x,y,a),a)

-x^2

In [21]:

-eq[0][0].rhs()^2*0.01/(553641.025)

-0.404966913401712

In [3]:

#Lagrange Multipliers Problem #We reconsider the color TV problem (Example 2.1) introduced in the previous section. There we assumed that the company has the potential to produce any number of TV sets per year. Now we introduce constraints based on the available production capacity. Consideration of these two products came about because the company plans to discontinue manufacture of some older models, #thus providing excess capacity at its assembly plant. This excess capacity could be used to increase production of other existing product lines, but the company feels that the new products will be more profitable. It is estimated that the available production capacity will be sufficient to produce 10,000 sets per year. The company has an ample supply of 19-inch and 21-inch LCD panels and other standard components; however, the circuit boards necessary for constructing the sets are currently in short supply. Also, the 19-inch TV requires a different board than the 21-inch models because of the internal configuration, which cannot be changed without a major redesign, which the company is not prepared to undertake at this time. The supplier is able to supply 8,000 boards per year for the 21-inch model and 5,000 boards per year for the 19-inch model. #1. Taking this information into account, how should the company set production levels? #2.2 Lagrange Multiplier cx(x, y) = 195*x cy(x, y) = 225*y ctot(x,y) = 400000 + cx(x,y) + cy(x,y) sx(x, y) = 339 - 0.01*x -0.003*y sy(x, y) = 399 -0.01*y - 0.004*x R(x, y) = x*sx(x, y) + y*sy(x, y) P(x, y) = R(x,y) - ctot(x,y)

In [23]:

p1 = contour_plot(P(x,y),(x, 0, 10000), (y,0,10000)) p2 = implicit_plot(x==5000,(x,0,10000),(y,0,10000),color='red') p3 = implicit_plot(y ==8000,(x,0,10000),(y,0,10000), color = 'blue') p4 = implicit_plot(x+y ==10000,(x,0,10000),(y,0,10000),color='green') show(p1 + p2+ p3 + p4)

In [24]:

L1 = var('L1') solve([P.diff(x)==L1,P.diff(y)==0,x==5000],x,y,L1)

[[x == 5000, y == 6950, L1 == (-93/20)]]

In [25]:

L2 = var('L2') solve([P.diff(x)==0,P.diff(y)==L2,y==8000],x,y,L2)

[[x == 4400, y == 8000, L2 == (-84/5)]]

In [27]:

L3 = var('L3') # Lambda values have an important meaning. solve([P.diff(x)==L3,P.diff(y)==L3, x+y ==10000],x,y,L3)

[[x == (50000/13), y == (80000/13), L3 == 24]]

In [ ]:

```
```

In [28]:

L4 = var('L4') solve([P.diff(x)==L4, P.diff(y)==0, x== 0],x,y,L4)

[[x == 0, y == 8700, L4 == (831/10)]]

In [29]:

L5 = var('L5') solve([P.diff(x)==0, P.diff(y)==L5, y==0],x,y,L5)

[[x == 7200, y == 0, L5 == (618/5)]]

(5000,0)

(5000, 5000)

(50,000/13, 80,000/13)

(2000, 8000)

(0, 8000)

(0,0)

In [7]:

show(P(50000/13, 80000/13))

$532307.692307692$

In [8]:

P(5000,0)

70000.0000000000

In [9]:

P(5000,5000)

515000.000000000

In [10]:

P(2000, 8000)

488000.000000000

In [11]:

P(0, 8000)

352000.000000000

In [12]:

P(0,0)

-400000.000000000

In [30]:

sxa(x, y,a) = 339 - a*x -0.003*y sy(x, y) = 399 -0.01*y - 0.004*x Ra(x, y,a) = x*sxa(x, y,a) + y*sy(x, y) Pa(x, y,a) = Ra(x,y,a) - ctot(x,y)

In [31]:

La = var('La') solve([Pa.diff(x)==La,Pa.diff(y)==La, x+y ==10000],x,y,La)

[[x == 50000/(1000*a + 3), y == 20000*(500*a - 1)/(1000*a + 3), La == -52*(500*a - 11)/(1000*a + 3)]]

In [32]:

xa(a)=50000/(1000*a + 3)

In [33]:

Sxa(a)= xa.diff(a)*a/xa

In [17]:

Sxa(0.01) # If a goes up by 10%, x decreases by 7,7%

-0.769230769230769

In [18]:

ya(a)=20000*(500*a - 1)/(1000*a + 3)

In [19]:

optimalP(a) = Pa(xa,ya,a)

In [20]:

Spa(a) = optimalP.diff(a)*a/optimalP

In [21]:

Spa(0.01) # If "a" goes up 10%, profit will go down by 2.8%.

-0.277901289461984

Sensitivity of the profit with respect to the condition $x+y =10000$

In [22]:

L= var('L') c = var('c') sol = solve([P.diff(x)==L,P.diff(y)==L, x+y ==c],x,y,L)

In [23]:

pmaxc(c) = P(sol[0][0].rhs(), sol[0][1].rhs())

In [24]:

SPc(c) = pmaxc.diff(c)*c/pmaxc

In [25]:

SPc(10000)

0.450867052023121

In [26]:

L3 = var('L3') solve([P.diff(x)==L3,P.diff(y)==L3, x+y ==10001],x,y,L3)

[[x == (100013/26), y == (160013/26), L3 == (47973/2000)]]

In [27]:

P(100013/26, 160013/26)

532331.685557693

In [28]:

pmaxcdiff(c)= pmaxc.diff(c)

In [ ]:

```
```

In [29]:

pmaxcdiff(10000)# How much you're willing to pay to increase production?

24.0000000000000

Suppose now that we have the constraint x<= 3000

In [31]:

P(3000, 7000)

523000.000000000

In [32]:

P(2000, 8000)

488000.000000000

In [ ]:

```
```

Shadow price is to increase the c by one

to increase 19-inch by 1, you should'nt pay more than 22 dollars, to increase total production by one , you shouldn't pay more than $13.

In [37]:

solve([P.diff(x)==L1 + L2, P.diff(y)==L2, x==3000, x+y==10000],x,y,L1,L2)

[[x == 3000, y == 7000, L1 == 22, L2 == 13]]

In [ ]:

In [ ]:

```
```

In [ ]:

```
```

In [ ]:

```
```

In [ ]:

```
```

In [ ]:

```
```

In [ ]:

```
```

In [ ]:

```
```

In [ ]:

```
```