[system] / branches / rel-2-4-patches / webwork2 / courses.dist / modelCourse / templates / setDemo / nsc2s10p2.pg.bak Repository:
ViewVC logotype

View of /branches/rel-2-4-patches/webwork2/courses.dist/modelCourse/templates/setDemo/nsc2s10p2.pg.bak

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5772 - (download) (as text) (annotate)
Wed Jun 25 11:55:32 2008 UTC (4 years, 10 months ago) by gage
File size: 4827 byte(s)
Adding the contents of modelCourse templates to rel-2-4-5

    1 ##################################################################
    2 ##########Date:: 9-1-101, 19:17:23################
    3 
    4 
    5 
    6 #DESCRIPTION
    7 # Identify the graphs of the function and the derivative
    8 #ENDDESCRIPTION
    9 
   10 #KEYWORDS('derivatives', 'graphs')
   11 DOCUMENT();        # This should be the first executable line in the problem.
   12 
   13 loadMacros(
   14   "PGbasicmacros.pl",
   15   "PGchoicemacros.pl",
   16   "PGanswermacros.pl",
   17   "PGauxiliaryFunctions.pl",
   18   "PGgraphmacros.pl"
   19 );
   20 
   21 TEXT(beginproblem());
   22 $showPartialCorrectAnswers = 0;
   23 
   24 $a=random(0, 6.3, .1);
   25 $b=random(1.1, 1.5, .1);
   26 
   27 $dom = 4;
   28 @slice = NchooseK(3,3);
   29 
   30 @colors = ("blue", "red", "green");
   31 @sc = @colors[@slice];  #scrambled colors
   32 @sa = ('A','B','C')[@slice];
   33 
   34 
   35 $f = "sin($a+$b*cos(x)) for x in <-$dom,$dom> using color:$sc[0] and weight:2";
   36 $fp = "cos($a+$b*cos(x))*(-$b)*sin(x)   for x in <-$dom,$dom> using color=$sc[1] and weight:2";
   37 $fpp = " -sin($a+$b*cos(x))*$b*$b*sin(x)*sin(x) + cos($a+$b*cos(x))*(-$b)*cos(x) for x in <-$dom,$dom> using color=$sc[2] and weight=2";
   38 
   39 $graph = init_graph(-4,-4,4,4,'axes'=>[0,0],'grid'=>[8,8]);
   40 
   41 ($fRef,$fpRef,$fppRef) = plot_functions( $graph,
   42                $f,$fp,$fpp
   43                            );
   44 
   45 # create labels
   46 
   47 $label_point=-0.75;
   48 $label_f = new Label ( $label_point,&{$fRef->rule}($label_point),$sa[0],"$sc[0]",'left')        ;
   49         # NOTE: $fRef->rule is a reference to the subroutine which calculates the
   50         # function.  It was defined in the output of plot_functions. It is used here
   51         # to calculate the y value of the label corresponding to the function,
   52         # and below to find the y values for the labels corresponding to the
   53         # first and second derivatives.
   54 
   55 $label_fp = new Label ( $label_point,&{$fpRef->rule}($label_point),$sa[1],"$sc[1]",'left')      ;
   56 $label_fpp = new Label ( $label_point,&{$fppRef->rule}($label_point),$sa[2],"$sc[2]",'left');
   57 
   58 # insert the labels into the graph
   59 
   60 $graph->lb($label_f,$label_fp,$label_fpp);
   61 
   62 BEGIN_TEXT
   63 \{ image(insertGraph($graph))\}$BR
   64 Identify the graphs A (blue), B( red) and C (green) as the graphs of a function and its
   65 derivatives:$PAR
   66 \{ans_rule(4)\} is the graph of the function $PAR
   67 \{ans_rule(4)\} is the graph of the function's first derivative $PAR
   68 \{ans_rule(4)\} is the graph of the function's second derivative $PAR
   69 END_TEXT
   70 ANS(std_str_cmp_list( @sa ) );
   71 
   72 ENDDOCUMENT();        # This should be the last executable line in the problem.
   73 ##################################################################
   74 ##########Date:: 9-1-101, 19:18:0################
   75 
   76 
   77 #DESCRIPTION
   78 # Identify the graphs of the function and the derivative
   79 #ENDDESCRIPTION
   80 
   81 #KEYWORDS('derivatives', 'graphs')
   82 DOCUMENT();        # This should be the first executable line in the problem.
   83 
   84 loadMacros(
   85   "PGbasicmacros.pl",
   86   "PGchoicemacros.pl",
   87   "PGanswermacros.pl",
   88   "PGauxiliaryFunctions.pl",
   89   "PGgraphmacros.pl"
   90 );
   91 
   92 TEXT(beginproblem());
   93 $showPartialCorrectAnswers = 0;
   94 
   95 $a=random(0, 6.3, .1);
   96 $b=random(1.1, 1.5, .1);
   97 
   98 $dom = 4;
   99 @slice = NchooseK(3,3);
  100 
  101 @colors = ("blue", "red", "orange");
  102 @sc = @colors[@slice];  #scrambled colors
  103 @sa = ('A','B','C')[@slice];
  104 
  105 
  106 $f = "sin($a+$b*cos(x)) for x in <-$dom,$dom> using color:$sc[0] and weight:2";
  107 $fp = "cos($a+$b*cos(x))*(-$b)*sin(x)   for x in <-$dom,$dom> using color=$sc[1] and weight:2";
  108 $fpp = " -sin($a+$b*cos(x))*$b*$b*sin(x)*sin(x) + cos($a+$b*cos(x))*(-$b)*cos(x) for x in <-$dom,$dom> using color=$sc[2] and weight=2";
  109 
  110 $graph = init_graph(-4,-4,4,4,'axes'=>[0,0],'grid'=>[8,8]);
  111 
  112 ($fRef,$fpRef,$fppRef) = plot_functions( $graph,
  113                $f,$fp,$fpp
  114                            );
  115 
  116 # create labels
  117 
  118 $label_point=-0.75;
  119 $label_f = new Label ( $label_point,&{$fRef->rule}($label_point),$sa[0],"$sc[0]",'left')        ;
  120         # NOTE: $fRef->rule is a reference to the subroutine which calculates the
  121         # function.  It was defined in the output of plot_functions. It is used here
  122         # to calculate the y value of the label corresponding to the function,
  123         # and below to find the y values for the labels corresponding to the
  124         # first and second derivatives.
  125 
  126 $label_fp = new Label ( $label_point,&{$fpRef->rule}($label_point),$sa[1],"$sc[1]",'left')      ;
  127 $label_fpp = new Label ( $label_point,&{$fppRef->rule}($label_point),$sa[2],"$sc[2]",'left');
  128 
  129 # insert the labels into the graph
  130 
  131 $graph->lb($label_f,$label_fp,$label_fpp);
  132 
  133 BEGIN_TEXT
  134 \{ image(insertGraph($graph))\}$BR
  135 Identify the graphs A (blue), B( red) and C (green) as the graphs of a function and its
  136 derivatives:$PAR
  137 \{ans_rule(4)\} is the graph of the function $PAR
  138 \{ans_rule(4)\} is the graph of the function's first derivative $PAR
  139 \{ans_rule(4)\} is the graph of the function's second derivative $PAR
  140 END_TEXT
  141 ANS(std_str_cmp_list( @sa ) );
  142 
  143 ENDDOCUMENT();        # This should be the last executable line in the problem.

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9