The Greatest Fenced Area along a Barn

Manipulate[
Pane[
Column[{		
Graphics[{ 
		{Opacity[0.25],Blue,Rectangle[{-50,0},{150,30}]},
		{Opacity[0.75],Darker[Green],Rectangle[{-50,-30},{150,0}]},
(*Tractor*) {Red,Rectangle[{40,-3},{48,2}]},
			{Red,Rectangle[{52,-2},{57,3}]},
			{Red,Rectangle[{48,-3},{57,0}]},	
			{Darker[Gray],Disk[{55,-2},4]},
			{Yellow,Disk[{55,-2},1.5]},
		 	{Darker[Gray],Disk[{43,-4},2]},
			{Yellow,Disk[{43,-4},1]},
			{Black,Rectangle[{42,2},{43,6}]},
			{Black,Rectangle[{42,6},{44,5}]},		
(*Barn*){Gray,Disk[{135,19},10]},
		{Lighter[Gray],Rectangle[{125,-10},{145,19}]},
		{Darker[Red],Polygon[{{70,-7.5},{70,7.5},{100,0},{100,-20}}]},
		{Darker[Red],Rectangle[{100,-20},{110,0}]},
		{Darker[Red],Rectangle[{100,-20},{110,0}]},
		{Darker[Red],Rectangle[{130,-20},{140,0}]},
		{Darker[Red],Polygon[{{100,0},{110,10},{130,10},{140,0} }]},
		{Darker[Gray],Polygon[{{100,0},{110,10},{80,17.5},{70,7.5} }]},				
		{Darker[Gray],Polygon[{{70,7.5},{80,17.5},{90,17.5},{130,10} }]},								
		{Gray,Rectangle[{110,-20},{130,0}]},
		
			
(*fence*){White,Line[{{110,0},{130,-20}}],Line[{{110,-20},{130,0}}]},
		{Opacity[0.75],Brown,Rectangle[{15x/100+70,-x/20},{-85x/100+70,-x/16-7.5}]},
		{Opacity[0.75],Brown,Rectangle[{-15x/100+100,x/20-10},{-15x/100+100-x,x/16-20}]},
		{Opacity[0.75],Brown,Polygon[{{-85x/100+70,-x/20},{-85x/100+70,-x/16-7.5},{-15x/100+100-x,x/16-20},{-15x/100+100-x,x/20-10}}]},
		{Thick,White,Line[{{-15x/100+100,x/20-10},{-15x/100+100-x,x/20-10}}]},
		{Thick,White,Line[{{15x/100+70,-x/20},{-85x/100+70,-x/20}}]},
		{Thick,White,Line[{{-15x/100+100-x,x/20-10},{-85x/100+70,-x/20}}]},
		{Thick,White,Line[{{-15x/100+100-x,x/20-10},{-15x/100+100-x,x/16-20}}]},
		{Thick,White,Line[{{-85x/100+70,-x/20},{-85x/100+70,-x/16-7.5}}]},
		{White,Text[Row[{Style["x",Italic]," = ",x}],{(200-x)/2,x/20-22}]} ,	
		{White, Text[ Row[{Style["y",Italic]," = ",(200-2x)}],{-19x/20+70,-12}]}
		
		},PlotRange->{{-50,150},{-30,30}},ImageSize->{500,200} ],(*End Graphics1 Row 1*)

		Grid[{{
			 Graphics[{ 
				{Darker[Green],Rectangle[{-45,-55},{185,85}]},
				{Red,Rectangle[{70,66},{90,60}]},
				{Darker[Gray],
				Rectangle[{71,58},{75,60}], Rectangle[{71,66},{75,68}],Rectangle[{80,60},{88,56}], Rectangle[{80,66},{88,70}],Rectangle[{83,65},{88,61}]  },
				{Black, Rectangle[{74,63.5},{76,62.5}]  },
				{Darker[Gray],Rectangle[{100,-50},{135,50}]},	
				{Darker[Gray],Disk[{160,0},20]},
				{Thick,White,Line[{{100-x,x/2-50},{100-x,-x/2+50}}]},
				{Thick,White,Line[{{100-x,x/2-50},{100,x/2-50}}]},
				{Thick,White,Line[{{100-x,-x/2+50},{100,-x/2+50}}]} ,
				{White,Text[Row[{Style["y",Italic]," = ",200-2x}], {80-x,0}]},
				{White,Text[Row[{Style["x",Italic]," = ",x}], {(190-x)/2-10,-50+x/3}]}

			},PlotRange->{{-45,200},{-55,95}}, ImageSize->{250,200},PlotLabel->"bird's eye view"],(*End Graphics 1 Row2*)
			Show[{ 
			 Plot[x(200-2x),{x,0,100},AxesLabel->{Row[{Style["x",Italic]," (m)"}],"area ((m^2))"},PlotRange->{{0,140},{-55,6500}}] , 
			            Graphics[{
				{PointSize[Large],Red,Point[{x,x(200-2x)}]},
				{Black,Text[Row[{Style["x",Italic]," = ",x}], {110,6000}]},
				{Black,Text[Row[{Style["y",Italic]," = 200 - 2 ",Style["x",Italic]," = ",200-2x}], {100,5000}]},
				{Black,Text[Row[{"area = ",x(200-2x)}], {110,4000}]}
			           }]
			
			  },ImageSize->{250,200}] (*End Show*)
		}}, Frame->True] (*End Grid*)	
}],ImageSize->{550,420}], (*End Column *)
 {{x,15,"x (meters)= "},0,100}]

CAPTION

A farmer has 200 meters of fence available and would like to fence off a rectangular area along his 200-meter-long barn. What dimensions would yield the maximum area and what is that maximum area?

THIS NOTEBOOK IS THE SOURCE CODE FROM

"The Greatest Fenced Area along a Barn" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/TheGreatestFencedAreaAlongABarn/

Contributed by: Nasri Abdel-Aziz

A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.
GET WOLFRAM MATHEMATICA »

© Wolfram Demonstrations Project & Contributors   |   Terms of Use   |   Make a new version of this Demonstration »