[npl] / trunk / NationalProblemLibrary / LoyolaChicago / Precalc / Chap9Sec5 / Q36.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/LoyolaChicago/Precalc/Chap9Sec5/Q36.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2461 - (download) (annotate)
Fri Oct 7 16:42:13 2011 UTC (19 months, 2 weeks ago) by glarose
File size: 5083 byte(s)
LoyolaChicago 9.5: 4e tagging, updates.

    1 # DESCRIPTION
    2 # Problem from Functions Modeling Change, Connally et al., 3rd ed.
    3 # WeBWorK problem written by Adam Spiegler, <aspiegler@luc.edu>
    4 # ENDDESCRIPTION
    5 
    6 ## DBsubject('Precalculus')
    7 ## DBchapter('Polynomial And Rational Functions')
    8 ## DBsection('The Short-Run Behavior Of Rational Functions')
    9 ## KEYWORDS('rational','fraction','polynomial,'asymptote','intercept')
   10 ## TitleText1('Functions Modeling Change')
   11 ## EditionText1('3')
   12 ## AuthorText1('Connally')
   13 ## Section1('9.5)
   14 ## Problem1('36')
   15 ## TitleText2('Functions Modeling Change');
   16 ## EditionText2('4')
   17 ## AuthorText2('Connally')
   18 ## Section2('11.5')
   19 ## Problem2('38')
   20 ## Author('Adam Spiegler and Paul Pearson')
   21 ## Institution('Loyola University Chicago and Fort Lewis College')
   22 
   23 DOCUMENT();
   24 
   25 loadMacros("PG.pl",
   26            "PGbasicmacros.pl",
   27 #           "PGchoicemacros.pl",
   28            "PGanswermacros.pl",
   29            "PGgraphmacros.pl",
   30            "PGauxiliaryFunctions.pl",
   31 #           "extraAnswerEvaluators.pl",
   32 "MathObjects.pl",
   33 "AnswerFormatHelp.pl",
   34 "PGcourse.pl",
   35            );
   36 
   37 TEXT(beginproblem());
   38 
   39 Context("Numeric");
   40 
   41 $showPartialCorrectAnswers = 1;
   42 
   43 $r = random(1,5,2);
   44 $s = random(-6,-2,2);
   45 $x0 = $r+1;
   46 
   47 
   48 $top1 = $r+.01;
   49 $bot1 = $r - .01;
   50 $top2 = $s+.01;
   51 $bot2 = $s - .01;
   52 
   53 ####### $i is vertical reflection ############
   54 $i = random(-1,1,2);
   55 
   56 if ($i == -1){
   57      $valign1 = 'right'; $dx1 = -.1; $yvert2 = 1;
   58      $valign2 = 'left'; $dx2 = .1; $yvert1 = -1;
   59      $disp_ans = "\frac{-x}{(x-$r)(x-$s)}";
   60      $ans = "-x/((x-$r)(x-$s))";
   61      $y0 = -$x0/($x0-$s);
   62      $y0_bot = $x0-$s; $y0_top = -$x0;
   63 
   64      ($n,$d) = reduce($y0_top,$y0_bot);
   65      $disp_y0 = ($d == 1 ) ? $n : "\frac{$n}{$d}";
   66      $txt_y0 = ( $d == 1 ) ? $n : "$n/$d";
   67 
   68      $pos = "below"; $neg = "above"; $sign = "negative";
   69      $otb = 'top'}
   70 else {
   71      $valign2 = 'left'; $dx2 = .1; $yvert1 = 1;
   72      $valign1 = 'right'; $dx1 = -.1; $yvert2 = -1;
   73      $disp_ans = "\frac{x}{(x-$r)(x-$s)}";
   74      $ans = "x/((x-$r)(x-$s))";
   75      $y0 = $x0/($x0-$s);
   76      $y0_bot = $x0-$s; $y0_top = $x0;
   77 
   78      ($n,$d) = reduce($x0,$y0_bot);
   79      $disp_y0 = ($d == 1 ) ? $n : "\frac{$n}{$d}";
   80      $txt_y0 = ( $d == 1 ) ? $n : "$n/$d";
   81 
   82      $pos = "above"; $neg = "below"; $sign = "positive";
   83      $otb = 'bottom'};
   84 
   85 $f[0] = "$i*x/((x-$r)(x-$s)) for x in <-10,$bot2> using color:blue and weight:2";
   86 $f[1] = "$i*x/((x-$r)(x-$s)) for x in <$top2,$bot1> using color:blue and weight:2";
   87 $f[2] = "$i*x/((x-$r)(x-$s)) for x in <$top1,10> using color:blue and weight:2";
   88 
   89 $graph = init_graph(-10,-2,10,2,'axes'=>[0,0],'ticks'=>[1,1]);
   90 $graph->lb('reset');
   91 #for ($i = 1; $i <= 4; $i++) {
   92 #   $graph->lb(new Label(2*$i,-.1,2*$i,'black','center','top'));
   93 #   $graph->lb(new Label(-2*$i,-.1,-2*$i,'black','center','top'));
   94 #   $graph->lb(new Label(-.1,2*$i,2*$i,'black','right','middle'));
   95 #   $graph->lb(new Label(-.1,-2*$i,-2*$i,'black','right','middle'))};
   96 $graph->lb(new Label($s+$dx1,$yvert1,"x=$s",'red',$valign1,'bottom'));
   97 $graph->lb(new Label($r+$dx2,$yvert2,"x=$r",'red',$valign2,'bottom'));
   98 $graph->lb(new Label(9.8,0.1,"x",'black','right','bottom'));
   99 $graph->lb(new Label(-.1,1.9,"y",'black','right','top'));
  100 $graph->lb(new Label($x0+.1,$y0,"($x0, $txt_y0)",'black','left',$otb));
  101 $graph->moveTo($r,10);
  102 $graph->lineTo($r,-10,'red');
  103 $graph->moveTo($s,10);
  104 $graph->lineTo($s,-10,'red');
  105 $point[0] = closed_circle( 0,0, black );
  106 $point[1] = closed_circle( $x0,$y0, black );
  107 $graph -> stamps(@point);
  108 plot_functions( $graph, $f[0],$f[1], $f[2] );
  109 $fig = image(insertGraph($graph), width => 400, height => 400, tex_size => 700);
  110 
  111 Context()->texStrings;
  112 BEGIN_TEXT
  113 Find a possible formula for the function graphed below.  Assume the function has only one \(x\)-intercept at the origin, and the point marked on the graph below is located at \( \left( $x0, $disp_y0 \right) \).  The asymptotes are \( x = $s \) and \( x = $r \).  Give your formula as a reduced rational function.
  114 $PAR
  115 \( f(x) = \) \{ ans_rule(30) \}
  116 \{ AnswerFormatHelp("formulas") \}
  117 $PAR
  118 $BCENTER
  119 $fig
  120 $BR
  121 (Click on graph to enlarge)
  122 $ECENTER
  123 END_TEXT
  124 Context()->normalStrings;
  125 
  126 ANS( Compute("$ans")->cmp() );
  127 
  128 #ANS(fun_cmp($ans, vars=>'x' ) );
  129 
  130 
  131 Context()->texStrings;
  132 SOLUTION(EV3(<<'END_SOLUTION'));
  133 $PAR
  134 $BBOLD  SOLUTION $EBOLD
  135 $PAR
  136 Since the graph has a vertical asymptotes at \( x=$r \) and \( x = $s \), let the denominator be \( (x-$r)(x-$s) \).
  137 $BR
  138 Since the graph a zero at \( x= 0 \) let the numerator be \( x \).
  139 $BR
  140 Since the long-run behavior tends toward \( y = 0 \) as \( x \to \pm \infty \), the degree of the numerator must be less than the degree of the denominator, which is true based on our work.
  141 $BR
  142 Since for large positive values of \( x \) the graph approaches the \( x \)-axis from $pos while for large negative values of \( x \) the graph approaches the \( x \)-axis from $neg, the leading coefficient must be $sign.
  143 $PAR
  144 So a possible formula is \( \displaystyle y = f(x) = $disp_ans \). You can check that the when \( x = $x0 \) we have \( y = $disp_y0 \), as we should.
  145 
  146 END_SOLUTION
  147 Context()->normalStrings;
  148 
  149 
  150 COMMENT('MathObject version');
  151 ENDDOCUMENT();

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9