Professional Documents
Culture Documents
Practical 7 (A) PDF
Practical 7 (A) PDF
LINEAR PROGRAMMING
Ques1 : Maximize f(x,y)=3x+9y
subject to : x+4y<=8 ,x+2y<=4 ,x>=0, y>=0
In[10]:= Manipulate [Show [RegionPlot [{x + 4 y ≤ 8 && x + 2 y ≤ 4 && x ≥ 0, y ≥ 0}, {x, 0, 8}, {y, 0, 3}], Plot [
{(8 - x) / 4, (4 - x) / 2, (z - 3 * x) / 9} , { x, 0, 8} , PlotStyle → { Red , Green , Blue }]], { z, 0, 20 }]
f[x_ , y _] := 3 x + 9 y
constraints [x_ , y _] := {x + 4 y ≤ 8, x + 2 y ≤ 4, x ≥ 0, y ≥ 0}
Maximize [f[x, y], constraints [x, y], {x, y}]
Out[10]=
$Aborted
Show RegionPlot [{x + 4 y ≤ 8 && x + 2 y ≤ 4 && x ≥ 0, y ≥ 0}, {x, 0, 8}, {y, 0, 3}],
8-x 4-x 1
Plot , , (z - 3 x) , { x, 0, 8} , PlotStyle → { Red , Green , Blue }
4 2 9
3.0
2.5
2.0
1.5
Out[1]=
1.0
0.5
0.0
0 2 4 6 8
In[22]:= Manipulate [
Show [RegionPlot [{20 x + 30 y ≤ 690 && 5 x + 4 y ≤ 120 && x ≥ 0 && y ≥ 0}, {x, 0, 30 }, {y, 0, 40 }],
Plot [{(690 - 20 x) / 30, (120 - 5 x) / 4, (z - 25 x) / 30 },
{ x, 0, 30 } , PlotStyle → { Red , Green , Blue }]], { z, 0, 1000 }]
f[x_ , y _] := 25 x + 30 y
constraints [x_ , y _] := {20 x + 30 y ≤ 690 , 5 x + 4 y ≤ 120 , x ≥ 0, y ≥ 0}
Maximize [f[x, y], constraints [x, y], {x, y}]
Out[22]=
RegionPlot [{20 x + 30 y ≤ 690 && 5 x + 4 y ≤ 120 && x ≥ 0 && y ≥ 0}, {x, 0, 30 }, {y, 0, 40 }], Plot
1 1 1
(690 - 20 x), (120 - 5 x), (z - 25 x) , { x, 0, 30 } , PlotStyle → { Red , Green , Blue }
30 4 30
40
30
20
Out[3]=
10
0
0 5 10 15 20 25 30
Out[18]=
Show RegionPlot [{2 x + 3 y ≤ 100 && 4 x + 3.5` y ≤ 120 && 2 x + 3 y ≤ 90 && x ≥ 0 && y ≥ 0},
1 120 - 4 x 1 1
{ x, 0, 50 } , { y, 0, 40 }], Plot (100 - 2 x), , (90 - 2 x), (z - 28 x) ,
3 3.5` 3 30
{ x, 0, 50 } , PlotStyle → { Red , Green , Blue , Orange }
40
30
20
Out[2]=
10
0
0 10 20 30 40 50