text: ##DESCRIPTION
  ##
  ## COPYRIGHT INFORMATION:
  ## This problem is used with permission from de Silva, Mechanics of Materials, CRC Press, Boca Raton, 2014. 
  ##
  ## Coding contact: agnes.dentremont@mech.ubc.ca
  ##
  ## 
  ## We gratefully acknowledge the financial support for this 
  ## project provided by UBC Vancouver students via the Teaching
  ## and Learning Enhancement Fund. We also gratefully acknowledge
  ## additional funding support from BCcampus, the UBC Department of
  ## Mechanical Engineering, and the UBC Applied Science Dean’s Office.  
  ##
  ## We acknowledge the generosity of Clarence de Silva in providing these problems for coding. 
  ##
  ## The coding of this work was completed on the traditional, ancestral, and unceded
  ## territory of the Musqueam people. 
  ##
  ##ENDDESCRIPTION
  
  ## DBsubject()
  ## DBchapter()
  ## DBsection()
  ## Institution('University of British Columbia')
  ## Author(Clarence de Silva)
  ## Date()
  ## Level()
  ## KEYWORDS('')
  ## RESOURCES('UBC-SM-18-003.png')
  ## TitleText('TBD')
  ## EditionText('TBD')
  ## AuthorText('TBD')
  ## Section('TBD')
  ## Problem('TBD')
  ## Beginner
  DOCUMENT();
  
  loadMacros(   
  	"PGstandard.pl",     # Standard macros for PG language
  	"MathObjects.pl",
  	"PGML.pl",
  	"parserPopUp.pl",
  	"parserMultiAnswer.pl",
  	"parserRadioButtons.pl",
  	#"source.pl",        # allows code to be displayed on certain sites.
  	#"PGcourse.pl", 	 # Customization file for the course
     	);
  
  TEXT(beginproblem());
  
  ##############################################################
  #
  #  Setup
  #
  #
  
  Context("Numeric");
  #given
  $m1 = random(800,1000,50);
  $m2 = 2000;
  $p = random(300,500,50);
  $d2 = random(0.1,0.3,.02);
  $mc = PopUp(["?","Compressive","Tensile"], "Compressive");
  
  #image scale
  $imgScale = .2;
  
  #image aspect ratio
  $width = $imgScale*1186;
  $height = $imgScale*1718;
  
  #computation 
  $ab = $m1*9.81;
  $bc = ($m1 - $p)*9.81;
  $cd = ($m1 + $m2 - $p)*9.81;
  $d1 = sqrt($ab/$bc)*$d2;
  $d3 = sqrt($cd/$bc)*$d2;
  
  
  
  ##############################################################
  #
  #  PGML 
  #
  #
  
  BEGIN_PGML
  
  >>[@ image( "UBC-SM-18-003.png", width=>[$width], height=>[$height]) @]*<<
  
  A tower is made of three uniform cylindrical segments [`AB`], [`BC`], and [`CD`] of diameter [`d_1`], [`d_2`], and [`d_3`], respectively.  It carries a load of [`M_1=[$m1]`] [`kg`] mass at the top at [`A`], a platform (deck) at [`B`] which is anchored using cables with a net vertical upward force [`P = [$p]`] [`kg`], and another load of mass [`M_2=[$m2]`] [`kg`] at [`C`].
  1.	Determine the internal axial force distribution in the three segments of the tower.
  2.	If [`d_2=[$d2]`] [`m`], determine [`d_1`] and [`d_3`] such that the average axial normal stress is uniform (i.e., constant) along the tower. 
  
  _Note: Assume the tower segments and the platform to be relatively light_.
  
  [`F_{AB}=`] [____] [`N\quad`]   [@ $mc->menu() @]*  
  [`F_{BC}=`] [____] [`N\quad`]   [@ $mc->menu() @]*  
  [`F_{CD}=`] [____] [`N\quad`]   [@ $mc->menu() @]*  
  
  [`d_1=`] [____] [`m`]  
  [`d_3=`] [____] [`m`]  
    
  END_PGML
  
  ANS(num_cmp($ab,reltol=>5));
  ANS($mc->cmp);
  ANS(num_cmp($bc,reltol=>5));
  ANS($mc->cmp);
  ANS(num_cmp($cd,reltol=>5));
  ANS($mc->cmp);
  
  ANS(num_cmp($d1,reltol=>5));
  ANS(num_cmp($d3,reltol=>5));
  
  ##############################################################
  
  ENDDOCUMENT();