##DESCRIPTION
## 
## Created by the UBC Faculty of Applied Science.  
## Project led by Agnes d'Entremont, Jonathan Verrett, and Negar M. Harandi. 
##
## Contact: agnes.dentremont@mech.ubc.ca
##
## This work is licensed under the Creative Commons
## Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
## <https://creativecommons.org/licenses/by-sa/4.0/>
##
## 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.  
##
## 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(UBC Engineering)
## Date()
## Level()
## KEYWORDS('Nodal Analysis', 'Loop Analysis')
## RESOURCES('UBC-CIR-18-518.png')
## TitleText('TBD')
## EditionText('TBD')
## AuthorText('TBD')
## Section('TBD')
## Problem('TBD')
## Beginner


DOCUMENT();

#image scale
$imgScale = .2;

#image aspect ratio
$width = $imgScale*3120;
$height = $imgScale*2019;



loadMacros(   
	"PGstandard.pl",     # Standard macros for PG language
	"MathObjects.pl",
	"PGML.pl",
	"parserPopUp.pl",
	"parserMultiAnswer.pl",
	"parserRadioButtons.pl",
	"PGauxiliaryFunctions.pl",
	"niceTables.pl",
	#"source.pl",        # allows code to be displayed on certain sites.
	#"PGcourse.pl", 	 # Customization file for the course
   	);

TEXT(beginproblem());

##############################################################
#
#  Setup
#
#

Context("Numeric");

#given
$r = random(10,25,2.5);
$a = random(0.1,1,0.1);

#computation 
$ionumer = (50*(2*$r - 25));
$iodenom = (50*$a - 95*$r - 4*$a*$r + 4*$r**2);
$vonumer = (50*(25*$a - 25*$r - 2*$a*$r + 2*$r**2));
$vodenom =(50*$a - 95*$r - 4*$a*$r + 4*$r**2);
$vo = $vonumer/$vodenom;
$io = $ionumer/$iodenom;

#set tolerance
Context()->flags->set(
tolerance=>.02,
);

##############################################################
#
#  Text 
#
#

BEGIN_PGML

Given [`a = [$a]`], [`R_1 = [$r]`] [`\Omega`], [`R_5 = [$r*5]`] [`\Omega`], [`R_4 = [$r*4]`] [`\Omega`], find [`i_o`] and [`v_o`].

[@ image("UBC-CIR-18-518.png", width=>[$width], height=>[$height]) @]*

[`v_o=`] [_____]{"$vo"} [`V`]  
[`i_o=`] [_____]{"$io"} [`A`]  

END_PGML

##############################################################

ENDDOCUMENT();