## DESCRIPTION ## Algebra ## ENDDESCRIPTION ## Tagged by tda2d ## DBsubject('Algebra') ## DBchapter('Functions') ## DBsection('Graphs of Functions') ## Date('6/3/2002') ## TitleText1('College Algebra') ## AuthorText1('Stewart, Redlin, Watson') ## EditionText1('3') ## Section1('4.2') ## Problem1('41 25 39 21') ## TitleText2('Precalculus') ## AuthorText2('Stewart, Redlin, Watson') ## EditionText2('3') ## Section2('2.2') ## Problem2('41 25 39 21') ## KEYWORDS('function' 'graph' 'domain' 'range','algebra', 'function') DOCUMENT(); # This should be the first executable line in the problem. loadMacros("PG.pl", "PGbasicmacros.pl", "PGchoicemacros.pl", "PGanswermacros.pl", "PGauxiliaryFunctions.pl" ); $showPartialCorrectAnswers = 0; TEXT(beginproblem()); # Define which of the three sets of pictures to use # The pictures are labeled 1.gif, 2.gif and 3.gif and # stored in the same directory as staticgraphicsexample.gif # These are the corresponding transformed pictures. # Be careful with the labeling, since the URL's could give the # correct answers away. # (In this example the middle integer tells you # the correct position.)$pictID[1] = [ "1-c2s2191.gif", # "$$3$$", "1-c2s2211.gif", # "$$2x+3$$" , "1-c2s2231.gif", # "$$-x+4$$", "1-c2s2251.gif", # "$$-x^2$$", "1-c2s2261.gif", # "$$x^2-4$$", "1-c2s2311.gif", # "$$\frac{1}{x}$$", "1-c2s2331.gif", # "$$|2x|$$", "1-c2s2351.gif", # "$$|x|+x+1$$", ]; $ml = new_match_list();$pictSet=random(1,1,1); # Choose one of the three picture sets #$pictSetname =$pictSet.".gif"; $ml->qa ( "$$3$$ ", image($pictID[$pictSet][0],tex_size=>200), "$$2x+3$$" , image($pictID[$pictSet][1],tex_size=>200), "$$-x+4$$ ", image($pictID[$pictSet][2],tex_size=>200), "$$-x^2$$", image($pictID[$pictSet][3],tex_size=>200), "$$x^2-4$$", image($pictID[$pictSet][4],tex_size=>200), "$$\frac{1}{x}$$" , image($pictID[$pictSet][5],tex_size=>200), "$$|2x|$$", image($pictID[$pictSet][6],tex_size=>200), "$$|x|+x+1$$", image($pictID[$pictSet][7],tex_size=>200), );$numGraphs = 4; $ml->choose($numGraphs); sub format_graphs { my $self = shift; my @in = @_; my$out = ""; while(@in) { $out .= shift(@in). "#" ; }$out; # The output has to be a string in order to conform to the # specs for the match list object, but I've put some # markers in (#) so that # I can break the string up into a list for use # as an input into row. } # We need to change the output, since the normal # output routine will put the pictures one above another. $ml->rf_print_a(~~&format_graphs); BEGIN_TEXT Match the functons with their graphs. Enter the letter of the graph below which corresponds to the function. ($BBOLD Click on image for a larger view $EBOLD) \{$ml -> print_q \} END_TEXT # Place the output into a table TEXT( begintable($numGraphs), row( split("#",$ml->print_a() ) ), row(@ALPHABET[ 0..($numGraphs-1) ] ), endtable(), ); ANS(str_cmp($ml ->ra_correct_ans() ) ) ; ENDDOCUMENT(); # This should be the last executable line in the problem.