diff options
author | Karl Berry <karl@freefriends.org> | 2014-12-07 00:59:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-12-07 00:59:56 +0000 |
commit | e1de1645f43fb9336c0c19a3589b553ca59e3963 (patch) | |
tree | cc5d849f59f3f4efbb690fbcda6e0ef37498df9c | |
parent | c2e02cd8865266a299d7d6149dea876ed0503074 (diff) |
latexindent (5dec14)
git-svn-id: svn://tug.org/texlive/trunk@35757 c570f23f-e606-0410-a88d-b1316a301751
36 files changed, 13142 insertions, 11588 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl b/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl index 9376117c324..d023ef014d0 100755 --- a/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl +++ b/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -13,14 +13,29 @@ # # For details of how to use this file, please see readme.txt -# load packages/modules +# load packages/modules: assume strict and warnings are part of every perl distribution use strict; -use warnings; -use FindBin; # help find defaultSettings.yaml -use YAML::Tiny; # interpret defaultSettings.yaml +use warnings; + +# check the other modules are available +foreach my $moduleName ('FindBin','YAML::Tiny','File::Copy','File::Basename','Getopt::Long','File::HomeDir') +{ + # references: + # http://stackoverflow.com/questions/251694/how-can-i-check-if-i-have-a-perl-module-before-using-it + # http://stackoverflow.com/questions/1917261/how-can-i-dynamically-include-perl-modules-without-using-eval + eval { + (my $file = $moduleName) =~ s|::|/|g; + require $file . '.pm'; + $moduleName->import(); + 1; + } or die "$moduleName Perl Module not currently installed; please install the module, and then try running latexindent.pl again; exiting"; +} + +# now that we have confirmed the modules are available, load them +use FindBin; # help find defaultSettings.yaml +use YAML::Tiny; # interpret defaultSettings.yaml and other potential settings files use File::Copy; # to copy the original file to backup (if overwrite option set) use File::Basename; # to get the filename and directory path -#use Getopt::Std; use Getopt::Long; # to get the switches/options/flags use File::HomeDir; # to get users home directory, regardless of OS @@ -32,7 +47,7 @@ my $tracingMode; my $readLocalSettings; my $onlyDefault; my $showhelp; -my $cruftDirectory='./'; +my $cruftDirectory; GetOptions ("w"=>\$overwrite, "o"=>\$outputToFile, @@ -44,12 +59,10 @@ GetOptions ("w"=>\$overwrite, "c=s"=>\$cruftDirectory, ); -die "Could not find directory $cruftDirectory\nExiting, no indentation done." if(!(-d $cruftDirectory)); - # version number -my $versionNumber = "1.11R"; +my $versionNumber = "2.0R"; -# Check the number of input arguments- if it is 0 then simply +# Check the number of input arguments- if it is 0 then simply # display the list of options (like a manual) if(scalar(@ARGV) < 1 or $showhelp) { @@ -70,6 +83,11 @@ ENDQUOTE exit(2); } +# set up default for cruftDirectory using the one from the input file, +# unless it has been specified using -c="/some/directory" +$cruftDirectory=dirname $ARGV[0] unless(defined($cruftDirectory)); + +die "Could not find directory $cruftDirectory\nExiting, no indentation done." if(!(-d $cruftDirectory)); # we'll be outputting to the logfile and to standard output my $logfile; @@ -97,12 +115,12 @@ ENDQUOTE # a quick options check if($outputToFile and $overwrite) { - print $logfile <<ENDQUOTE + print $logfile <<ENDQUOTE -WARNING: +WARNING: \t You have called latexindent.pl with both -o and -w \t -o (output to file) will take priority, and -w (over write) will be ignored - + ENDQUOTE ; $overwrite = 0; @@ -115,7 +133,7 @@ if(scalar(@ARGV)>2) ERROR: \t You're calling latexindent.pl with more than two file names -\t The script can take at MOST two file names, but you +\t The script can take at MOST two file names, but you \t need to call it with the -o switch; for example \t latexindent.pl -o originalfile.tex outputfile.tex @@ -144,7 +162,7 @@ ENDQUOTE exit(2); } -# if the script is called with the -o switch, then check that +# if the script is called with the -o switch, then check that # a second file is present in the call, e.g # latexindent.pl -o myfile.tex output.tex if($outputToFile and scalar(@ARGV)==1) @@ -173,9 +191,9 @@ $defaultSettings = YAML::Tiny->read( "$FindBin::RealBin/defaultSettings.yaml" ); if(!$defaultSettings) { for my $fh ($out,$logfile) { - print $fh <<ENDQUOTE + print $fh <<ENDQUOTE ERROR There seems to be a yaml formatting error in defaultSettings.yaml - Please check it for mistakes- you can find a working version at https://github.com/cmhughes/latexindent.plx + Please check it for mistakes- you can find a working version at https://github.com/cmhughes/latexindent.pl if you would like to overwrite your current version Exiting, no indendation done. @@ -195,6 +213,7 @@ my $indentPreamble = $defaultSettings->[0]->{indentPreamble}; my $onlyOneBackUp = $defaultSettings->[0]->{onlyOneBackUp}; my $maxNumberOfBackUps = $defaultSettings->[0]->{maxNumberOfBackUps}; my $removeTrailingWhitespace = $defaultSettings->[0]->{removeTrailingWhitespace}; +my $cycleThroughBackUps = $defaultSettings->[0]->{cycleThroughBackUps}; # hash variables my %lookForAlignDelims= %{$defaultSettings->[0]->{lookForAlignDelims}}; @@ -206,6 +225,9 @@ my %checkunmatchedELSE= %{$defaultSettings->[0]->{checkunmatchedELSE}}; my %checkunmatchedbracket= %{$defaultSettings->[0]->{checkunmatchedbracket}}; my %noAdditionalIndent= %{$defaultSettings->[0]->{noAdditionalIndent}}; my %indentAfterHeadings= %{$defaultSettings->[0]->{indentAfterHeadings}}; +my %indentAfterItems= %{$defaultSettings->[0]->{indentAfterItems}}; +my %itemNames= %{$defaultSettings->[0]->{itemNames}}; +my %constructIfElseFi= %{$defaultSettings->[0]->{constructIfElseFi}}; # need new hashes to store the user and local data before # overwriting the default @@ -218,6 +240,9 @@ my %checkunmatchedELSEUSER; my %checkunmatchedbracketUSER; my %noAdditionalIndentUSER; my %indentAfterHeadingsUSER; +my %indentAfterItemsUSER; +my %itemNamesUSER; +my %constructIfElseFiUSER; # for printing the user and local settings to the log file my %dataDump; @@ -230,7 +255,7 @@ my $userSettings; # get information about user settings- first check if indentconfig.yaml exists my $indentconfig = File::HomeDir->my_home . "/indentconfig.yaml"; -if ( -e $indentconfig and !$onlyDefault ) +if ( -e $indentconfig and !$onlyDefault ) { print $logfile "Reading path information from ",File::HomeDir->my_home,"/indentconfig.yaml\n"; @@ -248,13 +273,13 @@ if ( -e $indentconfig and !$onlyDefault ) else { print $logfile <<ENDQUOTE -WARNING: $indentconfig +WARNING: $indentconfig contains some invalid .yaml formatting- unable to read from it. - No user settings loaded. + No user settings loaded. ENDQUOTE ; } -} +} else { if($onlyDefault) @@ -275,16 +300,16 @@ else my $directoryName = dirname $ARGV[0]; # add local settings to the paths, if appropriate -if ( (-e "$directoryName/localSettings.yaml") and $readLocalSettings and !(-z "$directoryName/localSettings.yaml")) +if ( (-e "$directoryName/localSettings.yaml") and $readLocalSettings and !(-z "$directoryName/localSettings.yaml")) { - print $logfile "\nAdding ./localSettings.yaml to paths\n\n"; + print $logfile "\nAdding $directoryName/localSettings.yaml to paths\n\n"; push(@absPaths,"$directoryName/localSettings.yaml"); } -elsif ( !(-e "$directoryName/localSettings.yaml") and $readLocalSettings) +elsif ( !(-e "$directoryName/localSettings.yaml") and $readLocalSettings) { print $logfile "WARNING\n\t$directoryName/localSettings.yaml not found\n"; print $logfile "\tcarrying on without it.\n"; -} +} # read in the settings from each file foreach my $settings (@absPaths) @@ -312,8 +337,9 @@ foreach my $settings (@absPaths) $onlyOneBackUp = $userSettings->[0]->{onlyOneBackUp} if defined($userSettings->[0]->{onlyOneBackUp}); $maxNumberOfBackUps = $userSettings->[0]->{maxNumberOfBackUps} if defined($userSettings->[0]->{maxNumberOfBackUps}); $removeTrailingWhitespace = $userSettings->[0]->{removeTrailingWhitespace} if defined($userSettings->[0]->{removeTrailingWhitespace}); + $cycleThroughBackUps = $userSettings->[0]->{cycleThroughBackUps} if defined($userSettings->[0]->{cycleThroughBackUps}); - # hash variables - note that each one requires two lines, + # hash variables - note that each one requires two lines, # one to read in the data, one to put the keys&values in correctly %lookForAlignDelimsUSER= %{$userSettings->[0]->{lookForAlignDelims}} if defined($userSettings->[0]->{lookForAlignDelims}); @@ -340,6 +366,14 @@ foreach my $settings (@absPaths) %indentAfterHeadingsUSER= %{$userSettings->[0]->{indentAfterHeadings}} if defined($userSettings->[0]->{indentAfterHeadings}); @indentAfterHeadings{ keys %indentAfterHeadingsUSER } = values %indentAfterHeadingsUSER if (%indentAfterHeadingsUSER); + %indentAfterItemsUSER= %{$userSettings->[0]->{indentAfterItems}} if defined($userSettings->[0]->{indentAfterItems}); + @indentAfterItems{ keys %indentAfterItemsUSER } = values %indentAfterItemsUSER if (%indentAfterItemsUSER); + + %itemNamesUSER= %{$userSettings->[0]->{itemNames}} if defined($userSettings->[0]->{itemNames}); + @itemNames{ keys %itemNamesUSER } = values %itemNamesUSER if (%itemNamesUSER); + + %constructIfElseFiUSER= %{$userSettings->[0]->{constructIfElseFi}} if defined($userSettings->[0]->{constructIfElseFi}); + @constructIfElseFi{ keys %constructIfElseFiUSER } = values %constructIfElseFiUSER if (%constructIfElseFiUSER); } else { @@ -371,13 +405,14 @@ if ($overwrite) print $logfile "\nBackup procedure:\n"; # original name of file my $filename = $ARGV[0]; - # copy it - my $backupFile = $filename; + + # get the base file name, allowing for different extensions + my $backupFile = basename($filename,(".tex",".sty",".cls")); # add the user's backup directory to the backup path $backupFile = "$cruftDirectory/$backupFile"; - # if both ($onlyOneBackUp and $maxNumberOfBackUps) then we have + # if both ($onlyOneBackUp and $maxNumberOfBackUps) then we have # a conflict- er on the side of caution and turn off onlyOneBackUp if($onlyOneBackUp and $maxNumberOfBackUps>1) { @@ -386,7 +421,7 @@ if ($overwrite) $onlyOneBackUp = 0; } - # if the user has specified that $maxNumberOfBackUps = 1 then + # if the user has specified that $maxNumberOfBackUps = 1 then # they only want one backup if($maxNumberOfBackUps==1) { @@ -407,7 +442,7 @@ if ($overwrite) # be overwritten each time if($onlyOneBackUp) { - $backupFile =~ s/\.tex/$backupExtension/; + $backupFile .= $backupExtension; print $logfile "\t copying $filename to $backupFile\n"; print $logfile "\t $backupFile was overwritten\n\n" if (-e $backupFile); } @@ -415,7 +450,7 @@ if ($overwrite) { # start with a backup file .bak0 (or whatever $backupExtension is present) my $backupCounter = 0; - $backupFile =~ s/\.tex$/$backupExtension$backupCounter/; + $backupFile .= $backupExtension.$backupCounter; # if it exists, then keep going: .bak0, .bak1, ... while (-e $backupFile or $maxNumberOfBackUps>1) @@ -423,6 +458,36 @@ if ($overwrite) if($backupCounter==$maxNumberOfBackUps) { print $logfile "\t maxNumberOfBackUps reached ($maxNumberOfBackUps)\n"; + + # some users may wish to cycle through back up files, e.g: + # copy myfile.bak1 to myfile.bak0 + # copy myfile.bak2 to myfile.bak1 + # copy myfile.bak3 to myfile.bak2 + # + # current back up is stored in myfile.bak4 + if($cycleThroughBackUps) + { + print $logfile "\t cycleThroughBackUps detected (see cycleThroughBackUps) \n"; + for(my $i=1;$i<=$maxNumberOfBackUps;$i++) + { + # remove number from backUpFile + my $oldBackupFile = $backupFile; + $oldBackupFile =~ s/$backupExtension.*/$backupExtension/; + my $newBackupFile = $oldBackupFile; + + # add numbers back on + $oldBackupFile .= $i; + $newBackupFile .= $i-1; + + # check that the oldBackupFile exists + if(-e $oldBackupFile){ + print $logfile "\t\t copying $oldBackupFile to $newBackupFile \n"; + copy($oldBackupFile,$newBackupFile) or die "Could not write to backup file $backupFile. Please check permissions. Exiting.\n"; + } + } + } + + # rest maxNumberOfBackUps $maxNumberOfBackUps=1 ; last; # break out of the loop } @@ -444,7 +509,7 @@ if ($overwrite) copy($filename,$backupFile) or die "Could not write to backup file $backupFile. Please check permissions. Exiting.\n"; } -if(!($outputToFile or $overwrite)) +if(!($outputToFile or $overwrite)) { print $logfile "Just out put to the terminal :)\n\n" if !$silentMode ; } @@ -460,28 +525,28 @@ my $inverbatim=0; # $inverbatim: switch to determine if in my $delimiters=0; # $delimiters: switch that governs if # we need to check for & or not my $matchedbraces=0; # $matchedbraces: counter to see if { } - # are matched; it will be - # positive if too many { + # are matched; it will be + # positive if too many { # negative if too many } # 0 if matched my $matchedBRACKETS=0; # $matchedBRACKETS: counter to see if [ ] - # are matched; it will be - # positive if too many { + # are matched; it will be + # positive if too many { # negative if too many } # 0 if matched my $commandname; # $commandname: either \parbox, \marginpar, # or anything else from %checkunmatched my $commanddetails; # $command details: a scalar that stores - # details about the command + # details about the command # that splits {} across lines -my $countzeros; # $countzeros: a counter that helps +my $countzeros; # $countzeros: a counter that helps # when determining if we're in # an else construct -my $lookforelse=0; # $lookforelse: a boolean to help determine - # if we need to look for an +my $lookforelse=0; # $lookforelse: a boolean to help determine + # if we need to look for an # else construct -my $trailingcomments; # $trailingcomments stores the comments at the end of - # a line +my $trailingcomments; # $trailingcomments stores the comments at the end of + # a line my $lineCounter=0; # $lineCounter keeps track of the line number my $inIndentBlock=0; # $inindentblock: switch to determine if in # a inindentblock or not @@ -492,26 +557,26 @@ my $headingLevel=0; # $headingLevel: scalar that stores which heading my @indent; # @indent: stores current level of indentation my @lines; # @lines: stores the newly indented lines my @block; # @block: stores blocks that have & delimiters -my @commandstore; # @commandstore: stores commands that +my @commandstore; # @commandstore: stores commands that # have split {} across lines -my @commandstorebrackets; # @commandstorebrackets: stores commands that +my @commandstorebrackets; # @commandstorebrackets: stores commands that # have split [] across lines -my @mainfile; # @mainfile: stores input file; used to +my @mainfile; # @mainfile: stores input file; used to # grep for \documentclass my @headingStore; # @headingStore: stores headings: chapter, section, etc -my @indentNames; # @indentNames: keeps names of commands and +my @indentNames; # @indentNames: keeps names of commands and # environments that have caused # indentation to increase -my @environmentStack; # @environmentStack: stores the (nested) names +my @environmentStack; # @environmentStack: stores the (nested) names # of environments -# check to see if the current file has \documentclass, if so, then +# check to see if the current file has \documentclass, if so, then # it's the main file, if not, then it doesn't have preamble open(MAINFILE, $ARGV[0]) or die "Could not open input file"; @mainfile=<MAINFILE>; close(MAINFILE); -# if the MAINFILE doesn't have a \documentclass statement, then +# if the MAINFILE doesn't have a \documentclass statement, then # it shouldn't have preamble if(scalar(@{[grep(m/^\s*\\documentclass/, @mainfile)]})==0) { @@ -532,7 +597,7 @@ while(<MAINFILE>) { # increment the line counter $lineCounter++; - + # tracing mode print $logfile "\n" if($tracingMode and !($inpreamble or $inverbatim or $inIndentBlock)); @@ -542,10 +607,10 @@ while(<MAINFILE>) { # if not, remove all leading spaces and tabs # from the current line, assuming it isn't empty - #s/^\ *//; - #s/^\s+//; - #s/^\t+//; - s/^\t*// if($_ !~ /^((\s*)|(\t*))*$/); + #s/^\ *//; + #s/^\s+//; + #s/^\t+//; + s/^\t*// if($_ !~ /^((\s*)|(\t*))*$/); s/^\s*// if($_ !~ /^((\s*)|(\t*))*$/); # tracing mode @@ -580,19 +645,28 @@ while(<MAINFILE>) } } + # \END{ENVIRONMENTS}, or CLOSING } or CLOSING ] + # \END{ENVIRONMENTS}, or CLOSING } or CLOSING ] + # \END{ENVIRONMENTS}, or CLOSING } or CLOSING ] + + print $logfile "Line $lineCounter\t << PHASE 1: looking for reasons to DECREASE indentation of CURRENT line \n" if($tracingMode); # check to see if we have \end{something} or \] &at_end_of_env_or_eq() unless ($inpreamble or $inIndentBlock); - # check to see if we're at the end of a noindent + # check to see if we have %* \end{something} for alignment blocks + # outside of environments + &end_command_with_alignment(); + + # check to see if we're at the end of a noindent # block %\end{noindent} &at_end_noindent(); # only check for unmatched braces if we're not in # a verbatim-like environment or in the preamble or in a - # noIndentBlock - if(!($inverbatim or $inpreamble or $inIndentBlock)) + # noIndentBlock or in a delimiter block + if(!($inverbatim or $inpreamble or $inIndentBlock or $delimiters)) { - # The check for closing } and ] relies on counting, so + # The check for closing } and ] relies on counting, so # we have to remove trailing comments so that any {, }, [, ] # that are found after % are not counted # @@ -615,13 +689,19 @@ while(<MAINFILE>) # we're not starting another command that has split braces (nesting) &end_command_or_key_unmatched_braces(); - # check to see if we're at the end of a command that splits + # check to see if we're at the end of a command that splits # [ ] across lines &end_command_or_key_unmatched_brackets(); - # check for a heading + # check for a heading such as \chapter, \section, etc &indent_heading(); + # check for \item + &indent_item(); + + # check for \else or \fi + &indent_if_else_fi(); + # add the trailing comments back to the end of the line if(scalar($trailingcomments)) { @@ -630,21 +710,23 @@ while(<MAINFILE>) $_ = $_ . $trailingcomments."\n" ; # tracing mode - print $logfile "Line $lineCounter\t counting braces/brackets complete: added trailing comments back on $trailingcomments\n" if($tracingMode); + print $logfile "Line $lineCounter\t counting braces/brackets complete\n" if($tracingMode); + print $logfile "Line $lineCounter\t Adding trailing comments back on: $trailingcomments\n" if($tracingMode); # empty the trailingcomments $trailingcomments=''; } + # remove trailing whitespace + if ($removeTrailingWhitespace) + { + print $logfile "Line $lineCounter\t removing trailing whitespace (see removeTrailingWhitespace)\n" if ($tracingMode); + s/\s+$/\n/; + } } - # remove trailing whitespace - if ($removeTrailingWhitespace) - { - print $logfile "Line $lineCounter\t removing trailing whitespace\n" if ($tracingMode); - s/\s+$/\n/; - } - + # ADD CURRENT LEVEL OF INDENTATION + # ADD CURRENT LEVEL OF INDENTATION # ADD CURRENT LEVEL OF INDENTATION # (unless we're in a delimiter-aligned block) if(!$delimiters) @@ -666,7 +748,7 @@ while(<MAINFILE>) } push(@lines,$_); # tracing mode - print $logfile "Line $lineCounter\t Adding current level of indentation: ",join(", ",@indentNames),"\n" if($tracingMode); + print $logfile "Line $lineCounter\t || PHASE 2: Adding current level of indentation: ",join(", ",@indentNames),"\n" if($tracingMode); } } else @@ -678,21 +760,39 @@ while(<MAINFILE>) print $logfile "Line $lineCounter\t In delimeter block, waiting for block formatting\n" if($tracingMode); } - # only check for new environments or commands if we're + # \BEGIN{ENVIRONMENT} or OPEN { or OPEN [ + # \BEGIN{ENVIRONMENT} or OPEN { or OPEN [ + # \BEGIN{ENVIRONMENT} or OPEN { or OPEN [ + + # only check for new environments or commands if we're # not in a verbatim-like environment or in the preamble # or in a noIndentBlock, or delimiter block if(!($inverbatim or $inpreamble or $inIndentBlock or $delimiters)) { - # check if we are in a + print $logfile "Line $lineCounter\t >> PHASE 3: looking for reasons to INCREASE indentation of SUBSEQUENT lines \n" if($tracingMode); + + # check if we are in a # % \begin{noindent} # block; this is similar to a verbatim block, the user - # may not want some blocks of code to be touched + # may not want some blocks of code to be touched # # IMPORTANT: this needs to go before the trailing comments # are removed! &at_beg_noindent(); + # check for + # %* \begin{tabular} + # which might be used to align blocks that contain delimeters that + # are NOT contained in an alignment block in the usual way, e.g + # \matrix{ + # %* \begin{tabular} + # 1 & 2 \\ + # 3 & 4 \\ + # %* \end{tabular} + # } + &begin_command_with_alignment(); + # remove trailing comments so that any {, }, [, ] # that are found after % are not counted # @@ -706,7 +806,7 @@ while(<MAINFILE>) # tracing mode print $logfile "Line $lineCounter\t Removing trailing comments for brace count (line is already stored)\n" if($tracingMode); - # check to see if we have \begin{something} or \[ + # check to see if we have \begin{something} or \[ &at_beg_of_env_or_eq(); # check to see if we have \parbox, \marginpar, or @@ -714,7 +814,7 @@ while(<MAINFILE>) # specified in %checkunmatched hash table &start_command_or_key_unmatched_braces(); - # check for an else statement + # check for an else statement (braces, not \else) &check_for_else(); # check for a command that splits [] across lines @@ -723,6 +823,12 @@ while(<MAINFILE>) # check for a heading &indent_after_heading(); + # check for \item + &indent_after_item(); + + # check for \if or \else command + &indent_after_if_else_fi(); + # tracing mode print $logfile "Line $lineCounter\t Environments: ",join(", ",@environmentStack),"\n" if($tracingMode and scalar(@environmentStack)); } @@ -737,7 +843,7 @@ print $logfile "Line Count of indented $ARGV[0]: ",scalar(@lines); if(scalar(@mainfile) != scalar(@lines)) { print $logfile <<ENDQUOTE -WARNING: \t line count of original file and indented file does +WARNING: \t line count of original file and indented file does \t not match- consider reverting to a back up, see $backupExtension; ENDQUOTE ; @@ -771,6 +877,162 @@ close($logfile); exit; +sub indent_if_else_fi{ + # PURPOSE: set indentation of line that contains \else, \fi command + # + # + + # @indentNames could be empty -- if so, exit + return 0 unless(@indentNames); + + # look for \fi + if( $_ =~ m/^\s*\\fi/ and $constructIfElseFi{$indentNames[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t \\fi command found, matching: \\",$indentNames[-1], "\n" if($tracingMode); + &decrease_indent($indentNames[-1]); + } + elsif( ($_ =~ m/^\s*\\else/ or $_ =~ m/^\s*\\or/) and $constructIfElseFi{$indentNames[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t \\else command found, matching: \\",$indentNames[-1], "\n" if($tracingMode); + print $logfile "Line $lineCounter\t decreasing indent, but indentNames is still \\",join(", ",@indentNames), "\n" if($tracingMode); + pop(@indent); + } +} + +sub indent_after_if_else_fi{ + # PURPOSE: set indentation *after* \if construct such as + # + # \ifnum\x=2 + # <stuff> + # <stuff> + # \else + # <stuff> + # <stuff> + # \fi + # + # How to read /^\s*\\(if.*?)(\s|\\|\#) + # + # ^\s* begins with multiple spaces (possibly none) + # \\(if.*?)(\s|\\|\#) matches \if... up to either a + # space, a \, or a # + if( $_ =~ m/^\s*\\(if.*?)(\s|\\|\#)/ and $constructIfElseFi{$1}) + { + # tracing mode + print $logfile "Line $lineCounter\t ifelsefi construct found: $1 \n" if($tracingMode); + &increase_indent($1); + } + elsif(@indentNames) + { + if( ($_ =~ m/^\s*\\else/ or $_ =~ m/^\s*\\or/ ) and $constructIfElseFi{$indentNames[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t setting indent *after* \\else or \\or command found for $indentNames[-1] \n" if($tracingMode); + &increase_indent($indentNames[-1]); + # don't want to store the name of the \if construct twice + # so remove the second copy + pop(@indentNames); + } + } + } + +sub indent_item{ + # PURPOSE: this subroutine sets the indentation for the item *itself* + + if( $_ =~ m/^\s*\\(.*?)(\[|\s)/ and $itemNames{$1} and $indentAfterItems{$environmentStack[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t $1 found within ",$environmentStack[-1]," environment (see indentAfterItems and itemNames)\n" if($tracingMode); + if($itemNames{$indentNames[-1]}) + { + print $logfile "Line $lineCounter\t $1 found- neutralizing indentation from previous ",$indentNames[-1],"\n" if($tracingMode); + &decrease_indent($1); + } + } + +} + +sub indent_after_item{ + # PURPOSE: Set the indentation *after* the item + # This matches a line that begins with + # + # \item + # \item[ + # \myitem + # \myitem[ + # + # or anything else specified in itemNames + # + if( $_ =~ m/^\s*\\(.*?)(\[|\s)/ + and $itemNames{$1} + and $indentAfterItems{$environmentStack[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t $1 found within ",$environmentStack[-1]," environment (see indentAfterItems and itemNames)\n" if($tracingMode); + &increase_indent($1); + } +} +sub begin_command_with_alignment{ + # PURPOSE: This matches + # %* \begin{tabular} + # with any number of spaces (possibly none) between + # the * and \begin{noindent}. + # + # the comment symbol IS indended! + # + # This is to align blocks that contain delimeters that + # are NOT contained in an alignment block in the usual way, e.g + # \matrix{ + # %* \begin{tabular} + # 1 & 2 \\ + # 3 & 4 \\ + # %* \end{tabular} + # } + + if( $_ =~ m/^\s*%\*\s*\\begin{(.*?)}/ and $lookForAlignDelims{$1}) + { + $delimiters=1; + # tracing mode + print $logfile "Line $lineCounter\t Delimiter environment started: $1 (see lookForAlignDelims)\n" if($tracingMode); + } +} + +sub end_command_with_alignment{ + # PURPOSE: This matches + # %* \end{tabular} + # with any number of spaces (possibly none) between + # the * and \end{tabular} (or any other name used from + # lookFroAlignDelims) + # + # Note: the comment symbol IS indended! + # + # This is to align blocks that contain delimeters that + # are NOT contained in an alignment block in the usual way, e.g + # \matrix{ + # %* \begin{tabular} + # 1 & 2 \\ + # 3 & 4 \\ + # %* \end{tabular} + # } + + if( $_ =~ m/^\s*%\*\s*\\end{(.*?)}/ and $lookForAlignDelims{$1}) + { + # same subroutine used at the end of regular tabular, align, etc + # environments + if($delimiters) + { + &print_aligned_block(); + } + else + { + # tracing mode + print $logfile "Line $lineCounter\t FYI: did you mean to start a delimiter block on a previous line? \n" if($tracingMode); + print $logfile "Line $lineCounter\t perhaps using %* \\begin{$1}\n" if($tracingMode); + } + } +} + sub indent_heading{ # PURPOSE: This matches # \part @@ -783,7 +1045,7 @@ sub indent_heading{ # # and anything else listed in indentAfterHeadings # - # This subroutine specifies the indentation for the + # This subroutine specifies the indentation for the # heading itself, i.e the line that has \chapter, \section etc if( $_ =~ m/^\s*\\(.*?)(\[|{)/ and $indentAfterHeadings{$1}) { @@ -796,15 +1058,15 @@ sub indent_heading{ # local scalar my $previousHeadingLevel = $headingLevel; - # if current heading level < old heading level, + # if current heading level < old heading level, if($currentHeading{level}<$previousHeadingLevel) { - # decrease indentation, but only if - # specified in indentHeadings. Note that this check - # needs to be done here- decrease_indent won't + # decrease indentation, but only if + # specified in indentHeadings. Note that this check + # needs to be done here- decrease_indent won't # check a nested hash - - if(scalar(@headingStore)) + + if(scalar(@headingStore)) { while($currentHeading{level}<$previousHeadingLevel and scalar(@headingStore)) { @@ -823,7 +1085,7 @@ sub indent_heading{ } elsif($currentHeading{level}==$previousHeadingLevel) { - if(scalar(@headingStore)) + if(scalar(@headingStore)) { my $higherHeadingName = pop(@headingStore); my %higherLevelHeading = %{$indentAfterHeadings{$higherHeadingName}}; @@ -852,7 +1114,7 @@ sub indent_after_heading{ # # and anything else listed in indentAfterHeadings # - # This subroutine is specifies the indentation for + # This subroutine is specifies the indentation for # the text AFTER the heading, i.e the body of conent # in each \chapter, \section, etc if( $_ =~ m/^\s*\\(.*?)(\[|{)/ and $indentAfterHeadings{$1}) @@ -880,7 +1142,7 @@ sub at_end_noindent{ # This is for blocks of code that the user wants # to leave untouched- similar to verbatim blocks - if( $_ =~ m/^%\s*\\end{(.*?)}/ and $noIndentBlock{$1}) + if( $_ =~ m/^%\s*\\end{(.*?)}/ and $noIndentBlock{$1}) { $inIndentBlock=0; # tracing mode @@ -888,6 +1150,8 @@ sub at_end_noindent{ } } + + sub at_beg_noindent{ # PURPOSE: This matches # % \begin{noindent} @@ -899,7 +1163,7 @@ sub at_beg_noindent{ # This is for blocks of code that the user wants # to leave untouched- similar to verbatim blocks - if( $_ =~ m/^%\s*\\begin{(.*?)}/ and $noIndentBlock{$1}) + if( $_ =~ m/^%\s*\\begin{(.*?)}/ and $noIndentBlock{$1}) { $inIndentBlock = 1; # tracing mode @@ -908,11 +1172,11 @@ sub at_beg_noindent{ } sub start_command_or_key_unmatched_brackets{ - # PURPOSE: This matches + # PURPOSE: This matches # \pgfplotstablecreatecol[... # - # or any other command/key that has brackets [ ] - # split across lines specified in the + # or any other command/key that has brackets [ ] + # split across lines specified in the # hash tables, %checkunmatchedbracket # # How to read: ^\s*(\\)?(.*?)(\[\s*) @@ -924,7 +1188,7 @@ sub start_command_or_key_unmatched_brackets{ # ((?<!\\)\[\s*) match [ possibly leading with spaces # but it WON'T match \[ - if ($_ =~ m/^\s*(\\)?(.*?)(\s*(?<!\\)\[)/ + if ($_ =~ m/^\s*(\\)?(.*?)(\s*(?<!\\)\[)/ and (scalar($checkunmatchedbracket{$2}) or $alwaysLookforSplitBrackets) ) @@ -957,13 +1221,13 @@ sub start_command_or_key_unmatched_brackets{ } sub end_command_or_key_unmatched_brackets{ - # PURPOSE: Check for the closing BRACKET of a command that + # PURPOSE: Check for the closing BRACKET of a command that # splits its BRACKETS across lines, such as # # \pgfplotstablecreatecol[ ... # # It works by checking if we have any entries - # in the array @commandstorebrackets, and making + # in the array @commandstorebrackets, and making # sure that we're not starting another command/key # that has split BRACKETS (nesting). # @@ -971,8 +1235,8 @@ sub end_command_or_key_unmatched_brackets{ # # We count the number of [ and ADD to the counter # ] and SUBTRACT to the counter - if(scalar(@commandstorebrackets) - and !($_ =~ m/^\s*(\\)?(.*?)(\s*\[)/ + if(scalar(@commandstorebrackets) + and !($_ =~ m/^\s*(\\)?(.*?)(\s*\[)/ and (scalar($checkunmatchedbracket{$2}) or $alwaysLookforSplitBrackets)) and $_ !~ m/^\s*%/ @@ -1013,7 +1277,7 @@ sub end_command_or_key_unmatched_brackets{ } sub start_command_or_key_unmatched_braces{ - # PURPOSE: This matches + # PURPOSE: This matches # \parbox{... # \parbox[..]..{ # empty header/.style={ @@ -1021,7 +1285,7 @@ sub start_command_or_key_unmatched_braces{ # etc # # or any other command/key that has BRACES - # split across lines specified in the + # split across lines specified in the # hash tables, %checkunmatched, %checkunmatchedELSE # # How to read: ^\s*(\\)?(.*?)(\[|{|\s) @@ -1032,8 +1296,8 @@ sub start_command_or_key_unmatched_braces{ # (.*?) non-greedy character match and store the result # (\[|}|=|(\s*\\)) either [ or { or = or space \ - if ($_ =~ m/^\s*(\\)?(.*?)(\[|{|=|(\s*\\))/ - and (scalar($checkunmatched{$2}) + if ($_ =~ m/^\s*(\\)?(.*?)(\[|{|=|(\s*\\))/ + and (scalar($checkunmatched{$2}) or scalar($checkunmatchedELSE{$2}) or $alwaysLookforSplitBraces) ) @@ -1079,7 +1343,7 @@ sub start_command_or_key_unmatched_braces{ { # if $matchedbraces < 0 then we must be matching # braces from a previous split-braces command - + # keep matching { OR }, and don't match \{ or \} while ($_ =~ m/(((?<!\\){)|((?<!\\)}))/g) { @@ -1087,6 +1351,9 @@ sub start_command_or_key_unmatched_braces{ # store the match, either { or } my $braceType = $1; + # exit the loop if @commandstore is empty + last if(!@commandstore); + # get the details of the most recent command name $commanddetails = pop(@commandstore); $commandname = $commanddetails->{'commandname'}; @@ -1119,7 +1386,7 @@ sub start_command_or_key_unmatched_braces{ } else { - # otherwise we need to put the command back for the + # otherwise we need to put the command back for the # next brace count push(@commandstore,{commandname=>$commandname, matchedbraces=>$matchedbraces, @@ -1132,17 +1399,17 @@ sub start_command_or_key_unmatched_braces{ } sub end_command_or_key_unmatched_braces{ - # PURPOSE: Check for the closing BRACE of a command that + # PURPOSE: Check for the closing BRACE of a command that # splits its BRACES across lines, such as # # \parbox{ ... # # or one of the tikz keys, such as - # + # # empty header/.style={ # # It works by checking if we have any entries - # in the array @commandstore, and making + # in the array @commandstore, and making # sure that we're not starting another command/key # that has split BRACES (nesting). # @@ -1150,9 +1417,9 @@ sub end_command_or_key_unmatched_braces{ # # We count the number of { and ADD to the counter # } and SUBTRACT to the counter - if(scalar(@commandstore) - and !($_ =~ m/^\s*(\\)?(.*?)(\[|{|=|(\s*\\))/ - and (scalar($checkunmatched{$2}) + if(scalar(@commandstore) + and !($_ =~ m/^\s*(\\)?(.*?)(\[|{|=|(\s*\\))/ + and (scalar($checkunmatched{$2}) or scalar($checkunmatchedELSE{$2}) or $alwaysLookforSplitBraces)) and $_ !~ m/^\s*%/ @@ -1164,6 +1431,9 @@ sub end_command_or_key_unmatched_braces{ # store the match, either { or } my $braceType = $1; + # exit the loop if @commandstore is empty + last if(!@commandstore); + # get the details of the most recent command name $commanddetails = pop(@commandstore); $commandname = $commanddetails->{'commandname'}; @@ -1223,17 +1493,17 @@ sub check_for_else{ # else this # } # - # so we need to look for the else bit, and set + # so we need to look for the else bit, and set # the indentation appropriately. # # We only perform this check if there's something - # in the array @commandstore, and if - # the line itself is not a command, or comment, + # in the array @commandstore, and if + # the line itself is not a command, or comment, # and if it begins with { - if(scalar(@commandstore) - and !($_ =~ m/^\s*(\\)?(.*?)(\[|{|=)/ - and (scalar($checkunmatched{$2}) + if(scalar(@commandstore) + and !($_ =~ m/^\s*(\\)?(.*?)(\[|{|=)/ + and (scalar($checkunmatched{$2}) or scalar($checkunmatchedELSE{$2}) or $alwaysLookforSplitBraces)) and $_ =~ m/^\s*{/ @@ -1272,11 +1542,11 @@ sub at_beg_of_env_or_eq{ # \[ # # It also checks to see if the current environment - # should have alignment delimiters; if so, we need to turn - # ON the $delimiter switch + # should have alignment delimiters; if so, we need to turn + # ON the $delimiter switch # How to read - # m/^\s*(\$)?\\begin{(.*?)}/ + # m/^\s*(\$)?\\begin{(.*?)}/ # # ^ beginning of a line # \s* any white spaces (possibly none) @@ -1289,16 +1559,19 @@ sub at_beg_of_env_or_eq{ # ^ beginning of a line # \s* any white spaces (possibly none) # () empty just so that $1 and $2 are defined - # (\\\[) \[ there are lots of \ because both \ and [ need escaping + # (\\\[) \[ there are lots of \ because both \ and [ need escaping + # \\begin{\\?(.*?)} \begin{something} where something could start + # with a backslash, e.g \my@env@ which can happen + # in a style or class file, for example - if( ( ( $_ =~ m/^\s*(\$)?\\begin{(.*?)}/ and $_ !~ m/\\end{$2}/) + if( ( ( $_ =~ m/^\s*(\$)?\\begin{\\?(.*?)}/ and $_ !~ m/\\end{$2}/) or ($_=~ m/^\s*()(\\\[)/ and $_ !~ m/\\\]/) ) and $_ !~ m/^\s*%/ ) { # tracing mode print $logfile "Line $lineCounter\t \\begin{environment} found: $2 \n" if($tracingMode); - # increase the indentation + # increase the indentation &increase_indent($2); # check for verbatim-like environments @@ -1345,12 +1618,14 @@ sub at_end_of_env_or_eq{ # or # \] # + # Note: environmentname can begin with a backslash + # which might happen in a sty or cls file. + # # It also checks to see if the current environment - # had alignment delimiters; if so, we need to turn - # OFF the $delimiter switch - - if( ($_ =~ m/^\s*\\end{(.*?)}/ or $_=~ m/^(\\\])/) - and $_ !~ m/\s*^%/) + # had alignment delimiters; if so, we need to turn + # OFF the $delimiter switch + + if( ($_ =~ m/^\s*\\end{\\?(.*?)}/ or $_=~ m/^(\\\])/) and $_ !~ m/\s*^%/) { # check if we're at the end of a verbatim-like environment @@ -1361,79 +1636,110 @@ sub at_end_of_env_or_eq{ print $logfile "Line $lineCounter\t \\end{verbatim-like} found: $1, switching off verbatim \n" if($tracingMode); print $logfile "Line $lineCounter\t removing leading spaces \n" if($tracingMode); - #s/^\ *//; - s/^\t+// if($_ ne ""); - s/^\s+// if($_ ne ""); + #s/^\ *//; + s/^\t+// if($_ ne ""); + s/^\s+// if($_ ne ""); } - # check to see if \end{environment} fits with most recent \begin{...} - my $previousEnvironment = pop(@environmentStack); - - # check to see if we need to turn off alignment - # delimiters and output the current block - if($lookForAlignDelims{$1} and ($previousEnvironment eq $1)) + # check if we're in an environment that is looking + # to indent after each \item + if(scalar(@indentNames) and $itemNames{$indentNames[-1]}) { - $delimiters=0; + &decrease_indent($indentNames[-1]); + } - # tracing mode - print $logfile "Line $lineCounter\t Delimiter body FINISHED: $1\n" if($tracingMode); + # some commands contain \end{environmentname}, which + # can cause a problem if \begin{environmentname} was not + # started previously; if @environmentStack is empty, + # then we don't need to check for \end{environmentname} + if(@environmentStack) + { + # check to see if \end{environment} fits with most recent \begin{...} + my $previousEnvironment = pop(@environmentStack); - # print the current FORMATTED block - @block = &format_block(@block); - foreach $line (@block) - { - # add the indentation and add the - # each line of the formatted block - # to the output - # unless this would only create trailing whitespace and the - # corresponding option is set - unless ($line =~ m/^$/ and $removeTrailingWhitespace) - { - $line = join("",@indent).$line; - } - push(@lines,$line); - } - # empty the @block, very important! - @block=(); - } + # check to see if we need to turn off alignment + # delimiters and output the current block + if($lookForAlignDelims{$1} and ($previousEnvironment eq $1)) + { + &print_aligned_block(); + } - # tracing mode - print $logfile "Line $lineCounter\t \\end{envrionment} found: $1 \n" if($tracingMode and !$verbatimEnvironments{$1}); + # tracing mode + print $logfile "Line $lineCounter\t \\end{envrionment} found: $1 \n" if($tracingMode and !$verbatimEnvironments{$1}); - # check to see if \end{environment} fits with most recent \begin{...} - if($previousEnvironment eq $1) - { - # decrease the indentation (if appropriate) - &decrease_indent($1); - } - else - { - # otherwise put the environment name back on the stack - push(@environmentStack,$previousEnvironment); - print $logfile "Line $lineCounter\t WARNING: \\end{$1} found on its own line, not matched to \\begin{$previousEnvironment}\n" unless ($delimiters or $inverbatim or $inIndentBlock or $1 eq "\\\]"); - } + # check to see if \end{environment} fits with most recent \begin{...} + if($previousEnvironment eq $1) + { + # decrease the indentation (if appropriate) + &decrease_indent($1); + } + else + { + # otherwise put the environment name back on the stack + push(@environmentStack,$previousEnvironment); + print $logfile "Line $lineCounter\t WARNING: \\end{$1} found on its own line, not matched to \\begin{$previousEnvironment}\n" unless ($delimiters or $inverbatim or $inIndentBlock or $1 eq "\\\]"); + } - # need a special check for \[ and \] - if($1 eq "\\\]") - { - &decrease_indent($1); - pop(@environmentStack); + # need a special check for \[ and \] + if($1 eq "\\\]") + { + &decrease_indent($1); + pop(@environmentStack); + } } - # if we're at the end of the document, we remove all current - # indentation- this is especially prominent in examples that + # if we're at the end of the document, we remove all current + # indentation- this is especially prominent in examples that # have headings, and the user has chosen to indentAfterHeadings if($1 eq "document" and !(grep(/filecontents/, @indentNames)) and !$inpreamble and !$delimiters and !$inverbatim and !$inIndentBlock) { - @indent=(); - @indentNames=(); - print $logfile "Line $lineCounter\t \\end{$1} found- emptying indent array \n" unless ($delimiters or $inverbatim or $inIndentBlock or $1 eq "\\\]"); + @indent=(); + @indentNames=(); + + # tracing mode + if($tracingMode) + { + print $logfile "Line $lineCounter\t \\end{$1} found- emptying indent array \n" unless ($delimiters or $inverbatim or $inIndentBlock or $1 eq "\\\]"); + } } } } +sub print_aligned_block{ + # PURPOSE: this subroutine does a few things related + # to printing blocks of code that contain + # delimiters, such as align, tabular, etc + # + # It does the following + # - turns off delimiters switch + # - processes the block + # - deletes the block + $delimiters=0; + + # tracing mode + print $logfile "Line $lineCounter\t Delimiter body FINISHED: $1\n" if($tracingMode); + + # print the current FORMATTED block + @block = &format_block(@block); + foreach $line (@block) + { + # add the indentation and add the + # each line of the formatted block + # to the output + # unless this would only create trailing whitespace and the + # corresponding option is set + unless ($line =~ m/^$/ and $removeTrailingWhitespace) + { + $line = join("",@indent).$line; + } + push(@lines,$line); + } + # empty the @block, very important! + @block=(); +} + sub format_block{ - # PURPOSE: Format a delimited environment such as the + # PURPOSE: Format a delimited environment such as the # tabular or align environment that contains & # # INPUT: @block array containing unformatted block @@ -1448,7 +1754,7 @@ sub format_block{ print $logfile "\t\tFormatting alignment block\n" if($tracingMode); # step the line counter back to the beginning of the block- - # it will be increased back to the end of the block in the + # it will be increased back to the end of the block in the # loop later on: foreach $row (@tmpblock) $lineCounter -= scalar(@block); @@ -1479,7 +1785,7 @@ sub format_block{ my %stringsize=(); # loop through the block and count & per line- store the biggest - # NOTE: this needs to be done in its own block so that + # NOTE: this needs to be done in its own block so that # we can know what the maximum number of & in the block is foreach $row (@block) { @@ -1512,7 +1818,7 @@ sub format_block{ # tracing mode print $logfile "\t\tmaximum number of & in any row: $maxNumberAmpersands\n" if($tracingMode); - + # loop through the lines in the @block foreach $row (@block) { @@ -1560,11 +1866,11 @@ sub format_block{ { # increment column counter $aligncolcounter++; - + # remove leading and trailing space from element $column =~ s/^\s+//; $column =~ s/\s+$//; - + # assign string size to the array $stringsize{$alignrowcounter.$aligncolcounter}=length($column); if(length($column)==0) @@ -1583,7 +1889,7 @@ sub format_block{ } } - + # put $linebreak back on the string, now that # the measurement has been done $tmpstring .= $linebreak; @@ -1598,7 +1904,7 @@ sub format_block{ } else { - # if there are no & then use the + # if there are no & then use the # NOFORMATTING token # remove leading space s/^\s+//; @@ -1632,16 +1938,16 @@ sub format_block{ # the numbers represent how wide each column is # the s represents string # the & needs to be inserted - + # join up the maximum string lengths using "s %-" $fmtstring = join("s & %-",@maxmstringsize); - + # add an s to the end, and a newline $fmtstring .= "s "; - + # add %- to the beginning $fmtstring = "%-".$fmtstring; - + # process the @tmpblock of aligned material foreach $row (@tmpblock) { @@ -1689,7 +1995,7 @@ sub format_block{ # remove trailing whitespace if ($removeTrailingWhitespace) { - print $logfile "Line $lineCounter\t removing trailing whitespace from delimiter aligned line\n" if ($tracingMode); + print $logfile "\t\tLine $lineCounter\t removing trailing whitespace from delimiter aligned line\n" if ($tracingMode); $tmpstring =~ s/\s+$/\n/; } @@ -1711,7 +2017,7 @@ sub increase_indent{ my $command = pop(@_); - # if the user has specified $indentRules{$command} and + # if the user has specified $indentRules{$command} and # $noAdditionalIndent{$command} then they are a bit confused- # we remove the $indentRules{$command} and assume that they # want $noAdditionalIndent{$command} @@ -1726,7 +2032,7 @@ sub increase_indent{ delete $indentRules{$command}; } - # if the command is in verbatimEnvironments and in indentRules then + # if the command is in verbatimEnvironments and in indentRules then # remove it from %indentRules hash # to avoid any further confusion if($indentRules{$command} and $verbatimEnvironments{$command}) @@ -1745,7 +2051,7 @@ sub increase_indent{ push(@indent, $indentRules{$command}); # tracing mode print $logfile "Line $lineCounter\t increasing indent using rule for $command (see indentRules)\n" if($tracingMode); - push(@indentNames,"$command (rule)"); + push(@indentNames,"$command"); } else { @@ -1753,7 +2059,7 @@ sub increase_indent{ if(!($noAdditionalIndent{$command} or $verbatimEnvironments{$command} or $inverbatim)) { push(@indent, $defaultIndent); - push(@indentNames,"$command (default)"); + push(@indentNames,"$command"); # tracing mode print $logfile "Line $lineCounter\t increasing indent using defaultIndent\n" if($tracingMode); } @@ -1775,10 +2081,21 @@ sub decrease_indent{ if(!($noAdditionalIndent{$command} or $verbatimEnvironments{$command} or $inverbatim)) { + print $logfile "Line $lineCounter\t removing ", $indentNames[-1], " from indentNames\n" if($tracingMode); pop(@indent); pop(@indentNames); # tracing mode - print $logfile "Line $lineCounter\t decreasing indent to: ",join(", ",@indentNames),"\n" if($tracingMode); + if($tracingMode) + { + if(@indentNames) + { + print $logfile "Line $lineCounter\t decreasing indent to: ",join(", ",@indentNames),"\n" ; + } + else + { + print $logfile "Line $lineCounter\t indent now empty \n"; + } + } } } diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl index c3e17e4533c..808e9b21ccd 100755 --- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl +++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl @@ -1,12 +1,12 @@ #!/usr/bin/env perl -# $Id: tlmgr.pl 35326 2014-10-07 21:55:46Z karl $ +# $Id: tlmgr.pl 35700 2014-11-30 18:34:08Z karl $ # # Copyright 2008-2014 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. -my $svnrev = '$Revision: 35326 $'; -my $datrev = '$Date: 2014-10-07 23:55:46 +0200 (Tue, 07 Oct 2014) $'; +my $svnrev = '$Revision: 35700 $'; +my $datrev = '$Date: 2014-11-30 19:34:08 +0100 (Sun, 30 Nov 2014) $'; my $tlmgrrevision; my $prg; if ($svnrev =~ m/: ([0-9]+) /) { @@ -360,7 +360,7 @@ for the full story.\n"; # --machine-readable is only supported by update. if ($::machinereadable && $action ne "update" && $action ne "install" && $action ne "option") { - tlwarn("tlmgr: --machine-readable output not supported for $action\n"); + tlwarn("$prg: --machine-readable output not supported for $action\n"); } # check on supported arguments @@ -777,7 +777,7 @@ sub handle_execute_actions { # here we check whether an engine is updated my %foo = %{$::execute_actions{'enable'}{'formats'}{$m}}; if (!defined($foo{'name'}) || !defined($foo{'engine'})) { - tlwarn("tlmgr: Very strange error, please report ", %foo); + tlwarn("$prg: Very strange error, please report ", %foo); } else { $format_to_engine{$m} = $foo{'engine'}; if ($foo{'name'} eq $foo{'engine'}) { @@ -928,11 +928,11 @@ sub action_remove { # that package was asked for to be removed on the cmd line my @needed = $localtlpdb->needed_by($p); if ($opts{"force"}) { - info("tlmgr: $p is needed by " . join(" ", @needed) . "\n"); - info("tlmgr: removing it anyway, due to --force\n"); + info("$prg: $p is needed by " . join(" ", @needed) . "\n"); + info("$prg: removing it anyway, due to --force\n"); } else { delete($packs{$p}); - tlwarn("tlmgr: not removing $p, needed by " . + tlwarn("$prg: not removing $p, needed by " . join(" ", @needed) . "\n"); } } else { @@ -990,9 +990,9 @@ sub action_remove { $localtlpdb->save; my @foo = sort keys %already_removed; if (@foo) { - info("tlmgr: ultimately removed these packages: @foo\n"); + info("$prg: ultimately removed these packages: @foo\n"); } else { - info("tlmgr: no packages removed.\n"); + info("$prg: no packages removed.\n"); } } } @@ -1018,9 +1018,9 @@ sub action_paper { if ($action =~ m/^paper$/i) { # generic paper my $newpaper = shift @ARGV; if ($opts{"list"}) { # tlmgr paper --list => complain. - tlwarn("tlmgr: ignoring paper setting to $newpaper with --list\n") + tlwarn("$prg: ignoring paper setting to $newpaper with --list\n") if $newpaper; # complain if they tried to set, too. - tlwarn("tlmgr: please specify a program before paper --list, ", + tlwarn("$prg: please specify a program before paper --list, ", "as in: tlmgr pdftex paper --list\n"); } elsif (!defined($newpaper)) { # tlmgr paper => show all current sizes. @@ -1028,7 +1028,7 @@ sub action_paper { } elsif ($newpaper !~ /^(a4|letter)$/) { # tlmgr paper junk => complain. $newpaper = "the empty string" if !defined($newpaper); - tlwarn("tlmgr: expected `a4' or `letter' after paper, not $newpaper\n"); + tlwarn("$prg: expected `a4' or `letter' after paper, not $newpaper\n"); } else { # tlmgr paper {a4|letter} => do it. return if !check_on_writable(); @@ -1040,7 +1040,7 @@ sub action_paper { my $arg = shift @ARGV; # get "paper" argument if (!defined($arg) || $arg ne "paper") { $arg = "the empty string." if ! $arg; - tlwarn("tlmgr: expected `paper' after $prog, not $arg\n"); + tlwarn("$prg: expected `paper' after $prog, not $arg\n"); return; } # the do_paper progs check for the argument --list, so if given @@ -1064,7 +1064,7 @@ sub action_path { my $what = shift @ARGV; if (!defined($what) || ($what !~ m/^(add|remove)$/i)) { $what = "" if ! $what; - tlwarn("tlmgr: action path requires add or remove, not: $what\n"); + tlwarn("$prg: action path requires add or remove, not: $what\n"); return; } init_local_db(); @@ -1154,8 +1154,7 @@ sub action_path { $localtlpdb->option("sys_info")); } } else { - # that should not happen - tlwarn("\ntlmgr: Should not happen, action_path what=$what\n"); + tlwarn("\n$prg: Should not happen, action_path what=$what\n"); exit 1; } return; @@ -1197,7 +1196,7 @@ sub action_info { || $opts{"keyword"}) { $taxonomy = load_taxonomy_datafile(); if (!defined($taxonomy)) { - tlwarn("tlmgr: Cannot load taxonomy file, showing taxonomies not supported.\n"); + tlwarn("$prg: Cannot load taxonomy file, showing taxonomies not supported.\n"); } } my ($what, @todo) = @ARGV; @@ -1225,11 +1224,11 @@ sub action_info { } if (defined($tag)) { if (!$remotetlpdb->is_virtual) { - tlwarn("tlmgr: specifying implicit tags is not allowed for non-virtual databases!\n"); + tlwarn("$prg: specifying implicit tags is not allowed for non-virtual databases!\n"); next; } else { if (!$remotetlpdb->is_repository($tag)) { - tlwarn("tlmgr: no such repository tag defined: $tag\n"); + tlwarn("$prg: no such repository tag defined: $tag\n"); next; } } @@ -1239,7 +1238,7 @@ sub action_info { if (defined($tag)) { # we already searched for the package in a specific tag, don't retry # all candidates! - tlwarn("tlmgr: Cannot find package $pkg in repository $tag\n"); + tlwarn("$prg: Cannot find package $pkg in repository $tag\n"); next; } if ($remotetlpdb->is_virtual) { @@ -1277,7 +1276,7 @@ sub action_info { next; } } - tlwarn("tlmgr: cannot find package $pkg\n"); + tlwarn("$prg: cannot find package $pkg\n"); next; } # we want to also show the source if it is known @@ -1463,11 +1462,11 @@ sub load_taxonomy_datafile { my $fpath = $localtlpdb->root . "/texmf-dist/scripts/texlive/var/texcatalogue.keywords"; if (! -r $fpath) { - tlwarn("tlmgr: taxonomy file $fpath not readable: $!\n"); + tlwarn("$prg: taxonomy file $fpath not readable: $!\n"); return; } if (!open (TAXF, $fpath)) { - tlwarn("tlmgr: taxonomy file $fpath cannot be opened: $!\n"); + tlwarn("$prg: taxonomy file $fpath cannot be opened: $!\n"); return; } # suck in the whole file contents @@ -1512,11 +1511,11 @@ sub action_search { # if (!$opts{"list"} && (!defined($r) || !$r)) { - tlwarn("tlmgr: nothing to search for.\n"); + tlwarn("$prg: nothing to search for.\n"); return; } if ($opts{"extended"}) { - tlwarn("tlmgr: sorry, extended searching not implemented by now.\n"); + tlwarn("$prg: sorry, extended searching not implemented by now.\n"); return; } # check the arguments @@ -1528,7 +1527,7 @@ sub action_search { $search_type_nr++ if $opts{"keyword"}; $search_type_nr++ if $opts{"all"}; if ($search_type_nr > 1) { - tlwarn("tlmgr: please specify only one thing to search for!\n"); + tlwarn("$prg: please specify only one thing to search for!\n"); return; } init_local_db(); @@ -1552,7 +1551,7 @@ sub action_search { || $opts{"functionality"} || $opts{"keyword"}) { $taxonomy = load_taxonomy_datafile(); if (!defined($taxonomy)) { - tlwarn("tlmgr: Cannot load taxonomy file;", + tlwarn("$prg: Cannot load taxonomy file;", " searching/listing for taxonomies not supported.\n"); return; } @@ -1710,7 +1709,7 @@ sub check_backupdir_selection { my $ob = abs_path($opts{"backupdir"}); $ob && ($opts{"backupdir"} = $ob); if (! -d $opts{"backupdir"}) { - $warntext .= "tlmgr: backupdir argument\n"; + $warntext .= "$prg: backupdir argument\n"; $warntext .= " $opts{'backupdir'}\n"; $warntext .= "is not a directory.\n"; return (0, $warntext); @@ -1720,13 +1719,13 @@ sub check_backupdir_selection { init_local_db(1); $opts{"backupdir"} = norm_tlpdb_path($localtlpdb->option("backupdir")); if (!$opts{"backupdir"}) { - return (0, "tlmgr: No way to determine backupdir.\n"); + return (0, "$prg: No way to determine backupdir.\n"); } # we are still here, there is something set in tlpdb my $ob = abs_path($opts{"backupdir"}); $ob && ($opts{"backupdir"} = $ob); if (! -d $opts{"backupdir"}) { - $warntext = "tlmgr: backupdir as set in tlpdb\n"; + $warntext = "$prg: backupdir as set in tlpdb\n"; $warntext .= " $opts{'backupdir'}\n"; $warntext .= "is not a directory.\n"; return (0, $warntext); @@ -1751,7 +1750,7 @@ sub action_restore { if (!$a) { # in all these cases we want to terminate in the non-gui mode tlwarn($b); - tlwarn("Exiting.\n"); + tlwarn("$prg: Terminating.\n"); exit 1; } } @@ -1761,8 +1760,8 @@ sub action_restore { my %backups = get_available_backups($opts{"backupdir"}, 1); my ($pkg, $rev) = @ARGV; if (defined($pkg) && $opts{"all"}) { - tlwarn("Do you want to restore all packages or only $pkg?\n"); - tlwarn("Terminating.\n"); + tlwarn("$prg: Specify either --all or individual package(s) ($pkg)\n"); + tlwarn("$prg: to restore, not both. Terminating.\n"); exit 1; } if ($opts{"all"}) { @@ -1899,7 +1898,7 @@ sub action_backup { if (!$a) { # in all these cases we want to terminate in the non-gui mode tlwarn($b); - tlwarn("Exiting.\n"); + tlwarn("$prg: Terminating.\n"); exit 1; } } @@ -2312,9 +2311,9 @@ sub auto_remove_install_force_packages { $forcermpkgs{$p} = 1 if defined($forcermpkgs_full{$p}); $newpkgs{$p} = 1 if defined($newpkgs_full{$p}); } - debug ("tlmgr: new pkgs: " . join("\n\t",keys %newpkgs) . "\n"); - debug ("tlmgr: deleted : " . join("\n\t",keys %removals) . "\n"); - debug ("tlmgr: forced : " . join("\n\t",keys %forcermpkgs) . "\n"); + debug ("$prg: new pkgs: " . join("\n\t",keys %newpkgs) . "\n"); + debug ("$prg: deleted : " . join("\n\t",keys %removals) . "\n"); + debug ("$prg: forced : " . join("\n\t",keys %forcermpkgs) . "\n"); return (\%removals, \%newpkgs, \%forcermpkgs, \%new_pkgs_due_forcerm_coll); } @@ -2422,7 +2421,7 @@ sub action_update { # return here and don't do any updates return; } else { - die "$prg: Exiting, please read above warning.\n"; + die "$prg: Terminating; please read above warning.\n"; } } } @@ -2458,7 +2457,7 @@ sub action_update { if (!$a) { # in all these cases we want to terminate in the non-gui mode tlwarn($b); - tlwarn("Exiting.\n"); + tlwarn("$prg: Terminating.\n"); exit 1; } } @@ -2466,7 +2465,7 @@ sub action_update { # finally, if we have --backupdir, but no --backup, just enable it $opts{"backup"} = 1 if $opts{"backupdir"}; - info("tlmgr: saving backups to $opts{'backupdir'}\n") + info("$prg: saving backups to $opts{'backupdir'}\n") if $opts{"backup"} && !$::machinereadable; # these two variables are used throughout this function @@ -2503,7 +2502,7 @@ sub action_update { # don't do anything if we have been invoced in a strange way if (!@todo) { if ($opts{"self"}) { - info("tlmgr: no updates for tlmgr present.\n"); + info("$prg: no updates for tlmgr present.\n"); } else { tlwarn("tlmgr update: please specify a list of packages, --all, or --self.\n"); } @@ -2617,11 +2616,11 @@ sub action_update { # and has already been removed next; } elsif (defined($new_due_to_forcerm_coll{$pkg})) { - debug("tlmgr: $pkg seems to be contained in a forcibly removed" . + debug("$prg: $pkg seems to be contained in a forcibly removed" . " collection, not auto-installing it!\n"); next; } else { - tlwarn("\ntlmgr: $pkg mentioned, but neither new nor forcibly removed\n"); + tlwarn("\n$prg: $pkg mentioned, but neither new nor forcibly removed\n"); next; } # install new packages @@ -2828,7 +2827,7 @@ sub action_update { # for creating the backup will create some rubbish! # Same as further down in the update part! if ($pkg->relocated) { - debug("tlmgr: warn, relocated bit set for $p, but that is wrong!\n"); + debug("$prg: warn, relocated bit set for $p, but that is wrong!\n"); $pkg->relocated(0); } if ($opts{"backup"}) { @@ -2931,8 +2930,8 @@ sub action_update { # - then it is tried to be updated here, which is not working! # report that and ask for report if (!defined($tlp)) { - tlwarn("tlmgr: inconsistency on the server:\n"); - tlwarn("tlmgr: tlp for package $pkg cannot be found, please report.\n"); + tlwarn("$prg: inconsistency on the server:\n"); + tlwarn("$prg: tlp for package $pkg cannot be found, please report.\n"); next; } my $unwind_package; @@ -2998,7 +2997,7 @@ sub action_update { # for creating an unwind container will create some rubbish # TODO for user mode we should NOT clear this bit! if ($tlp->relocated) { - debug("tlmgr: warn, relocated bit set for $pkg, but that is wrong!\n"); + debug("$prg: warn, relocated bit set for $pkg, but that is wrong!\n"); $tlp->relocated(0); } @@ -3085,9 +3084,9 @@ sub action_update { if (!defined($parentobj)) { # well, in this case we might have hit a package that only # has .ARCH package, like psv.win32, so do nothing - debug("tlmgr: .ARCH package without parent, not announcing postaction\n"); + debug("$prg: .ARCH package without parent, not announcing postaction\n"); } else { - debug("tlmgr: announcing parent execute action for $pkg\n"); + debug("$prg: announcing parent execute action for $pkg\n"); TeXLive::TLUtils::announce_execute_actions("enable", $parentobj); } } @@ -3329,7 +3328,7 @@ sub action_update { # if a real update from default disk location didn't find anything, # warn if nothing is updated. if (!(@new || @updated)) { - info("tlmgr: no updates available\n"); + info("$prg: no updates available\n"); if ($remotetlpdb->media ne "NET" && $remotetlpdb->media ne "virtual" && !$opts{"dry-run"} @@ -3337,7 +3336,7 @@ sub action_update { && !$ENV{"TEXLIVE_INSTALL_ENV_NOCHECK"} ) { tlwarn(<<END_DISK_WARN); -tlmgr: Your installation is set up to look on the disk for updates. +$prg: Your installation is set up to look on the disk for updates. To install from the Internet for this one time only, run: tlmgr -repository $TeXLiveURL ACTION ARG... where ACTION is install, update, etc.; see tlmgr -help if needed. @@ -3405,7 +3404,7 @@ sub action_install { # return here and don't do any updates return; } else { - die "tlmgr: Not continuing, please see warning above!\n"; + die "$prg: Not continuing, please see warning above!\n"; } } } @@ -5487,7 +5486,7 @@ sub init_local_db { $location = $opts{"location"}; } if (!defined($location)) { - die("No installation source found, nor in the texlive.tlpdb nor on the cmd line.\nPlease specify one!"); + die("$prg: No installation source found: neither in texlive.tlpdb nor on command line.\n$prg: Please specify one!"); } if ($location =~ m/^ctan$/i) { $location = "$TeXLive::TLConfig::TeXLiveURL"; diff --git a/Master/texmf-dist/doc/support/latexindent/README b/Master/texmf-dist/doc/support/latexindent/README index 0bfe8cb2854..0fc5cf558ed 100644 --- a/Master/texmf-dist/doc/support/latexindent/README +++ b/Master/texmf-dist/doc/support/latexindent/README @@ -14,7 +14,7 @@ See http://www.gnu.org/licenses/ - Dr. C. M. Hughes + C. M. Hughes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/doc/support/latexindent/documentation/manual.pdf b/Master/texmf-dist/doc/support/latexindent/documentation/manual.pdf Binary files differindex 585e6dd43de..c804d386db6 100644 --- a/Master/texmf-dist/doc/support/latexindent/documentation/manual.pdf +++ b/Master/texmf-dist/doc/support/latexindent/documentation/manual.pdf diff --git a/Master/texmf-dist/doc/support/latexindent/documentation/manual.tex b/Master/texmf-dist/doc/support/latexindent/documentation/manual.tex index 1e3afd3aedf..812aae39eb8 100644 --- a/Master/texmf-dist/doc/support/latexindent/documentation/manual.tex +++ b/Master/texmf-dist/doc/support/latexindent/documentation/manual.tex @@ -1,8 +1,9 @@ % arara: pdflatex -% arara: bibtex -% arara: pdflatex -% arara: pdflatex -% !arara: indent: {overwrite: yes, trace: yes, localSettings: no, silent: yes} +% !arara: bibtex +% !arara: pdflatex +% !arara: pdflatex +% !arara: indent: {overwrite: no, trace: yes, localSettings: yes, silent: yes} +% http://tex.stackexchange.com/questions/122135/how-to-add-a-png-icon-on-the-right-side-of-a-tcolorbox-title \begin{filecontents}{mybib.bib} @online{cmh:videodemo, title="Video demonstration of latexindet.pl on youtube", @@ -22,12 +23,12 @@ % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. -% +% % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. -% +% % See <http://www.gnu.org/licenses/>. \usepackage[left=4.5cm,right=2.5cm,showframe=false, top=2cm,bottom=1.5cm]{geometry} % page setup @@ -39,11 +40,14 @@ top=2cm,bottom=1.5cm]{geometry} % page setup \usepackage{fancyhdr} % headers & footers \usepackage[sc,format=hang,font=small]{caption} % captions \usepackage[backend=bibtex]{biblatex} % bibliography -\usepackage{mdframed} % framed environments +\usepackage{tcolorbox} % framed environments \usepackage[charter]{mathdesign} % changes font \usepackage[expansion=false,kerning=true]{microtype} % better kerning \usepackage{enumitem} % custom lists \usepackage{tikz} % so so much +\usepackage{tcolorbox} +% tcolorbox libraries +\tcbuselibrary{breakable,skins,listings} \usetikzlibrary{positioning} \usepackage{varioref} % clever referencing \usepackage[colorlinks=true,linkcolor=blue,citecolor=black]{hyperref} @@ -51,37 +55,69 @@ top=2cm,bottom=1.5cm]{geometry} % page setup \addbibresource{mybib} -\newmdenv[linecolor=red,innertopmargin=.5cm,linewidth=3pt, - splittopskip=\topskip,skipbelow=0pt,% -]{warning} +%\newmdenv[linecolor=red,innertopmargin=.5cm,linewidth=3pt, +% splittopskip=\topskip,skipbelow=0pt,% +%]{warning} + + +\newtcolorbox{warning}{parbox=false,breakable,enhanced,arc=0mm,colback=red!5,colframe=red,leftrule=12mm,% + overlay={\node[anchor=north west,outer sep=2pt] at (frame.north west) {\includegraphics[width=8mm]{warning}}; }} + +\makeatletter +\tcbset{ + addtolol/.style={list entry={\kvtcb@title},add to list={lol}{lstlisting}}, +} + +\newtcblisting[use counter=lstlisting]{cmhlistings}[3][]{% + width=\linewidth, + breakable, + colback=blue!5!white, + colframe=white!85!black, + top=0cm, + bottom=0cm, + left=6mm, + listing only, + listing options={#1}, + center title, + title={\color{black}{\scshape Listing \thetcbcounter}: ~#2},label={#3}, + addtolol, +} \lstset{% - basicstyle=\small\ttfamily,language={[LaTeX]TeX}, - numbers=left, - numberstyle=\ttfamily\small, - breaklines=true,frame=single,framexleftmargin=8mm, xleftmargin=8mm, - prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookrightarrow}}, - backgroundcolor=\color{green!5},frameround=fttt, - rulecolor=\color{blue!70!black}, + basicstyle=\small\ttfamily,language={[LaTeX]TeX}, + % numbers=left, + numberstyle=\ttfamily%\small, + breaklines=true, + % frame=single,framexleftmargin=8mm, xleftmargin=8mm, + % prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookrightarrow}}, + % backgroundcolor=\color{green!5},frameround=fttt, + % rulecolor=\color{blue!70!black}, keywordstyle=\color{blue}, % keywords commentstyle=\color{purple}, % comments tabsize=3, - %columns=fullflexible + %xleftmargin=1.5em, }% -\lstdefinestyle{demo}{numbers=none,xleftmargin=0mm,framexleftmargin=0mm,linewidth=1.25\textwidth} +\lstdefinestyle{yaml}{% + numbers=left, + numberstyle=\color{black},} +\lstdefinestyle{demo}{ + numbers=none, + linewidth=1.25\textwidth, + columns=fullflexible, +} \newcommand{\verbitem}[1]{\small\ttfamily{#1}} % stolen from arara.sty http://mirrors.med.harvard.edu/ctan/support/arara/doc/arara.sty -\lstnewenvironment{yaml}[1][]{\lstset{% - basicstyle=\ttfamily, - numbers=left, - xleftmargin=1.5em, - breaklines=true, - numberstyle=\ttfamily\small, - columns=flexible, - mathescape=false, - #1, -}} -{} +%\lstnewenvironment{yaml}[1][]{\lstset{% +% basicstyle=\ttfamily, +% numbers=left, +% xleftmargin=1.5em, +% breaklines=true, +% numberstyle=\ttfamily\small, +% columns=flexible, +% mathescape=false, +% #1, +%}} +%{} \newcommand{\fixthis}[1] {% @@ -120,53 +156,53 @@ top=2cm,bottom=1.5cm]{geometry} % page setup \Crefname{figure}{Figure}{Figures} \crefname{section}{Section}{Sections} \Crefname{section}{Section}{Sections} -\crefname{lstlisting}{Listing}{Listings} -\Crefname{lstlisting}{Listing}{Listings} +\crefname{listing}{Listing}{Listings} +\Crefname{listing}{Listing}{Listings} \begin{document} % \begin{noindent} \title{\lstinline[basicstyle=\huge\ttfamily]!latexindent.pl!\\[1cm] - Version 1.11R} + Version 2.0R} % \end{noindent} \author{Chris Hughes \footnote{smr01cmh AT users.sourceforge.net}} \maketitle \begin{abstract} \lstinline!latexindent.pl! is a \lstinline!Perl! script that indents \lstinline!.tex! - files according to an indentation scheme that the user can modify to suit their - taste. Environments, including those with alignment delimiters (such as \lstinline!tabular!), - and commands, including those that can split braces and brackets across lines, + files according to an indentation scheme that the user can modify to suit their + taste. Environments, including those with alignment delimiters (such as \lstinline!tabular!), + and commands, including those that can split braces and brackets across lines, are \emph{usually} handled correctly by the script. Options for \lstinline!verbatim!-like - environments and indentation after headings (such as \lstinline!\chapter!, \lstinline!\section!, etc) + environments and indentation after headings (such as \lstinline!\chapter!, \lstinline!\section!, etc) are also available. \end{abstract} - + \tableofcontents \lstlistoflistings - + \section{Before we begin} \subsection{Thanks} -I first created \lstinline!latexindent.pl! to help me format chapter files -in a big project. After I blogged about it on the -\TeX{} stack exchange \cite{cmhblog} I received some positive feedback and -follow-up feature requests. A big thank you to Harish Kumar who has really +I first created \lstinline!latexindent.pl! to help me format chapter files +in a big project. After I blogged about it on the +\TeX{} stack exchange \cite{cmhblog} I received some positive feedback and +follow-up feature requests. A big thank you to Harish Kumar who has really helped to drive the script forward and has put it through a number of challenging -tests-- I look forward to more challenges in the future Harish! - -The \lstinline!yaml!-based interface of \lstinline!latexindent.pl! was inspired -by the wonderful \lstinline!arara! tool; any similarities are deliberate, and -I hope that it is perceived as the compliment that it is. Thank you to Paulo Cereda and the -team for releasing this awesome tool; I initially worried that I was going to -have to make a GUI for \lstinline!latexindent.pl!, but the release of \lstinline!arara! -has meant there is no need. Thank you to Paulo for all of your advice and +tests--I look forward to more challenges in the future Harish! + +The \lstinline!yaml!-based interface of \lstinline!latexindent.pl! was inspired +by the wonderful \lstinline!arara! tool; any similarities are deliberate, and +I hope that it is perceived as the compliment that it is. Thank you to Paulo Cereda and the +team for releasing this awesome tool; I initially worried that I was going to +have to make a GUI for \lstinline!latexindent.pl!, but the release of \lstinline!arara! +has meant there is no need. Thank you to Paulo for all of your advice and encouragement. - + \subsection{License} \lstinline!latexindent.pl! is free and open source, and it always will be. Before you start using it on any important files, bear in mind that \lstinline!latexindent.pl! has the option to overwrite your \lstinline!.tex! files. It will always make at least one backup (you can choose how many it makes, see \cpageref{page:onlyonebackup}) but you should still be careful when using it. The script has been tested on many -files, but there are some known limitations (see \cref{sec:knownlimitations}). +files, but there are some known limitations (see \cref{sec:knownlimitations}). You, the user, are responsible for ensuring that you maintain backups of your files before running \lstinline!latexindent.pl! on them. I think it is important at this stage to restate an important part of the license here: @@ -177,35 +213,36 @@ stage to restate an important part of the license here: GNU General Public License for more details. \end{quote} There is certainly no malicious intent in releasing this script, and I do hope -that it works as you expect it to-- if it does not, please first of all -make sure that you have the correct settings, and then feel free to let me know with a -complete minimum working example as I would like to improve the code as much as possible. - +that it works as you expect it to--if it does not, please first of all +make sure that you have the correct settings, and then feel free to let me know with a +complete minimum working example as I would like to improve the code as much as possible. + \begin{warning} - Before you try the script on anything important (like your thesis), test it - out on the sample files that come with it in the \lstinline!success! directory. + Before you try the script on anything important (like your thesis), test it + out on the sample files that come with it in the \lstinline!success! directory. \end{warning} - - + + \section{Demonstration: before and after} -Let's give a demonstration of some before and after code-- after all, you probably -won't want to try the script if you don't much like the results. You might also +Let's give a demonstration of some before and after code--after all, you probably +won't want to try the script if you don't much like the results. You might also like to watch the video demonstration I made on youtube \cite{cmh:videodemo} - + As you look at \crefrange{lst:filecontentsbefore}{lst:pstricksafter}, remember -that \lstinline!latexindent.pl! is just following its rules-- there is nothing -particular about these code snippets. All of the rules can be modified -so that each user can personalize their indentation scheme. - +that \lstinline!latexindent.pl! is just following its rules--there is nothing +particular about these code snippets. All of the rules can be modified +so that each user can personalize their indentation scheme. + In each of the samples given in \crefrange{lst:filecontentsbefore}{lst:pstricksafter} the `before' case is a `worst case scenario' with no effort to make indentation. The `after' -result would be the same, regardless of the leading white space at the beginning of +result would be the same, regardless of the leading white space at the beginning of each line which is stripped by \lstinline!latexindent.pl! (unless a \lstinline!verbatim!-like -environment or \lstinline!noIndentBlock! is specified-- more on this in \cref{sec:defuseloc}). - +environment or \lstinline!noIndentBlock! is specified--more on this in \cref{sec:defuseloc}). + \begin{adjustwidth}{-2cm}{2cm} - \begin{minipage}{.5\textwidth} - \begin{lstlisting}[style=demo,caption={\lstinline!filecontents! before},label={lst:filecontentsbefore}] + \noindent + \begin{minipage}{.6\textwidth} + \begin{cmhlistings}[style=demo]{\lstinline!filecontents! before}{lst:filecontentsbefore} \begin{filecontents}{mybib.bib} @online{strawberryperl, title="Strawberry Perl", @@ -214,10 +251,11 @@ url="http://strawberryperl.com/"} title="A Perl script ... url="... \end{filecontents} - \end{lstlisting} + \end{cmhlistings} \end{minipage}% - \begin{minipage}{.5\textwidth} - \begin{lstlisting}[style=demo,caption={\lstinline!filecontents! after}] + \noindent + \begin{minipage}{.6\textwidth} + \begin{cmhlistings}[style=demo]{\lstinline!filecontents! after}{lst:filecontentsafter} \begin{filecontents}{mybib.bib} @online{strawberryperl, title="Strawberry Perl", @@ -226,164 +264,163 @@ url="... title="A Perl script for ... url="... \end{filecontents} - \end{lstlisting} + \end{cmhlistings} \end{minipage} - - \begin{minipage}{.5\textwidth} - \begin{lstlisting}[style=demo,caption={\lstinline!tikzset! before}] + \begin{minipage}{.6\textwidth} + \begin{cmhlistings}[style=demo]{\lstinline!tikzset! before}{lst:tikzsetbefore} \tikzset{ shrink inner sep/.code={ \pgfkeysgetvalue... \pgfkeysgetvalue... } } - \end{lstlisting} + \end{cmhlistings} \end{minipage}% - \begin{minipage}{.5\textwidth} - \begin{lstlisting}[style=demo,caption={\lstinline!tikzset! after}] + \begin{minipage}{.6\textwidth} + \begin{cmhlistings}[style=demo]{\lstinline!tikzset! after}{lst:tikzsetafter} \tikzset{ shrink inner sep/.code={ \pgfkeysgetvalue... \pgfkeysgetvalue... } } - \end{lstlisting} + \end{cmhlistings} \end{minipage} - \begin{minipage}{.5\textwidth} - \begin{lstlisting}[style=demo,caption={\lstinline!pstricks! before}] + \begin{minipage}{.6\textwidth} + \begin{cmhlistings}[style=demo]{\lstinline!pstricks! before}{lst:pstricksbefore} \def\Picture#1{% \def\stripH{#1}% \begin{pspicture}[showgrid... \psforeach{\row}{% -{{3,2.8,2.7,3,3.1}},% <=== Only this +{{3,2.8,2.7,3,3.1}},% <=== Only this {2.8,1,1.2,2,3},% ... }{% \expandafter... } \end{pspicture}} - \end{lstlisting} + \end{cmhlistings} \end{minipage}% - \begin{minipage}{.5\textwidth} - \begin{lstlisting}[style=demo,caption={\lstinline!pstricks! after},label={lst:pstricksafter}] + \begin{minipage}{.6\textwidth} + \begin{cmhlistings}[style=demo]{\lstinline!pstricks! after}{lst:pstricksafter} \def\Picture#1{% \def\stripH{#1}% \begin{pspicture}[showgrid... \psforeach{\row}{% - {{3,2.8,2.7,3,3.1}},% <=== + {{3,2.8,2.7,3,3.1}},% <=== {2.8,1,1.2,2,3},% ... }{% \expandafter... } \end{pspicture}} - \end{lstlisting} + \end{cmhlistings} \end{minipage} \end{adjustwidth} - + \section{How to use the script} -There are two ways to use \lstinline!latexindent.pl!: from the command line, -and using \lstinline!arara!. We will discuss how to change the settings and behaviour +There are two ways to use \lstinline!latexindent.pl!: from the command line, +and using \lstinline!arara!. We will discuss how to change the settings and behaviour of the script in \cref{sec:defuseloc}. - -\lstinline!latexindent.pl! ships with \lstinline!latexindent.exe! for Windows -users, so that you can use the script with or without a Perl distribution. -If you plan to use \lstinline!latexindent.pl! (i.e, the original Perl script) then you will -need a few standard Perl modules-- see \vref{sec:requiredmodules} for details. - -In what follows, we will always refer to \lstinline!latexindent.pl!, but depending on + +\lstinline!latexindent.pl! ships with \lstinline!latexindent.exe! for Windows +users, so that you can use the script with or without a Perl distribution. +If you plan to use \lstinline!latexindent.pl! (i.e, the original Perl script) then you will +need a few standard Perl modules--see \vref{sec:requiredmodules} for details. + +In what follows, we will always refer to \lstinline!latexindent.pl!, but depending on your operating system and preference, you might substitute \lstinline!latexindent.exe! or simply \lstinline!latexindent!. - + \subsection{From the command line}\label{sec:commandline} -\lstinline!latexindent.pl! has a number of different switches/flags/options, which -can be combined in any way that you like. \lstinline!latexindent.pl! +\lstinline!latexindent.pl! has a number of different switches/flags/options, which +can be combined in any way that you like. \lstinline!latexindent.pl! produces a \lstinline!.log! file, \lstinline!indent.log! every time it is run. There is a base of information that is written to \lstinline!indent.log!, -but other additional information will be written depending +but other additional information will be written depending on which of the following options are used. - + \begin{itemize}[labelsep=.5cm] \item[] \lstinline!latexindent.pl! - - This will output a welcome message to the terminal, including the version number - and available options. + + This will output a welcome message to the terminal, including the version number + and available options. \item[\verbitem{-h}] \lstinline!latexindent.pl -h! - - As above this will output a welcome message to the terminal, including the version number - and available options. + + As above this will output a welcome message to the terminal, including the version number + and available options. \item[] \lstinline!latexindent.pl myfile.tex! - - This will operate on \lstinline!myfile.tex!, but will simply output to your terminal; \lstinline!myfile.tex! will not be changed in any way using this command. + + This will operate on \lstinline!myfile.tex!, but will simply output to your terminal; \lstinline!myfile.tex! will not be changed in any way using this command. \item[\verbitem{-w}] \lstinline!latexindent.pl -w myfile.tex! - - This \emph{will} overwrite \lstinline!myfile.tex!, but it will - make a copy of \lstinline!myfile.tex! first. You can control the name of - the extension (default is \lstinline!.bak!), and how many different backups are made-- - more on this in \cref{sec:defuseloc}; see \lstinline!backupExtension! and \lstinline!onlyOneBackUp!. - - Note that if \lstinline!latexindent.pl! can not create the backup, then it - will exit without touching your original file; an error message will be given - asking you to check the permissions of the backup file. + + This \emph{will} overwrite \lstinline!myfile.tex!, but it will + make a copy of \lstinline!myfile.tex! first. You can control the name of + the extension (default is \lstinline!.bak!), and how many different backups are made-- + more on this in \cref{sec:defuseloc}; see \lstinline!backupExtension! and \lstinline!onlyOneBackUp!. + + Note that if \lstinline!latexindent.pl! can not create the backup, then it + will exit without touching your original file; an error message will be given + asking you to check the permissions of the backup file. \item[\verbitem{-o}] \lstinline!latexindent.pl -o myfile.tex outputfile.tex! - - This will indent \lstinline!myfile.tex! and output it to \lstinline!outputfile.tex!, - overwriting it (\lstinline!outputfile.tex!) if it already exists. Note that if \lstinline!latexindent.pl! is called with both - the \lstinline!-w! and \lstinline!-o! switches, then \lstinline!-w! will - be ignored and \lstinline!-o! will take priority (this seems safer than the - other way round). - - Note that using \lstinline!-o! is equivalent to using \lstinline!latexindent.pl myfile.tex > outputfile.tex! + + This will indent \lstinline!myfile.tex! and output it to \lstinline!outputfile.tex!, + overwriting it (\lstinline!outputfile.tex!) if it already exists. Note that if \lstinline!latexindent.pl! is called with both + the \lstinline!-w! and \lstinline!-o! switches, then \lstinline!-w! will + be ignored and \lstinline!-o! will take priority (this seems safer than the + other way round). + + Note that using \lstinline!-o! is equivalent to using \lstinline!latexindent.pl myfile.tex > outputfile.tex! \item[\verbitem{-s}] \lstinline!latexindent.pl -s myfile.tex! - - Silent mode: no output will be given to the terminal. + + Silent mode: no output will be given to the terminal. \item[\verbitem{-t}] \lstinline!latexindent.pl -t myfile.tex! - - Tracing mode: verbose output will be given to \lstinline!indent.log!. This - is useful if \lstinline!latexindent.pl! has made a mistake and you're - trying to find out where and why. You might also be interested in learning - about \lstinline!latexindent.pl!'s thought process-- if so, this - switch is for you. + + Tracing mode: verbose output will be given to \lstinline!indent.log!. This + is useful if \lstinline!latexindent.pl! has made a mistake and you're + trying to find out where and why. You might also be interested in learning + about \lstinline!latexindent.pl!'s thought process--if so, this + switch is for you. \item[\verbitem{-l}] \lstinline!latexindent.pl -l myfile.tex! - - \label{page:localswitch} - Local settings: you might like to read \cref{sec:defuseloc} before - using this switch. \lstinline!latexindent.pl! will always load \lstinline!defaultSettings.yaml! - and if it is called with the \lstinline!-l! switch and it finds \lstinline!localSettings.yaml! - in the same directory as \lstinline!myfile.tex! then these settings will be - added to the indentation scheme. Information will be given in \lstinline!indent.log! on - the success or failure of loading \lstinline!localSettings.yaml!. + + \label{page:localswitch} + Local settings: you might like to read \cref{sec:defuseloc} before + using this switch. \lstinline!latexindent.pl! will always load \lstinline!defaultSettings.yaml! + and if it is called with the \lstinline!-l! switch and it finds \lstinline!localSettings.yaml! + in the same directory as \lstinline!myfile.tex! then these settings will be + added to the indentation scheme. Information will be given in \lstinline!indent.log! on + the success or failure of loading \lstinline!localSettings.yaml!. \item[\verbitem{-d}] \lstinline!latexindent.pl -d myfile.tex! - - Only \lstinline!defaultSettings.yaml!: you might like to read \cref{sec:defuseloc} before - using this switch. By default, \lstinline!latexindent.pl! will always search for - \lstinline!indentconfig.yaml! in your home directory. If you would prefer it not to do so - then (instead of deleting or renaming \lstinline!indentconfig.yaml!) you can simply - call the script with the \lstinline!-d! switch; note that this will also tell - the script to ignore \lstinline!localSettings.yaml! even if it has been called with the - \lstinline!-l! switch. - + + Only \lstinline!defaultSettings.yaml!: you might like to read \cref{sec:defuseloc} before + using this switch. By default, \lstinline!latexindent.pl! will always search for + \lstinline!indentconfig.yaml! in your home directory. If you would prefer it not to do so + then (instead of deleting or renaming \lstinline!indentconfig.yaml!) you can simply + call the script with the \lstinline!-d! switch; note that this will also tell + the script to ignore \lstinline!localSettings.yaml! even if it has been called with the + \lstinline!-l! switch. + \item[\verbitem{-c}]\lstinline!latexindent.pl -c=/path/to/directory/ myfile.tex! - - If you wish to have backup files and \lstinline!indent.log! written to a directory - other than the current working directory, then you can send these `cruft' files - to another directory. - % this switch was made as a result of http://tex.stackexchange.com/questions/142652/output-latexindent-auxiliary-files-to-a-different-directory + + If you wish to have backup files and \lstinline!indent.log! written to a directory + other than the current working directory, then you can send these `cruft' files + to another directory. + % this switch was made as a result of http://tex.stackexchange.com/questions/142652/output-latexindent-auxiliary-files-to-a-different-directory \end{itemize} - + \subsection{From \lstinline!arara!} Using \lstinline!latexindent.pl! from the command line is fine for some folks, but others may find it easier to use from \lstinline!arara!. \lstinline!latexindent.pl! -ships with an \lstinline!arara! rule, \lstinline!indent.yaml!, which can be copied +ships with an \lstinline!arara! rule, \lstinline!indent.yaml!, which can be copied to the directory of your other \lstinline!arara! rules; otherwise you can add the directory in which \lstinline!latexindent.pl! resides to your \lstinline!araraconfig.yaml! file. - -Once you have told \lstinline!arara! where to find your \lstinline!indent! rule, -you can use it any of the ways described in \cref{lst:arara} (or combinations thereof). -In fact, \lstinline!arara! allows yet greater flexibility-- you can use \lstinline!yes/no!, \lstinline!true/false!, or \lstinline!on/off! to toggle the various options. - -\begin{lstlisting}[caption={\lstinline!arara! sample usage},label={lst:arara},escapeinside={(*@}{@*)}] + +Once you have told \lstinline!arara! where to find your \lstinline!indent! rule, +you can use it any of the ways described in \cref{lst:arara} (or combinations thereof). +In fact, \lstinline!arara! allows yet greater flexibility--you can use \lstinline!yes/no!, \lstinline!true/false!, or \lstinline!on/off! to toggle the various options. + +\begin{cmhlistings}[style=demo,escapeinside={(*@}{@*)}]{\lstinline!arara! sample usage}{lst:arara} %(*@@*) arara: indent %(*@@*) arara: indent: {overwrite: yes} %(*@@*) arara: indent: {output: myfile.tex} @@ -394,12 +431,12 @@ In fact, \lstinline!arara! allows yet greater flexibility-- you can use \lstinli %(*@@*) arara: indent: { cruft: /home/cmhughes/Desktop } \documentclass{article} ... -\end{lstlisting} - +\end{cmhlistings} + Hopefully the use of these rules is fairly self-explanatory, but for completeness -\cref{tab:orbsandswitches} shows the relationship between \lstinline!arara! directive arguments and the +\cref{tab:orbsandswitches} shows the relationship between \lstinline!arara! directive arguments and the switches given in \cref{sec:commandline}. - + \begin{table}[!ht] \centering \caption{\lstinline!arara! directive arguments and corresponding switches} @@ -418,106 +455,124 @@ switches given in \cref{sec:commandline}. \bottomrule \end{tabular} \end{table} - -The \lstinline!cruft! directive does not work well when used with + +The \lstinline!cruft! directive does not work well when used with directories that contain spaces. - + \section{default, user, and local settings}\label{sec:defuseloc} -\lstinline!latexindent.pl! loads its settings from \lstinline!defaultSettings.yaml! -(rhymes with camel). The idea is to separate the behaviour of the script -from the internal working-- this is very similar to the way that we separate content +\lstinline!latexindent.pl! loads its settings from \lstinline!defaultSettings.yaml! +(rhymes with camel). The idea is to separate the behaviour of the script +from the internal working--this is very similar to the way that we separate content from form when writing our documents in \LaTeX. - + \subsection{\lstinline!defaultSettings.yaml!} -If you look in \lstinline!defaultSettings.yaml! you'll find the switches +If you look in \lstinline!defaultSettings.yaml! you'll find the switches that govern the behaviour of \lstinline!latexindent.pl!. If you're not sure where \lstinline!defaultSettings.yaml! resides on your computer, don't worry as \lstinline!indent.log! will tell you where to find it. -\lstinline!defaultSettings.yaml! is commented, -but here is a description of what each switch is designed to do. The default +\lstinline!defaultSettings.yaml! is commented, +but here is a description of what each switch is designed to do. The default value is given in each case. - -You can certainly feel free to edit \lstinline!defaultSettings.yaml!, but + +You can certainly feel free to edit \lstinline!defaultSettings.yaml!, but this is not ideal as it may be overwritten when you update your distribution-- -all of your hard work tweaking the script would be undone! Don't worry, -there's a solution-- feel free to peek ahead to \cref{sec:indentconfig} if you like. +all of your hard work tweaking the script would be undone! Don't worry, +there's a solution--feel free to peek ahead to \cref{sec:indentconfig} if you like. \begin{itemize} \item[\verbitem{defaultIndent}] \lstinline!"\t"! - - This is the default indentation (\lstinline!\t! means a tab) used in the absence of other details - for the command or environment we are working with-- see \lstinline!indentRules! - for more details (\cpageref{page:indentRules}). - - If you're interested in experimenting with \lstinline!latexindent.pl! then you - can \emph{remove} all indentation by setting \lstinline!defaultIndent: ""! + + This is the default indentation (\lstinline!\t! means a tab) used in the absence of other details + for the command or environment we are working with--see \lstinline!indentRules! + for more details (\cpageref{page:indentRules}). + + If you're interested in experimenting with \lstinline!latexindent.pl! then you + can \emph{remove} all indentation by setting \lstinline!defaultIndent: ""! \item[\verbitem{backupExtension}] \lstinline!.bak! - - If you call \lstinline!latexindent.pl! with the \lstinline!-w! switch (to overwrite - \lstinline!myfile.tex!) then it will create a backup file before doing - any indentation: \lstinline!myfile.bak0! - - By default, every time you call \lstinline!latexindent.pl! after this with - the \lstinline!-w! switch it will create \lstinline!myfile.bak1!, \lstinline!myfile.bak2!, - etc. + + If you call \lstinline!latexindent.pl! with the \lstinline!-w! switch (to overwrite + \lstinline!myfile.tex!) then it will create a backup file before doing + any indentation: \lstinline!myfile.bak0! + + By default, every time you call \lstinline!latexindent.pl! after this with + the \lstinline!-w! switch it will create \lstinline!myfile.bak1!, \lstinline!myfile.bak2!, + etc. \item[\verbitem{onlyOneBackUp}] \lstinline!0! - - \label{page:onlyonebackup} - If you don't want a backup for every time that you call \lstinline!latexindent.pl! (so - you don't want \lstinline!myfile.bak1!, \lstinline!myfile.bak2!, etc) and you simply - want \lstinline!myfile.bak! (or whatever you chose \lstinline!backupExtension! to be) - then change \lstinline!onlyOneBackUp! to \lstinline!1!. - + + \label{page:onlyonebackup} + If you don't want a backup for every time that you call \lstinline!latexindent.pl! (so + you don't want \lstinline!myfile.bak1!, \lstinline!myfile.bak2!, etc) and you simply + want \lstinline!myfile.bak! (or whatever you chose \lstinline!backupExtension! to be) + then change \lstinline!onlyOneBackUp! to \lstinline!1!. + \item[\verbitem{maxNumberOfBackUps}]\lstinline!0! - - Some users may only want a finite number of backup files, - say at most $3$, in which case, they can change this switch. - The smallest value of \lstinline!maxNumberOfBackUps! is $0$ which will \emph{not} - prevent back up files being made-- in this case, the behaviour will be dictated - entirely by \lstinline!onlyOneBackUp!. - %\footnote{This was a feature request made on \href{https://github.com/cmhughes/latexindent.plx}{github}} - + + Some users may only want a finite number of backup files, + say at most $3$, in which case, they can change this switch. + The smallest value of \lstinline!maxNumberOfBackUps! is $0$ which will \emph{not} + prevent backup files being made--in this case, the behaviour will be dictated + entirely by \lstinline!onlyOneBackUp!. + %\footnote{This was a feature request made on \href{https://github.com/cmhughes/latexindent.plx}{github}} + \item[\verbitem{cycleThroughBackUps}]\lstinline!0! + + Some users may wish to cycle through backup files, by deleting the + oldest backup file and keeping only the most recent; for example, + with \lstinline!maxNumberOfBackUps: 4!, and \lstinline!cycleThroughBackUps! + set to \lstinline!1! then the \lstinline!copy! procedure given in \cref{lst:cycleThroughBackUps} + would be obeyed. + + \begin{cmhlistings}[language=Perl]{\lstinline!cycleThroughBackUps!}{lst:cycleThroughBackUps} +copy myfile.bak1 to myfile.bak0 +copy myfile.bak2 to myfile.bak1 +copy myfile.bak3 to myfile.bak2 +copy myfile.bak4 to myfile.bak3 + \end{cmhlistings} + \item[\verbitem{indentPreamble}] \lstinline!0! - - The preamble of a document can sometimes contain some trickier code - for \lstinline!latexindent.pl! to work with. By default, \lstinline!latexindent.pl! - won't try to operate on the preamble, but if you'd like it to try then - change \lstinline!indentPreamble! to \lstinline!1!. + + The preamble of a document can sometimes contain some trickier code + for \lstinline!latexindent.pl! to work with. By default, \lstinline!latexindent.pl! + won't try to operate on the preamble, but if you'd like it to try then + change \lstinline!indentPreamble! to \lstinline!1!. \item[\verbitem{alwaysLookforSplitBraces}] \lstinline!1! - - This switch tells \lstinline!latexindent.pl! to look for commands that - can split \emph{braces} across lines, such as \lstinline!parbox!, \lstinline!tikzset!, etc. In older - versions of \lstinline!latexindent.pl! you had to specify each one in \lstinline!checkunmatched!-- this - clearly became tedious, hence the introduction of \lstinline!alwaysLookforSplitBraces!. - - \emph{As long as you leave this switch on (set to 1) you don't need to specify which - commands can split braces across lines-- you can ignore the - fields \lstinline!checkunmatched! and \lstinline!checkunmatchedELSE! described later}. + + This switch tells \lstinline!latexindent.pl! to look for commands that + can split \emph{braces} across lines, such as \lstinline!parbox!, \lstinline!tikzset!, etc. In older + versions of \lstinline!latexindent.pl! you had to specify each one in \lstinline!checkunmatched!--this + clearly became tedious, hence the introduction of \lstinline!alwaysLookforSplitBraces!. + + \emph{As long as you leave this switch on (set to 1) you don't need to specify which + commands can split braces across lines--you can ignore the + fields \lstinline!checkunmatched! and \lstinline!checkunmatchedELSE! described + later on \cpageref{lst:checkunmatched}}. \item[\verbitem{alwaysLookforSplitBrackets}] \lstinline!1! - - This switch tells \lstinline!latexindent.pl! to look for commands that - can split \emph{brackets} across lines, such as \lstinline!psSolid!, \lstinline!pgfplotstabletypeset!, - etc. In older versions of \lstinline!latexindent.pl! you had to specify each one in \lstinline!checkunmatchedbracket!-- - this clearly became tedious, hence the introduction of \lstinline!alwaysLookforSplitBraces!. - - \emph{As long as you leave this switch on (set to 1) you don't need to specify which - commands can split brackets across lines-- you can ignore \lstinline!checkunmatchedbracket! described later}. - + + This switch tells \lstinline!latexindent.pl! to look for commands that + can split \emph{brackets} across lines, such as \lstinline!psSolid!, \lstinline!pgfplotstabletypeset!, + etc. In older versions of \lstinline!latexindent.pl! you had to specify each one in \lstinline!checkunmatchedbracket!-- + this clearly became tedious, hence the introduction of \lstinline!alwaysLookforSplitBraces!. + + \emph{As long as you leave this switch on (set to 1) you don't need to specify which + commands can split brackets across lines--you can ignore \lstinline!checkunmatchedbracket! described later on + \cpageref{lst:checkunmatched}}. + \item[\verbitem{removeTrailingWhitespace}] \lstinline!0! - - By default \lstinline!latexindent.pl! indents every line (including empty lines) - which creates `trailing whitespace' feared by most version control systems. If - this option is set to \lstinline!1!, trailing whitespace is removed from all - lines, also non-empty ones. In general this should not create any problems, but - by precaution this option is turned off by default. \footnote{Thanks to \href{https://github.com/vosskuhle}{vosskuhle} for - providing this feature.} - + + By default \lstinline!latexindent.pl! indents every line (including empty lines) + which creates `trailing whitespace' feared by most version control systems. If + this option is set to \lstinline!1!, trailing whitespace is removed from all + lines, also non-empty ones. In general this should not create any problems, but + by precaution this option is turned off by default. \footnote{Thanks to \href{https://github.com/vosskuhle}{vosskuhle} for + providing this feature.} + \item[\verbitem{lookForAlignDelims}] This is the first example of a field - in \lstinline!defaultSettings.yaml! that has more than one line; \cref{lst:aligndelims} - shows more details. - - \begin{yaml}[caption={\lstinline!lookForAlignDelims!},label={lst:aligndelims}] + in \lstinline!defaultSettings.yaml! that has more than one line; \cref{lst:aligndelims} + shows more details. + + \begin{cmhlistings}[style=yaml]{\lstinline!lookForAlignDelims!}{lst:aligndelims} lookForAlignDelims: tabular: 1 + tabularx: 1 + longtable: 1 array: 1 matrix: 1 bmatrix: 1 @@ -531,79 +586,95 @@ lookForAlignDelims: dcases: 1 pmatrix: 1 listabla: 1 - \end{yaml} - + \end{cmhlistings} + The environments specified in this field will be operated on in a special way by \lstinline!latexindent.pl!. In particular, it will try and align each column by its alignment - tabs. It does have some limitations (discussed further in \cref{sec:knownlimitations}), - but in many cases it will produce results such as those in \cref{lst:tabularbefore,lst:tabularafter}. - + tabs. It does have some limitations (discussed further in \cref{sec:knownlimitations}), + but in many cases it will produce results such as those in \cref{lst:tabularbefore,lst:tabularafter}. + \begin{minipage}{.5\textwidth} - \begin{lstlisting}[caption={\lstinline!tabular! before},label={lst:tabularbefore}] + \begin{cmhlistings}[style=demo,columns=fixed]{\lstinline!tabular! before}{lst:tabularbefore} \begin{tabular}{cccc} 1& 2 &3 &4\\ 5& &6 &\\ \end{tabular} - \end{lstlisting} + \end{cmhlistings} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{lstlisting}[caption={\lstinline!tabular! after},label={lst:tabularafter}] + \begin{cmhlistings}[style=demo,columns=fixed]{\lstinline!tabular! after}{lst:tabularafter} \begin{tabular}{cccc} 1 & 2 & 3 & 4 \\ 5 & & 6 & \\ \end{tabular} - \end{lstlisting} + \end{cmhlistings} \end{minipage} - - If you find that \lstinline!latexindent.pl! does not perform satisfactorily on such - environments then you can either remove them from \lstinline!lookForAlignDelims! altogether, or set the relevant key to \lstinline!0!, for example \lstinline!tabular: 0!, or if you just want to ignore \emph{specific} + + If you find that \lstinline!latexindent.pl! does not perform satisfactorily on such + environments then you can either remove them from \lstinline!lookForAlignDelims! altogether, or set the relevant key to \lstinline!0!, for example \lstinline!tabular: 0!, or if you just want to ignore \emph{specific} instances of the environment, you could wrap them in something from \lstinline!noIndentBlock! (see \cref{lst:noIndentBlock}). - + + \item If you have blocks of code that you wish to align at the \& character that + are \emph{not} wrapped in, for example, \lstinline!\begin{tabular}...\end{tabular}!, then you use the mark up + illustrated in \cref{lst:alignmentmarkup}. Note that the \lstinline!%*! must be next to + each other, but that there can be any number of spaces (possibly none) between the + \lstinline!*! and \lstinline!\begin{tabular}!; note also that you may use any + environment name that you have specified in \lstinline!lookForAlignDelims!. + \begin{cmhlistings}[style=demo,columns=fixed]{Mark up for aligning delimiters outside of environments}{lst:alignmentmarkup} +\matrix{% +%* \begin{tabular} + 1 & 2 & 3 & 4 \\ + 5 & & 6 & \\ +%* \end{tabular} +} + \end{cmhlistings} + \item[\verbitem{verbatimEnvironments}] A field that contains a list of environments - that you would like left completely alone-- no indentation will be done - to environments that you have specified in this field-- see \cref{lst:verbatimEnvironments}. - - \begin{yaml}[caption={\lstinline!verbatimEnvironments!},label={lst:verbatimEnvironments}] + that you would like left completely alone--no indentation will be done + to environments that you have specified in this field--see \cref{lst:verbatimEnvironments}. + + + \begin{cmhlistings}[style=yaml]{\lstinline!verbatimEnvironments!}{lst:verbatimEnvironments} verbatimEnvironments: verbatim: 1 lstlisting: 1 - \end{yaml} - Note that if you put an environment in \lstinline!verbatimEnvironments! - and in other fields such as \lstinline!lookForAlignDelims! or \lstinline!noAdditionalIndent! + \end{cmhlistings} + Note that if you put an environment in \lstinline!verbatimEnvironments! + and in other fields such as \lstinline!lookForAlignDelims! or \lstinline!noAdditionalIndent! then \lstinline!latexindent.pl! will \emph{always} prioritize \lstinline!verbatimEnvironments!. - - \item[\verbitem{noIndentBlock}] If you have a block of code that you don't - want \lstinline!latexindent.pl! to touch (even if it is \emph{not} a verbatim-like - environment) then you can wrap it in an environment from \lstinline!noIndentBlock!; - you can use any name you like for this, provided you populate it as demonstrate in - \cref{lst:noIndentBlock}. - - \begin{yaml}[caption={\lstinline!noIndentBlock!},label={lst:noIndentBlock}] + + \item[\verbitem{noIndentBlock}] If you have a block of code that you don't + want \lstinline!latexindent.pl! to touch (even if it is \emph{not} a verbatim-like + environment) then you can wrap it in an environment from \lstinline!noIndentBlock!; + you can use any name you like for this, provided you populate it as demonstrate in + \cref{lst:noIndentBlock}. + + \begin{cmhlistings}[style=yaml]{\lstinline!noIndentBlock!}{lst:noIndentBlock} noIndentBlock: noindent: 1 cmhtest: 1 - \end{yaml} - + \end{cmhlistings} + Of course, you don't want to have to specify these as null environments - in your code, so you use them with a comment symbol, \lstinline!%!, followed - by as many spaces (possibly none) as you like; see \cref{lst:noIndentBlockdemo} for + in your code, so you use them with a comment symbol, \lstinline!%!, followed + by as many spaces (possibly none) as you like; see \cref{lst:noIndentBlockdemo} for example. - \begin{lstlisting}[caption={\lstinline!noIndentBlock! demonstration},label={lst:noIndentBlockdemo},escapeinside={(*@}{@*)}] -%(*@@*) \begin{noindent} + \begin{cmhlistings}[style=demo,escapeinside={(*@}{@*)}]{\lstinline!noIndentBlock! demonstration}{lst:noIndentBlockdemo} +%(*@@*) \begin{noindent} this code - won't + won't be touched - by + by latexindent.pl! -%(*@@*)\end{noindent} - \end{lstlisting} - +%(*@@*)\end{noindent} + \end{cmhlistings} + \item[\verbitem{noAdditionalIndent}] If you would prefer some of your - environments or commands not to receive any additional indent, then - populate \lstinline!noAdditionalIndent!; see \cref{lst:noAdditionalIndent}. - Note that these environments will still receive the \emph{current} level - of indentation unless they belong to \lstinline!verbatimEnvironments!, or \lstinline!noIndentBlock!. - - \begin{yaml}[caption={\lstinline!noAdditionalIndent!},label={lst:noAdditionalIndent}] + environments or commands not to receive any additional indent, then + populate \lstinline!noAdditionalIndent!; see \cref{lst:noAdditionalIndent}. + Note that these environments will still receive the \emph{current} level + of indentation unless they belong to \lstinline!verbatimEnvironments!, or \lstinline!noIndentBlock!. + + \begin{cmhlistings}[style=yaml]{\lstinline!noAdditionalIndent!}{lst:noAdditionalIndent} noAdditionalIndent: document: 1 myexample: 1 @@ -617,154 +688,218 @@ noAdditionalIndent: \[: 1 \]: 1 frame: 0 - \end{yaml} - Note in particular from \cref{lst:noAdditionalIndent} that if you wish content within - \lstinline!\[! and \lstinline!\]! to receive no additional content then - you have to specify \emph{both} as \lstinline!1! (the default is \lstinline!0!). + \end{cmhlistings} + Note in particular from \cref{lst:noAdditionalIndent} that if you wish content within + \lstinline!\[! and \lstinline!\]! to receive no additional indentation then + you have to specify \emph{both} as \lstinline!1! (the default is \lstinline!0!). If you do not specify both as the same value you may get some interesting results! - \item[\verbitem{indentRules}] If\label{page:indentRules} you would prefer to specify - individual rules for certain environments or commands, just - populate \lstinline!indentRules!; see \cref{lst:indentRules} - - \begin{yaml}[caption={\lstinline!indentRules!},label={lst:indentRules}] + \item[\verbitem{indentRules}] If\label{page:indentRules} you would prefer to specify + individual rules for certain environments or commands, just + populate \lstinline!indentRules!; see \cref{lst:indentRules} + + \begin{cmhlistings}[style=yaml]{\lstinline!indentRules!}{lst:indentRules} indentRules: myenvironment: "\t\t" anotherenvironment: "\t\t\t\t" \[: "\t" - \end{yaml} %%%%%\] just here to stop vim from colouring the rest of my code - Note that in contrast to \lstinline!noAdditionalIndent! you do \emph{not} - need to specify both \lstinline!\[! and \lstinline!\]! in this field. - - If you put an environment in both \lstinline!noAdditionalIndent! and in - \lstinline!indentRules! then \lstinline!latexindent.pl! will resolve the conflict + \end{cmhlistings} %%%%%\] just here to stop vim from colouring the rest of my code + Note that in contrast to \lstinline!noAdditionalIndent! you do \emph{not} + need to specify both \lstinline!\[! and \lstinline!\]! in this field. + + If you put an environment in both \lstinline!noAdditionalIndent! and in + \lstinline!indentRules! then \lstinline!latexindent.pl! will resolve the conflict by ignoring \lstinline!indentRules! and prioritizing \lstinline!noAdditionalIndent!. - You will get a warning message in \lstinline!indent.log!; note that you will only - get one warning message per command or environment. Further discussion + You will get a warning message in \lstinline!indent.log!; note that you will only + get one warning message per command or environment. Further discussion is given in \cref{sec:fieldhierachy}. - - \item[\verbitem{indentAfterHeadings}] This field enables the user to specify - indentation rules that take effect after heading commands such as \lstinline!\part!, \lstinline!\chapter!, - \lstinline!\section!, \lstinline!\subsection*! etc. This field is slightly different from all - of the fields that we have considered previously, because each element is - itself a field which has two elements: \lstinline!indent! and \lstinline!level!. - \begin{yaml}[caption={\lstinline!indentAfterHeadings!},label={lst:indentAfterHeadings}] + + \item[\verbitem{indentAfterHeadings}] This field enables the user to specify + indentation rules that take effect after heading commands such as \lstinline!\part!, \lstinline!\chapter!, + \lstinline!\section!, \lstinline!\subsection*! etc. This field is slightly different from all + of the fields that we have considered previously, because each element is + itself a field which has two elements: \lstinline!indent! and \lstinline!level!. + \begin{cmhlistings}[style=yaml]{\lstinline!indentAfterHeadings!}{lst:indentAfterHeadings} indentAfterHeadings: part: indent: 0 level: 1 - chapter: + chapter: indent: 0 level: 2 section: indent: 0 level: 3 ... - \end{yaml} - The default settings do \emph{not} place indentation after a heading-- you + \end{cmhlistings} + The default settings do \emph{not} place indentation after a heading--you can easily switch them on by changing \lstinline!indent: 0! to \lstinline!indent: 1!. - The \lstinline!level! field tells \lstinline!latexindent.pl! the hierarchy of the heading + The \lstinline!level! field tells \lstinline!latexindent.pl! the hierarchy of the heading structure in your document. You might, for example, like to have both \lstinline!section! - and \lstinline!subsection! set with \lstinline!level: 3! because you do not want the indentation to go too deep. - + and \lstinline!subsection! set with \lstinline!level: 3! because you do not want the indentation to go too deep. + You can add any of your own custom heading commands to this field, specifying the \lstinline!level! - as appropriate. You can also specify your own indentation in \lstinline!indentRules!-- - you will find the default \lstinline!indentRules! contains \lstinline!chapter: " "! which - tells \lstinline!latexindent.pl! simply to use a space character after \lstinline!\chapter! headings + as appropriate. You can also specify your own indentation in \lstinline!indentRules!-- + you will find the default \lstinline!indentRules! contains \lstinline!chapter: " "! which + tells \lstinline!latexindent.pl! simply to use a space character after \lstinline!\chapter! headings (once \lstinline!indent! is set to \lstinline!1! for \lstinline!chapter!). + + \item[\verbitem{indentAfterItems}] The environments specified in \lstinline!indentAfterItems! tell +\lstinline!latexindent.pl! to look for \lstinline!\item! commands; if these switches are set to \lstinline!1! +then indentation will be performed so as indent the code after each \lstinline!item!. + \begin{cmhlistings}{\lstinline!indentAfterItems!}{lst:indentafteritems} +indentAfterItems: + itemize: 1 + enumerate: 1 + \end{cmhlistings} +A demonstration is given in \cref{lst:itemsbefore,lst:itemsafter} + + \begin{minipage}{.5\textwidth} + \begin{cmhlistings}[style=demo,xleftmargin=-3mm,columns=fixed]{\lstinline!items! before}{lst:itemsbefore} +\begin{itemize} +\item some text here +some more text here +some more text here +\item another item +\end{itemize} + \end{cmhlistings} + \end{minipage} + \begin{minipage}{.5\textwidth} + \begin{cmhlistings}[style=demo,xleftmargin=-3mm,columns=fixed]{\lstinline!items! after}{lst:itemsafter} +\begin{itemize} + \item some text here + some more text here + some more text here + \item another item +\end{itemize} + \end{cmhlistings} + \end{minipage} + + \item[\verbitem{itemNames}] If you have your own \lstinline!item! commands (perhaps you + prefer to use \lstinline!myitem!, for example) + then you can put populate them in \lstinline!itemNames!. + For example, users of the \lstinline!exam! document class might like to add +\lstinline!parts! to \lstinline!indentAfterItems! and \lstinline!part! to \lstinline!itemNames! +to their user settings--see \vref{sec:indentconfig} for details of how to configure user settings, +and \vref{lst:mysettings} in particular.\label{page:examsettings} + +\item[\verbitem{constructIfElseFi}] The commands specified in this field + will tell \lstinline!latexindent.pl! to look for constructs that + have the form \lstinline!\if...! \lstinline!\else...! \lstinline!\fi!, such as, + for example, \lstinline!\ifnum!; see \cref{lst:iffibefore,lst:iffiafter} for + a before-and-after demonstration. + + \begin{minipage}{.5\textwidth} + \begin{cmhlistings}[style=demo,xleftmargin=-3mm,columns=fixed]{\lstinline!if-else-fi! construct before}{lst:iffibefore} +\ifnum\radius>5 +\ifnum\radius<16 +\draw[decorate,... +\fi +\fi +\end{cmhlistings} + \end{minipage} + \begin{minipage}{.5\textwidth} + \begin{cmhlistings}[style=demo,xleftmargin=-3mm,columns=fixed]{\lstinline!if-else-fi! construct after}{lst:iffiafter} +\ifnum\radius>5 + \ifnum\radius<16 + \draw[decorate,... + \fi +\fi +\end{cmhlistings} + \end{minipage} \begin{warning} \emph{The following fields are marked in red, as they are not necessary unless you wish to micro-manage your indentation scheme. Note that in each case, you should \emph{not} use the backslash.} \end{warning} - + % to anyone reading the source code- I know the next line isn't the % correct way to do it :) \item[\color{red}\verbitem{checkunmatched}] Assuming you keep \lstinline!alwaysLookforSplitBraces! set to \lstinline!1! (which - is the default) then you don't need to worry about \lstinline!checkunmatched!. - - Should you wish to deactivate \lstinline!alwaysLookforSplitBraces! by setting it to \lstinline!0!, then - you can populate \lstinline!checkunmatched! with commands that can split braces across - lines-- see \cref{lst:checkunmatched}. - - \begin{yaml}[caption={\lstinline!checkunmatched!},label={lst:checkunmatched}] + is the default) then you don't need to worry about \lstinline!checkunmatched!. + + Should you wish to deactivate \lstinline!alwaysLookforSplitBraces! by setting it to \lstinline!0!, then + you can populate \lstinline!checkunmatched! with commands that can split braces across + lines--see \cref{lst:checkunmatched}. + + \begin{cmhlistings}[style=yaml]{\lstinline!checkunmatched!}{lst:checkunmatched} checkunmatched: parbox: 1 vbox: 1 - \end{yaml} + \end{cmhlistings} \item[\color{red}\verbitem{checkunmatchedELSE}] Similarly, assuming you keep \lstinline!alwaysLookforSplitBraces! set to \lstinline!1! (which - is the default) then you don't need to worry about \lstinline!checkunmatchedELSE!. - - As in \lstinline!checkunmatched!, should you wish to deactivate \lstinline!alwaysLookforSplitBraces! by setting it to \lstinline!0!, then - you can populate \lstinline!checkunmatchedELSE! with commands that can split braces across - lines \emph{and} have an `else' statement-- see \cref{lst:checkunmatchedELSE}. - - \begin{yaml}[caption={\lstinline!checkunmatchedELSE!},label={lst:checkunmatchedELSE}] + is the default) then you don't need to worry about \lstinline!checkunmatchedELSE!. + + As in \lstinline!checkunmatched!, should you wish to deactivate \lstinline!alwaysLookforSplitBraces! by setting it to \lstinline!0!, then + you can populate \lstinline!checkunmatchedELSE! with commands that can split braces across + lines \emph{and} have an `else' statement--see \cref{lst:checkunmatchedELSE}. + + \begin{cmhlistings}[style=yaml]{\lstinline!checkunmatchedELSE!}{lst:checkunmatchedELSE} checkunmatchedELSE: pgfkeysifdefined: 1 DTLforeach: 1 ifthenelse: 1 - \end{yaml} - \item[\color{red}\verbitem{checkunmatchedbracket}] Assuming you keep \lstinline!alwaysLookforSplitBrackets! - set to \lstinline!1! (which is the default) then you don't need to worry about \lstinline!checkunmatchedbracket!. - - Should you wish to deactivate \lstinline!alwaysLookforSplitBrackets! by setting it - to \lstinline!0!, then you can populate \lstinline!checkunmatchedbracket! with commands that can - split \emph{brackets} across lines-- see \cref{lst:checkunmatchedbracket}. - - \begin{yaml}[caption={\lstinline!checkunmatchedbracket!},label={lst:checkunmatchedbracket}] + \end{cmhlistings} + \item[\color{red}\verbitem{checkunmatchedbracket}] Assuming you keep \lstinline!alwaysLookforSplitBrackets! + set to \lstinline!1! (which is the default) then you don't need to worry about \lstinline!checkunmatchedbracket!. + + Should you wish to deactivate \lstinline!alwaysLookforSplitBrackets! by setting it + to \lstinline!0!, then you can populate \lstinline!checkunmatchedbracket! with commands that can + split \emph{brackets} across lines--see \cref{lst:checkunmatchedbracket}. + + \begin{cmhlistings}[style=yaml]{\lstinline!checkunmatchedbracket!}{lst:checkunmatchedbracket} checkunmatchedbracket: psSolid: 1 pgfplotstablecreatecol: 1 pgfplotstablesave: 1 pgfplotstabletypeset: 1 mycommand: 1 - \end{yaml} + \end{cmhlistings} \end{itemize} - + \subsubsection{Hierarchy of fields}\label{sec:fieldhierachy} -After reading the previous section, it should sound reasonable that -\lstinline!noAdditionalIndent!, \lstinline!indentRules!, and -\lstinline!verbatim! all serve mutually exclusive tasks. Naturally, you may -well wonder what happens if you choose to ask \lstinline!latexindent.pl! to +After reading the previous section, it should sound reasonable that +\lstinline!noAdditionalIndent!, \lstinline!indentRules!, and +\lstinline!verbatim! all serve mutually exclusive tasks. Naturally, you may +well wonder what happens if you choose to ask \lstinline!latexindent.pl! to prioritize one above the other. - -For example, let's say that you put the fields in \cref{lst:conflict} into -one of your settings files. -\begin{yaml}[caption={Conflicting ideas},label={lst:conflict}] + +For example, let's say that (after reading \cref{sec:indentconfig}) you put the fields in \cref{lst:conflict} into +one of your settings files. +\begin{cmhlistings}[style=yaml]{Conflicting ideas}{lst:conflict} indentRules: myenvironment: "\t\t" noAdditionalIndent: myenvironment: 1 -\end{yaml} - -Clearly these fields conflict: first of all -you are telling \lstinline!latexindent.pl! that \lstinline!myenvironment! should -receive two tabs of indentation, and then you are telling it +\end{cmhlistings} + +Clearly these fields conflict: first of all +you are telling \lstinline!latexindent.pl! that \lstinline!myenvironment! should +receive two tabs of indentation, and then you are telling it not to put any indentation in the environment. \lstinline!latexindent.pl! will always make the decision to prioritize \lstinline!noAdditionalIndent! above -\lstinline!indentRules! regardless of the order that you load them in -your settings file. The first +\lstinline!indentRules! regardless of the order that you load them in +your settings file. The first time it encounters \lstinline!myenvironment! it will put a warning in \lstinline!indent.log! -and delete the offending key from \lstinline!indentRules! so that any future -conflicts won't have to be addressed. - +and delete the offending key from \lstinline!indentRules! so that any future +conflicts will not have to be addressed. + Let's consider another conflicting example in \cref{lst:bigconflict} -\begin{yaml}[caption={More conflicting ideas},label={lst:bigconflict}] +\begin{cmhlistings}[style=yaml]{More conflicting ideas}{lst:bigconflict} lookForAlignDelims: myenvironment: 1 verbatimEnvironments: myenvironment: 1 -\end{yaml} -This is quite a significant conflict-- we are first of all telling \lstinline!latexindent.pl! -to look for alignment delimiters in \lstinline!myenvironment! and then -telling it that actually we would like \lstinline!myenvironment! to be considered -as a \lstinline!verbatim!-like environment. Regardless of the order that we +\end{cmhlistings} +This is quite a significant conflict--we are first of all telling \lstinline!latexindent.pl! +to look for alignment delimiters in \lstinline!myenvironment! and then +telling it that actually we would like \lstinline!myenvironment! to be considered +as a \lstinline!verbatim!-like environment. Regardless of the order that we state \cref{lst:bigconflict} the \lstinline!verbatim! instruction will always win. -As in \cref{lst:conflict} you will only receive a warning in \lstinline!indent.log! the -first time \lstinline!latexindent.pl! encounters \lstinline!myenvironment! as the +As in \cref{lst:conflict} you will only receive a warning in \lstinline!indent.log! the +first time \lstinline!latexindent.pl! encounters \lstinline!myenvironment! as the offending key is deleted from \lstinline!lookForAlignDelims!. - -To summarize, \lstinline!latexindent.pl! will prioritize the various fields in the + +To summarize, \lstinline!latexindent.pl! will prioritize the various fields in the following order: \begin{enumerate} \item \lstinline!verbatimEnvironments! @@ -772,27 +907,27 @@ following order: \item \lstinline!indentRules! \end{enumerate} \subsection{\lstinline!indentconfig.yaml! (for user settings)}\label{sec:indentconfig} -Editing \lstinline!defaultSettings.yaml! is not ideal as it may be overwritten when -updating your distribution-- a better way to customize the settings to your liking -is to set up your own settings file, -\lstinline!mysettings.yaml! (or any name you like, provided it ends with \lstinline!.yaml!). -The only thing you have to do is tell \lstinline!latexindent.pl! where to find it. - -\lstinline!latexindent.pl! will always check your home directory for \lstinline!indentconfig.yaml! (unless -it is called with the \lstinline!-d! switch), +Editing \lstinline!defaultSettings.yaml! is not ideal as it may be overwritten when +updating your distribution--a better way to customize the settings to your liking +is to set up your own settings file, +\lstinline!mysettings.yaml! (or any name you like, provided it ends with \lstinline!.yaml!). +The only thing you have to do is tell \lstinline!latexindent.pl! where to find it. + +\lstinline!latexindent.pl! will always check your home directory for \lstinline!indentconfig.yaml! (unless +it is called with the \lstinline!-d! switch), which is a plain text file you can create that contains the \emph{absolute} paths for any settings files that you wish \lstinline!latexindent.pl! to load. Note that Mac and Linux users home directory is \lstinline!~/username! while -Windows (Vista onwards) is \lstinline!C:\Users\username! \footnote{If you're not sure - where to put \lstinline!indentconfig.yaml!, don't - worry \lstinline!latexindent.pl! will tell you in the log file exactly where to +Windows (Vista onwards) is \lstinline!C:\Users\username! \footnote{If you're not sure + where to put \lstinline!indentconfig.yaml!, don't + worry \lstinline!latexindent.pl! will tell you in the log file exactly where to put it assuming it doesn't exist already.} \Cref{lst:indentconfig} shows a sample \lstinline!indentconfig.yaml! file. - -\begin{yaml}[caption={\lstinline!indentconfig.yaml! (sample)},label={lst:indentconfig}] + +\begin{cmhlistings}[style=yaml]{\lstinline!indentconfig.yaml! (sample)}{lst:indentconfig} # Paths to user settings for latexindent.pl # -# Note that the settings will be read in the order you +# Note that the settings will be read in the order you # specify here- each successive settings file will overwrite # the variables that you specify @@ -802,90 +937,101 @@ paths: - /some/other/folder/anynameyouwant.yaml - C:\Users\chughes\Documents\mysettings.yaml - C:\Users\chughes\Desktop\test spaces\more spaces.yaml -\end{yaml} - +\end{cmhlistings} + Note that the \lstinline!.yaml! files you specify in \lstinline!indentconfig.yaml! -will be loaded in the order that you write them in. Each file doesn't have -to have every switch from \lstinline!defaultSettings.yaml!; in fact, I recommend -that you only keep the switches that you want to \emph{change} in these +will be loaded in the order that you write them in. Each file doesn't have +to have every switch from \lstinline!defaultSettings.yaml!; in fact, I recommend +that you only keep the switches that you want to \emph{change} in these settings files. - -To get started with your own settings file, you might like to save a copy of -\lstinline!defaultSettings.yaml! in another directory and call it, for + +To get started with your own settings file, you might like to save a copy of +\lstinline!defaultSettings.yaml! in another directory and call it, for example, \lstinline!mysettings.yaml!. Once you have added the path to \lstinline!indentconfig.yaml! -feel free to start changing the switches and adding more environments to it -as you see fit-- have a look at \cref{lst:mysettings} for an example -that uses four tabs for the default indent, and adds the \lstinline!tabbing! -environment to the list of environments that contains alignment delimiters. - -\begin{yaml}[caption={\lstinline!mysettings.yaml! (example)},label={lst:mysettings}] +feel free to start changing the switches and adding more environments to it +as you see fit--have a look at \cref{lst:mysettings} for an example +that uses four tabs for the default indent, adds the \lstinline!tabbing! +environment to the list of environments that contains alignment delimiters, +and adds the changes we described on \cpageref{page:examsettings}. + +\begin{cmhlistings}[style=yaml]{\lstinline!mysettings.yaml! (example)}{lst:mysettings} # Default value of indentation defaultIndent: "\t\t\t\t" -# environments that have tab delimiters, add more +# environments that have tab delimiters, add more # as needed lookForAlignDelims: tabbing: 1 -\end{yaml} - + +# If you use the exam documentclass, you might +# like the following settings +# environments that have \item commands +indentAfterItems: + parts: 1 + +# commands to be treated like \item +itemNames: + part: 1 +\end{cmhlistings} + You can make sure that your settings are loaded by checking \lstinline!indent.log! -for details-- if you have specified a path that \lstinline!latexindent.pl! doesn't -recognize then you'll get a warning, otherwise you'll get confirmation that -\lstinline!latexindent.pl! has read your settings file \footnote{Windows users +for details--if you have specified a path that \lstinline!latexindent.pl! doesn't +recognize then you'll get a warning, otherwise you'll get confirmation that +\lstinline!latexindent.pl! has read your settings file \footnote{Windows users may find that they have to end \lstinline!.yaml! files with a blank line}. - + \begin{warning} - When editing \lstinline!.yaml! files it is \emph{extremely} important - to remember how sensitive they are to spaces. I highly recommend copying + When editing \lstinline!.yaml! files it is \emph{extremely} important + to remember how sensitive they are to spaces. I highly recommend copying and pasting from \lstinline!defaultSettings.yaml! when you create your first \lstinline!whatevernameyoulike.yaml! file. - - If \lstinline!latexindent.pl! can not read your \lstinline!.yaml! file it + + If \lstinline!latexindent.pl! can not read your \lstinline!.yaml! file it will tell you so in \lstinline!indent.log!. \end{warning} - + \subsection{\lstinline!localSettings.yaml!} You may remember on \cpageref{page:localswitch} we discussed the \lstinline!-l! switch -that tells \lstinline!latexindent.pl! to look for \lstinline!localSettings.yaml! in the -\emph{same directory} as \lstinline!myfile.tex!. This settings file will -be read \emph{after} \lstinline!defaultSettings.yaml! and, assuming they exist, -user settings. - +that tells \lstinline!latexindent.pl! to look for \lstinline!localSettings.yaml! in the +\emph{same directory} as \lstinline!myfile.tex!. This settings file will +be read \emph{after} \lstinline!defaultSettings.yaml! and, assuming they exist, +user settings. + In contrast to the \emph{user} settings which can be named anything you like (provided that they are detailed in \lstinline!indentconfig.yaml!), the \emph{local} settings file must be called \lstinline!localSettings.yaml!. It can contain any switches that you'd -like to change-- a sample is shown in \cref{lst:localSettings}. - -\begin{yaml}[caption={\lstinline!localSettings.yaml! (example)},label={lst:localSettings}] +like to change--a sample is shown in \cref{lst:localSettings}. + +\begin{cmhlistings}[style=yaml]{\lstinline!localSettings.yaml! (example)}{lst:localSettings} # Default value of indentation defaultIndent: " " -# environments that have tab delimiters, add more +# environments that have tab delimiters, add more # as needed lookForAlignDelims: tabbing: 0 -# verbatim environments- environments specified +# verbatim environments- environments specified # in this hash table will not be changed at all! verbatimEnvironments: cmhenvironment: 0 -\end{yaml} - +\end{cmhlistings} + You can make sure that your local settings are loaded by checking \lstinline!indent.log! -for details-- if \lstinline!localSettings.yaml! can not be read then you will -get a warning, otherwise you'll get confirmation that +for details--if \lstinline!localSettings.yaml! can not be read then you will +get a warning, otherwise you'll get confirmation that \lstinline!latexindent.pl! has read \lstinline!localSettings.yaml!. - + \subsection{Settings load order}\label{sec:loadorder} \lstinline!latexindent.pl! loads the settings files in the following order: \begin{enumerate} \item \lstinline!defaultSettings.yaml! (always loaded, can not be renamed) \item \lstinline!anyUserSettings.yaml! (and any other arbitrarily-named files specified in \lstinline!indentconfig.yaml!) \item \lstinline!localSettings.yaml! (if found in same directory as \lstinline!myfile.tex! and called - with \lstinline!-l! switch; can not be renamed) + with \lstinline!-l! switch; can not be renamed) \end{enumerate} A visual representation of this is given in \cref{fig:loadorder}. - + \begin{figure} \centering \begin{tikzpicture}[ @@ -914,129 +1060,175 @@ A visual representation of this is given in \cref{fig:loadorder}. \draw[connections,optional] (indentconfig) -- (want) ; \draw[connections,optional] (latexindent) -- node[pos=0.5,anchor=west]{3} (local) ; \end{tikzpicture} - \caption{Schematic of the load order described in \cref{sec:loadorder}; solid lines represent - mandatory files, dotted lines represent optional files. \lstinline!indentconfig.yaml! can - contain as many files as you like-- the files will be loaded in order; if you specify + \caption{Schematic of the load order described in \cref{sec:loadorder}; solid lines represent + mandatory files, dotted lines represent optional files. \lstinline!indentconfig.yaml! can + contain as many files as you like--the files will be loaded in order; if you specify settings for the same field in more than one file, the most recent takes priority. } \label{fig:loadorder} \end{figure} - + \subsection{An important example} -I was working on a document that had the text shown in \cref{lst:casestudy}. -\begin{lstlisting}[caption={When to set \lstinline!alwaysLookforSplitBrackets=0!},label={lst:casestudy},escapeinside={(*@}{@*)}] +I was working on a document that had the text shown in \cref{lst:casestudy}. +\begin{cmhlistings}[style=demo,escapeinside={(*@}{@*)}]{When to set \lstinline!alwaysLookforSplitBrackets=0!}{lst:casestudy} Hence determine how many zeros the function $h(x)=f(x)-g(x)$ has on the interval $[0,9)$.(*@\label{line:interval1}@*) \begin{shortsolution} The function $h$ has $10$ zeros on the interval $[0,9)$.(*@\label{line:interval2}@*) \end{shortsolution} -\end{lstlisting} -I had allowed \lstinline!alwaysLookforSplitBrackets=1!, which is the default setting. -Unfortunately, this caused undesired results, as \lstinline!latexindent.pl! thought that the opening -\lstinline![! in the interval notation (\cref{line:interval1,line:interval2}) -was an opening brace that needed to be closed (with a corresponding \lstinline!]!). Clearly +\end{cmhlistings} +I had allowed \lstinline!alwaysLookforSplitBrackets=1!, which is the default setting. +Unfortunately, this caused undesired results, as \lstinline!latexindent.pl! thought that the opening +\lstinline![! in the interval notation (\cref{line:interval1,line:interval2}) +was an opening brace that needed to be closed (with a corresponding \lstinline!]!). Clearly this was inappropriate, but also expected since \lstinline!latexindent.pl! was simply following its matching rules. - -In this particular instance, I set up \lstinline!localSettings.yaml! -to contain \lstinline!alwaysLookforSplitBrackets: 0! and then specified the commands + +In this particular instance, I set up \lstinline!localSettings.yaml! +to contain \lstinline!alwaysLookforSplitBrackets: 0! and then specified the commands that could split brackets across lines (such as \lstinline!begin{axis}!) individually -in \lstinline!checkunmatchedbracket!. Another option would have been to wrap the +in \lstinline!checkunmatchedbracket!. Another option would have been to wrap the the line in an environment from \lstinline!noIndentBlock! which treats its contents as a verbatim environment. - - + + \section{Known limitations}\label{sec:knownlimitations} There are a number of known limitations of the script, and almost certainly quite a few that are \emph{unknown}! - -The main limitation is to do with the alignment routine of environments that contain -delimiters-- in other words, environments that are entered in \lstinline!lookForAlignDelims!. -Indeed, this is the only part of the script that can \emph{potentially} remove + +The main limitation is to do with the alignment routine of environments that contain +delimiters--in other words, environments that are entered in \lstinline!lookForAlignDelims!. +Indeed, this is the only part of the script that can \emph{potentially} remove lines from \lstinline!myfile.tex!. Note that \lstinline!indent.log! will always -finish with a comparison of line counts before and after. - +finish with a comparison of line counts before and after. + The routine works well for `standard' blocks of code that have the same number of \lstinline!&! -per line, but it will not do anything for blocks that do not-- such examples -include \lstinline!tabular! environments that use \lstinline!\multicolumn! or -perhaps spread cell contents across multiple lines. For each alignment block (\lstinline!tabular!, -\lstinline!align!, etc) \lstinline!latexindent.pl! first of all makes a record -of the maximum number of \lstinline!&!; if each row does not have that -number of \lstinline!&! then it will not try to format that row. Details +per line, but it will not do anything for lines that do not--such examples +include \lstinline!tabular! environments that use \lstinline!\multicolumn! or +perhaps spread cell contents across multiple lines. For each alignment block (\lstinline!tabular!, +\lstinline!align!, etc) \lstinline!latexindent.pl! first of all makes a record +of the maximum number of \lstinline!&!; if each row does not have that +number of \lstinline!&! then it will not try to format that row. Details will be given in \lstinline!indent.log! assuming that \lstinline!trace! mode is active. - + If you have a \lstinline!verbatim!-like environment inside a \lstinline!tabular!-like -environment, the \lstinline!verbatim! environment \emph{will} be formatted, which -is probably not what you want. I hope to address this in future versions, but for the +environment, the \lstinline!verbatim! environment \emph{will} be formatted, which +is probably not what you want. I hope to address this in future versions, but for the moment wrap it in a \lstinline!noIndentBlock! (see \cpageref{lst:noIndentBlockdemo}). - -I hope that this script is useful to some-- if you find an example where the + +You can run \lstinline!latexindent! on \lstinline!.sty! and \lstinline!.cls! files, but it may +struggle with some of the pattern matching; if you find such a case in which it struggles, please feel free +to report it at \href{https://github.com/cmhughes/latexindent.pl}{https://github.com/cmhughes/latexindent.pl}, and +in the meantime, use a \lstinline!noIndentBlock! (see \cpageref{lst:noIndentBlockdemo}). + +I hope that this script is useful to some--if you find an example where the script does not behave as you think it should, feel free to e-mail me or else -come and find me on the \url{http://tex.stackexchange.com} site; I'm often around +come and find me on the \url{http://tex.stackexchange.com} site; I'm often around and in the chat room. - + \printbibliography[heading=bibintoc] - + \appendix \section{Required \lstinline!Perl! modules}\label{sec:requiredmodules} -If you intend to use \lstinline!latexindent.pl! and \emph{not} one of the supplied standalone executable files, then you will need a few standard Perl modules-- if you can run the -minimum code in \cref{lst:helloworld} (\lstinline!perl helloworld.pl!) then you will be able to run \lstinline!latexindent.pl!, otherwise you may +If you intend to use \lstinline!latexindent.pl! and \emph{not} one of the supplied standalone executable files, then you will need a few standard Perl modules--if you can run the +minimum code in \cref{lst:helloworld} (\lstinline!perl helloworld.pl!) then you will be able to run \lstinline!latexindent.pl!, otherwise you may need to install the missing modules. - -\begin{lstlisting}[language=Perl,caption={\lstinline!helloworld.pl!},label={lst:helloworld}] + +\begin{cmhlistings}[language=Perl]{\lstinline!helloworld.pl!}{lst:helloworld} #!/usr/bin/perl use strict; -use warnings; -use FindBin; -use YAML::Tiny; -use File::Copy; -use File::Basename; -use Getopt::Std; -use File::HomeDir; +use warnings; +use FindBin; +use YAML::Tiny; +use File::Copy; +use File::Basename; +use Getopt::Long; +use File::HomeDir; print "hello world"; exit; -\end{lstlisting} +\end{cmhlistings} My default installation on Ubuntu 12.04 did \emph{not} come with all of these modules as standard, but Strawberry Perl for Windows \cite{strawberryperl} did. - -Installing the modules given in \cref{lst:helloworld} will vary depending on your -operating system and \lstinline!Perl! distribution. For example, Ubuntu users -might visit the software center, and Strawberry Perl users on Windows might use + +Installing the modules given in \cref{lst:helloworld} will vary depending on your +operating system and \lstinline!Perl! distribution. For example, Ubuntu users +might visit the software center, or else run +\begin{lstlisting}[numbers=none] +sudo perl -MCPAN -e 'install "File::HomeDir"' +\end{lstlisting} +Strawberry Perl users on Windows might use \lstinline!CPAN client!. All of the modules are readily available on CPAN \cite{cpan}. - + \section{The \lstinline!arara! rule} The \lstinline!arara! rule (\lstinline!indent.yaml!) contains lines such as those -given in \cref{lst:arararule}. With this setup, the user \emph{always} has +given in \cref{lst:arararule}. With this setup, the user \emph{always} has to specify whether or not they want (in this example) to use the \lstinline!trace! identifier. -\begin{yaml}[caption={The \lstinline!arara! rule},label={lst:arararule},numbers=none] +\begin{cmhlistings}[style=yaml,numbers=none]{The \lstinline!arara! rule}{lst:arararule} ... arguments: - identifier: trace flag: <arara> @{ isTrue( parameters.trace, "-t" ) } ... -\end{yaml} - -If you would like to have the \lstinline!trace! option on by default every time you +\end{cmhlistings} + +If you would like to have the \lstinline!trace! option on by default every time you call \lstinline!latexindent.pl! from \lstinline!arara! (without having to write \lstinline!% arara: indent: {trace: yes}!), then simply amend \cref{lst:arararule} so that it looks like \cref{lst:arararulemod}. -\begin{yaml}[caption={The \lstinline!arara! rule (modified)},label={lst:arararulemod},numbers=none] +\begin{cmhlistings}[style=yaml,numbers=none]{The \lstinline!arara! rule (modified)}{lst:arararulemod} ... arguments: - identifier: trace flag: <arara> @{ isTrue( parameters.trace, "-t" ) } default: "-t" ... -\end{yaml} - -With this modification in place, you now simply to write \lstinline!% arara: indent! and +\end{cmhlistings} + +With this modification in place, you now simply to write \lstinline!% arara: indent! and \lstinline!trace! mode will be activated by default. If you wish to turn off \lstinline!trace! mode then you can write \lstinline!% arara: indent: {trace: off}!. - -Of course, you can apply these types of modifications to \emph{any} of the identifiers, + +Of course, you can apply these types of modifications to \emph{any} of the identifiers, but proceed with caution if you intend to do this for \lstinline!overwrite!. - + +\end{document} + +set local settings to include psset as an item +\documentclass[pstricks,border=30pt,12pt]{standalone} +\usepackage{pst-eucl} +\psset{opacity=.2} +\begin{document} +\begin{pspicture}(7,7) + \pstGeonode[PosAngle={-90,-90,0,-90,180}]{A}(5,0){B}(7,1){C}(2,1){D}(0,5){A_1} + \pstTranslation[PosAngle=120]{A}{A_1}{B,C,D}[B_1,C_1,D_1] + \pspolygon(A)(B)(C)(C_1)(D_1)(A_1) + \psline(A_1)(B_1)(C_1)(B)(B_1) + \pstMiddleAB[PosAngle=20]{B}{C_1}{E} + \psline(E)(C) + \pstMarkAngle{D}{E}{C}{} + \psset{linestyle=dashed} + \psline(C)(D)(D_1) + \psline(A)(D) + \psline(B)(D)(C_1) + \psline(D)(E) + \psset{linestyle=none,fillstyle=solid,fillcolor=gray} + \pspolygon(A)(D)(D_1)(A_1) + \pspolygon(B)(C_1)(D) +\end{pspicture} \end{document} +\begin{frame}[label=timeline]{The journey\ldots} + \begin{tikzpicture} + \pause + \node[cloudy](spring2010){Spr... + \node[below=0mm of spring2010... + \pause + \node[cloudy,right=of spring20... + \node[below=0mm of summer2010... + \pause + \node[cloudy,right=of summer2... + \node[below=0mm of fall2010... + \end{tikzpicture} +\end{frame} diff --git a/Master/texmf-dist/doc/support/latexindent/success/alignmentoutsideEnvironments.tex b/Master/texmf-dist/doc/support/latexindent/success/alignmentoutsideEnvironments.tex new file mode 100644 index 00000000000..0edbbbd28e1 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/success/alignmentoutsideEnvironments.tex @@ -0,0 +1,29 @@ +% arara: indent: {overwrite: true, trace: yes, silent: yes} + +\matrix{% + % \begin{tabular} + & A_1 & A_2 & A_3 & A_4 & A_5 & A_6 & A_7 & A_8 & A_9 \\\hline + A_1 & 0 & & & & & & & & \\ + A_2 & & 0 & & & & & & & \\ + A_3 & & & 0 & & & & & & \\ + A_4 & & & & 0 & & & & & \\ + A_5 & & & & & 0 & & & & \\ + A_6 & & & & & & 0 & & & \\ + A_7 & & & & & & & 0 & & \\ + A_8 & & & & & & & & 0 & \\ + A_9 & & & & & & & & & 0 \\ + %* \end{align} +} +\begin{tabular} + & A_1 & A_2 & A_3 & A_4 & A_5 & A_6 & A_7 & A_8 & A_9 \\\hline + & + A_1 & 0 & & & & & & & & \\ + A_2 & & 0 & & & & & & & \\ + A_3 & & & 0 & & & & & & \\ + A_4 & & & & 0 & & & & & \\ + A_5 & & & & & 0 & & & & \\ + A_6 & & & & & & 0 & & & \\ + A_7 & & & & & & & 0 & & \\ + A_8 & & & & & & & & 0 & \\ + A_9 & & & & & & & & & 0 \\ +\end{tabular} diff --git a/Master/texmf-dist/doc/support/latexindent/success/bigTest.tex b/Master/texmf-dist/doc/support/latexindent/success/bigTest.tex index 0e47c4a2cf2..e38913da9b3 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/bigTest.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/bigTest.tex @@ -1,4 +1,4 @@ -% arara: indent: {trace: true} +% arara: indent: {trace: true, overwrite: yes} \documentclass[10pt,twoside]{report} \begin{document} @@ -27,7 +27,7 @@ % change the page geometry using \newgeometry %\cleardoublepage \clearpage -%\setbool{@twoside}{false} +%\setbool{@twoside}{false} \fancyheadoffset[RE,RO]{2cm} \fancyheadoffset[LE,LO]{1cm} \renewcommand{\rightmark}{Solutions to Section \thesection} @@ -46,7 +46,7 @@ \Closesolutionfile{crossrefsWEB} % when itemized lists are used in the solutions, they -% are actually at 2nd depth because the solution environment +% are actually at 2nd depth because the solution environment % uses an \itemize environment to get the indendation correct \setlist[itemize,2]{label=\textbullet} @@ -93,7 +93,7 @@ {% % set a boolean that says the problem number is odd (used later) \setbool{oddproblemnumber}{true}% - % display or not + % display or not \ifbool{showoddsolns}% {% % if we want to show the odd problems @@ -107,7 +107,7 @@ }% {% % otherwise don't show them! - \expandafter\comment% + \expandafter\comment% }% }% {% @@ -126,7 +126,7 @@ }% {% % otherwise don't show them! - \expandafter\comment% + \expandafter\comment% }% }% }% @@ -134,7 +134,7 @@ % after the environment finishes \ifbool{oddproblemnumber}% {% - % odd numbered problems + % odd numbered problems \ifbool{showoddsolns}% {% % if we want to show the odd problems @@ -202,7 +202,7 @@ {% % set a boolean that says the problem number is odd (used later) \setbool{oddproblemnumber}{true}% - % display or not + % display or not \ifbool{showoddsolns}% {% % if we want to show the odd problems @@ -210,7 +210,7 @@ }% {% % otherwise don't show them! - \expandafter\comment% + \expandafter\comment% }% }% {% @@ -223,7 +223,7 @@ }% {% % otherwise don't show them! - \expandafter\comment% + \expandafter\comment% }% }% }% @@ -231,7 +231,7 @@ % after the environment finishes \ifbool{oddproblemnumber}% {% - % odd numbered problems + % odd numbered problems \ifbool{showoddsolns}% {% % if we want to show the odd problems diff --git a/Master/texmf-dist/doc/support/latexindent/success/braceTest.tex b/Master/texmf-dist/doc/support/latexindent/success/braceTest.tex index 2fd9e34a10f..ac6b72d6be4 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/braceTest.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/braceTest.tex @@ -1,12 +1,12 @@ -% arara: indent: { overwrite: false, output: outputfile.tex } +% arara: indent: { overwrite: on} \hypersetup{% -pdfstartview={% -FitH \hypercalcbp{\paperheight-\topmargin-0in --\headheight-\headsep -} -}% -%--------------------------------------------------------------------------- + pdfstartview={% + FitH \hypercalcbp{\paperheight-\topmargin-0in + -\headheight-\headsep + } + }% + %--------------------------------------------------------------------------- } some other text @@ -14,10 +14,10 @@ some other text some other text \hypersetup{% -pdfstartview={% -FitH \hypercalcbp{\paperheight-\topmargin-0in --\headheight-\headsep -} + pdfstartview={% + FitH \hypercalcbp{\paperheight-\topmargin-0in + -\headheight-\headsep + } }} some other text @@ -25,9 +25,9 @@ some other text some other text \hypersetup{% -pdfstartview={% -FitH \hypercalcbp{\paperheight-\topmargin-0in --\headheight-\headsep + pdfstartview={% + FitH \hypercalcbp{\paperheight-\topmargin-0in + -\headheight-\headsep }}} some other text @@ -36,10 +36,10 @@ some other text \hypersetup{% -pdfstartview={% -FitH \hypercalcbp{\paperheight-\topmargin-0in --\headheight-\headsep -}} + pdfstartview={% + FitH \hypercalcbp{\paperheight-\topmargin-0in + -\headheight-\headsep + }} } some other text @@ -47,9 +47,9 @@ some other text some other text \parbox{ -\begin{something} + \begin{something} -\end{something} + \end{something} } some other text diff --git a/Master/texmf-dist/doc/support/latexindent/success/braceTestsmall.tex b/Master/texmf-dist/doc/support/latexindent/success/braceTestsmall.tex index 48ddbf68ae6..38b7f495db6 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/braceTestsmall.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/braceTestsmall.tex @@ -1,10 +1,10 @@ -% arara: indent: {trace: on} +% arara: indent: {trace: on, overwrite: on} \hypersetup{% -pdfstartview={% -FitH \hypercalcbp{\paperheight-\topmargin-0in --\headheight-\headsep }% -}% -%--------------------------------------------------------------------------- + pdfstartview={% + FitH \hypercalcbp{\paperheight-\topmargin-0in + -\headheight-\headsep }% + }% + %--------------------------------------------------------------------------- } some other text @@ -12,9 +12,9 @@ some other text some other text \hypersetup{% -pdfstartview={% -FitH \hypercalcbp{\paperheight-\topmargin-0in --\headheight-\headsep }}% + pdfstartview={% + FitH \hypercalcbp{\paperheight-\topmargin-0in + -\headheight-\headsep }}% } some other text @@ -22,9 +22,9 @@ some other text some other text \hypersetup{% -pdfstartview={\someothercommand{here}% -FitH \hypercalcbp{\paperheight-\topmargin-0in --\headheight-\headsep }}} + pdfstartview={\someothercommand{here}% + FitH \hypercalcbp{\paperheight-\topmargin-0in + -\headheight-\headsep }}} some other text some other text diff --git a/Master/texmf-dist/doc/support/latexindent/success/conditional.tex b/Master/texmf-dist/doc/support/latexindent/success/conditional.tex new file mode 100644 index 00000000000..9a857e0af64 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/success/conditional.tex @@ -0,0 +1,12 @@ +% arara: indent: {overwrite: yes} +% add these lines to a localSettings.yaml file +%constructIfElseFi: +% if@isu@draftcls@: 1 +\newif\if@isu@draftcls@ +\if@isu@draftcls@ + \RequirePackage[firstpage]{draftwatermark} + \RequirePackage{datetime} + \newcommand{\isu@draftfooter}{DRAFT --- rendered \today\ at \currenttime} +\else + \newcommand{\isu@draftfooter}{} +\fi diff --git a/Master/texmf-dist/doc/support/latexindent/success/environments.tex b/Master/texmf-dist/doc/support/latexindent/success/environments.tex index b33d9982896..bf1d4d86c80 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/environments.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/environments.tex @@ -1,27 +1,28 @@ % arara: indent: { cruft: /home/cmhughes/Desktop/tmp/, overwrite: on, trace: yes, silent: yes, onlyDefault: no} -some -other +some +other text \begin{enumerate} \item $3x^3y(-4x^3+y) = -12x^6y+3x^3y^2$ \item $3x^3+y(-4x^3+y) = 3x^3-4x^3y+y^2$ - \item \begin{align*} - {\color{red}(3x^3+y)}(-4x^3+y) & = {\color{red}(3x^3+y)}(-4x^3)+{\color{red}(3x^3+y)}(y) \\ - & = -12x^6-4x^3y+3x^3y+y^2 \\ - & = -12x^6-x^3y+y^2 - \end{align*} + \item + \begin{align*} + {\color{red}(3x^3+y)}(-4x^3+y) & = {\color{red}(3x^3+y)}(-4x^3)+{\color{red}(3x^3+y)}(y) \\ + & = -12x^6-4x^3y+3x^3y+y^2 \\ + & = -12x^6-x^3y+y^2 + \end{align*} \end{enumerate} \begin{enumerate} \item $3x^3y(-4x^3+y) = -12x^6y+3x^3y^2$ \item $3x^3+y(-4x^3+y) = 3x^3-4x^3y+y^2$ - \item - \begin{align*} - {\color{red}(3x^3+y)}(-4x^3+y) & = {\color{red}(3x^3+y)}(-4x^3)+{\color{red}(3x^3+y)}(y) \\ - & = -12x^6-4x^3y+3x^3y+y^2 \\ - & = -12x^6-x^3y+y^2 - \end{align*} + \item + \begin{align*} + {\color{red}(3x^3+y)}(-4x^3+y) & = {\color{red}(3x^3+y)}(-4x^3)+{\color{red}(3x^3+y)}(y) \\ + & = -12x^6-4x^3y+3x^3y+y^2 \\ + & = -12x^6-x^3y+y^2 + \end{align*} \end{enumerate} - + \begin{something} \begin{else} again @@ -32,7 +33,7 @@ environments here \[ x^2+ 3x\] other text -\[ +\[ x^2+ 3x \] other text diff --git a/Master/texmf-dist/doc/support/latexindent/success/filecontents.tex b/Master/texmf-dist/doc/support/latexindent/success/filecontents.tex index d6132684232..ccc35c32684 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/filecontents.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/filecontents.tex @@ -27,27 +27,27 @@ here we are in a block % \end{noindent} some more \begin{tabular}{cccc} - 1 & 2 & 3 & 4 \\ - 5 & & 6 & \\ + 1 & 2 & 3 & 4 \\ + 5 & & 6 & \\ \end{tabular} another test \begin{tabular}{cccc} - 1 & 2 & 3 & 4 \\ - 5 & & 6 & \\ + 1 & 2 & 3 & 4 \\ + 5 & & 6 & \\ \end{tabular} \begin{something} \parbox{something - else - goes - here + else + goes + here } some text some text some text some text some text some text \[ - x^2+2x + x^2+2x \] some text some text some text some text @@ -57,11 +57,11 @@ another test \end{something} \begin{filecontents}{mybib.bib} @online{strawberryperl, - title="Strawberry Perl", - url="http://strawberryperl.com/"} + title="Strawberry Perl", + url="http://strawberryperl.com/"} @online{cmhblog, - title="A Perl script for indenting tex files", - url="http://tex.blogoverflow.com/2012/08/a-perl-script-for-indenting-tex-files/"} + title="A Perl script for indenting tex files", + url="http://tex.blogoverflow.com/2012/08/a-perl-script-for-indenting-tex-files/"} \end{filecontents} \begin{myotherenvironment} diff --git a/Master/texmf-dist/doc/support/latexindent/success/ifelsefi.tex b/Master/texmf-dist/doc/support/latexindent/success/ifelsefi.tex new file mode 100644 index 00000000000..389985acaed --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/success/ifelsefi.tex @@ -0,0 +1,103 @@ +% !arara: pdflatex +% arara: indent: {overwrite: yes, trace: yes, localSettings: yes} +\documentclass{report} +\usepackage{etoolbox} +\usepackage{pgfplots} +\usepackage{lipsum} + +\makeatletter +\newcommand{\totalchapters}[1]{% + \@ifundefined{c@totalchapters} + {% + \newcounter{totalchapters} + \setcounter{totalchapters}{#1} + \typeout{Defining a new counter: totalchapters (#1)} + }% + {% + \ifodd\value{totalchapters}=#1 + \typeout{Total Chapters match auxilary file (#1)} + \else + \typeout{Warning: total Chapter count updated from \the\value{totalchapters} to #1-- recompile to fix} + \fi + \setcounter{totalchapters}{#1} + }% +} +\newcommand{\definetotalpagecount}[2]{% + \@ifundefined{c@totalpages\@roman{#1}}% + {% + \newcounter{totalpages\@roman{#1}} + \setcounter{totalpages\@roman{#1}}{#2} + \typeout{Defining a new counter: totalpages\@roman{#1}} + }% + {% + \ifnum\value{totalpages\@roman{#1}}=#2 + \typeout{Total pages for Chapter #1 match auxilary file (#2)} + \else + \typeout{Warning: total pages for Chapter #1 updated from \the\value{totalpages\@roman{#1}} to #2-- recompile to fix} + \fi + \setcounter{totalpages\@roman{#1}}{#2} + }% +} + + +\preto\chapter{% + \ifnum\value{chapter}>0 + \immediate\write\@auxout{% + \string\definetotalpagecount\string{\thechapter\string}\string{\the\value{page}\string} + } + \fi +} + +\AtEndDocument{% + \immediate\write\@auxout{% + \string\definetotalpagecount\string{\thechapter\string}\string{\the\value{page}\string} + \string\totalchapters\string{\thechapter\string}% + } +} + +\newcommand{\drawPageChart}{% + \begin{tikzpicture} + \begin{axis}[ + xbar stacked, + xmin=-0.1, + %ymin=0,ymax=1, + bar width=40pt, + nodes near coords, + axis lines=none, + nodes near coords align={horizontal}, + visualization depends on=x \as \myxcoord, + nodes near coords={\pgfmathprintnumber\myxcoord}, + every node near coord/.append style={ + anchor=east}, + ] + \@ifundefined{c@totalchapters} + {} + {% + \foreach \i in {1,...,\thetotalchapters}{% + \addplot coordinates {(\the\value{totalpages\@roman{\i}},0)}; + } + } + \end{axis} + \end{tikzpicture} +} +\begin{document} + +\begin{figure}[!htb] + \centering + \drawPageChart + \caption{Blueprint of my thesis} +\end{figure} + + +\chapter{} + \lipsum +\chapter{} + \lipsum + \lipsum +\chapter{} + \lipsum + \lipsum + \lipsum + \lipsum + \lipsum +\end{document} diff --git a/Master/texmf-dist/doc/support/latexindent/success/ifelsefiONE.tex b/Master/texmf-dist/doc/support/latexindent/success/ifelsefiONE.tex new file mode 100644 index 00000000000..0d3c4f39322 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/success/ifelsefiONE.tex @@ -0,0 +1,43 @@ +% arara: indent: {overwrite: yes, trace: yes} +\documentclass[tikz]{standalone} +\usepackage{tikz} +\usetikzlibrary{decorations.pathmorphing,decorations.shapes} + +\begin{document} + +\foreach \radius in {1,2,...,20} +{ + \begin{tikzpicture} + % background rectangle + \filldraw[black] (-3,-3) rectangle (5,3); + % skyline + \filldraw[black!80!blue](-3,-3)--(-3,-2)--(-2.5,-2)--(-2.5,-1)--(-2.25,-1)--(-2.25,-2)--(-2,-2) + --(-2,-1)--(-1.75,-0.75)--(-1.5,-1) + --(-1.5,-2)--(-1.1,-2)--(-1.1,0)--(-0.5,0)--(-0.5,-2) + --(0,-2)--(0,-1.5)--(1,-1.5)--(1.25,-0.5)--(1.5,-1.5)--(1.5,-2) + --(2,-2)--(2,0)--(2.5,0)--(2.5,-2) + --(3,-2)--(3,-1)--(4,-1)--(4,-2)--(5,-2)--(5,-3)--cycle; + % moon- what a hack! + \filldraw[white] (4,2.5) arc (90:-90:20pt); + \filldraw[black] (3.8,2.5) arc (90:-90:20pt); + % fireworks + \pgfmathparse{100-(\radius-1)*10}; + % red firework + \ifnum\radius<11 + \draw[decorate,decoration={crosses},red!\pgfmathresult!black] (0,0) circle (\radius ex); + \fi + % orange firework + \pgfmathparse{100-(\radius-6)*10}; + \ifnum\radius>5 + \ifnum\radius<16 + \draw[decorate,decoration={crosses},orange!\pgfmathresult!black] (1,1) circle ( \radius ex-5ex); + \fi + \fi + % yellow firework + \pgfmathparse{100-(\radius-11)*10}; + \ifnum\radius>10 + \draw[decorate,decoration={crosses},yellow!\pgfmathresult!black] (2.5,1) circle (\radius ex-10ex); + \fi + \end{tikzpicture} +} +\end{document} diff --git a/Master/texmf-dist/doc/support/latexindent/success/matrix.tex b/Master/texmf-dist/doc/support/latexindent/success/matrix.tex index 3d60ebc3905..729a922b8d7 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/matrix.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/matrix.tex @@ -1,6 +1,6 @@ % arara: indent: {overwrite: true, trace: true} -\[ - \begin{matrix}[cc|cccccc|c] +\[ + \begin{matrix}[cc|cccccc|c] & & & & & & {\color{blue}\downarrow} & {\color{blue}\downarrow} & S \\\hline & 6 & {\color{red}\newmoon} & & & & & & {\color{red}\leftarrow} \\ {\color{blue}*} & 5 & & & & & & {\color{blue}\newmoon} & \\ @@ -9,6 +9,6 @@ & 2 & & & \fullmoon & & & & \\ {\color{blue}*} & 1 & & & & & {\color{blue}\newmoon} & & \\\hline & & 1 & 2 & 3 & 4 & 5 & 6 & \\ - \% & & {\color{red}*} & {\color{red}*} & & {\color{red}*} & & & + \% & & {\color{red}*} & {\color{red}*} & & {\color{red}*} & & & \end{matrix} \] diff --git a/Master/texmf-dist/doc/support/latexindent/success/multipleBraces.tex b/Master/texmf-dist/doc/support/latexindent/success/multipleBraces.tex new file mode 100644 index 00000000000..63a2967dab3 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/success/multipleBraces.tex @@ -0,0 +1,15 @@ +% arara: indent: {overwrite: yes, trace: on} +\xapptocmd{\tableofcontents}{% + \end{singlespace}% + \pagestyle{plain}% + \clearpage}{}{} + +\xapptocmd{\tableofcontents}{% + \end{singlespace}% + \pagestyle{plain}% + \clearpage}{}{} + +\xapptocmd{\tableofcontents}{% + \end{singlespace}% + \pagestyle{plain}% + \clearpage}{}{} diff --git a/Master/texmf-dist/doc/support/latexindent/success/nestedalignment.tex b/Master/texmf-dist/doc/support/latexindent/success/nestedalignment.tex index 2f6afd65169..4bf214f2e4f 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/nestedalignment.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/nestedalignment.tex @@ -5,18 +5,18 @@ \left\{ \begin{array}{rl} x+y & =6 \\ - 2x+y & =8 + 2x+y & =8 \end{array} \right. \) - & Substitution {\em or }Addition & Because it is easy to solve for $x$ in the 1st equation + & Substitution {\em or }Addition & Because it is easy to solve for $x$ in the 1st equation {\em or} Because it is easy to multiply the first equation by -1 \\ \hline \( \left\{ \begin{array}{rl} 3x-7y & =13 \\ - 6x+5y & =7 + 6x+5y & =7 \end{array} \right. \) @@ -25,9 +25,9 @@ \left\{ \begin{array}{rl} x-7y & =13 \\ - 6x+5y & =7 + 6x+5y & =7 \end{array} \right. \) - & Substitution & Because the first equation can easily be solved for one of the variables + & Substitution & Because the first equation can easily be solved for one of the variables \end{tabular} diff --git a/Master/texmf-dist/doc/support/latexindent/success/nestedalignment1.tex b/Master/texmf-dist/doc/support/latexindent/success/nestedalignment1.tex index 54a012f8e2b..0e6aa609a03 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/nestedalignment1.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/nestedalignment1.tex @@ -1,11 +1,11 @@ % arara: indent: { overwrite: on, silent: no, trace: yes} \begin{tabular}{p{3cm}|c|p{8cm}} x+y & = & 6 \\ - 2x+y & \&\%=8 % \% & - \%\&\%\% & & \\ % & & 2x+y & =8 + 2x+y & \&\%=8 % \% & + \%\&\%\% & & \\ % & & 2x+y & =8 x+y & = & 6 \\ - 2x+y & =8 - 2x+y \&\& & = & 8 % trailine comment + 2x+y & =8 + 2x+y \&\& & = & 8 % trailine comment \end{tabular} here's another line $\{ x^2 + 5x \}$ diff --git a/Master/texmf-dist/doc/support/latexindent/success/outputfile.tex b/Master/texmf-dist/doc/support/latexindent/success/outputfile.tex index 71278475a00..4d5506777d4 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/outputfile.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/outputfile.tex @@ -1,4 +1,4 @@ -% arara: indent: { overwrite: false, output: outputfile.tex } +% arara: indent: { overwrite: yes} \hypersetup{% pdfstartview={% @@ -48,7 +48,7 @@ some other text \parbox{ \begin{something} - + \end{something} } diff --git a/Master/texmf-dist/doc/support/latexindent/success/preamble.tex b/Master/texmf-dist/doc/support/latexindent/success/preamble.tex index 666277aa88f..749e9819c20 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/preamble.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/preamble.tex @@ -1,4 +1,4 @@ -% arara: indent: {trace: on} +% arara: indent: {trace: on, overwrite: yes} \documentclass[10pt,twoside]{report} \newenvironment{widepage}{\begin{adjustwidth}{-\offsetpage}{}% \addtolength{\textwidth}{\offsetpage}}% diff --git a/Master/texmf-dist/doc/support/latexindent/success/pstricks1.tex b/Master/texmf-dist/doc/support/latexindent/success/pstricks1.tex index 2dfed9849f1..ff55548b6c7 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/pstricks1.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/pstricks1.tex @@ -3,7 +3,7 @@ \usepackage{pstricks,multido} \def\Bottle#1{{\pscustom[linewidth=2pt]{% - \rotate{#1} + \rotate{#1} \psline(-1,3.5)(-1,4)(1,4)(1,3.5) \pscurve(3,2)(1,0)\psline(-1,0) \pscurve(-3,2)(-1,3.5)}}} @@ -20,6 +20,7 @@ \multido{\iA=-45+5}{19}{% \begin{pspicture}(-2.5,-0.5)(6,5.5) \BottleWithWater(1.5,1){\iA} - \end{pspicture}} + \end{pspicture} +} \end{document} diff --git a/Master/texmf-dist/doc/support/latexindent/success/sampleAFTER.tex b/Master/texmf-dist/doc/support/latexindent/success/sampleAFTER.tex index cc7a2b6c4d7..c9b38625713 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/sampleAFTER.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/sampleAFTER.tex @@ -1,7 +1,8 @@ -% A sample chapter file- it contains a lot of +% arara: indent: {overwrite: yes} +% A sample chapter file- it contains a lot of % environments, including tabulars, align, etc -% -% Don't try and compile this file using pdflatex etc, just +% +% Don't try and compile this file using pdflatex etc, just % compare the *format* of it to the format of the % sampleAFTER.tex % @@ -9,5810 +10,5810 @@ % environments before and after running the script \section{Polynomial functions} -\reformatstepslist{P} % the steps list should be P1, P2, \ldots -In your previous mathematics classes you have studied \emph{linear} and -\emph{quadratic} functions. The most general forms of these types of -functions can be represented (respectively) by the functions $f$ -and $g$ that have formulas -\begin{equation}\label{poly:eq:linquad} - f(x)=mx+b, \qquad g(x)=ax^2+bx+c -\end{equation} -We know that $m$ is the slope of $f$, and that $a$ is the \emph{leading coefficient} -of $g$. We also know that the \emph{signs} of $m$ and $a$ completely -determine the behavior of the functions $f$ and $g$. For example, if $m>0$ -then $f$ is an \emph{increasing} function, and if $m<0$ then $f$ is -a \emph{decreasing} function. Similarly, if $a>0$ then $g$ is -\emph{concave up} and if $a<0$ then $g$ is \emph{concave down}. Graphical -representations of these statements are given in \cref{poly:fig:linquad}. - -\begin{figure}[!htb] - \setlength{\figurewidth}{.2\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-10:8]{(x+2)}; - \end{axis} - \end{tikzpicture} - \caption{$m>0$} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-10:8]{-(x+2)}; - \end{axis} - \end{tikzpicture} - \caption{$m<0$} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-4:4]{(x^2-6)}; - \end{axis} - \end{tikzpicture} - \caption{$a>0$} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-4:4]{-(x^2-6)}; - \end{axis} - \end{tikzpicture} - \caption{$a<0$} - \end{subfigure} - \caption{Typical graphs of linear and quadratic functions.} - \label{poly:fig:linquad} -\end{figure} - -Let's look a little more closely at the formulas for $f$ and $g$ in -\cref{poly:eq:linquad}. Note that the \emph{degree} -of $f$ is $1$ since the highest power of $x$ that is present in the -formula for $f(x)$ is $1$. Similarly, the degree of $g$ is $2$ since -the highest power of $x$ that is present in the formula for $g(x)$ -is $2$. - -In this section we will build upon our knowledge of these elementary -functions. In particular, we will generalize the functions $f$ and $g$ to a function $p$ that has -any degree that we wish. - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{essentialskills} - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{problem}[Quadratic functions] - Every quadratic function has the form $y=ax^2+bx+c$; state the value - of $a$ for each of the following functions, and hence decide if the - parabola that represents the function opens upward or downward. - \begin{multicols}{2} - \begin{subproblem} - $F(x)=x^2+3$ - \begin{shortsolution} - $a=1$; the parabola opens upward. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $G(t)=4-5t^2$ - \begin{shortsolution} - $a=-5$; the parabola opens downward. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $H(y)=4y^2-96y+8$ - \begin{shortsolution} - $a=4$; the parabola opens upward. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $K(z)=-19z^2$ - \begin{shortsolution} - $m=-19$; the parabola opens downward. - \end{shortsolution} - \end{subproblem} - \end{multicols} - Now let's generalize our findings for the most general quadratic function $g$ - that has formula $g(x)=a_2x^2+a_1x+a_0$. Complete the following sentences. - \begin{subproblem} - When $a_2>0$, the parabola that represents $y=g(x)$ opens $\ldots$ - \begin{shortsolution} - When $a_2>0$, the parabola that represents the function opens upward. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - When $a_2<0$, the parabola that represents $y=g(x)$ opens $\ldots$ - \begin{shortsolution} - When $a_2<0$, the parabola that represents the function opens downward. - \end{shortsolution} - \end{subproblem} - \end{problem} -\end{essentialskills} - -\subsection*{Power functions with positive exponents} -The study of polynomials will rely upon a good knowledge -of power functions| you may reasonably ask, what is a power function? -\begin{pccdefinition}[Power functions] -Power functions have the form -\[ - f(x) = a_n x^n -\] -where $n$ can be any real number. - -Note that for this section we will only be concerned with the -case when $n$ is a positive integer. -\end{pccdefinition} - -You may find assurance in the fact that you are already very comfortable -with power functions that have $n=1$ (linear) and $n=2$ (quadratic). Let's -explore some power functions that you might not be so familiar with. -As you read \cref{poly:ex:oddpow,poly:ex:evenpow}, try and spot -as many patterns and similarities as you can. - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{pccexample}[Power functions with odd positive exponents] -\label{poly:ex:oddpow} -Graph each of the following functions, state their domain, and their -long-run behavior as $x\rightarrow\pm\infty$ -\[ - f(x)=x^3, \qquad g(x)=x^5, \qquad h(x)=x^7 -\] -\begin{pccsolution} -The functions $f$, $g$, and $h$ are plotted in \cref{poly:fig:oddpow}. -The domain of each of the functions $f$, $g$, and $h$ is $(-\infty,\infty)$. Note that -the long-run behavior of each of the functions is the same, and in particular -\begin{align*} - f(x)\rightarrow\infty & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} f(x)\rightarrow-\infty & \text{ as } x\rightarrow-\infty -\end{align*} -The same results hold for $g$ and $h$. -\end{pccsolution} -\end{pccexample} - -\begin{figure}[!htb] - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-1.5,xmax=1.5, - ymin=-5,ymax=5, - xtick={-1.0,-0.5,...,1.0}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\textwidth, - legend pos=north west, - ] - \addplot expression[domain=-1.5:1.5]{x^3}; - \addplot expression[domain=-1.379:1.379]{x^5}; - \addplot expression[domain=-1.258:1.258]{x^7}; - \addplot[soldot]coordinates{(-1,-1)} node[axisnode,anchor=north west]{$(-1,-1)$}; - \addplot[soldot]coordinates{(1,1)} node[axisnode,anchor=south east]{$(1,1)$}; - \legend{$f$,$g$,$h$} - \end{axis} - \end{tikzpicture} - \caption{Odd power functions} - \label{poly:fig:oddpow} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-2.5,xmax=2.5, - ymin=-5,ymax=5, - xtick={-2.0,-1.5,...,2.0}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\textwidth, - legend pos=south east, - ] - \addplot expression[domain=-2.236:2.236]{x^2}; - \addplot expression[domain=-1.495:1.495]{x^4}; - \addplot expression[domain=-1.307:1.307]{x^6}; - \addplot[soldot]coordinates{(-1,1)} node[axisnode,anchor=east]{$(-1,1)$}; - \addplot[soldot]coordinates{(1,1)} node[axisnode,anchor=west]{$(1,1)$}; - \legend{$F$,$G$,$H$} - \end{axis} - \end{tikzpicture} - \caption{Even power functions} - \label{poly:fig:evenpow} - \end{minipage}% -\end{figure} - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{pccexample}[Power functions with even positive exponents]\label{poly:ex:evenpow}% -Graph each of the following functions, state their domain, and their -long-run behavior as $x\rightarrow\pm\infty$ -\[ - F(x)=x^2, \qquad G(x)=x^4, \qquad H(x)=x^6 -\] -\begin{pccsolution} -The functions $F$, $G$, and $H$ are plotted in \cref{poly:fig:evenpow}. The domain -of each of the functions is $(-\infty,\infty)$. Note that the long-run behavior -of each of the functions is the same, and in particular -\begin{align*} - F(x)\rightarrow\infty & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} F(x)\rightarrow\infty & \text{ as } x\rightarrow-\infty -\end{align*} -The same result holds for $G$ and $H$. -\end{pccsolution} -\end{pccexample} - -\begin{doyouunderstand} - \begin{problem} - Repeat \cref{poly:ex:oddpow,poly:ex:evenpow} using (respectively) - \begin{subproblem} - $f(x)=-x^3, \qquad g(x)=-x^5, \qquad h(x)=-x^7$ - \begin{shortsolution} - The functions $f$, $g$, and $h$ have domain $(-\infty,\infty)$ and - are graphed below. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-1.5,xmax=1.5, - ymin=-5,ymax=5, - xtick={-1.0,-0.5,...,0.5}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\solutionfigurewidth, - legend pos=north east, - ] - \addplot expression[domain=-1.5:1.5]{-x^3}; - \addplot expression[domain=-1.379:1.379]{-x^5}; - \addplot expression[domain=-1.258:1.258]{-x^7}; - \legend{$f$,$g$,$h$} - \end{axis} - \end{tikzpicture} - - Note that - \begin{align*} - f(x)\rightarrow-\infty & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} f(x)\rightarrow\infty & \text{ as } x\rightarrow-\infty - \end{align*} - The same is true for $g$ and $h$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $F(x)=-x^2, \qquad G(x)=-x^4, \qquad H(x)=-x^6$ - \begin{shortsolution} - The functions $F$, $G$, and $H$ have domain $(-\infty,\infty)$ and - are graphed below. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-2.5,xmax=2.5, - ymin=-5,ymax=5, - xtick={-1.0,-0.5,...,0.5}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\solutionfigurewidth, - legend pos=north east, - ] - \addplot expression[domain=-2.236:2.236]{-x^2}; - \addplot expression[domain=-1.495:1.495]{-x^4}; - \addplot expression[domain=-1.307:1.307]{-x^6}; - \legend{$F$,$G$,$H$} - \end{axis} - \end{tikzpicture} - - Note that - \begin{align*} - F(x)\rightarrow-\infty & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} F(x)\rightarrow-\infty & \text{ as } x\rightarrow-\infty - \end{align*} - The same is true for $G$ and $H$. - \end{shortsolution} - \end{subproblem} - \end{problem} -\end{doyouunderstand} - -\subsection*{Polynomial functions} -Now that we have a little more familiarity with power functions, -we can define polynomial functions. Provided that you were comfortable -with our opening discussion about linear and quadratic functions (see -$f$ and $g$ in \cref{poly:eq:linquad}) then there is every chance -that you'll be able to master polynomial functions as well; just remember -that polynomial functions are a natural generalization of linear -and quadratic functions. Once you've studied the examples and problems -in this section, you'll hopefully agree that polynomial functions -are remarkably predictable. - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccdefinition}[Polynomial functions] -Polynomial functions have the form -\[ - p(x)=a_nx^n+a_{n-1}x^{n-1}+\ldots+a_1x+a_0 -\] -where $a_n$, $a_{n-1}$, $a_{n-2}$, \ldots, $a_0$ are real numbers. -\begin{itemize} - \item We call $n$ the degree of the polynomial, and require that $n$ - is a non-negative integer; - \item $a_n$, $a_{n-1}$, $a_{n-2}$, \ldots, $a_0$ are called the coefficients; - \item We typically write polynomial functions in descending powers of $x$. -\end{itemize} -In particular, we call $a_n$ the \emph{leading} coefficient, and $a_nx^n$ the -\emph{leading term}. - -Note that if a polynomial is given in factored form, then the degree can be found -by counting the number of linear factors. -\end{pccdefinition} - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{pccexample}[Polynomial or not] -Identify the following functions as polynomial or not; if the function -is a polynomial, state its degree. -\begin{multicols}{3} - \begin{enumerate} - \item $p(x)=x^2-3$ - \item $q(x)=-4x^{\nicefrac{1}{2}}+10$ - \item $r(x)=10x^5$ - \item $s(x)=x^{-2}+x^{23}$ - \item $f(x)=-8$ - \item $g(x)=3^x$ - \item $h(x)=\sqrt[3]{x^7}-x^2+x$ - \item $k(x)=4x(x+2)(x-3)$ - \item $j(x)=x^2(x-4)(5-x)$ - \end{enumerate} -\end{multicols} -\begin{pccsolution} -\begin{enumerate} - \item $p$ is a polynomial, and its degree is $2$. - \item $q$ is \emph{not} a polynomial, because $\frac{1}{2}$ is not an integer. - \item $r$ is a polynomial, and its degree is $5$. - \item $s$ is \emph{not} a polynomial, because $-2$ is not a positive integer. - \item $f$ is a polynomial, and its degree is $0$. - \item $g$ is \emph{not} a polynomial, because the independent - variable, $x$, is in the exponent. - \item $h$ is \emph{not} a polynomial, because $\frac{7}{3}$ is not an integer. - \item $k$ is a polynomial, and its degree is $3$. - \item $j$ is a polynomial, and its degree is $4$. -\end{enumerate} -\end{pccsolution} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{pccexample}[Typical graphs]\label{poly:ex:typical} -\Cref{poly:fig:typical} shows graphs of some polynomial functions; -the ticks have deliberately been left off the axis to allow us to concentrate -on the features of each graph. Note in particular that: -\begin{itemize} - \item \cref{poly:fig:typical1} shows a degree-$1$ polynomial (you might also - classify the function as linear) whose leading coefficient, $a_1$, is positive. - \item \cref{poly:fig:typical2} shows a degree-$2$ polynomial (you might also - classify the function as quadratic) whose leading coefficient, $a_2$, is positive. - \item \cref{poly:fig:typical3} shows a degree-$3$ polynomial whose leading coefficient, $a_3$, - is positive| compare its overall - shape and long-run behavior to the functions described in \cref{poly:ex:oddpow}. - \item \cref{poly:fig:typical4} shows a degree-$4$ polynomial whose leading coefficient, $a_4$, - is positive|compare its overall shape and long-run behavior to the functions described in \cref{poly:ex:evenpow}. - \item \cref{poly:fig:typical5} shows a degree-$5$ polynomial whose leading coefficient, $a_5$, - is positive| compare its overall - shape and long-run behavior to the functions described in \cref{poly:ex:oddpow}. -\end{itemize} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{\textwidth/6} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-10:8]{(x+2)}; - \end{axis} - \end{tikzpicture} - \caption{$a_1>0$} - \label{poly:fig:typical1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-4:4]{(x^2-6)}; - \end{axis} - \end{tikzpicture} - \caption{$a_2>0$} - \label{poly:fig:typical2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-7.5:7.5]{0.05*(x+6)*x*(x-6)}; - \end{axis} - \end{tikzpicture} - \caption{$a_3>0$} - \label{poly:fig:typical3} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-2.35:5.35,samples=100]{0.2*(x-5)*x*(x-3)*(x+2)}; - \end{axis} - \end{tikzpicture} - \caption{$a_4>0$} - \label{poly:fig:typical4} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-5.5:6.3,samples=100]{0.01*(x+2)*x*(x-3)*(x+5)*(x-6)}; - \end{axis} - \end{tikzpicture} - \caption{$a_5>0$} - \label{poly:fig:typical5} - \end{subfigure} - \end{widepage} - \caption{Graphs to illustrate typical curves of polynomial functions.} - \label{poly:fig:typical} -\end{figure} - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{doyouunderstand} - \begin{problem} - Use \cref{poly:ex:typical} and \cref{poly:fig:typical} to help you sketch - the graphs of polynomial functions that have negative leading coefficients| note - that there are many ways to do this! The intention with this problem - is to use your knowledge of transformations- in particular, \emph{reflections}- - to guide you. - \begin{shortsolution} - $a_1<0$: - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-10:8]{-(x+2)}; - \end{axis} - \end{tikzpicture} - - $a_2<0$ - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-4:4]{-(x^2-6)}; - \end{axis} - \end{tikzpicture} - - $a_3<0$ - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-7.5:7.5]{-0.05*(x+6)*x*(x-6)}; - \end{axis} - \end{tikzpicture} - - $a_4<0$ - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-2.35:5.35,samples=100]{-0.2*(x-5)*x*(x-3)*(x+2)}; - \end{axis} - \end{tikzpicture} - - $a_5<0$ - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-5.5:6.3,samples=100]{-0.01*(x+2)*x*(x-3)*(x+5)*(x-6)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{problem} -\end{doyouunderstand} - -\fixthis{poly: Need a more basic example here- it can have a similar -format to the multiple zeros example, but just keep it simple; it should -be halfway between the 2 examples surrounding it} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample}[Multiple zeros] -Consider the polynomial functions $p$, $q$, and $r$ which are -graphed in \cref{poly:fig:moremultiple}. -The formulas for $p$, $q$, and $r$ are as follows -\begin{align*} - p(x) & =(x-3)^2(x+4)^2 \\ - q(x) & =x(x+2)^2(x-1)^2(x-3) \\ - r(x) & =x(x-3)^3(x+1)^2 -\end{align*} -Find the degree of $p$, $q$, and $r$, and decide if the functions bounce off or cut -through the horizontal axis at each of their zeros. -\begin{pccsolution} -The degree of $p$ is 4. Referring to \cref{poly:fig:bouncep}, -the curve bounces off the horizontal axis at both zeros, $3$ and $4$. - -The degree of $q$ is 6. Referring to \cref{poly:fig:bounceq}, -the curve bounces off the horizontal axis at $-2$ and $1$, and cuts -through the horizontal axis at $0$ and $3$. - -The degree of $r$ is 6. Referring to \cref{poly:fig:bouncer}, -the curve bounces off the horizontal axis at $-1$, and cuts through -the horizontal axis at $0$ and at $3$, although is flattened immediately to the left and right of $3$. -\end{pccsolution} -\end{pccexample} - -\setlength{\figurewidth}{0.25\textwidth} -\begin{figure}[!htb] - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-6,xmax=5, - ymin=-30,ymax=200, - xtick={-4,-2,...,4}, - width=\textwidth, - ] - \addplot expression[domain=-5.63733:4.63733,samples=50]{(x-3)^2*(x+4)^2}; - \addplot[soldot]coordinates{(3,0)(-4,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=p(x)$} - \label{poly:fig:bouncep} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-3,xmax=4, - xtick={-2,...,3}, - ymin=-60,ymax=40, - width=\textwidth, - ] - \addplot+[samples=50] expression[domain=-2.49011:3.11054]{x*(x+2)^2*(x-1)^2*(x-3)}; - \addplot[soldot]coordinates{(-2,0)(0,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=q(x)$} - \label{poly:fig:bounceq} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-2,xmax=4, - xtick={-1,...,3}, - ymin=-40,ymax=40, - width=\textwidth, - ] - \addplot expression[domain=-1.53024:3.77464,samples=50]{x*(x-3)^3*(x+1)^2}; - \addplot[soldot]coordinates{(-1,0)(0,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=r(x)$} - \label{poly:fig:bouncer} - \end{subfigure} - \caption{} - \label{poly:fig:moremultiple} -\end{figure} - -\begin{pccdefinition}[Multiple zeros]\label{poly:def:multzero} -Let $p$ be a polynomial that has a repeated linear factor $(x-a)^n$. Then we say -that $p$ has a multiple zero at $a$ of multiplicity $n$ and -\begin{itemize} - \item if the factor $(x-a)$ is repeated an even number of times, the graph of $y=p(x)$ does not - cross the $x$ axis at $a$, but `bounces' off the horizontal axis at $a$. - \item if the factor $(x-a)$ is repeated an odd number of times, the graph of $y=p(x)$ crosses the - horizontal axis at $a$, but it looks `flattened' there -\end{itemize} -If $n=1$, then we say that $p$ has a \emph{simple} zero at $a$. -\end{pccdefinition} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample}[Find a formula] -Find formulas for the polynomial functions, $p$ and $q$, graphed in \cref{poly:fig:findformulademoboth}. -\begin{figure}[!htb] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[framed, - xmin=-5,xmax=5, - ymin=-10,ymax=10, - xtick={-4,-2,...,4}, - minor xtick={-3,-1,...,3}, - ytick={-8,-6,...,8}, - width=\textwidth, - grid=both] - \addplot expression[domain=-3.25842:2.25842,samples=50]{-x*(x-2)*(x+3)*(x+1)}; - \addplot[soldot]coordinates{(1,8)}node[axisnode,inner sep=.35cm,anchor=west]{$(1,8)$}; - \addplot[soldot]coordinates{(-3,0)(-1,0)(0,0)(2,0)}; - \end{axis} - \end{tikzpicture} - \caption{$p$} - \label{poly:fig:findformulademo} - \end{subfigure} - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[framed, - xmin=-5,xmax=5, - ymin=-10,ymax=10, - xtick={-4,-2,...,4}, - minor xtick={-3,-1,...,3}, - ytick={-8,-6,...,8}, - width=\textwidth, - grid=both] - \addplot expression[domain=-4.33:4.08152]{-.25*(x+2)^2*(x-3)}; - \addplot[soldot]coordinates{(2,4)}node[axisnode,anchor=south west]{$(2,4)$}; - \addplot[soldot]coordinates{(-2,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$q$} - \label{poly:fig:findformulademo1} - \end{subfigure} - \caption{} - \label{poly:fig:findformulademoboth} -\end{figure} -\begin{pccsolution} -\begin{enumerate} - \item We begin by noting that the horizontal intercepts of $p$ are $(-3,0)$, $(-1,0)$, $(0,0)$ and $(2,0)$. - We also note that each zero is simple (multiplicity $1$). - If we assume that $p$ has no other zeros, then we can start by writing - \begin{align*} - p(x) & =(x+3)(x+1)(x-0)(x-2) \\ - & =x(x+3)(x+1)(x-2) \\ - \end{align*} - According to \cref{poly:fig:findformulademo}, the point $(1,8)$ lies - on the curve $y=p(x)$. - Let's check if the formula we have written satisfies this requirement - \begin{align*} - p(1) & = (1)(4)(2)(-1) \\ - & = -8 - \end{align*} - which is clearly not correct| it is close though. We can correct this by - multiplying $p$ by a constant $k$; so let's assume that - \[ - p(x)=kx(x+3)(x+1)(x-2) - \] - Then $p(1)=-8k$, and if this is to equal $8$, then $k=-1$. Therefore - the formula for $p(x)$ is - \[ - p(x)=-x(x+3)(x+1)(x-2) - \] - \item The function $q$ has a zero at $-2$ of multiplicity $2$, and zero of - multiplicity $1$ at $3$ (so $3$ is a simple zero of $q$); we can therefore assume that $q$ has the form - \[ - q(x)=k(x+2)^2(x-3) - \] - where $k$ is some real number. In order to find $k$, we use the given ordered pair, $(2,4)$, and - evaluate $p(2)$ - \begin{align*} - p(2) & =k(4)^2(-1) \\ - & =-16k - \end{align*} - We solve the equation $4=-8k$ and obtain $k=-\frac{1}{4}$ and conclude that the - formula for $q(x)$ is - \[ - q(x)=-\frac{1}{4}(x+2)^2(x-3) - \] -\end{enumerate} -\end{pccsolution} -\end{pccexample} - - -\fixthis{Chris: need sketching polynomial problems} -\begin{pccspecialcomment}[Steps to follow when sketching polynomial functions] - \begin{steps} - \item \label{poly:step:first} Determine the degree of the polynomial, - its leading term and leading coefficient, and hence determine - the long-run behavior of the polynomial| does it behave like $\pm x^2$ or $\pm x^3$ - as $x\rightarrow\pm\infty$? - \item Determine the zeros and their multiplicity. Mark all zeros - and the vertical intercept on the graph using solid circles $\bullet$. - \item \label{poly:step:last} Deduce the overall shape of the curve, and sketch it. If there isn't - enough information from the previous steps, then construct a table of values. - \end{steps} - Remember that until we have the tools of calculus, we won't be able to - find the exact coordinates of local minimums, local maximums, and points - of inflection. -\end{pccspecialcomment} -Before we demonstrate some examples, it is important to remember the following: -\begin{itemize} - \item our sketches will give a good representation of the overall - shape of the graph, but until we have the tools of calculus (from MTH 251) - we can not find local minimums, local maximums, and inflection points algebraically. This - means that we will make our best guess as to where these points are. - \item we will not concern ourselves too much with the vertical scale (because of - our previous point)| we will, however, mark the vertical intercept (assuming there is one), - and any horizontal asymptotes. -\end{itemize} -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}\label{poly:ex:simplecubic} -Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $p$ -that has formula -\[ - p(x)=\frac{1}{2}(x-4)(x-1)(x+3) -\] -\begin{pccsolution} -\begin{steps} - \item $p$ has degree $3$. The leading term of $p$ is $\frac{1}{2}x^3$, so the leading coefficient of $p$ - is $\frac{1}{2}$. The long-run behavior of $p$ is therefore similar to that of $x^3$. - \item The zeros of $p$ are $-3$, $1$, and $4$; each zero is simple (i.e, it has multiplicity $1$). - This means that the curve of $p$ cuts the horizontal axis at each zero. The vertical - intercept of $p$ is $(0,6)$. - \item We draw the details we have obtained so far on \cref{poly:fig:simplecubicp1}. Given - that the curve of $p$ looks like the curve of $x^3$ in the long-run, we are able to complete a sketch of the - graph of $p$ in \cref{poly:fig:simplecubicp2}. - - Note that we can not find the coordinates of the local minimums, local maximums, and inflection - points| for the moment we make reasonable guesses as to where these points are (you'll find how - to do this in calculus). -\end{steps} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=15, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-3,0)(1,0)(4,0)(0,6)}node[axisnode,anchor=south west]{$(0,6)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:simplecubicp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=15, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-3,0)(1,0)(4,0)(0,6)}node[axisnode,anchor=south west]{$(0,6)$}; - \addplot[pccplot] expression[domain=-3.57675:4.95392,samples=100]{.5*(x-4)*(x-1)*(x+3)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:simplecubicp2} - \end{subfigure}% - \caption{$y=\dfrac{1}{2}(x-4)(x-1)(x+3)$} - \label{poly:fig:simplecubic} -\end{figure} -\end{pccsolution} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}\label{poly:ex:degree5} -Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $q$ -that has formula -\[ - q(x)=\frac{1}{200}(x+7)^2(2-x)(x-6)^2 -\] -\begin{pccsolution} -\begin{steps} - \item $q$ has degree $4$. The leading term of $q$ is - \[ - -\frac{1}{200}x^5 - \] - so the leading coefficient of $q$ is $-\frac{1}{200}$. The long-run behavior of $q$ - is therefore similar to that of $-x^5$. - \item The zeros of $q$ are $-7$ (multiplicity 2), $2$ (simple), and $6$ (multiplicity $2$). - The curve of $q$ bounces off the horizontal axis at the zeros with multiplicity $2$ and - cuts the horizontal axis at the simple zeros. The vertical intercept of $q$ is $\left( 0,\frac{441}{25} \right)$. - \item We mark the details we have found so far on \cref{poly:fig:degree5p1}. Given that - the curve of $q$ looks like the curve of $-x^5$ in the long-run, we can complete \cref{poly:fig:degree5p2}. -\end{steps} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=40, - xtick={-8,-6,...,8}, - ytick={-5,0,...,35}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-7,0)(2,0)(6,0)(0,441/25)}node[axisnode,anchor=south west]{$\left( 0, \frac{441}{25} \right)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:degree5p1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=40, - xtick={-8,-6,...,8}, - ytick={-5,0,...,35}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-7,0)(2,0)(6,0)(0,441/25)}node[axisnode,anchor=south west]{$\left( 0, \frac{441}{25} \right)$}; - \addplot[pccplot] expression[domain=-8.83223:7.34784,samples=50]{1/200*(x+7)^2*(2-x)*(x-6)^2}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:degree5p2} - \end{subfigure}% - \caption{$y=\dfrac{1}{200}(x+7)^2(2-x)(x-6)^2$} - \label{poly:fig:degree5} -\end{figure} -\end{pccsolution} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample} -Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $r$ -that has formula -\[ - r(x)=\frac{1}{100}x^3(x+4)(x-4)(x-6) -\] -\begin{pccsolution} -\begin{steps} - \item $r$ has degree $6$. The leading term of $r$ is - \[ - \frac{1}{100}x^6 - \] - so the leading coefficient of $r$ is $\frac{1}{100}$. The long-run behavior of $r$ - is therefore similar to that of $x^6$. - \item The zeros of $r$ are $-4$ (simple), $0$ (multiplicity $3$), $4$ (simple), - and $6$ (simple). The vertical intercept of $r$ is $(0,0)$. The curve of $r$ - cuts the horizontal axis at the simple zeros, and goes through the axis - at $(0,0)$, but does so in a flattened way. - \item We mark the zeros and vertical intercept on \cref{poly:fig:degree6p1}. Given that - the curve of $r$ looks like the curve of $x^6$ in the long-run, we complete the graph - of $r$ in \cref{poly:fig:degree6p2}. -\end{steps} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=10, - ymin=-20,ymax=10, - xtick={-4,-2,...,8}, - ytick={-15,-10,...,5}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-4,0)(0,0)(4,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:degree6p1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=10, - ymin=-20,ymax=10, - xtick={-4,-2,...,8}, - ytick={-15,-10,...,5}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-4,0)(0,0)(4,0)(6,0)}; - \addplot[pccplot] expression[domain=-4.16652:6.18911,samples=100]{1/100*(x+4)*x^3*(x-4)*(x-6)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:degree6p2} - \end{subfigure}% - \caption{$y=\dfrac{1}{100}(x+4)x^3(x-4)(x-6)$} -\end{figure} -\end{pccsolution} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{pccexample}[An open-topped box] -A cardboard company makes open-topped boxes for their clients. The specifications -dictate that the box must have a square base, and that it must be open-topped. -The company uses sheets of cardboard that are $\unit[1200]{cm^2}$. Assuming that -the base of each box has side $x$ (measured in cm), it can be shown that the volume of each box, $V(x)$, -has formula -\[ - V(x)=\frac{x}{4}(1200-x^2) -\] -Find the dimensions of the box that maximize the volume. -\begin{pccsolution} -We graph $y=V(x)$ in \cref{poly:fig:opentoppedbox}. Note that because -$x$ represents the length of a side, and $V(x)$ represents the volume -of the box, we necessarily require both values to be positive; we illustrate -the part of the curve that applies to this problem using a solid line. - -\begin{figure}[!htb] - \centering - \begin{tikzpicture} - \begin{axis}[framed, - xmin=-50,xmax=50, - ymin=-5000,ymax=5000, - xtick={-40,-30,...,40}, - minor xtick={-45,-35,...,45}, - minor ytick={-3000,-1000,1000,3000}, - width=.75\textwidth, - height=.5\textwidth, - grid=both] - \addplot[pccplot,dashed,<-] expression[domain=-40:0,samples=50]{x/4*(1200-x^2)}; - \addplot[pccplot,-] expression[domain=0:34.64,samples=50]{x/4*(1200-x^2)}; - \addplot[pccplot,dashed,->] expression[domain=34.64:40,samples=50]{x/4*(1200-x^2)}; - \addplot[soldot] coordinates{(20,4000)}; - \end{axis} - \end{tikzpicture} - \caption{$y=V(x)$} - \label{poly:fig:opentoppedbox} -\end{figure} - -According to \cref{poly:fig:opentoppedbox}, the maximum volume of such a box is -approximately $\unit[4000]{cm^2}$, and we achieve it using a base of length -approximately $\unit[20]{cm}$. Since the base is square and each sheet of cardboard -is $\unit[1200]{cm^2}$, we conclude that the dimensions of each box are $\unit[20]{cm}\times\unit[20]{cm}\times\unit[30]{cm}$. -\end{pccsolution} -\end{pccexample} - -\subsection*{Complex zeros} -There has been a pattern to all of the examples that we have seen so far| -the degree of the polynomial has dictated the number of \emph{real} zeros that the -polynomial has. For example, the function $p$ in \cref{poly:ex:simplecubic} -has degree $3$, and $p$ has $3$ real zeros; the function $q$ in \cref{poly:ex:degree5} -has degree $5$ and $q$ has $5$ real zeros. - -You may wonder if this result can be generalized| does every polynomial that -has degree $n$ have $n$ real zeros? Before we tackle the general result, -let's consider an example that may help motivate it. -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{pccexample}\label{poly:ex:complx} -Consider the polynomial function $c$ that has formula -\[ - c(x)=x(x^2+1) -\] -It is clear that $c$ has degree $3$, and that $c$ has a (simple) zero at $0$. Does -$c$ have any other zeros, i.e, can we find any values of $x$ that satisfy the equation -\begin{equation}\label{poly:eq:complx} - x^2+1=0 -\end{equation} -The solutions to \cref{poly:eq:complx} are $\pm i$. - -We conclude that $c$ has $3$ zeros: $0$ and $\pm i$; we note that \emph{not -all of them are real}. -\end{pccexample} -\Cref{poly:ex:complx} shows that not every degree-$3$ polynomial has $3$ -\emph{real} zeros; however, if we are prepared to venture into the complex numbers, -then we can state the following theorem. -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{pccspecialcomment}[The fundamental theorem of algebra] - Every polynomial function of degree $n$ has $n$ roots, some of which may - be complex, and some may be repeated. -\end{pccspecialcomment} -\fixthis{Fundamental theorem of algebra: is this wording ok? do we want -it as a theorem?} -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{pccexample} -Find all the zeros of the polynomial function $p$ that has formula -\[ - p(x)=x^4-2x^3+5x^2 -\] -\begin{pccsolution} -We begin by factoring $p$ -\begin{align*} - p(x) & =x^4-2x^3+5x^2 \\ - & =x^2(x^2-2x+5) -\end{align*} -We note that $0$ is a zero of $p$ with multiplicity $2$. The other zeros of $p$ -can be found by solving the equation -\[ - x^2-2x+5=0 -\] -This equation can not be factored, so we use the quadratic formula -\begin{align*} - x & =\frac{2\pm\sqrt{(-2)^2}-20}{2(1)} \\ - & =\frac{2\pm\sqrt{-16}}{2} \\ - & =1\pm 2i -\end{align*} -We conclude that $p$ has $4$ zeros: $0$ (multiplicity $2$), and $1\pm 2i$ (simple). -\end{pccsolution} -\end{pccexample} -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{pccexample} -Find a polynomial that has zeros at $2\pm i\sqrt{2}$. -\begin{pccsolution} -We know that the zeros of a polynomial can be found by analyzing the linear -factors. We are given the zeros, and have to work backwards to find the -linear factors. - -We begin by assuming that $p$ has the form -\begin{align*} - p(x) & =(x-(2-i\sqrt{2}))(x-(2+i\sqrt{2})) \\ - & =x^2-x(2+i\sqrt{2})-x(2-i\sqrt{2})+(2-i\sqrt{2})(2+i\sqrt{2}) \\ - & =x^2-4x+(4-2i^2) \\ - & =x^2-4x+6 -\end{align*} -We conclude that a possible formula for a polynomial function, $p$, -that has zeros at $2\pm i\sqrt{2}$ is -\[ - p(x)=x^2-4x+6 -\] -Note that we could multiply $p$ by any real number and still ensure -that $p$ has the same zeros. -\end{pccsolution} -\end{pccexample} -\investigation*{} -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Find a formula from a graph] -For each of the polynomials in \cref{poly:fig:findformula} -\begin{enumerate} - \item count the number of times the curve turns round, and cuts/bounces off the $x$ axis; - \item approximate the degree of the polynomial; - \item use your information to find the linear factors of each polynomial, and therefore write a possible formula for each; - \item make sure your polynomial goes through the given ordered pair. -\end{enumerate} -\begin{shortsolution} - \Vref{poly:fig:findformdeg2}: - \begin{enumerate} - \item the curve turns round once; - \item the degree could be 2; - \item based on the zeros, the linear factors are $(x+5)$ and $(x-3)$; since the - graph opens downwards, we will assume the leading coefficient is negative: $p(x)=-k(x+5)(x-3)$; - \item $p$ goes through $(2,2)$, so we need to solve $2=-k(7)(-1)$ and therefore $k=\nicefrac{2}{7}$, so - \[ - p(x)=-\frac{2}{7}(x+5)(x-3) - \] - \end{enumerate} - \Vref{poly:fig:findformdeg3}: - \begin{enumerate} - \item the curve turns around twice; - \item the degree could be 3; - \item based on the zeros, the linear factors are $(x+2)^2$, and $(x-1)$; - based on the behavior of $p$, we assume that the leading coefficient is positive, and try $p(x)=k(x+2)^2(x-1)$; - \item $p$ goes through $(0,-2)$, so we need to solve $-2=k(4)(-1)$ and therefore $k=\nicefrac{1}{2}$, so - \[ - p(x)=\frac{1}{2}(x+2)^2(x-1) - \] - \end{enumerate} - \Vref{poly:fig:findformdeg5}: - \begin{enumerate} - \item the curve turns around 4 times; - \item the degree could be 5; - \item based on the zeros, the linear factors are $(x+5)^2$, $(x+1)$, $(x-2)$, $(x-3)$; - based on the behavior of $p$, we assume that the leading coefficient is positive, and try $p(x)=k(x+5)^2(x+1)(x-2)(x-3)$; - \item $p$ goes through $(-3,-50)$, so we need to solve $-50=k(64)(-2)(-5)(-6)$ and therefore $k=\nicefrac{5}{384}$, so - \[ - p(x)=\frac{5}{384}(x+5)^2(x+1)(x-2)(x-3) - \] - \end{enumerate} -\end{shortsolution} -\end{problem} - - -\begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-2,ymax=5, - width=\textwidth, - ] - \addplot expression[domain=-4.5:3.75]{-1/3*(x+4)*(x-3)}; - \addplot[soldot] coordinates{(-4,0)(3,0)(2,2)} node[axisnode,above right]{$(2,2)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:findformdeg2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-3,xmax=2, - ymin=-2,ymax=4, - xtick={-2,...,1}, - width=\textwidth, - ] - \addplot expression[domain=-2.95:1.75]{1/3*(x+2)^2*(x-1)}; - \addplot[soldot]coordinates{(-2,0)(1,0)(0,-1.33)}node[axisnode,anchor=north west]{$(0,-2)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:findformdeg3} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-100,ymax=150, - width=\textwidth, - ] - \addplot expression[domain=-4.5:3.4,samples=50]{(x+4)^2*(x+1)*(x-2)*(x-3)}; - \addplot[soldot]coordinates{(-4,0)(-1,0)(2,0)(3,0)(-3,-60)}node[axisnode,anchor=north]{$(-3,-50)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:findformdeg5} - \end{subfigure} - \caption{} - \label{poly:fig:findformula} -\end{figure} - - - - -\begin{exercises} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Prerequisite classifacation skills] -Decide if each of the following functions are linear or quadratic. -\begin{multicols}{3} - \begin{subproblem} - $f(x)=2x+3$ - \begin{shortsolution} - $f$ is linear. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $g(x)=10-7x$ - \begin{shortsolution} - $g$ is linear - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $h(x)=-x^2+3x-9$ - \begin{shortsolution} - $h$ is quadratic. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $k(x)=-17$ - \begin{shortsolution} - $k$ is linear. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $l(x)=-82x^2-4$ - \begin{shortsolution} - $l$ is quadratic - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $m(x)=6^2x-8$ - \begin{shortsolution} - $m$ is linear. - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Prerequisite slope identification] -State the slope of each of the following linear functions, and -hence decide if each function is increasing or decreasing. -\begin{multicols}{4} - \begin{subproblem} - $\alpha(x)=4x+1$ - \begin{shortsolution} - $m=4$; $\alpha$ is increasing. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $\beta(x)=-9x$ - \begin{shortsolution} - $m=-9$; $\beta$ is decreasing. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $\gamma(t)=18t+100$ - \begin{shortsolution} - $m=18$; $\gamma$ is increasing. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $\delta(y)=23-y$ - \begin{shortsolution} - $m=-1$; $\delta$ is decreasing. - \end{shortsolution} - \end{subproblem} -\end{multicols} -Now let's generalize our findings for the most general linear function $f$ -that has formula $f(x)=mx+b$. Complete the following sentences. -\begin{subproblem} - When $m>0$, the function $f$ is $\ldots$ - \begin{shortsolution} - When $m>0$, the function $f$ is $\ldots$ \emph{increasing}. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - When $m<0$, the function $f$ is $\ldots$ - \begin{shortsolution} - When $m<0$, the function $f$ is $\ldots$ \emph{decreasing}. - \end{shortsolution} -\end{subproblem} -\end{problem} -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Polynomial or not?] -Identify whether each of the following functions is a polynomial or not. -If the function is a polynomial, state its degree. -\begin{multicols}{3} - \begin{subproblem} - $p(x)=2x+1$ - \begin{shortsolution} - $p$ is a polynomial (you might also describe $p$ as linear). The degree of $p$ is 1. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=7x^2+4x$ - \begin{shortsolution} - $p$ is a polynomial (you might also describe $p$ as quadratic). The degree of $p$ is 2. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=\sqrt{x}+2x+1$ - \begin{shortsolution} - $p$ is not a polynomial; we require the powers of $x$ to be integer values. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=2^x-45$ - \begin{shortsolution} - $p$ is not a polynomial; the $2^x$ term is exponential. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=6x^4-5x^3+9$ - \begin{shortsolution} - $p$ is a polynomial, and the degree of $p$ is $6$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=-5x^{17}+9x+2$ - \begin{shortsolution} - $p$ is a polynomial, and the degree of $p$ is 17. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=4x(x+7)^2(x-3)^3$ - \begin{shortsolution} - $p$ is a polynomial, and the degree of $p$ is $6$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=4x^{-5}-x^2+x$ - \begin{shortsolution} - $p$ is not a polynomial because $-5$ is not a positive integer. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=-x^6(x^2+1)(x^3-2)$ - \begin{shortsolution} - $p$ is a polynomial, and the degree of $p$ is $11$. - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Polynomial graphs] -Three polynomial functions $p$, $m$, and $n$ are shown in \crefrange{poly:fig:functionp}{poly:fig:functionn}. -The functions have the following formulas -\begin{align*} - p(x) & = (x-1)(x+2)(x-3) \\ - m(x) & = -(x-1)(x+2)(x-3) \\ - n(x) & = (x-1)(x+2)(x-3)(x+1)(x+4) -\end{align*} -Note that for our present purposes we are not concerned with the vertical scale of the graphs. -\begin{subproblem} - Identify both on the graph {\em and} algebraically, the zeros of each polynomial. - \begin{shortsolution} - $y=p(x)$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-2.5:3.5,samples=50]{(x-1)*(x+2)*(x-3)}; - \addplot[soldot] coordinates{(-2,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - - $y=m(x)$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-2.5:3.5,samples=50]{-1*(x-1)*(x+2)*(x-3)}; - \addplot[soldot] coordinates{(-2,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - - $y=n(x)$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-90,ymax=70, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-4.15:3.15,samples=50]{(x-1)*(x+2)*(x-3)*(x+1)*(x+4)}; - \addplot[soldot] coordinates{(-4,0)(-2,0)(-1,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - - The zeros of $p$ are $-2$, $1$, and $3$; the zeros of $m$ are $-2$, $1$, and $3$; the zeros of $n$ are - $-4$, $-2$, $-1$, and $3$. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Write down the degree, how many times the curve of each function `turns around', - and how many zeros it has - \begin{shortsolution} - \begin{itemize} - \item The degree of $p$ is 3, and the curve $y=p(x)$ turns around twice. - \item The degree of $q$ is also 3, and the curve $y=q(x)$ turns around twice. - \item The degree of $n$ is $5$, and the curve $y=n(x)$ turns around 4 times. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\end{problem} - -\begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-10,ymax=10, - ytick={-5,5}, - width=\textwidth, - ] - \addplot expression[domain=-2.5:3.5,samples=50]{(x-1)*(x+2)*(x-3)}; - \addplot[soldot]coordinates{(-2,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=p(x)$} - \label{poly:fig:functionp} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-10,ymax=10, - ytick={-5,5}, - width=\textwidth, - ] - \addplot expression[domain=-2.5:3.5,samples=50]{-1*(x-1)*(x+2)*(x-3)}; - \addplot[soldot]coordinates{(-2,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=m(x)$} - \label{poly:fig:functionm} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-90,ymax=70, - width=\textwidth, - ] - \addplot expression[domain=-4.15:3.15,samples=100]{(x-1)*(x+2)*(x-3)*(x+1)*(x+4)}; - \addplot[soldot]coordinates{(-4,0)(-2,0)(-1,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=n(x)$} - \label{poly:fig:functionn} - \end{subfigure} - \caption{} - \end{widepage} -\end{figure} -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Horizontal intercepts]\label{poly:prob:matchpolys}% -State the horizontal intercepts (as ordered pairs) of the following polynomials. -\begin{multicols}{2} - \begin{subproblem}\label{poly:prob:degree5} - $p(x)=(x-1)(x+2)(x-3)(x+1)(x+4)$ - \begin{shortsolution} - $(-4,0)$, $(-2,0)$, $(-1,0)$, $(1,0)$, $(3,0)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $q(x)=-(x-1)(x+2)(x-3)$ - \begin{shortsolution} - $(-2,0)$, $(1,0)$, $(3,0)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $r(x)=(x-1)(x+2)(x-3)$ - \begin{shortsolution} - $(-2,0)$, $(1,0)$, $(3,0)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem}\label{poly:prob:degree2} - $s(x)=(x-2)(x+2)$ - \begin{shortsolution} - $(-2,0)$, $(2,0)$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Minimums, maximums, and concavity]\label{poly:prob:incdec} -Four polynomial functions are graphed in \cref{poly:fig:incdec}. The formulas -for these functions are (not respectively) -\begin{gather*} - p(x)=\frac{x^3}{6}-\frac{x^2}{4}-3x, \qquad q(x)=\frac{x^4}{20}+\frac{x^3}{15}-\frac{6}{5}x^2+1\\ - r(x)=-\frac{x^5}{50}-\frac{x^4}{40}+\frac{2x^3}{5}+6, \qquad s(x)=-\frac{x^6}{6000}-\frac{x^5}{2500}+\frac{67x^4}{4000}+\frac{17x^3}{750}-\frac{42x^2}{125} -\end{gather*} -\begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{.23\textwidth} - \centering - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - width=\textwidth, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=major, - ] - \addplot expression[domain=-5.28:4.68,samples=50]{-x^5/50-x^4/40+2*x^3/5+6}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:incdec3} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - width=\textwidth, - xmin=-10,xmax=10,ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=major, - ] - \addplot expression[domain=-6.08:4.967,samples=50]{x^4/20+x^3/15-6/5*x^2+1}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:incdec2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - width=\textwidth, - xmin=-6,xmax=8,ymin=-10,ymax=10, - xtick={-4,-2,...,6}, - ytick={-8,-4,4,8}, - minor ytick={-6,-2,...,6}, - grid=both, - ] - \addplot expression[domain=-4.818:6.081,samples=50]{x^3/6-x^2/4-3*x}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:incdec1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - width=\textwidth, - xmin=-10,xmax=10,ymin=-10,ymax=10, - xtick={-8,-4,4,8}, - ytick={-8,-4,4,8}, - minor xtick={-6,-2,...,6}, - minor ytick={-6,-2,...,6}, - grid=both, - ] - \addplot expression[domain=-9.77:8.866,samples=50]{-x^6/6000-x^5/2500+67*x^4/4000+17/750*x^3-42/125*x^2}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:incdec4} - \end{subfigure} - \caption{Graphs for \cref{poly:prob:incdec}.} - \label{poly:fig:incdec} - \end{widepage} -\end{figure} -\begin{subproblem} - Match each of the formulas with one of the given graphs. - \begin{shortsolution} - \begin{itemize} - \item $p$ is graphed in \vref{poly:fig:incdec1}; - \item $q$ is graphed in \vref{poly:fig:incdec2}; - \item $r$ is graphed in \vref{poly:fig:incdec3}; - \item $s$ is graphed in \vref{poly:fig:incdec4}. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Approximate the zeros of each function using the appropriate graph. - \begin{shortsolution} - \begin{itemize} - \item $p$ has simple zeros at about $-3.8$, $0$, and $5$. - \item $q$ has simple zeros at about $-5.9$, $-1$, $1$, and $4$. - \item $r$ has simple zeros at about $-5$, $-2.9$, and $4.1$. - \item $s$ has simple zeros at about $-9$, $-6$, $4.2$, $8.1$, and a zero of multiplicity $2$ at $0$. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Approximate the local maximums and minimums of each of the functions. - \begin{shortsolution} - \begin{itemize} - \item $p$ has a local maximum of approximately $3.9$ at $-2$, and a local minimum of approximately $-6.5$ at $3$. - \item $q$ has a local minimum of approximately $-10$ at $-4$, and $-4$ at $3$; $q$ has a local maximum of approximately $1$ at $0$. - \item $r$ has a local minimum of approximately $-5.5$ at $-4$, and a local maximum of approximately $10$ at $3$. - \item $s$ has a local maximum of approximately $5$ at $-8$, $0$ at $0$, and $5$ at $7$; $s$ has local minimums - of approximately $-3$ at $-4$, and $-1$ at $3$. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Approximate the global maximums and minimums of each of the functions. - \begin{shortsolution} - \begin{itemize} - \item $p$ does not have a global maximum, nor a global minimum. - \item $q$ has a global minimum of approximately $-10$; it does not have a global maximum. - \item $r$ does not have a global maximum, nor a global minimum. - \item $s$ has a global maximum of approximately $5$; it does not have a global minimum. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Approximate the intervals on which each function is increasing and decreasing. - \begin{shortsolution} - \begin{itemize} - \item $p$ is increasing on $(-\infty,-2)\cup (3,\infty)$, and decreasing on $(-2,3)$. - \item $q$ is increasing on $(-4,0)\cup (3,\infty)$, and decreasing on $(-\infty,-4)\cup (0,3)$. - \item $r$ is increasing on $(-4,3)$, and decreasing on $(-\infty,-4)\cup (3,\infty)$. - \item $s$ is increasing on $(-\infty,-8)\cup (-4,0)\cup (3,5)$, and decreasing on $(-8,-4)\cup (0,3)\cup (5,\infty)$. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Approximate the intervals on which each function is concave up and concave down. - \begin{shortsolution} - \begin{itemize} - \item $p$ is concave up on $(1,\infty)$, and concave down on $(-\infty,1)$. - \item $q$ is concave up on $(-\infty,-1)\cup (1,\infty)$, and concave down on $(-1,1)$. - \item $r$ is concave up on $(-\infty,-3)\cup (0,2)$, and concave down on $(-3,0)\cup (2,\infty)$. - \item $s$ is concave up on $(-6,-2)\cup (2,5)$, and concave down on $(-\infty,-6)\cup (-2,2)\cup (5,\infty)$. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - The degree of $q$ is $5$. Assuming that all of the real zeros of $q$ are - shown in its graph, how many complex zeros does $q$ have? - \begin{shortsolution} - \Vref{poly:fig:incdec2} shows that $q$ has $3$ real zeros - since the curve of $q$ cuts the horizontal axis $3$ times. - Since $q$ has degree $5$, $q$ must have $2$ complex zeros. - \end{shortsolution} -\end{subproblem} -\end{problem} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Long-run behaviour of polynomials] -Describe the long-run behavior of each of polynomial functions in -\crefrange{poly:prob:degree5}{poly:prob:degree2}. -\begin{shortsolution} - $\dd\lim_{x\rightarrow-\infty}p(x)=-\infty$, - $\dd\lim_{x\rightarrow\infty}p(x)=\infty$, - $\dd\lim_{x\rightarrow-\infty}q(x)=\infty$, - $\dd\lim_{x\rightarrow\infty}q(x)=-\infty$, - $\dd\lim_{x\rightarrow-\infty}r(x)=-\infty$, - $\dd\lim_{x\rightarrow\infty}r(x)=\infty$, - $\dd\lim_{x\rightarrow-\infty}s(x)=\infty$, - $\dd\lim_{x\rightarrow\infty}s(x)=\infty$, -\end{shortsolution} -\end{problem} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[True of false?] -Let $p$ be a polynomial function. -Label each of the following statements as true (T) or false (F); if they are false, -provide an example that supports your answer. -\begin{subproblem} - If $p$ has degree $3$, then $p$ has $3$ distinct zeros. - \begin{shortsolution} - False. Consider $p(x)=x^2(x+1)$ which has only 2 distinct zeros. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - If $p$ has degree $4$, then $\dd\lim_{x\rightarrow-\infty}p(x)=\infty$ and $\dd\lim_{x\rightarrow\infty}p(x)=\infty$. - \begin{shortsolution} - False. Consider $p(x)=-x^4$. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - If $p$ has even degree, then it is possible that $p$ can have no real zeros. - \begin{shortsolution} - True. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - If $p$ has odd degree, then it is possible that $p$ can have no real zeros. - \begin{shortsolution} - False. All odd degree polynomials will cut the horizontal axis at least once. - \end{shortsolution} -\end{subproblem} -\end{problem} -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Find a formula from a description] -In each of the following problems, give a possible formula for a polynomial -function that has the specified properties. -\begin{subproblem} - Degree 2 and has zeros at $4$ and $5$. - \begin{shortsolution} - Possible option: $p(x)=(x-4)(x-5)$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Degree 3 and has zeros at $4$,$5$ and $-3$. - \begin{shortsolution} - Possible option: $p(x)=(x-4)(x-5)(x+3)$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Degree 4 and has zeros at $0$, $4$, $5$, $-3$. - \begin{shortsolution} - Possible option: $p(x)=x(x-4)(x-5)(x+3)$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Degree 4, with zeros that make the graph cut at $2$, $-5$, and a zero that makes the graph touch at $-2$; - \begin{shortsolution} - Possible option: $p(x)=(x-2)(x+5)(x+2)^2$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Degree 3, with only one zero at $-1$. - \begin{shortsolution} - Possible option: $p(x)=(x+1)^3$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} -\end{subproblem} -\end{problem} -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{problem}[\Cref{poly:step:last}] -\pccname{Saheed} is graphing a polynomial function, $p$. -He is following \crefrange{poly:step:first}{poly:step:last} and has so far -marked the zeros of $p$ on \cref{poly:fig:optionsp1}. Saheed tells you that -$p$ has degree $3$, but does \emph{not} say if the leading coefficient -of $p$ is positive or negative. -\begin{figure}[!htbp] - \begin{widepage} - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\textwidth, - height=.5\textwidth, - ] - \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:optionsp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\textwidth, - height=.5\textwidth, - ] - \addplot[soldot] coordinates{(-5,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:optionsp2} - \end{subfigure}% - \caption{} - \end{widepage} -\end{figure} -\begin{subproblem} - Use the information in \cref{poly:fig:optionsp1} to help sketch $p$, assuming that the leading coefficient - is positive. - \begin{shortsolution} - Assuming that $a_3>0$: - - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-6.78179:8.35598,samples=50]{1/20*(x+5)*(x-2)*(x-6)}; - \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Use the information in \cref{poly:fig:optionsp1} to help sketch $p$, assuming that the leading coefficient - is negative. - \begin{shortsolution} - Assuming that $a_3<0$: - - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-6.78179:8.35598,samples=50]{-1/20*(x+5)*(x-2)*(x-6)}; - \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} -\end{subproblem} -Saheed now turns his attention to another polynomial function, $q$. He finds -the zeros of $q$ (there are only $2$) and marks them on \cref{poly:fig:optionsp2}. -Saheed knows that $q$ has degree $3$, but doesn't know if the leading -coefficient is positive or negative. -\begin{subproblem} - Use the information in \cref{poly:fig:optionsp2} to help sketch $q$, assuming that the leading - coefficient of $q$ is positive. Hint: only one of the zeros is simple. - \begin{shortsolution} - Assuming that $a_4>0$ there are $2$ different options: - - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-8.68983:7.31809,samples=50]{1/20*(x+5)^2*(x-6)}; - \addplot expression[domain=-6.31809:9.68893,samples=50]{1/20*(x+5)*(x-6)^2}; - \addplot[soldot] coordinates{(-5,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Use the information in \cref{poly:fig:optionsp2} to help sketch $q$, assuming that the leading - coefficient of $q$ is negative. - \begin{shortsolution} - Assuming that $a_4<0$ there are $2$ different options: - - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-8.68983:7.31809,samples=50]{-1/20*(x+5)^2*(x-6)}; - \addplot expression[domain=-6.31809:9.68893,samples=50]{-1/20*(x+5)*(x-6)^2}; - \addplot[soldot] coordinates{(-5,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} -\end{subproblem} -\end{problem} -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{problem}[Zeros] -Find all zeros of each of the following polynomial functions, making -sure to detail their multiplicity. Note that -you may need to use factoring, or the quadratic formula, or both! Also note -that some zeros may be repeated, and some may be complex. -\begin{multicols}{3} - \begin{subproblem} - $p(x)=x^2+1$ - \begin{shortsolution} - $\pm i$ (simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $q(y)=(y^2-9)(y^2-7)$ - \begin{shortsolution} - $\pm 3$, $\pm \sqrt{7}$ (all are simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $r(z)=-4z^3(z^2+3)(z^2+64)$ - \begin{shortsolution} - $0$ (multiplicity $3$), $\pm\sqrt{3}$ (simple), $\pm\sqrt{8}$ (simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $a(x)=x^4-81$ - \begin{shortsolution} - $\pm 3$, $\pm 3i$ (all are simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $b(y)=y^3-8$ - \begin{shortsolution} - $2$, $-1\pm i\sqrt{3}$ (all are simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $c(m)=m^3-m^2$ - \begin{shortsolution} - $0$ (multiplicity $2$), $1$ (simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $h(n)=(n+1)(n^2+4)$ - \begin{shortsolution} - $-1$, $\pm 2i$ (all are simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $f(\alpha)=(\alpha^2-16)(\alpha^2-5\alpha+4)$ - \begin{shortsolution} - $-4$ (simple), $4$ (multiplicity $2$), $1$ (simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $g(\beta)=(\beta^2-25)(\beta^2-5\beta-4)$ - \begin{shortsolution} - $\pm 5$, $\dfrac{5\pm\sqrt{41}}{2}$ (all are simple). - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{problem}[Given zeros, find a formula] -In each of the following problems you are given the zeros of a polynomial. -Write a possible formula for each polynomial| you may leave your -answer in factored form, but it may not contain complex numbers. Unless -otherwise stated, assume that the zeros are simple. -\begin{multicols}{3} - \begin{subproblem} - $1$, $2$ - \begin{shortsolution} - $p(x)=(x-1)(x-2)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $0$, $5$, $13$ - \begin{shortsolution} - $p(x)=x(x-5)(x-13)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $-7$, $2$ (multiplicity $3$), $5$ - \begin{shortsolution} - $p(x)=(x+7)(x-2)^3(x-5)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $0$, $\pm i$ - \begin{shortsolution} - $p(x)=x(x^2+1)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $\pm 2i$, $\pm 7$ - \begin{shortsolution} - $p(x)=(x^2+4)(x^2-49)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $-2\pm i\sqrt{6}$ - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{problem}[Composition of polynomials] -Let $p$ and $q$ be polynomial functions that have formulas -\[ - p(x)=(x+1)(x+2)(x+5), \qquad q(x)=3-x^4 -\] -Evaluate each of the following. -\begin{multicols}{4} - \begin{subproblem} - $(p\circ q)(0)$ - \begin{shortsolution} - $160$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(q\circ p)(0)$ - \begin{shortsolution} - $-9997$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(p\circ q)(1)$ - \begin{shortsolution} - $84$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(p\circ p)(0)$ - \begin{shortsolution} - $1980$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{problem}[Piecewise polynomial functions] -Let $P$ be the piecewise-defined function with formula -\[ - P(x)=\begin{cases} - (1-x)(2x+5)(x^2+1), & x\leq -3\\ - 4-x^2, & -3<x < 4\\ - x^3 & x\geq 4 -\end{cases} -\] -Evaluate each of the following -\begin{multicols}{5} - \begin{subproblem} - $P(-4)$ - \begin{shortsolution} - $-255$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $P(0)$ - \begin{shortsolution} - $4$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $P(4)$ - \begin{shortsolution} - $64$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $P(-3)$ - \begin{shortsolution} - $-40$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(P\circ P)(0)$ - \begin{shortsolution} - $64$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - -%=================================== -% Author: Hughes -% Date: July 2012 -%=================================== -\begin{problem}[Function algebra] -Let $p$ and $q$ be the polynomial functions that have formulas -\[ - p(x)=x(x+1)(x-3)^2, \qquad q(x)=7-x^2 -\] -Evaluate each of the following (if possible). -\begin{multicols}{4} - \begin{subproblem} - $(p+q)(1)$ - \begin{shortsolution} - $14$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(p-q)(0)$ - \begin{shortsolution} - $7$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(p\cdot q)(\sqrt{7})$ - \begin{shortsolution} - $0$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $\left( \frac{q}{p} \right)(1)$ - \begin{shortsolution} - $\frac{3}{4}$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\begin{subproblem} - What is the domain of the function $\frac{q}{p}$? - \begin{shortsolution} - $(-\infty,-1)\cup (-1,0)\cup (0,3)\cup (3,\infty)$ - \end{shortsolution} -\end{subproblem} -\end{problem} - -%=================================== -% Author: Hughes -% Date: July 2012 -%=================================== -\begin{problem}[Transformations: given the transformation, find the formula] -Let $p$ be the polynomial function that has formula. -\[ - p(x)=4x(x^2-1)(x+3) -\] -In each of the following -problems apply the given transformation to the function $p$ and -write a formula for the transformed version of $p$. -\begin{multicols}{2} - \begin{subproblem} - Shift $p$ to the right by $5$ units. - \begin{shortsolution} - $p(x-5)=4(x-5)(x-2)(x^2-10x+24)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $p$ to the left by $6$ units. - \begin{shortsolution} - $p(x+6)=4(x+6)(x+9)(x^2+12x+35)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $p$ up by $12$ units. - \begin{shortsolution} - $p(x)+12=4x(x^2-1)(x+3)+12$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $p$ down by $2$ units. - \begin{shortsolution} - $p(x)-2=4x(x^2-1)(x+3)-2$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Reflect $p$ over the horizontal axis. - \begin{shortsolution} - $-p(x)=-4x(x^2-1)(x+3)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Reflect $p$ over the vertical axis. - \begin{shortsolution} - $p(-x)=-4x(x^2-1)(3-x)$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Find a formula from a table]\label{poly:prob:findformula} -\Crefrange{poly:tab:findformulap}{poly:tab:findformulas} show values of polynomial functions, $p$, $q$, -$r$, and $s$. - -\begin{table}[!htb] - \centering - \begin{widepage} - \caption{Tables for \cref{poly:prob:findformula}} - \label{poly:tab:findformula} - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=p(x)$} - \label{poly:tab:findformulap} - \begin{tabular}{rr} - \beforeheading - \heading{$x$} & \heading{$y$} \\ - \afterheading - $-4$ & $-56$ \\\normalline - $-3$ & $-18$ \\\normalline - $-2$ & $0$ \\\normalline - $-1$ & $4$ \\\normalline - $0$ & $0$ \\\normalline - $1$ & $-6$ \\\normalline - $2$ & $-8$ \\\normalline - $3$ & $0$ \\\normalline - $4$ & $24$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=q(x)$} - \label{poly:tab:findformulaq} - \begin{tabular}{rr} - \beforeheading - \heading{$x$} & \heading{$y$} \\ \afterheading - $-4$ & $-16$ \\\normalline - $-3$ & $-3$ \\\normalline - $-2$ & $0$ \\\normalline - $-1$ & $-1$ \\\normalline - $0$ & $0$ \\\normalline - $1$ & $9$ \\\normalline - $2$ & $32$ \\\normalline - $3$ & $75$ \\\normalline - $4$ & $144$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=r(x)$} - \label{poly:tab:findformular} - \begin{tabular}{rr} - \beforeheading - \heading{$x$} & \heading{$y$} \\ \afterheading - $-4$ & $105$ \\\normalline - $-3$ & $0$ \\\normalline - $-2$ & $-15$ \\\normalline - $-1$ & $0$ \\\normalline - $0$ & $9$ \\\normalline - $1$ & $0$ \\\normalline - $2$ & $-15$ \\\normalline - $3$ & $0$ \\\normalline - $4$ & $105$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=s(x)$} - \label{poly:tab:findformulas} - \begin{tabular}{rr} - \beforeheading - \heading{$x$} & \heading{$y$} \\ \afterheading - $-4$ & $75$ \\\normalline - $-3$ & $0$ \\\normalline - $-2$ & $-9$ \\\normalline - $-1$ & $0$ \\\normalline - $0$ & $3$ \\\normalline - $1$ & $0$ \\\normalline - $2$ & $15$ \\\normalline - $3$ & $96$ \\\normalline - $4$ & $760$ \\\lastline - \end{tabular} - \end{subtable} - \end{widepage} -\end{table} - -\begin{subproblem} - Assuming that all of the zeros of $p$ are shown (in \cref{poly:tab:findformulap}), how many zeros does $p$ have? - \begin{shortsolution} - $p$ has 3 zeros. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - What is the degree of $p$? - \begin{shortsolution} - $p$ is degree 3. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Write a formula for $p(x)$. - \begin{shortsolution} - $p(x)=x(x+2)(x-3)$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Assuming that all of the zeros of $q$ are shown (in \cref{poly:tab:findformulaq}), how many zeros does $q$ have? - \begin{shortsolution} - $q$ has 2 zeros. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Describe the difference in behavior of $p$ and $q$ at $-2$. - \begin{shortsolution} - $p$ changes sign at $-2$, and $q$ does not change sign at $-2$. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Given that $q$ is a degree-$3$ polynomial, write a formula for $q(x)$. - \begin{shortsolution} - $q(x)=x(x+2)^2$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Assuming that all of the zeros of $r$ are shown (in \cref{poly:tab:findformular}), find a formula for $r(x)$. - \begin{shortsolution} - $r(x)=(x+3)(x+1)(x-1)(x-3)$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Assuming that all of the zeros of $s$ are shown (in \cref{poly:tab:findformulas}), find a formula for $s(x)$. - \begin{shortsolution} - $s(x)=(x+3)(x+1)(x-1)^2$ - \end{shortsolution} -\end{subproblem} -\end{problem} -\end{exercises} + \reformatstepslist{P} % the steps list should be P1, P2, \ldots + In your previous mathematics classes you have studied \emph{linear} and + \emph{quadratic} functions. The most general forms of these types of + functions can be represented (respectively) by the functions $f$ + and $g$ that have formulas + \begin{equation}\label{poly:eq:linquad} + f(x)=mx+b, \qquad g(x)=ax^2+bx+c + \end{equation} + We know that $m$ is the slope of $f$, and that $a$ is the \emph{leading coefficient} + of $g$. We also know that the \emph{signs} of $m$ and $a$ completely + determine the behavior of the functions $f$ and $g$. For example, if $m>0$ + then $f$ is an \emph{increasing} function, and if $m<0$ then $f$ is + a \emph{decreasing} function. Similarly, if $a>0$ then $g$ is + \emph{concave up} and if $a<0$ then $g$ is \emph{concave down}. Graphical + representations of these statements are given in \cref{poly:fig:linquad}. + + \begin{figure}[!htb] + \setlength{\figurewidth}{.2\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-10:8]{(x+2)}; + \end{axis} + \end{tikzpicture} + \caption{$m>0$} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-10:8]{-(x+2)}; + \end{axis} + \end{tikzpicture} + \caption{$m<0$} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-4:4]{(x^2-6)}; + \end{axis} + \end{tikzpicture} + \caption{$a>0$} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-4:4]{-(x^2-6)}; + \end{axis} + \end{tikzpicture} + \caption{$a<0$} + \end{subfigure} + \caption{Typical graphs of linear and quadratic functions.} + \label{poly:fig:linquad} + \end{figure} + + Let's look a little more closely at the formulas for $f$ and $g$ in + \cref{poly:eq:linquad}. Note that the \emph{degree} + of $f$ is $1$ since the highest power of $x$ that is present in the + formula for $f(x)$ is $1$. Similarly, the degree of $g$ is $2$ since + the highest power of $x$ that is present in the formula for $g(x)$ + is $2$. + + In this section we will build upon our knowledge of these elementary + functions. In particular, we will generalize the functions $f$ and $g$ to a function $p$ that has + any degree that we wish. + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{essentialskills} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Quadratic functions] + Every quadratic function has the form $y=ax^2+bx+c$; state the value + of $a$ for each of the following functions, and hence decide if the + parabola that represents the function opens upward or downward. + \begin{multicols}{2} + \begin{subproblem} + $F(x)=x^2+3$ + \begin{shortsolution} + $a=1$; the parabola opens upward. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $G(t)=4-5t^2$ + \begin{shortsolution} + $a=-5$; the parabola opens downward. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $H(y)=4y^2-96y+8$ + \begin{shortsolution} + $a=4$; the parabola opens upward. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $K(z)=-19z^2$ + \begin{shortsolution} + $m=-19$; the parabola opens downward. + \end{shortsolution} + \end{subproblem} + \end{multicols} + Now let's generalize our findings for the most general quadratic function $g$ + that has formula $g(x)=a_2x^2+a_1x+a_0$. Complete the following sentences. + \begin{subproblem} + When $a_2>0$, the parabola that represents $y=g(x)$ opens $\ldots$ + \begin{shortsolution} + When $a_2>0$, the parabola that represents the function opens upward. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + When $a_2<0$, the parabola that represents $y=g(x)$ opens $\ldots$ + \begin{shortsolution} + When $a_2<0$, the parabola that represents the function opens downward. + \end{shortsolution} + \end{subproblem} + \end{problem} + \end{essentialskills} + + \subsection*{Power functions with positive exponents} + The study of polynomials will rely upon a good knowledge + of power functions| you may reasonably ask, what is a power function? + \begin{pccdefinition}[Power functions] + Power functions have the form + \[ + f(x) = a_n x^n + \] + where $n$ can be any real number. + + Note that for this section we will only be concerned with the + case when $n$ is a positive integer. + \end{pccdefinition} + + You may find assurance in the fact that you are already very comfortable + with power functions that have $n=1$ (linear) and $n=2$ (quadratic). Let's + explore some power functions that you might not be so familiar with. + As you read \cref{poly:ex:oddpow,poly:ex:evenpow}, try and spot + as many patterns and similarities as you can. + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Power functions with odd positive exponents] + \label{poly:ex:oddpow} + Graph each of the following functions, state their domain, and their + long-run behavior as $x\rightarrow\pm\infty$ + \[ + f(x)=x^3, \qquad g(x)=x^5, \qquad h(x)=x^7 + \] + \begin{pccsolution} + The functions $f$, $g$, and $h$ are plotted in \cref{poly:fig:oddpow}. + The domain of each of the functions $f$, $g$, and $h$ is $(-\infty,\infty)$. Note that + the long-run behavior of each of the functions is the same, and in particular + \begin{align*} + f(x)\rightarrow\infty & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} f(x)\rightarrow-\infty & \text{ as } x\rightarrow-\infty + \end{align*} + The same results hold for $g$ and $h$. + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htb] + \begin{minipage}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-1.5,xmax=1.5, + ymin=-5,ymax=5, + xtick={-1.0,-0.5,...,1.0}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\textwidth, + legend pos=north west, + ] + \addplot expression[domain=-1.5:1.5]{x^3}; + \addplot expression[domain=-1.379:1.379]{x^5}; + \addplot expression[domain=-1.258:1.258]{x^7}; + \addplot[soldot]coordinates{(-1,-1)} node[axisnode,anchor=north west]{$(-1,-1)$}; + \addplot[soldot]coordinates{(1,1)} node[axisnode,anchor=south east]{$(1,1)$}; + \legend{$f$,$g$,$h$} + \end{axis} + \end{tikzpicture} + \caption{Odd power functions} + \label{poly:fig:oddpow} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-2.5,xmax=2.5, + ymin=-5,ymax=5, + xtick={-2.0,-1.5,...,2.0}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\textwidth, + legend pos=south east, + ] + \addplot expression[domain=-2.236:2.236]{x^2}; + \addplot expression[domain=-1.495:1.495]{x^4}; + \addplot expression[domain=-1.307:1.307]{x^6}; + \addplot[soldot]coordinates{(-1,1)} node[axisnode,anchor=east]{$(-1,1)$}; + \addplot[soldot]coordinates{(1,1)} node[axisnode,anchor=west]{$(1,1)$}; + \legend{$F$,$G$,$H$} + \end{axis} + \end{tikzpicture} + \caption{Even power functions} + \label{poly:fig:evenpow} + \end{minipage}% + \end{figure} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Power functions with even positive exponents]\label{poly:ex:evenpow}% + Graph each of the following functions, state their domain, and their + long-run behavior as $x\rightarrow\pm\infty$ + \[ + F(x)=x^2, \qquad G(x)=x^4, \qquad H(x)=x^6 + \] + \begin{pccsolution} + The functions $F$, $G$, and $H$ are plotted in \cref{poly:fig:evenpow}. The domain + of each of the functions is $(-\infty,\infty)$. Note that the long-run behavior + of each of the functions is the same, and in particular + \begin{align*} + F(x)\rightarrow\infty & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} F(x)\rightarrow\infty & \text{ as } x\rightarrow-\infty + \end{align*} + The same result holds for $G$ and $H$. + \end{pccsolution} + \end{pccexample} + + \begin{doyouunderstand} + \begin{problem} + Repeat \cref{poly:ex:oddpow,poly:ex:evenpow} using (respectively) + \begin{subproblem} + $f(x)=-x^3, \qquad g(x)=-x^5, \qquad h(x)=-x^7$ + \begin{shortsolution} + The functions $f$, $g$, and $h$ have domain $(-\infty,\infty)$ and + are graphed below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-1.5,xmax=1.5, + ymin=-5,ymax=5, + xtick={-1.0,-0.5,...,0.5}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + legend pos=north east, + ] + \addplot expression[domain=-1.5:1.5]{-x^3}; + \addplot expression[domain=-1.379:1.379]{-x^5}; + \addplot expression[domain=-1.258:1.258]{-x^7}; + \legend{$f$,$g$,$h$} + \end{axis} + \end{tikzpicture} + + Note that + \begin{align*} + f(x)\rightarrow-\infty & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} f(x)\rightarrow\infty & \text{ as } x\rightarrow-\infty + \end{align*} + The same is true for $g$ and $h$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $F(x)=-x^2, \qquad G(x)=-x^4, \qquad H(x)=-x^6$ + \begin{shortsolution} + The functions $F$, $G$, and $H$ have domain $(-\infty,\infty)$ and + are graphed below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-2.5,xmax=2.5, + ymin=-5,ymax=5, + xtick={-1.0,-0.5,...,0.5}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + legend pos=north east, + ] + \addplot expression[domain=-2.236:2.236]{-x^2}; + \addplot expression[domain=-1.495:1.495]{-x^4}; + \addplot expression[domain=-1.307:1.307]{-x^6}; + \legend{$F$,$G$,$H$} + \end{axis} + \end{tikzpicture} + + Note that + \begin{align*} + F(x)\rightarrow-\infty & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} F(x)\rightarrow-\infty & \text{ as } x\rightarrow-\infty + \end{align*} + The same is true for $G$ and $H$. + \end{shortsolution} + \end{subproblem} + \end{problem} + \end{doyouunderstand} + + \subsection*{Polynomial functions} + Now that we have a little more familiarity with power functions, + we can define polynomial functions. Provided that you were comfortable + with our opening discussion about linear and quadratic functions (see + $f$ and $g$ in \cref{poly:eq:linquad}) then there is every chance + that you'll be able to master polynomial functions as well; just remember + that polynomial functions are a natural generalization of linear + and quadratic functions. Once you've studied the examples and problems + in this section, you'll hopefully agree that polynomial functions + are remarkably predictable. + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccdefinition}[Polynomial functions] + Polynomial functions have the form + \[ + p(x)=a_nx^n+a_{n-1}x^{n-1}+\ldots+a_1x+a_0 + \] + where $a_n$, $a_{n-1}$, $a_{n-2}$, \ldots, $a_0$ are real numbers. + \begin{itemize} + \item We call $n$ the degree of the polynomial, and require that $n$ + is a non-negative integer; + \item $a_n$, $a_{n-1}$, $a_{n-2}$, \ldots, $a_0$ are called the coefficients; + \item We typically write polynomial functions in descending powers of $x$. + \end{itemize} + In particular, we call $a_n$ the \emph{leading} coefficient, and $a_nx^n$ the + \emph{leading term}. + + Note that if a polynomial is given in factored form, then the degree can be found + by counting the number of linear factors. + \end{pccdefinition} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Polynomial or not] + Identify the following functions as polynomial or not; if the function + is a polynomial, state its degree. + \begin{multicols}{3} + \begin{enumerate} + \item $p(x)=x^2-3$ + \item $q(x)=-4x^{\nicefrac{1}{2}}+10$ + \item $r(x)=10x^5$ + \item $s(x)=x^{-2}+x^{23}$ + \item $f(x)=-8$ + \item $g(x)=3^x$ + \item $h(x)=\sqrt[3]{x^7}-x^2+x$ + \item $k(x)=4x(x+2)(x-3)$ + \item $j(x)=x^2(x-4)(5-x)$ + \end{enumerate} + \end{multicols} + \begin{pccsolution} + \begin{enumerate} + \item $p$ is a polynomial, and its degree is $2$. + \item $q$ is \emph{not} a polynomial, because $\frac{1}{2}$ is not an integer. + \item $r$ is a polynomial, and its degree is $5$. + \item $s$ is \emph{not} a polynomial, because $-2$ is not a positive integer. + \item $f$ is a polynomial, and its degree is $0$. + \item $g$ is \emph{not} a polynomial, because the independent + variable, $x$, is in the exponent. + \item $h$ is \emph{not} a polynomial, because $\frac{7}{3}$ is not an integer. + \item $k$ is a polynomial, and its degree is $3$. + \item $j$ is a polynomial, and its degree is $4$. + \end{enumerate} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Typical graphs]\label{poly:ex:typical} + \Cref{poly:fig:typical} shows graphs of some polynomial functions; + the ticks have deliberately been left off the axis to allow us to concentrate + on the features of each graph. Note in particular that: + \begin{itemize} + \item \cref{poly:fig:typical1} shows a degree-$1$ polynomial (you might also + classify the function as linear) whose leading coefficient, $a_1$, is positive. + \item \cref{poly:fig:typical2} shows a degree-$2$ polynomial (you might also + classify the function as quadratic) whose leading coefficient, $a_2$, is positive. + \item \cref{poly:fig:typical3} shows a degree-$3$ polynomial whose leading coefficient, $a_3$, + is positive| compare its overall + shape and long-run behavior to the functions described in \cref{poly:ex:oddpow}. + \item \cref{poly:fig:typical4} shows a degree-$4$ polynomial whose leading coefficient, $a_4$, + is positive|compare its overall shape and long-run behavior to the functions described in \cref{poly:ex:evenpow}. + \item \cref{poly:fig:typical5} shows a degree-$5$ polynomial whose leading coefficient, $a_5$, + is positive| compare its overall + shape and long-run behavior to the functions described in \cref{poly:ex:oddpow}. + \end{itemize} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{\textwidth/6} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-10:8]{(x+2)}; + \end{axis} + \end{tikzpicture} + \caption{$a_1>0$} + \label{poly:fig:typical1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-4:4]{(x^2-6)}; + \end{axis} + \end{tikzpicture} + \caption{$a_2>0$} + \label{poly:fig:typical2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-7.5:7.5]{0.05*(x+6)*x*(x-6)}; + \end{axis} + \end{tikzpicture} + \caption{$a_3>0$} + \label{poly:fig:typical3} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-2.35:5.35,samples=100]{0.2*(x-5)*x*(x-3)*(x+2)}; + \end{axis} + \end{tikzpicture} + \caption{$a_4>0$} + \label{poly:fig:typical4} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-5.5:6.3,samples=100]{0.01*(x+2)*x*(x-3)*(x+5)*(x-6)}; + \end{axis} + \end{tikzpicture} + \caption{$a_5>0$} + \label{poly:fig:typical5} + \end{subfigure} + \end{widepage} + \caption{Graphs to illustrate typical curves of polynomial functions.} + \label{poly:fig:typical} + \end{figure} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{doyouunderstand} + \begin{problem} + Use \cref{poly:ex:typical} and \cref{poly:fig:typical} to help you sketch + the graphs of polynomial functions that have negative leading coefficients| note + that there are many ways to do this! The intention with this problem + is to use your knowledge of transformations- in particular, \emph{reflections}- + to guide you. + \begin{shortsolution} + $a_1<0$: + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-10:8]{-(x+2)}; + \end{axis} + \end{tikzpicture} + + $a_2<0$ + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-4:4]{-(x^2-6)}; + \end{axis} + \end{tikzpicture} + + $a_3<0$ + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-7.5:7.5]{-0.05*(x+6)*x*(x-6)}; + \end{axis} + \end{tikzpicture} + + $a_4<0$ + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-2.35:5.35,samples=100]{-0.2*(x-5)*x*(x-3)*(x+2)}; + \end{axis} + \end{tikzpicture} + + $a_5<0$ + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-5.5:6.3,samples=100]{-0.01*(x+2)*x*(x-3)*(x+5)*(x-6)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{problem} + \end{doyouunderstand} + + \fixthis{poly: Need a more basic example here- it can have a similar + format to the multiple zeros example, but just keep it simple; it should + be halfway between the 2 examples surrounding it} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Multiple zeros] + Consider the polynomial functions $p$, $q$, and $r$ which are + graphed in \cref{poly:fig:moremultiple}. + The formulas for $p$, $q$, and $r$ are as follows + \begin{align*} + p(x) & =(x-3)^2(x+4)^2 \\ + q(x) & =x(x+2)^2(x-1)^2(x-3) \\ + r(x) & =x(x-3)^3(x+1)^2 + \end{align*} + Find the degree of $p$, $q$, and $r$, and decide if the functions bounce off or cut + through the horizontal axis at each of their zeros. + \begin{pccsolution} + The degree of $p$ is 4. Referring to \cref{poly:fig:bouncep}, + the curve bounces off the horizontal axis at both zeros, $3$ and $4$. + + The degree of $q$ is 6. Referring to \cref{poly:fig:bounceq}, + the curve bounces off the horizontal axis at $-2$ and $1$, and cuts + through the horizontal axis at $0$ and $3$. + + The degree of $r$ is 6. Referring to \cref{poly:fig:bouncer}, + the curve bounces off the horizontal axis at $-1$, and cuts through + the horizontal axis at $0$ and at $3$, although is flattened immediately to the left and right of $3$. + \end{pccsolution} + \end{pccexample} + + \setlength{\figurewidth}{0.25\textwidth} + \begin{figure}[!htb] + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-6,xmax=5, + ymin=-30,ymax=200, + xtick={-4,-2,...,4}, + width=\textwidth, + ] + \addplot expression[domain=-5.63733:4.63733,samples=50]{(x-3)^2*(x+4)^2}; + \addplot[soldot]coordinates{(3,0)(-4,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=p(x)$} + \label{poly:fig:bouncep} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-3,xmax=4, + xtick={-2,...,3}, + ymin=-60,ymax=40, + width=\textwidth, + ] + \addplot+[samples=50] expression[domain=-2.49011:3.11054]{x*(x+2)^2*(x-1)^2*(x-3)}; + \addplot[soldot]coordinates{(-2,0)(0,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=q(x)$} + \label{poly:fig:bounceq} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-2,xmax=4, + xtick={-1,...,3}, + ymin=-40,ymax=40, + width=\textwidth, + ] + \addplot expression[domain=-1.53024:3.77464,samples=50]{x*(x-3)^3*(x+1)^2}; + \addplot[soldot]coordinates{(-1,0)(0,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=r(x)$} + \label{poly:fig:bouncer} + \end{subfigure} + \caption{} + \label{poly:fig:moremultiple} + \end{figure} + + \begin{pccdefinition}[Multiple zeros]\label{poly:def:multzero} + Let $p$ be a polynomial that has a repeated linear factor $(x-a)^n$. Then we say + that $p$ has a multiple zero at $a$ of multiplicity $n$ and + \begin{itemize} + \item if the factor $(x-a)$ is repeated an even number of times, the graph of $y=p(x)$ does not + cross the $x$ axis at $a$, but `bounces' off the horizontal axis at $a$. + \item if the factor $(x-a)$ is repeated an odd number of times, the graph of $y=p(x)$ crosses the + horizontal axis at $a$, but it looks `flattened' there + \end{itemize} + If $n=1$, then we say that $p$ has a \emph{simple} zero at $a$. + \end{pccdefinition} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Find a formula] + Find formulas for the polynomial functions, $p$ and $q$, graphed in \cref{poly:fig:findformulademoboth}. + \begin{figure}[!htb] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[framed, + xmin=-5,xmax=5, + ymin=-10,ymax=10, + xtick={-4,-2,...,4}, + minor xtick={-3,-1,...,3}, + ytick={-8,-6,...,8}, + width=\textwidth, + grid=both] + \addplot expression[domain=-3.25842:2.25842,samples=50]{-x*(x-2)*(x+3)*(x+1)}; + \addplot[soldot]coordinates{(1,8)}node[axisnode,inner sep=.35cm,anchor=west]{$(1,8)$}; + \addplot[soldot]coordinates{(-3,0)(-1,0)(0,0)(2,0)}; + \end{axis} + \end{tikzpicture} + \caption{$p$} + \label{poly:fig:findformulademo} + \end{subfigure} + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[framed, + xmin=-5,xmax=5, + ymin=-10,ymax=10, + xtick={-4,-2,...,4}, + minor xtick={-3,-1,...,3}, + ytick={-8,-6,...,8}, + width=\textwidth, + grid=both] + \addplot expression[domain=-4.33:4.08152]{-.25*(x+2)^2*(x-3)}; + \addplot[soldot]coordinates{(2,4)}node[axisnode,anchor=south west]{$(2,4)$}; + \addplot[soldot]coordinates{(-2,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$q$} + \label{poly:fig:findformulademo1} + \end{subfigure} + \caption{} + \label{poly:fig:findformulademoboth} + \end{figure} + \begin{pccsolution} + \begin{enumerate} + \item We begin by noting that the horizontal intercepts of $p$ are $(-3,0)$, $(-1,0)$, $(0,0)$ and $(2,0)$. + We also note that each zero is simple (multiplicity $1$). + If we assume that $p$ has no other zeros, then we can start by writing + \begin{align*} + p(x) & =(x+3)(x+1)(x-0)(x-2) \\ + & =x(x+3)(x+1)(x-2) \\ + \end{align*} + According to \cref{poly:fig:findformulademo}, the point $(1,8)$ lies + on the curve $y=p(x)$. + Let's check if the formula we have written satisfies this requirement + \begin{align*} + p(1) & = (1)(4)(2)(-1) \\ + & = -8 + \end{align*} + which is clearly not correct| it is close though. We can correct this by + multiplying $p$ by a constant $k$; so let's assume that + \[ + p(x)=kx(x+3)(x+1)(x-2) + \] + Then $p(1)=-8k$, and if this is to equal $8$, then $k=-1$. Therefore + the formula for $p(x)$ is + \[ + p(x)=-x(x+3)(x+1)(x-2) + \] + \item The function $q$ has a zero at $-2$ of multiplicity $2$, and zero of + multiplicity $1$ at $3$ (so $3$ is a simple zero of $q$); we can therefore assume that $q$ has the form + \[ + q(x)=k(x+2)^2(x-3) + \] + where $k$ is some real number. In order to find $k$, we use the given ordered pair, $(2,4)$, and + evaluate $p(2)$ + \begin{align*} + p(2) & =k(4)^2(-1) \\ + & =-16k + \end{align*} + We solve the equation $4=-8k$ and obtain $k=-\frac{1}{4}$ and conclude that the + formula for $q(x)$ is + \[ + q(x)=-\frac{1}{4}(x+2)^2(x-3) + \] + \end{enumerate} + \end{pccsolution} + \end{pccexample} + + + \fixthis{Chris: need sketching polynomial problems} + \begin{pccspecialcomment}[Steps to follow when sketching polynomial functions] + \begin{steps} + \item \label{poly:step:first} Determine the degree of the polynomial, + its leading term and leading coefficient, and hence determine + the long-run behavior of the polynomial| does it behave like $\pm x^2$ or $\pm x^3$ + as $x\rightarrow\pm\infty$? + \item Determine the zeros and their multiplicity. Mark all zeros + and the vertical intercept on the graph using solid circles $\bullet$. + \item \label{poly:step:last} Deduce the overall shape of the curve, and sketch it. If there isn't + enough information from the previous steps, then construct a table of values. + \end{steps} + Remember that until we have the tools of calculus, we won't be able to + find the exact coordinates of local minimums, local maximums, and points + of inflection. + \end{pccspecialcomment} + Before we demonstrate some examples, it is important to remember the following: + \begin{itemize} + \item our sketches will give a good representation of the overall + shape of the graph, but until we have the tools of calculus (from MTH 251) + we can not find local minimums, local maximums, and inflection points algebraically. This + means that we will make our best guess as to where these points are. + \item we will not concern ourselves too much with the vertical scale (because of + our previous point)| we will, however, mark the vertical intercept (assuming there is one), + and any horizontal asymptotes. + \end{itemize} + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{poly:ex:simplecubic} + Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $p$ + that has formula + \[ + p(x)=\frac{1}{2}(x-4)(x-1)(x+3) + \] + \begin{pccsolution} + \begin{steps} + \item $p$ has degree $3$. The leading term of $p$ is $\frac{1}{2}x^3$, so the leading coefficient of $p$ + is $\frac{1}{2}$. The long-run behavior of $p$ is therefore similar to that of $x^3$. + \item The zeros of $p$ are $-3$, $1$, and $4$; each zero is simple (i.e, it has multiplicity $1$). + This means that the curve of $p$ cuts the horizontal axis at each zero. The vertical + intercept of $p$ is $(0,6)$. + \item We draw the details we have obtained so far on \cref{poly:fig:simplecubicp1}. Given + that the curve of $p$ looks like the curve of $x^3$ in the long-run, we are able to complete a sketch of the + graph of $p$ in \cref{poly:fig:simplecubicp2}. + + Note that we can not find the coordinates of the local minimums, local maximums, and inflection + points| for the moment we make reasonable guesses as to where these points are (you'll find how + to do this in calculus). + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=15, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-3,0)(1,0)(4,0)(0,6)}node[axisnode,anchor=south west]{$(0,6)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:simplecubicp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=15, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-3,0)(1,0)(4,0)(0,6)}node[axisnode,anchor=south west]{$(0,6)$}; + \addplot[pccplot] expression[domain=-3.57675:4.95392,samples=100]{.5*(x-4)*(x-1)*(x+3)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:simplecubicp2} + \end{subfigure}% + \caption{$y=\dfrac{1}{2}(x-4)(x-1)(x+3)$} + \label{poly:fig:simplecubic} + \end{figure} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{poly:ex:degree5} + Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $q$ + that has formula + \[ + q(x)=\frac{1}{200}(x+7)^2(2-x)(x-6)^2 + \] + \begin{pccsolution} + \begin{steps} + \item $q$ has degree $4$. The leading term of $q$ is + \[ + -\frac{1}{200}x^5 + \] + so the leading coefficient of $q$ is $-\frac{1}{200}$. The long-run behavior of $q$ + is therefore similar to that of $-x^5$. + \item The zeros of $q$ are $-7$ (multiplicity 2), $2$ (simple), and $6$ (multiplicity $2$). + The curve of $q$ bounces off the horizontal axis at the zeros with multiplicity $2$ and + cuts the horizontal axis at the simple zeros. The vertical intercept of $q$ is $\left( 0,\frac{441}{25} \right)$. + \item We mark the details we have found so far on \cref{poly:fig:degree5p1}. Given that + the curve of $q$ looks like the curve of $-x^5$ in the long-run, we can complete \cref{poly:fig:degree5p2}. + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=40, + xtick={-8,-6,...,8}, + ytick={-5,0,...,35}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-7,0)(2,0)(6,0)(0,441/25)}node[axisnode,anchor=south west]{$\left( 0, \frac{441}{25} \right)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:degree5p1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=40, + xtick={-8,-6,...,8}, + ytick={-5,0,...,35}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-7,0)(2,0)(6,0)(0,441/25)}node[axisnode,anchor=south west]{$\left( 0, \frac{441}{25} \right)$}; + \addplot[pccplot] expression[domain=-8.83223:7.34784,samples=50]{1/200*(x+7)^2*(2-x)*(x-6)^2}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:degree5p2} + \end{subfigure}% + \caption{$y=\dfrac{1}{200}(x+7)^2(2-x)(x-6)^2$} + \label{poly:fig:degree5} + \end{figure} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample} + Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $r$ + that has formula + \[ + r(x)=\frac{1}{100}x^3(x+4)(x-4)(x-6) + \] + \begin{pccsolution} + \begin{steps} + \item $r$ has degree $6$. The leading term of $r$ is + \[ + \frac{1}{100}x^6 + \] + so the leading coefficient of $r$ is $\frac{1}{100}$. The long-run behavior of $r$ + is therefore similar to that of $x^6$. + \item The zeros of $r$ are $-4$ (simple), $0$ (multiplicity $3$), $4$ (simple), + and $6$ (simple). The vertical intercept of $r$ is $(0,0)$. The curve of $r$ + cuts the horizontal axis at the simple zeros, and goes through the axis + at $(0,0)$, but does so in a flattened way. + \item We mark the zeros and vertical intercept on \cref{poly:fig:degree6p1}. Given that + the curve of $r$ looks like the curve of $x^6$ in the long-run, we complete the graph + of $r$ in \cref{poly:fig:degree6p2}. + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=10, + ymin=-20,ymax=10, + xtick={-4,-2,...,8}, + ytick={-15,-10,...,5}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-4,0)(0,0)(4,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:degree6p1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=10, + ymin=-20,ymax=10, + xtick={-4,-2,...,8}, + ytick={-15,-10,...,5}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-4,0)(0,0)(4,0)(6,0)}; + \addplot[pccplot] expression[domain=-4.16652:6.18911,samples=100]{1/100*(x+4)*x^3*(x-4)*(x-6)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:degree6p2} + \end{subfigure}% + \caption{$y=\dfrac{1}{100}(x+4)x^3(x-4)(x-6)$} + \end{figure} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[An open-topped box] + A cardboard company makes open-topped boxes for their clients. The specifications + dictate that the box must have a square base, and that it must be open-topped. + The company uses sheets of cardboard that are $\unit[1200]{cm^2}$. Assuming that + the base of each box has side $x$ (measured in cm), it can be shown that the volume of each box, $V(x)$, + has formula + \[ + V(x)=\frac{x}{4}(1200-x^2) + \] + Find the dimensions of the box that maximize the volume. + \begin{pccsolution} + We graph $y=V(x)$ in \cref{poly:fig:opentoppedbox}. Note that because + $x$ represents the length of a side, and $V(x)$ represents the volume + of the box, we necessarily require both values to be positive; we illustrate + the part of the curve that applies to this problem using a solid line. + + \begin{figure}[!htb] + \centering + \begin{tikzpicture} + \begin{axis}[framed, + xmin=-50,xmax=50, + ymin=-5000,ymax=5000, + xtick={-40,-30,...,40}, + minor xtick={-45,-35,...,45}, + minor ytick={-3000,-1000,1000,3000}, + width=.75\textwidth, + height=.5\textwidth, + grid=both] + \addplot[pccplot,dashed,<-] expression[domain=-40:0,samples=50]{x/4*(1200-x^2)}; + \addplot[pccplot,-] expression[domain=0:34.64,samples=50]{x/4*(1200-x^2)}; + \addplot[pccplot,dashed,->] expression[domain=34.64:40,samples=50]{x/4*(1200-x^2)}; + \addplot[soldot] coordinates{(20,4000)}; + \end{axis} + \end{tikzpicture} + \caption{$y=V(x)$} + \label{poly:fig:opentoppedbox} + \end{figure} + + According to \cref{poly:fig:opentoppedbox}, the maximum volume of such a box is + approximately $\unit[4000]{cm^2}$, and we achieve it using a base of length + approximately $\unit[20]{cm}$. Since the base is square and each sheet of cardboard + is $\unit[1200]{cm^2}$, we conclude that the dimensions of each box are $\unit[20]{cm}\times\unit[20]{cm}\times\unit[30]{cm}$. + \end{pccsolution} + \end{pccexample} + + \subsection*{Complex zeros} + There has been a pattern to all of the examples that we have seen so far| + the degree of the polynomial has dictated the number of \emph{real} zeros that the + polynomial has. For example, the function $p$ in \cref{poly:ex:simplecubic} + has degree $3$, and $p$ has $3$ real zeros; the function $q$ in \cref{poly:ex:degree5} + has degree $5$ and $q$ has $5$ real zeros. + + You may wonder if this result can be generalized| does every polynomial that + has degree $n$ have $n$ real zeros? Before we tackle the general result, + let's consider an example that may help motivate it. + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccexample}\label{poly:ex:complx} + Consider the polynomial function $c$ that has formula + \[ + c(x)=x(x^2+1) + \] + It is clear that $c$ has degree $3$, and that $c$ has a (simple) zero at $0$. Does + $c$ have any other zeros, i.e, can we find any values of $x$ that satisfy the equation + \begin{equation}\label{poly:eq:complx} + x^2+1=0 + \end{equation} + The solutions to \cref{poly:eq:complx} are $\pm i$. + + We conclude that $c$ has $3$ zeros: $0$ and $\pm i$; we note that \emph{not + all of them are real}. + \end{pccexample} + \Cref{poly:ex:complx} shows that not every degree-$3$ polynomial has $3$ + \emph{real} zeros; however, if we are prepared to venture into the complex numbers, + then we can state the following theorem. + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccspecialcomment}[The fundamental theorem of algebra] + Every polynomial function of degree $n$ has $n$ roots, some of which may + be complex, and some may be repeated. + \end{pccspecialcomment} + \fixthis{Fundamental theorem of algebra: is this wording ok? do we want + it as a theorem?} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccexample} + Find all the zeros of the polynomial function $p$ that has formula + \[ + p(x)=x^4-2x^3+5x^2 + \] + \begin{pccsolution} + We begin by factoring $p$ + \begin{align*} + p(x) & =x^4-2x^3+5x^2 \\ + & =x^2(x^2-2x+5) + \end{align*} + We note that $0$ is a zero of $p$ with multiplicity $2$. The other zeros of $p$ + can be found by solving the equation + \[ + x^2-2x+5=0 + \] + This equation can not be factored, so we use the quadratic formula + \begin{align*} + x & =\frac{2\pm\sqrt{(-2)^2}-20}{2(1)} \\ + & =\frac{2\pm\sqrt{-16}}{2} \\ + & =1\pm 2i + \end{align*} + We conclude that $p$ has $4$ zeros: $0$ (multiplicity $2$), and $1\pm 2i$ (simple). + \end{pccsolution} + \end{pccexample} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccexample} + Find a polynomial that has zeros at $2\pm i\sqrt{2}$. + \begin{pccsolution} + We know that the zeros of a polynomial can be found by analyzing the linear + factors. We are given the zeros, and have to work backwards to find the + linear factors. + + We begin by assuming that $p$ has the form + \begin{align*} + p(x) & =(x-(2-i\sqrt{2}))(x-(2+i\sqrt{2})) \\ + & =x^2-x(2+i\sqrt{2})-x(2-i\sqrt{2})+(2-i\sqrt{2})(2+i\sqrt{2}) \\ + & =x^2-4x+(4-2i^2) \\ + & =x^2-4x+6 + \end{align*} + We conclude that a possible formula for a polynomial function, $p$, + that has zeros at $2\pm i\sqrt{2}$ is + \[ + p(x)=x^2-4x+6 + \] + Note that we could multiply $p$ by any real number and still ensure + that $p$ has the same zeros. + \end{pccsolution} + \end{pccexample} + \investigation*{} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a graph] + For each of the polynomials in \cref{poly:fig:findformula} + \begin{enumerate} + \item count the number of times the curve turns round, and cuts/bounces off the $x$ axis; + \item approximate the degree of the polynomial; + \item use your information to find the linear factors of each polynomial, and therefore write a possible formula for each; + \item make sure your polynomial goes through the given ordered pair. + \end{enumerate} + \begin{shortsolution} + \Vref{poly:fig:findformdeg2}: + \begin{enumerate} + \item the curve turns round once; + \item the degree could be 2; + \item based on the zeros, the linear factors are $(x+5)$ and $(x-3)$; since the + graph opens downwards, we will assume the leading coefficient is negative: $p(x)=-k(x+5)(x-3)$; + \item $p$ goes through $(2,2)$, so we need to solve $2=-k(7)(-1)$ and therefore $k=\nicefrac{2}{7}$, so + \[ + p(x)=-\frac{2}{7}(x+5)(x-3) + \] + \end{enumerate} + \Vref{poly:fig:findformdeg3}: + \begin{enumerate} + \item the curve turns around twice; + \item the degree could be 3; + \item based on the zeros, the linear factors are $(x+2)^2$, and $(x-1)$; + based on the behavior of $p$, we assume that the leading coefficient is positive, and try $p(x)=k(x+2)^2(x-1)$; + \item $p$ goes through $(0,-2)$, so we need to solve $-2=k(4)(-1)$ and therefore $k=\nicefrac{1}{2}$, so + \[ + p(x)=\frac{1}{2}(x+2)^2(x-1) + \] + \end{enumerate} + \Vref{poly:fig:findformdeg5}: + \begin{enumerate} + \item the curve turns around 4 times; + \item the degree could be 5; + \item based on the zeros, the linear factors are $(x+5)^2$, $(x+1)$, $(x-2)$, $(x-3)$; + based on the behavior of $p$, we assume that the leading coefficient is positive, and try $p(x)=k(x+5)^2(x+1)(x-2)(x-3)$; + \item $p$ goes through $(-3,-50)$, so we need to solve $-50=k(64)(-2)(-5)(-6)$ and therefore $k=\nicefrac{5}{384}$, so + \[ + p(x)=\frac{5}{384}(x+5)^2(x+1)(x-2)(x-3) + \] + \end{enumerate} + \end{shortsolution} + \end{problem} + + + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-2,ymax=5, + width=\textwidth, + ] + \addplot expression[domain=-4.5:3.75]{-1/3*(x+4)*(x-3)}; + \addplot[soldot] coordinates{(-4,0)(3,0)(2,2)} node[axisnode,above right]{$(2,2)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:findformdeg2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-3,xmax=2, + ymin=-2,ymax=4, + xtick={-2,...,1}, + width=\textwidth, + ] + \addplot expression[domain=-2.95:1.75]{1/3*(x+2)^2*(x-1)}; + \addplot[soldot]coordinates{(-2,0)(1,0)(0,-1.33)}node[axisnode,anchor=north west]{$(0,-2)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:findformdeg3} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-100,ymax=150, + width=\textwidth, + ] + \addplot expression[domain=-4.5:3.4,samples=50]{(x+4)^2*(x+1)*(x-2)*(x-3)}; + \addplot[soldot]coordinates{(-4,0)(-1,0)(2,0)(3,0)(-3,-60)}node[axisnode,anchor=north]{$(-3,-50)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:findformdeg5} + \end{subfigure} + \caption{} + \label{poly:fig:findformula} + \end{figure} + + + + + \begin{exercises} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Prerequisite classifacation skills] + Decide if each of the following functions are linear or quadratic. + \begin{multicols}{3} + \begin{subproblem} + $f(x)=2x+3$ + \begin{shortsolution} + $f$ is linear. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $g(x)=10-7x$ + \begin{shortsolution} + $g$ is linear + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $h(x)=-x^2+3x-9$ + \begin{shortsolution} + $h$ is quadratic. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $k(x)=-17$ + \begin{shortsolution} + $k$ is linear. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $l(x)=-82x^2-4$ + \begin{shortsolution} + $l$ is quadratic + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $m(x)=6^2x-8$ + \begin{shortsolution} + $m$ is linear. + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Prerequisite slope identification] + State the slope of each of the following linear functions, and + hence decide if each function is increasing or decreasing. + \begin{multicols}{4} + \begin{subproblem} + $\alpha(x)=4x+1$ + \begin{shortsolution} + $m=4$; $\alpha$ is increasing. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\beta(x)=-9x$ + \begin{shortsolution} + $m=-9$; $\beta$ is decreasing. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\gamma(t)=18t+100$ + \begin{shortsolution} + $m=18$; $\gamma$ is increasing. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\delta(y)=23-y$ + \begin{shortsolution} + $m=-1$; $\delta$ is decreasing. + \end{shortsolution} + \end{subproblem} + \end{multicols} + Now let's generalize our findings for the most general linear function $f$ + that has formula $f(x)=mx+b$. Complete the following sentences. + \begin{subproblem} + When $m>0$, the function $f$ is $\ldots$ + \begin{shortsolution} + When $m>0$, the function $f$ is $\ldots$ \emph{increasing}. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + When $m<0$, the function $f$ is $\ldots$ + \begin{shortsolution} + When $m<0$, the function $f$ is $\ldots$ \emph{decreasing}. + \end{shortsolution} + \end{subproblem} + \end{problem} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Polynomial or not?] + Identify whether each of the following functions is a polynomial or not. + If the function is a polynomial, state its degree. + \begin{multicols}{3} + \begin{subproblem} + $p(x)=2x+1$ + \begin{shortsolution} + $p$ is a polynomial (you might also describe $p$ as linear). The degree of $p$ is 1. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=7x^2+4x$ + \begin{shortsolution} + $p$ is a polynomial (you might also describe $p$ as quadratic). The degree of $p$ is 2. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=\sqrt{x}+2x+1$ + \begin{shortsolution} + $p$ is not a polynomial; we require the powers of $x$ to be integer values. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=2^x-45$ + \begin{shortsolution} + $p$ is not a polynomial; the $2^x$ term is exponential. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=6x^4-5x^3+9$ + \begin{shortsolution} + $p$ is a polynomial, and the degree of $p$ is $6$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=-5x^{17}+9x+2$ + \begin{shortsolution} + $p$ is a polynomial, and the degree of $p$ is 17. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=4x(x+7)^2(x-3)^3$ + \begin{shortsolution} + $p$ is a polynomial, and the degree of $p$ is $6$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=4x^{-5}-x^2+x$ + \begin{shortsolution} + $p$ is not a polynomial because $-5$ is not a positive integer. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=-x^6(x^2+1)(x^3-2)$ + \begin{shortsolution} + $p$ is a polynomial, and the degree of $p$ is $11$. + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Polynomial graphs] + Three polynomial functions $p$, $m$, and $n$ are shown in \crefrange{poly:fig:functionp}{poly:fig:functionn}. + The functions have the following formulas + \begin{align*} + p(x) & = (x-1)(x+2)(x-3) \\ + m(x) & = -(x-1)(x+2)(x-3) \\ + n(x) & = (x-1)(x+2)(x-3)(x+1)(x+4) + \end{align*} + Note that for our present purposes we are not concerned with the vertical scale of the graphs. + \begin{subproblem} + Identify both on the graph {\em and} algebraically, the zeros of each polynomial. + \begin{shortsolution} + $y=p(x)$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-2.5:3.5,samples=50]{(x-1)*(x+2)*(x-3)}; + \addplot[soldot] coordinates{(-2,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + + $y=m(x)$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-2.5:3.5,samples=50]{-1*(x-1)*(x+2)*(x-3)}; + \addplot[soldot] coordinates{(-2,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + + $y=n(x)$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-90,ymax=70, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-4.15:3.15,samples=50]{(x-1)*(x+2)*(x-3)*(x+1)*(x+4)}; + \addplot[soldot] coordinates{(-4,0)(-2,0)(-1,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + + The zeros of $p$ are $-2$, $1$, and $3$; the zeros of $m$ are $-2$, $1$, and $3$; the zeros of $n$ are + $-4$, $-2$, $-1$, and $3$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Write down the degree, how many times the curve of each function `turns around', + and how many zeros it has + \begin{shortsolution} + \begin{itemize} + \item The degree of $p$ is 3, and the curve $y=p(x)$ turns around twice. + \item The degree of $q$ is also 3, and the curve $y=q(x)$ turns around twice. + \item The degree of $n$ is $5$, and the curve $y=n(x)$ turns around 4 times. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \end{problem} + + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-10,ymax=10, + ytick={-5,5}, + width=\textwidth, + ] + \addplot expression[domain=-2.5:3.5,samples=50]{(x-1)*(x+2)*(x-3)}; + \addplot[soldot]coordinates{(-2,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=p(x)$} + \label{poly:fig:functionp} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-10,ymax=10, + ytick={-5,5}, + width=\textwidth, + ] + \addplot expression[domain=-2.5:3.5,samples=50]{-1*(x-1)*(x+2)*(x-3)}; + \addplot[soldot]coordinates{(-2,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=m(x)$} + \label{poly:fig:functionm} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-90,ymax=70, + width=\textwidth, + ] + \addplot expression[domain=-4.15:3.15,samples=100]{(x-1)*(x+2)*(x-3)*(x+1)*(x+4)}; + \addplot[soldot]coordinates{(-4,0)(-2,0)(-1,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=n(x)$} + \label{poly:fig:functionn} + \end{subfigure} + \caption{} + \end{widepage} + \end{figure} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Horizontal intercepts]\label{poly:prob:matchpolys}% + State the horizontal intercepts (as ordered pairs) of the following polynomials. + \begin{multicols}{2} + \begin{subproblem}\label{poly:prob:degree5} + $p(x)=(x-1)(x+2)(x-3)(x+1)(x+4)$ + \begin{shortsolution} + $(-4,0)$, $(-2,0)$, $(-1,0)$, $(1,0)$, $(3,0)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $q(x)=-(x-1)(x+2)(x-3)$ + \begin{shortsolution} + $(-2,0)$, $(1,0)$, $(3,0)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(x)=(x-1)(x+2)(x-3)$ + \begin{shortsolution} + $(-2,0)$, $(1,0)$, $(3,0)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem}\label{poly:prob:degree2} + $s(x)=(x-2)(x+2)$ + \begin{shortsolution} + $(-2,0)$, $(2,0)$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Minimums, maximums, and concavity]\label{poly:prob:incdec} + Four polynomial functions are graphed in \cref{poly:fig:incdec}. The formulas + for these functions are (not respectively) + \begin{gather*} + p(x)=\frac{x^3}{6}-\frac{x^2}{4}-3x, \qquad q(x)=\frac{x^4}{20}+\frac{x^3}{15}-\frac{6}{5}x^2+1\\ + r(x)=-\frac{x^5}{50}-\frac{x^4}{40}+\frac{2x^3}{5}+6, \qquad s(x)=-\frac{x^6}{6000}-\frac{x^5}{2500}+\frac{67x^4}{4000}+\frac{17x^3}{750}-\frac{42x^2}{125} + \end{gather*} + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{.23\textwidth} + \centering + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + width=\textwidth, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=major, + ] + \addplot expression[domain=-5.28:4.68,samples=50]{-x^5/50-x^4/40+2*x^3/5+6}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:incdec3} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + width=\textwidth, + xmin=-10,xmax=10,ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=major, + ] + \addplot expression[domain=-6.08:4.967,samples=50]{x^4/20+x^3/15-6/5*x^2+1}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:incdec2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + width=\textwidth, + xmin=-6,xmax=8,ymin=-10,ymax=10, + xtick={-4,-2,...,6}, + ytick={-8,-4,4,8}, + minor ytick={-6,-2,...,6}, + grid=both, + ] + \addplot expression[domain=-4.818:6.081,samples=50]{x^3/6-x^2/4-3*x}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:incdec1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + width=\textwidth, + xmin=-10,xmax=10,ymin=-10,ymax=10, + xtick={-8,-4,4,8}, + ytick={-8,-4,4,8}, + minor xtick={-6,-2,...,6}, + minor ytick={-6,-2,...,6}, + grid=both, + ] + \addplot expression[domain=-9.77:8.866,samples=50]{-x^6/6000-x^5/2500+67*x^4/4000+17/750*x^3-42/125*x^2}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:incdec4} + \end{subfigure} + \caption{Graphs for \cref{poly:prob:incdec}.} + \label{poly:fig:incdec} + \end{widepage} + \end{figure} + \begin{subproblem} + Match each of the formulas with one of the given graphs. + \begin{shortsolution} + \begin{itemize} + \item $p$ is graphed in \vref{poly:fig:incdec1}; + \item $q$ is graphed in \vref{poly:fig:incdec2}; + \item $r$ is graphed in \vref{poly:fig:incdec3}; + \item $s$ is graphed in \vref{poly:fig:incdec4}. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Approximate the zeros of each function using the appropriate graph. + \begin{shortsolution} + \begin{itemize} + \item $p$ has simple zeros at about $-3.8$, $0$, and $5$. + \item $q$ has simple zeros at about $-5.9$, $-1$, $1$, and $4$. + \item $r$ has simple zeros at about $-5$, $-2.9$, and $4.1$. + \item $s$ has simple zeros at about $-9$, $-6$, $4.2$, $8.1$, and a zero of multiplicity $2$ at $0$. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Approximate the local maximums and minimums of each of the functions. + \begin{shortsolution} + \begin{itemize} + \item $p$ has a local maximum of approximately $3.9$ at $-2$, and a local minimum of approximately $-6.5$ at $3$. + \item $q$ has a local minimum of approximately $-10$ at $-4$, and $-4$ at $3$; $q$ has a local maximum of approximately $1$ at $0$. + \item $r$ has a local minimum of approximately $-5.5$ at $-4$, and a local maximum of approximately $10$ at $3$. + \item $s$ has a local maximum of approximately $5$ at $-8$, $0$ at $0$, and $5$ at $7$; $s$ has local minimums + of approximately $-3$ at $-4$, and $-1$ at $3$. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Approximate the global maximums and minimums of each of the functions. + \begin{shortsolution} + \begin{itemize} + \item $p$ does not have a global maximum, nor a global minimum. + \item $q$ has a global minimum of approximately $-10$; it does not have a global maximum. + \item $r$ does not have a global maximum, nor a global minimum. + \item $s$ has a global maximum of approximately $5$; it does not have a global minimum. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Approximate the intervals on which each function is increasing and decreasing. + \begin{shortsolution} + \begin{itemize} + \item $p$ is increasing on $(-\infty,-2)\cup (3,\infty)$, and decreasing on $(-2,3)$. + \item $q$ is increasing on $(-4,0)\cup (3,\infty)$, and decreasing on $(-\infty,-4)\cup (0,3)$. + \item $r$ is increasing on $(-4,3)$, and decreasing on $(-\infty,-4)\cup (3,\infty)$. + \item $s$ is increasing on $(-\infty,-8)\cup (-4,0)\cup (3,5)$, and decreasing on $(-8,-4)\cup (0,3)\cup (5,\infty)$. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Approximate the intervals on which each function is concave up and concave down. + \begin{shortsolution} + \begin{itemize} + \item $p$ is concave up on $(1,\infty)$, and concave down on $(-\infty,1)$. + \item $q$ is concave up on $(-\infty,-1)\cup (1,\infty)$, and concave down on $(-1,1)$. + \item $r$ is concave up on $(-\infty,-3)\cup (0,2)$, and concave down on $(-3,0)\cup (2,\infty)$. + \item $s$ is concave up on $(-6,-2)\cup (2,5)$, and concave down on $(-\infty,-6)\cup (-2,2)\cup (5,\infty)$. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + The degree of $q$ is $5$. Assuming that all of the real zeros of $q$ are + shown in its graph, how many complex zeros does $q$ have? + \begin{shortsolution} + \Vref{poly:fig:incdec2} shows that $q$ has $3$ real zeros + since the curve of $q$ cuts the horizontal axis $3$ times. + Since $q$ has degree $5$, $q$ must have $2$ complex zeros. + \end{shortsolution} + \end{subproblem} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Long-run behaviour of polynomials] + Describe the long-run behavior of each of polynomial functions in + \crefrange{poly:prob:degree5}{poly:prob:degree2}. + \begin{shortsolution} + $\dd\lim_{x\rightarrow-\infty}p(x)=-\infty$, + $\dd\lim_{x\rightarrow\infty}p(x)=\infty$, + $\dd\lim_{x\rightarrow-\infty}q(x)=\infty$, + $\dd\lim_{x\rightarrow\infty}q(x)=-\infty$, + $\dd\lim_{x\rightarrow-\infty}r(x)=-\infty$, + $\dd\lim_{x\rightarrow\infty}r(x)=\infty$, + $\dd\lim_{x\rightarrow-\infty}s(x)=\infty$, + $\dd\lim_{x\rightarrow\infty}s(x)=\infty$, + \end{shortsolution} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[True of false?] + Let $p$ be a polynomial function. + Label each of the following statements as true (T) or false (F); if they are false, + provide an example that supports your answer. + \begin{subproblem} + If $p$ has degree $3$, then $p$ has $3$ distinct zeros. + \begin{shortsolution} + False. Consider $p(x)=x^2(x+1)$ which has only 2 distinct zeros. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + If $p$ has degree $4$, then $\dd\lim_{x\rightarrow-\infty}p(x)=\infty$ and $\dd\lim_{x\rightarrow\infty}p(x)=\infty$. + \begin{shortsolution} + False. Consider $p(x)=-x^4$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + If $p$ has even degree, then it is possible that $p$ can have no real zeros. + \begin{shortsolution} + True. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + If $p$ has odd degree, then it is possible that $p$ can have no real zeros. + \begin{shortsolution} + False. All odd degree polynomials will cut the horizontal axis at least once. + \end{shortsolution} + \end{subproblem} + \end{problem} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a description] + In each of the following problems, give a possible formula for a polynomial + function that has the specified properties. + \begin{subproblem} + Degree 2 and has zeros at $4$ and $5$. + \begin{shortsolution} + Possible option: $p(x)=(x-4)(x-5)$. Note we could multiply $p$ by any real number, and still meet the requirements. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Degree 3 and has zeros at $4$,$5$ and $-3$. + \begin{shortsolution} + Possible option: $p(x)=(x-4)(x-5)(x+3)$. Note we could multiply $p$ by any real number, and still meet the requirements. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Degree 4 and has zeros at $0$, $4$, $5$, $-3$. + \begin{shortsolution} + Possible option: $p(x)=x(x-4)(x-5)(x+3)$. Note we could multiply $p$ by any real number, and still meet the requirements. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Degree 4, with zeros that make the graph cut at $2$, $-5$, and a zero that makes the graph touch at $-2$; + \begin{shortsolution} + Possible option: $p(x)=(x-2)(x+5)(x+2)^2$. Note we could multiply $p$ by any real number, and still meet the requirements. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Degree 3, with only one zero at $-1$. + \begin{shortsolution} + Possible option: $p(x)=(x+1)^3$. Note we could multiply $p$ by any real number, and still meet the requirements. + \end{shortsolution} + \end{subproblem} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[\Cref{poly:step:last}] + \pccname{Saheed} is graphing a polynomial function, $p$. + He is following \crefrange{poly:step:first}{poly:step:last} and has so far + marked the zeros of $p$ on \cref{poly:fig:optionsp1}. Saheed tells you that + $p$ has degree $3$, but does \emph{not} say if the leading coefficient + of $p$ is positive or negative. + \begin{figure}[!htbp] + \begin{widepage} + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\textwidth, + height=.5\textwidth, + ] + \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:optionsp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\textwidth, + height=.5\textwidth, + ] + \addplot[soldot] coordinates{(-5,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:optionsp2} + \end{subfigure}% + \caption{} + \end{widepage} + \end{figure} + \begin{subproblem} + Use the information in \cref{poly:fig:optionsp1} to help sketch $p$, assuming that the leading coefficient + is positive. + \begin{shortsolution} + Assuming that $a_3>0$: + + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-6.78179:8.35598,samples=50]{1/20*(x+5)*(x-2)*(x-6)}; + \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Use the information in \cref{poly:fig:optionsp1} to help sketch $p$, assuming that the leading coefficient + is negative. + \begin{shortsolution} + Assuming that $a_3<0$: + + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-6.78179:8.35598,samples=50]{-1/20*(x+5)*(x-2)*(x-6)}; + \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + Saheed now turns his attention to another polynomial function, $q$. He finds + the zeros of $q$ (there are only $2$) and marks them on \cref{poly:fig:optionsp2}. + Saheed knows that $q$ has degree $3$, but doesn't know if the leading + coefficient is positive or negative. + \begin{subproblem} + Use the information in \cref{poly:fig:optionsp2} to help sketch $q$, assuming that the leading + coefficient of $q$ is positive. Hint: only one of the zeros is simple. + \begin{shortsolution} + Assuming that $a_4>0$ there are $2$ different options: + + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-8.68983:7.31809,samples=50]{1/20*(x+5)^2*(x-6)}; + \addplot expression[domain=-6.31809:9.68893,samples=50]{1/20*(x+5)*(x-6)^2}; + \addplot[soldot] coordinates{(-5,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Use the information in \cref{poly:fig:optionsp2} to help sketch $q$, assuming that the leading + coefficient of $q$ is negative. + \begin{shortsolution} + Assuming that $a_4<0$ there are $2$ different options: + + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-8.68983:7.31809,samples=50]{-1/20*(x+5)^2*(x-6)}; + \addplot expression[domain=-6.31809:9.68893,samples=50]{-1/20*(x+5)*(x-6)^2}; + \addplot[soldot] coordinates{(-5,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[Zeros] + Find all zeros of each of the following polynomial functions, making + sure to detail their multiplicity. Note that + you may need to use factoring, or the quadratic formula, or both! Also note + that some zeros may be repeated, and some may be complex. + \begin{multicols}{3} + \begin{subproblem} + $p(x)=x^2+1$ + \begin{shortsolution} + $\pm i$ (simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $q(y)=(y^2-9)(y^2-7)$ + \begin{shortsolution} + $\pm 3$, $\pm \sqrt{7}$ (all are simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(z)=-4z^3(z^2+3)(z^2+64)$ + \begin{shortsolution} + $0$ (multiplicity $3$), $\pm\sqrt{3}$ (simple), $\pm\sqrt{8}$ (simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $a(x)=x^4-81$ + \begin{shortsolution} + $\pm 3$, $\pm 3i$ (all are simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $b(y)=y^3-8$ + \begin{shortsolution} + $2$, $-1\pm i\sqrt{3}$ (all are simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $c(m)=m^3-m^2$ + \begin{shortsolution} + $0$ (multiplicity $2$), $1$ (simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $h(n)=(n+1)(n^2+4)$ + \begin{shortsolution} + $-1$, $\pm 2i$ (all are simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $f(\alpha)=(\alpha^2-16)(\alpha^2-5\alpha+4)$ + \begin{shortsolution} + $-4$ (simple), $4$ (multiplicity $2$), $1$ (simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $g(\beta)=(\beta^2-25)(\beta^2-5\beta-4)$ + \begin{shortsolution} + $\pm 5$, $\dfrac{5\pm\sqrt{41}}{2}$ (all are simple). + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[Given zeros, find a formula] + In each of the following problems you are given the zeros of a polynomial. + Write a possible formula for each polynomial| you may leave your + answer in factored form, but it may not contain complex numbers. Unless + otherwise stated, assume that the zeros are simple. + \begin{multicols}{3} + \begin{subproblem} + $1$, $2$ + \begin{shortsolution} + $p(x)=(x-1)(x-2)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $0$, $5$, $13$ + \begin{shortsolution} + $p(x)=x(x-5)(x-13)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $-7$, $2$ (multiplicity $3$), $5$ + \begin{shortsolution} + $p(x)=(x+7)(x-2)^3(x-5)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $0$, $\pm i$ + \begin{shortsolution} + $p(x)=x(x^2+1)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\pm 2i$, $\pm 7$ + \begin{shortsolution} + $p(x)=(x^2+4)(x^2-49)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $-2\pm i\sqrt{6}$ + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[Composition of polynomials] + Let $p$ and $q$ be polynomial functions that have formulas + \[ + p(x)=(x+1)(x+2)(x+5), \qquad q(x)=3-x^4 + \] + Evaluate each of the following. + \begin{multicols}{4} + \begin{subproblem} + $(p\circ q)(0)$ + \begin{shortsolution} + $160$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(q\circ p)(0)$ + \begin{shortsolution} + $-9997$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(p\circ q)(1)$ + \begin{shortsolution} + $84$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(p\circ p)(0)$ + \begin{shortsolution} + $1980$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[Piecewise polynomial functions] + Let $P$ be the piecewise-defined function with formula + \[ + P(x)=\begin{cases} + (1-x)(2x+5)(x^2+1), & x\leq -3\\ + 4-x^2, & -3<x < 4\\ + x^3 & x\geq 4 + \end{cases} + \] + Evaluate each of the following + \begin{multicols}{5} + \begin{subproblem} + $P(-4)$ + \begin{shortsolution} + $-255$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $P(0)$ + \begin{shortsolution} + $4$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $P(4)$ + \begin{shortsolution} + $64$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $P(-3)$ + \begin{shortsolution} + $-40$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(P\circ P)(0)$ + \begin{shortsolution} + $64$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: July 2012 + %=================================== + \begin{problem}[Function algebra] + Let $p$ and $q$ be the polynomial functions that have formulas + \[ + p(x)=x(x+1)(x-3)^2, \qquad q(x)=7-x^2 + \] + Evaluate each of the following (if possible). + \begin{multicols}{4} + \begin{subproblem} + $(p+q)(1)$ + \begin{shortsolution} + $14$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(p-q)(0)$ + \begin{shortsolution} + $7$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(p\cdot q)(\sqrt{7})$ + \begin{shortsolution} + $0$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\left( \frac{q}{p} \right)(1)$ + \begin{shortsolution} + $\frac{3}{4}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \begin{subproblem} + What is the domain of the function $\frac{q}{p}$? + \begin{shortsolution} + $(-\infty,-1)\cup (-1,0)\cup (0,3)\cup (3,\infty)$ + \end{shortsolution} + \end{subproblem} + \end{problem} + + %=================================== + % Author: Hughes + % Date: July 2012 + %=================================== + \begin{problem}[Transformations: given the transformation, find the formula] + Let $p$ be the polynomial function that has formula. + \[ + p(x)=4x(x^2-1)(x+3) + \] + In each of the following + problems apply the given transformation to the function $p$ and + write a formula for the transformed version of $p$. + \begin{multicols}{2} + \begin{subproblem} + Shift $p$ to the right by $5$ units. + \begin{shortsolution} + $p(x-5)=4(x-5)(x-2)(x^2-10x+24)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $p$ to the left by $6$ units. + \begin{shortsolution} + $p(x+6)=4(x+6)(x+9)(x^2+12x+35)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $p$ up by $12$ units. + \begin{shortsolution} + $p(x)+12=4x(x^2-1)(x+3)+12$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $p$ down by $2$ units. + \begin{shortsolution} + $p(x)-2=4x(x^2-1)(x+3)-2$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Reflect $p$ over the horizontal axis. + \begin{shortsolution} + $-p(x)=-4x(x^2-1)(x+3)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Reflect $p$ over the vertical axis. + \begin{shortsolution} + $p(-x)=-4x(x^2-1)(3-x)$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a table]\label{poly:prob:findformula} + \Crefrange{poly:tab:findformulap}{poly:tab:findformulas} show values of polynomial functions, $p$, $q$, + $r$, and $s$. + + \begin{table}[!htb] + \centering + \begin{widepage} + \caption{Tables for \cref{poly:prob:findformula}} + \label{poly:tab:findformula} + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=p(x)$} + \label{poly:tab:findformulap} + \begin{tabular}{rr} + \beforeheading + \heading{$x$} & \heading{$y$} \\ + \afterheading + $-4$ & $-56$ \\\normalline + $-3$ & $-18$ \\\normalline + $-2$ & $0$ \\\normalline + $-1$ & $4$ \\\normalline + $0$ & $0$ \\\normalline + $1$ & $-6$ \\\normalline + $2$ & $-8$ \\\normalline + $3$ & $0$ \\\normalline + $4$ & $24$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=q(x)$} + \label{poly:tab:findformulaq} + \begin{tabular}{rr} + \beforeheading + \heading{$x$} & \heading{$y$} \\ \afterheading + $-4$ & $-16$ \\\normalline + $-3$ & $-3$ \\\normalline + $-2$ & $0$ \\\normalline + $-1$ & $-1$ \\\normalline + $0$ & $0$ \\\normalline + $1$ & $9$ \\\normalline + $2$ & $32$ \\\normalline + $3$ & $75$ \\\normalline + $4$ & $144$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=r(x)$} + \label{poly:tab:findformular} + \begin{tabular}{rr} + \beforeheading + \heading{$x$} & \heading{$y$} \\ \afterheading + $-4$ & $105$ \\\normalline + $-3$ & $0$ \\\normalline + $-2$ & $-15$ \\\normalline + $-1$ & $0$ \\\normalline + $0$ & $9$ \\\normalline + $1$ & $0$ \\\normalline + $2$ & $-15$ \\\normalline + $3$ & $0$ \\\normalline + $4$ & $105$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=s(x)$} + \label{poly:tab:findformulas} + \begin{tabular}{rr} + \beforeheading + \heading{$x$} & \heading{$y$} \\ \afterheading + $-4$ & $75$ \\\normalline + $-3$ & $0$ \\\normalline + $-2$ & $-9$ \\\normalline + $-1$ & $0$ \\\normalline + $0$ & $3$ \\\normalline + $1$ & $0$ \\\normalline + $2$ & $15$ \\\normalline + $3$ & $96$ \\\normalline + $4$ & $760$ \\\lastline + \end{tabular} + \end{subtable} + \end{widepage} + \end{table} + + \begin{subproblem} + Assuming that all of the zeros of $p$ are shown (in \cref{poly:tab:findformulap}), how many zeros does $p$ have? + \begin{shortsolution} + $p$ has 3 zeros. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + What is the degree of $p$? + \begin{shortsolution} + $p$ is degree 3. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Write a formula for $p(x)$. + \begin{shortsolution} + $p(x)=x(x+2)(x-3)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Assuming that all of the zeros of $q$ are shown (in \cref{poly:tab:findformulaq}), how many zeros does $q$ have? + \begin{shortsolution} + $q$ has 2 zeros. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Describe the difference in behavior of $p$ and $q$ at $-2$. + \begin{shortsolution} + $p$ changes sign at $-2$, and $q$ does not change sign at $-2$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Given that $q$ is a degree-$3$ polynomial, write a formula for $q(x)$. + \begin{shortsolution} + $q(x)=x(x+2)^2$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Assuming that all of the zeros of $r$ are shown (in \cref{poly:tab:findformular}), find a formula for $r(x)$. + \begin{shortsolution} + $r(x)=(x+3)(x+1)(x-1)(x-3)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Assuming that all of the zeros of $s$ are shown (in \cref{poly:tab:findformulas}), find a formula for $s(x)$. + \begin{shortsolution} + $s(x)=(x+3)(x+1)(x-1)^2$ + \end{shortsolution} + \end{subproblem} + \end{problem} + \end{exercises} \section{Rational functions} -\subsection*{Power functions with negative exponents} -The study of rational functions will rely upon a good knowledge -of power functions with negative exponents. \Cref{rat:ex:oddpow,rat:ex:evenpow} are -simple but fundamental to understanding the behavior of rational functions. -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample}[Power functions with odd negative exponents]\label{rat:ex:oddpow} -Graph each of the following functions on your calculator, state their domain in interval notation, and their -behavior as $x\rightarrow 0^-$ and $x\rightarrow 0^+$. -\[ - f(x)=\frac{1}{x},\qquad g(x)=\dfrac{1}{x^3},\qquad h(x)=\dfrac{1}{x^5} -\] -\begin{pccsolution} -The functions $f$, $g$, and $k$ are plotted in \cref{rat:fig:oddpow}. -The domain of each of the functions $f$, $g$, and $h$ is $(-\infty,0)\cup (0,\infty)$. Note that -the long-run behavior of each of the functions is the same, and in particular -\begin{align*} - f(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} f(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty -\end{align*} -The same results hold for $g$ and $h$. Note also that each of the functions -has a \emph{vertical asymptote} at $0$. We see that -\begin{align*} - f(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^- \\ - \mathllap{\text{and }} f(x)\rightarrow \infty & \text{ as } x\rightarrow 0^+ -\end{align*} -The same results hold for $g$ and $h$. - -The curve of a function that has a vertical asymptote is necessarily separated -into \emph{branches}| each of the functions $f$, $g$, and $h$ have $2$ branches. -\end{pccsolution} -\end{pccexample} - -\begin{figure}[!htb] - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-3,xmax=3, - ymin=-5,ymax=5, - xtick={-2,-1,...,2}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\textwidth, - legend pos=north west, - ] - \addplot expression[domain=-3:-0.2]{1/x}; - \addplot expression[domain=-3:-0.584]{1/x^3}; - \addplot expression[domain=-3:-0.724]{1/x^5}; - \addplot expression[domain=0.2:3]{1/x}; - \addplot expression[domain=0.584:3]{1/x^3}; - \addplot expression[domain=0.724:3]{1/x^5}; - \addplot[soldot]coordinates{(-1,-1)}node[axisnode,anchor=north east]{$(-1,-1)$}; - \addplot[soldot]coordinates{(1,1)}node[axisnode,anchor=south west]{$(1,1)$}; - \legend{$f$,$g$,$h$} - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:oddpow} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-3,xmax=3, - ymin=-5,ymax=5, - xtick={-2,-1,...,2}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\textwidth, - legend pos=south east, - ] - \addplot expression[domain=-3:-0.447]{1/x^2}; - \addplot expression[domain=-3:-0.668]{1/x^4}; - \addplot expression[domain=-3:-0.764]{1/x^6}; - \addplot expression[domain=0.447:3]{1/x^2}; - \addplot expression[domain=0.668:3]{1/x^4}; - \addplot expression[domain=0.764:3]{1/x^6}; - \addplot[soldot]coordinates{(-1,1)}node[axisnode,anchor=south east]{$(-1,1)$}; - \addplot[soldot]coordinates{(1,1)}node[axisnode,anchor=south west]{$(1,1)$}; - \legend{$F$,$G$,$H$} - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:evenpow} - \end{minipage}% -\end{figure} - - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample}[Power functions with even negative exponents]\label{rat:ex:evenpow}% -Graph each of the following functions, state their domain, and their -behavior as $x\rightarrow 0^-$ and $x\rightarrow 0^+$. -\[ - f(x)=\frac{1}{x^2},\qquad g(x)=\frac{1}{x^4},\qquad h(x)=\frac{1}{x^6} -\] -\begin{pccsolution} -The functions $F$, $G$, and $H$ are plotted in \cref{rat:fig:evenpow}. -The domain of each of the functions $F$, $G$, and $H$ is $(-\infty,0)\cup (0,\infty)$. Note that -the long-run behavior of each of the functions is the same, and in particular -\begin{align*} - F(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} f(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty -\end{align*} -As in \cref{rat:ex:oddpow}, $F$ has a horizontal asymptote that -has equation $y=0$. -The same results hold for $G$ and $H$. Note also that each of the functions -has a \emph{vertical asymptote} at $0$. We see that -\begin{align*} - F(x)\rightarrow \infty & \text{ as } x\rightarrow 0^- \\ - \mathllap{\text{and }} F(x)\rightarrow \infty & \text{ as } x\rightarrow 0^+ -\end{align*} -The same results hold for $G$ and $H$. Each of the functions $F$, $G$, and $H$ -have $2$ branches. -\end{pccsolution} -\end{pccexample} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{doyouunderstand} - \begin{problem} - Repeat \cref{rat:ex:oddpow,rat:ex:evenpow} using (respectively) - \begin{subproblem} - $k(x)=-\dfrac{1}{x}$, $ m(x)=-\dfrac{1}{x^3}$, $ n(x)=-\dfrac{1}{x^5}$ - \begin{shortsolution} - The functions $k$, $m$, and $n$ have domain $(-\infty,0)\cup (0,\infty)$, and - are graphed below. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-3,xmax=3, - ymin=-5,ymax=5, - xtick={-2,-1,...,2}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\solutionfigurewidth, - legend pos=north east, - ] - \addplot expression[domain=-3:-0.2]{-1/x}; - \addplot expression[domain=-3:-0.584]{-1/x^3}; - \addplot expression[domain=-3:-0.724]{-1/x^5}; - \addplot expression[domain=0.2:3]{-1/x}; - \addplot expression[domain=0.584:3]{-1/x^3}; - \addplot expression[domain=0.724:3]{-1/x^5}; - \legend{$k$,$m$,$n$} - \end{axis} - \end{tikzpicture} - - Note that - \begin{align*} - k(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} k(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \\ - \intertext{and also} - k(x)\rightarrow \infty & \text{ as } x\rightarrow 0^- \\ - \mathllap{\text{and }} k(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^+ - \end{align*} - The same are true for $m$ and $n$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $ K(x)=-\dfrac{1}{x^2}$, $ M(x)=-\dfrac{1}{x^4}$, $ N(x)=-\dfrac{1}{x^6}$ - \begin{shortsolution} - The functions $K$, $M$, and $N$ have domain $(-\infty,0)\cup (0,\infty)$, and - are graphed below. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-3,xmax=3, - ymin=-5,ymax=5, - xtick={-2,-1,...,2}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\solutionfigurewidth, - legend pos=north east, - ] - \addplot expression[domain=-3:-0.447]{-1/x^2}; - \addplot expression[domain=-3:-0.668]{-1/x^4}; - \addplot expression[domain=-3:-0.764]{-1/x^6}; - \addplot expression[domain=0.447:3]{-1/x^2}; - \addplot expression[domain=0.668:3]{-1/x^4}; - \addplot expression[domain=0.764:3]{-1/x^6}; - \legend{$K$,$M$,$N$} - \end{axis} - \end{tikzpicture} - - Note that - \begin{align*} - K(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} K(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \\ - \intertext{and also} - K(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^- \\ - \mathllap{\text{and }} K(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^+ - \end{align*} - The same are true for $M$ and $N$. - \end{shortsolution} - \end{subproblem} - \end{problem} -\end{doyouunderstand} - -\subsection*{Rational functions} -\begin{pccdefinition}[Rational functions]\label{rat:def:function} -Rational functions have the form -\[ - r(x) = \frac{p(x)}{q(x)} -\] -where both $p$ and $q$ are polynomials. - -Note that -\begin{itemize} - \item the domain or $r$ will be all real numbers, except those that - make the \emph{denominator}, $q(x)$, equal to $0$; - \item the zeros of $r$ are the zeros of $p$, i.e the real numbers - that make the \emph{numerator}, $p(x)$, equal to $0$. -\end{itemize} - -\Cref{rat:ex:oddpow,rat:ex:evenpow} are particularly important because $r$ -will behave like $\frac{1}{x}$, or $\frac{1}{x^2}$ around its vertical asymptotes, -depending on the power that the relevant term is raised to| we will demonstrate -this in what follows. -\end{pccdefinition} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample}[Rational or not] -Identify whether each of the following functions is a rational or not. If -the function is rational, state the domain. -\begin{multicols}{3} - \begin{enumerate} - \item $r(x)=\dfrac{1}{x}$ - \item $f(x)=2^x+3$ - \item $g(x)=19$ - \item $h(x)=\dfrac{3+x}{4-x}$ - \item $k(x)=\dfrac{x^3+2x}{x-15}$ - \item $l(x)=9-4x$ - \item $m(x)=\dfrac{x+5}{(x-7)(x+9)}$ - \item $n(x)=x^2+6x+7$ - \item $q(x)=1-\dfrac{3}{x+1}$ - \end{enumerate} -\end{multicols} -\begin{pccsolution} -\begin{enumerate} - \item $r$ is rational; the domain of $r$ is $(-\infty,0)\cup(0,\infty)$. - \item $f$ is not rational. - \item $g$ is not rational; $g$ is constant. - \item $h$ is rational; the domain of $h$ is $(-\infty,4)\cup(4,\infty)$. - \item $k$ is rational; the domain of $k$ is $(-\infty,15)\cup(15,\infty)$. - \item $l$ is not rational; $l$ is linear. - \item $m$ is rational; the domain of $m$ is $(-\infty,-9)\cup(-9,7)\cup(7,\infty)$. - \item $n$ is not rational; $n$ is quadratic (or you might describe $n$ as a polynomial). - \item $q$ is rational; the domain of $q$ is $(-\infty,-1)\cup (-1,\infty)$. -\end{enumerate} -\end{pccsolution} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample}[Match formula to graph] -Each of the following functions is graphed in \cref{rat:fig:whichiswhich}. -Which is which? -\[ - r(x)=\frac{1}{x-3}, \qquad q(x)=\frac{x-2}{x+5}, \qquad k(x)=\frac{1}{(x+2)(x-3)} -\] -\begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/(x+5);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-6,ymax=6, - xtick={-8,-6,...,8}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-6.37]{f}; - \addplot[pccplot] expression[domain=-3.97:10]{f}; - \addplot[soldot] coordinates{(2,0)}; - \addplot[asymptote,domain=-6:6]({-5},{x}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:which1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=1/(x-3);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-5,ymax=6, - xtick={-8,-6,...,8}, - ytick={-4,4}, - minor ytick={-3,...,5}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:2.8]{f}; - \addplot[pccplot] expression[domain=3.17:10]{f}; - \addplot[asymptote,domain=-6:6]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:which2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=1/((x-3)*(x+2));}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-5,ymax=5, - xtick={-8,-6,...,8}, - ytick={-4,4}, - minor ytick={-3,...,3}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-2.03969]{f}; - \addplot[pccplot] expression[domain=-1.95967:2.95967]{f}; - \addplot[pccplot] expression[domain=3.03969:10]{f}; - \addplot[asymptote,domain=-5:5]({-2},{x}); - \addplot[asymptote,domain=-5:5]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:which3} - \end{subfigure} - \caption{} - \label{rat:fig:whichiswhich} -\end{figure} - -\begin{pccsolution} -Let's start with the function $r$. Note that domain of $r$ is $(-\infty,3)\cup(0,3)$, so -we search for a function that has a vertical asymptote at $3$. There -are two possible choices: the functions graphed in \cref{rat:fig:which2,rat:fig:which3}, -but note that the function in \cref{rat:fig:which3} also has a vertical asymptote at $-2$ -which is not consistent with the formula for $r(x)$. Therefore, $y=r(x)$ -is graphed in \cref{rat:fig:which2}. - -The function $q$ has domain $(-\infty,-5)\cup(-5,\infty)$, so we search -for a function that has a vertical asymptote at $-5$. The only candidate -is the curve shown in \cref{rat:fig:which1}; note that the curve also goes through $(2,0)$, -which is consistent with the formula for $q(x)$, since $q(2)=0$, i.e $q$ -has a zero at $2$. - -The function $k$ has domain $(-\infty,-2)\cup(-2,3)\cup(3,\infty)$, and -has vertical asymptotes at $-2$ and $3$. This is consistent with -the graph in \cref{rat:fig:which3} (and is the only curve that -has $3$ branches). - -We note that each function behaves like $\frac{1}{x}$ around its vertical asymptotes, -because each linear factor in each denominator is raised to the power $1$; if (for example) -the definition of $r$ was instead -\[ - r(x)=\frac{1}{(x-3)^2} -\] -then we would see that $r$ behaves like $\frac{1}{x^2}$ around its vertical asymptote, and -the graph of $r$ would be very different. We will deal with these cases in the examples that follow. -\end{pccsolution} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample}[Repeated factors in the denominator] -Consider the functions $f$, $g$, and $h$ that have formulas -\[ - f(x)=\frac{x-2}{(x-3)(x+2)}, \qquad g(x)=\frac{x-2}{(x-3)^2(x+2)}, \qquad h(x)=\frac{x-2}{(x-3)(x+2)^2} -\] -which are graphed in \cref{rat:fig:repfactd}. Note that each function has $2$ -vertical asymptotes, and the domain of each function is -\[ - (-\infty,-2)\cup(-2,3)\cup(3,\infty) -\] -so we are not surprised to see that each curve has $3$ branches. We also note that -the numerator of each function is the same, which tells us that each function has -only $1$ zero at $2$. - -The functions $g$ and $h$ are different from those that we have considered previously, -because they have a repeated factor in the denominator. Notice in particular -the way that the functions behave around their asymptotes: -\begin{itemize} - \item $f$ behaves like $\frac{1}{x}$ around both of its asymptotes; - \item $g$ behaves like $\frac{1}{x}$ around $-2$, and like $\frac{1}{x^2}$ around $3$; - \item $h$ behaves like $\frac{1}{x^2}$ around $-2$, and like $\frac{1}{x}$ around $3$. -\end{itemize} -\end{pccexample} -\begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-4,ymax=4, - xtick={-4,-2,...,4}, - ytick={-2,2}, - % grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-5:-2.201]{f}; - \addplot[pccplot] expression[domain=-1.802:2.951]{f}; - \addplot[pccplot] expression[domain=3.052:5]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-6:6]({-2},{x}); - % \addplot[asymptote,domain=-6:6]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x-2}{(x+2)(x-3)}$} - \label{rat:fig:repfactd1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)*(x-3)^2);}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-4,ymax=4, - xtick={-4,-2,...,4}, - ytick={-2,2}, - % grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-5:-2.039]{f}; - \addplot[pccplot] expression[domain=-1.959:2.796]{f}; - \addplot[pccplot] expression[domain=3.243:5]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-4:4]({-2},{x}); - % \addplot[asymptote,domain=-4:4]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x-2}{(x+2)(x-3)^2}$} - \label{rat:fig:repfactd2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)^2*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-4,ymax=4, - xtick={-4,-2,...,2}, - ytick={-2,2}, - % grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-5:-2.451]{f}; - \addplot[pccplot] expression[domain=-1.558:2.990]{f}; - \addplot[pccplot] expression[domain=3.010:6]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-4:4]({-2},{x}); - % \addplot[asymptote,domain=-4:4]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x-2}{(x+2)^2(x-3)}$} - \label{rat:fig:repfactd3} - \end{subfigure} - \caption{} - \label{rat:fig:repfactd} -\end{figure} - -\Cref{rat:def:function} says that the zeros of -the rational function $r$ that has formula $r(x)=\frac{p(x)}{q(x)}$ are -the zeros of $p$. Let's explore this a little more. -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}[Zeros] Find the zeros of each of the following functions -\[ - \alpha(x)=\frac{x+5}{3x-7}, \qquad \beta(x)=\frac{9-x}{x+1}, \qquad \gamma(x)=\frac{17x^2-10}{2x+1} -\] -\begin{pccsolution} -We find the zeros of each function in turn by setting the numerator equal to $0$. The zeros of -$\alpha$ are found by solving -\[ - x+5=0 -\] -The zero of $\alpha$ is $-5$. - -Similarly, we may solve $9-x=0$ to find the zero of $\beta$, which is clearly $9$. - -The zeros of $\gamma$ satisfy the equation -\[ - 17x^2-10=0 -\] -which we can solve using the square root property to obtain -\[ - x=\pm\frac{10}{17} -\] -The zeros of $\gamma$ are $\pm\frac{10}{17}$. -\end{pccsolution} -\end{pccexample} - -\subsection*{Long-run behavior} -Our focus so far has been on the behavior of rational functions around -their \emph{vertical} asymptotes. In fact, rational functions also -have interesting long-run behavior around their \emph{horizontal} or -\emph{oblique} asymptotes. A rational function will always have either -a horizontal or an oblique asymptote| the case is determined by the degree -of the numerator and the degree of the denominator. -\begin{pccdefinition}[Long-run behavior]\label{rat:def:longrun} -Let $r$ be the rational function that has formula -\[ - r(x) = \frac{a_n x^n + a_{n-1}x^{n-1}+\ldots + a_0}{b_m x^m + b_{m-1}x^{m-1}+\ldots+b_0} -\] -We can classify the long-run behavior of the rational function $r$ -according to the following criteria: -\begin{itemize} - \item if $n<m$ then $r$ has a horizontal asymptote with equation $y=0$; - \item if $n=m$ then $r$ has a horizontal asymptote with equation $y=\dfrac{a_n}{b_m}$; - \item if $n>m$ then $r$ will have an oblique asymptote as $x\rightarrow\pm\infty$ (more on this in \cref{rat:sec:oblique}) -\end{itemize} -\end{pccdefinition} -We will concentrate on functions that have horizontal asymptotes until -we reach \cref{rat:sec:oblique}. - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}[Long-run behavior graphically]\label{rat:ex:horizasymp} -\pccname{Kebede} has graphed the following functions in his graphing calculator -\[ - r(x)=\frac{x+1}{x-3}, \qquad s(x)=\frac{2(x+1)}{x-3}, \qquad t(x)=\frac{3(x+1)}{x-3} -\] -and obtained the curves shown in \cref{rat:fig:horizasymp}. Kebede decides -to test his knowledgeable friend \pccname{Oscar}, and asks him -to match the formulas to the graphs. - -\begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=2*(x+1)/(x-3);}] - \begin{axis}[ - framed, - xmin=-15,xmax=15, - ymin=-6,ymax=6, - xtick={-12,-8,...,12}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-15:2]{f}; - \addplot[pccplot] expression[domain=5:15]{f}; - \addplot[soldot] coordinates{(-1,0)}; - \addplot[asymptote,domain=-6:6]({3},{x}); - \addplot[asymptote,domain=-15:15]({x},{2}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:horizasymp1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x+1)/(x-3);}] - \begin{axis}[ - framed, - xmin=-15,xmax=15, - ymin=-6,ymax=6, - xtick={-12,-8,...,12}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-15:2.42857,samples=50]{f}; - \addplot[pccplot] expression[domain=3.8:15,samples=50]{f}; - \addplot[soldot] coordinates{(-1,0)}; - \addplot[asymptote,domain=-6:6]({3},{x}); - \addplot[asymptote,domain=-15:15]({x},{1}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:horizasymp2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=3*(x+1)/(x-3);}] - \begin{axis}[ - framed, - xmin=-15,xmax=15, - ymin=-6,ymax=6, - xtick={-12,-8,...,12}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-15:1.6666,samples=50]{f}; - \addplot[pccplot] expression[domain=7:15]{f}; - \addplot[soldot] coordinates{(-1,0)}; - \addplot[asymptote,domain=-6:6]({3},{x}); - \addplot[asymptote,domain=-15:15]({x},{3}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:horizasymp3} - \end{subfigure} - \caption{Horizontal asymptotes} - \label{rat:fig:horizasymp} -\end{figure} - -Oscar notices that each function has a vertical asymptote at $3$ and a zero at $-1$. -The main thing that catches Oscar's eye is that each function has a different -coefficient in the numerator, and that each curve has a different horizontal asymptote. -In particular, Oscar notes that -\begin{itemize} - \item the curve shown in \cref{rat:fig:horizasymp1} has a horizontal asymptote with equation $y=2$; - \item the curve shown in \cref{rat:fig:horizasymp2} has a horizontal asymptote with equation $y=1$; - \item the curve shown in \cref{rat:fig:horizasymp3} has a horizontal asymptote with equation $y=3$. -\end{itemize} -Oscar is able to tie it all together for Kebede by referencing \cref{rat:def:longrun}. He says -that since the degree of the numerator and the degree of the denominator is the same -for each of the functions $r$, $s$, and $t$, the horizontal asymptote will be determined -by evaluating the ratio of their leading coefficients. - -Oscar therefore says that $r$ should have a horizontal asymptote $y=\frac{1}{1}=1$, $s$ should -have a horizontal asymptote $y=\frac{2}{1}=2$, and $t$ should have a horizontal asymptote -$y=\frac{3}{1}=3$. Kebede is able to finish the problem from here, and says that $r$ is -shown in \cref{rat:fig:horizasymp2}, $s$ is shown in \cref{rat:fig:horizasymp1}, and -$t$ is shown in \cref{rat:fig:horizasymp3}. -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}[Long-run behavior numerically] -\pccname{Xiao} and \pccname{Dwayne} saw \cref{rat:ex:horizasymp} but are a little confused -about horizontal asymptotes. What does it mean to say that a function $r$ has a horizontal -asymptote? - -They decide to explore the concept by -constructing a table of values for the rational functions $R$ and $S$ that have formulas -\[ - R(x)=\frac{-5(x+1)}{x-3}, \qquad S(x)=\frac{7(x-5)}{2(x+1)} -\] -In \cref{rat:tab:plusinfty} they model the behavior of $R$ and $S$ as $x\rightarrow\infty$, -and in \cref{rat:tab:minusinfty} they model the behavior of $R$ and $S$ as $x\rightarrow-\infty$ -by substituting very large values of $|x|$ into each function. -\begin{table}[!htb] - \begin{minipage}{.5\textwidth} - \centering - \caption{$R$ and $S$ as $x\rightarrow\infty$} - \label{rat:tab:plusinfty} - \begin{tabular}{crr} - \beforeheading - $x$ & $R(x)$ & $S(x)$ \\ \afterheading - $1\times 10^2$ & $-5.20619$ & $3.29208$ \\\normalline - $1\times 10^3$ & $-5.02006$ & $3.47902$ \\\normalline - $1\times 10^4$ & $-5.00200$ & $3.49790$ \\\normalline - $1\times 10^5$ & $-5.00020$ & $3.49979$ \\\normalline - $1\times 10^6$ & $-5.00002$ & $3.49998$ \\\lastline - \end{tabular} - \end{minipage}% - \begin{minipage}{.5\textwidth} - \centering - \caption{$R$ and $S$ as $x\rightarrow-\infty$} - \label{rat:tab:minusinfty} - \begin{tabular}{crr} - \beforeheading - $x$ & $R(x)$ & $S(x)$ \\ \afterheading - $-1\times 10^2$ & $-4.80583$ & $3.71212$ \\\normalline - $-1\times 10^3$ & $-4.98006$ & $3.52102$ \\\normalline - $-1\times 10^4$ & $-4.99800$ & $3.50210$ \\\normalline - $-1\times 10^5$ & $-4.99980$ & $3.50021$ \\\normalline - $-1\times 10^6$ & $-4.99998$ & $3.50002$ \\\lastline - \end{tabular} - \end{minipage} -\end{table} - -Xiao and Dwayne study \cref{rat:tab:plusinfty,rat:tab:minusinfty} and decide that -the functions $R$ and $S$ never actually touch their horizontal asymptotes, but they -do get infinitely close. They also feel as if they have a better understanding of -what it means to study the behavior of a function as $x\rightarrow\pm\infty$. -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample}[Repeated factors in the numerator] -Consider the functions $f$, $g$, and $h$ that have formulas -\[ - f(x)=\frac{(x-2)^2}{(x-3)(x+1)}, \qquad g(x)=\frac{x-2}{(x-3)(x+1)}, \qquad h(x)=\frac{(x-2)^3}{(x-3)(x+1)} -\] -which are graphed in \cref{rat:fig:repfactn}. We note that each function has vertical -asymptotes at $-1$ and $3$, and so the domain of each function is -\[ - (-\infty,-1)\cup(-1,3)\cup(3,\infty) -\] -We also notice that the numerators of each function are quite similar| indeed, each -function has a zero at $2$, but how does each function behave around their zero? - -Using \cref{rat:fig:repfactn} to guide us, we note that -\begin{itemize} - \item $f$ has a horizontal intercept $(2,0)$, but the curve of - $f$ does not cut the horizontal axis| it bounces off it; - \item $g$ also has a horizontal intercept $(2,0)$, and the curve - of $g$ \emph{does} cut the horizontal axis; - \item $h$ has a horizontal intercept $(2,0)$, and the curve of $h$ - also cuts the axis, but appears flattened as it does so. -\end{itemize} - -We can further enrich our study by discussing the long-run behavior of each function. -Using the tools of \cref{rat:def:longrun}, we can deduce that -\begin{itemize} - \item $f$ has a horizontal asymptote with equation $y=1$; - \item $g$ has a horizontal asymptote with equation $y=0$; - \item $h$ does \emph{not} have a horizontal asymptote| it has an oblique asymptote (we'll - study this more in \cref{rat:sec:oblique}). -\end{itemize} -\end{pccexample} - -\begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)^2/((x+1)*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-10,ymax=10, - xtick={-4,-2,...,4}, - ytick={-8,-4,...,8}, - % grid=both, - width=\figurewidth, - ] - \addplot[pccplot] expression[domain=-5:-1.248,samples=50]{f}; - \addplot[pccplot] expression[domain=-0.794:2.976,samples=50]{f}; - \addplot[pccplot] expression[domain=3.026:5,samples=50]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-6:6]({-1},{x}); - % \addplot[asymptote,domain=-6:6]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{(x-2)^2}{(x+1)(x-3)}$} - \label{rat:fig:repfactn1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+1)*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-10,ymax=10, - xtick={-4,-2,...,4}, - ytick={-8,-4,...,8}, - % grid=both, - width=\figurewidth, - ] - \addplot[pccplot] expression[domain=-5:-1.075]{f}; - \addplot[pccplot] expression[domain=-0.925:2.975]{f}; - \addplot[pccplot] expression[domain=3.025:5]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-6:6]({-1},{x}); - % \addplot[asymptote,domain=-6:6]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x-2}{(x+1)(x-3)}$} - \label{rat:fig:repfactn2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)^3/((x+1)*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - xtick={-8,-6,...,8}, - % grid=both, - ymin=-30,ymax=30, - width=\figurewidth, - ] - \addplot[pccplot] expression[domain=-5:-1.27]{f}; - \addplot[pccplot] expression[domain=-0.806:2.99185]{f}; - \addplot[pccplot] expression[domain=3.0085:5]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-30:30]({-1},{x}); - % \addplot[asymptote,domain=-30:30]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{(x-2)^3}{(x+1)(x-3)}$} - \label{rat:fig:repfactn3} - \end{subfigure} - \caption{} - \label{rat:fig:repfactn} -\end{figure} - -\subsection*{Holes} -Rational functions have a vertical asymptote at $a$ if the denominator is $0$ at $a$. -What happens if the numerator is $0$ at the same place? In this case, we say that the rational -function has a \emph{hole} at $a$. -\begin{pccdefinition}[Holes] -The rational function -\[ - r(x)=\frac{p(x)}{q(x)} -\] -has a hole at $a$ if $p(a)=q(a)=0$. Note that holes are different from -a vertical asymptotes. We represent that $r$ has a hole at the point -$(a,r(a))$ on the curve $y=r(x)$ by -using a hollow circle, $\circ$. -\end{pccdefinition} - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{pccexample} -\pccname{Mohammed} and \pccname{Sue} have graphed the function $r$ that has formula -\[ - r(x)=\frac{x^2+x-6}{(x-2)} -\] -in their calculators, and can not decide if the correct graph -is \cref{rat:fig:hole} or \cref{rat:fig:hole1}. - -Luckily for them, Oscar is nearby, and can help them settle the debate. -Oscar demonstrates that -\begin{align*} - r(x) & =\frac{(x+3)(x-2)}{(x-2)} \\ - & = x+3 -\end{align*} -but only when $x\ne 2$, because the function is undefined at $2$. Oscar -says that this necessarily means that the domain or $r$ is -\[ - (-\infty,2)\cup(2,\infty) -\] -and that $r$ must have a hole at $2$. - -Mohammed and Sue are very grateful for the clarification, and conclude that -the graph of $r$ is shown in \cref{rat:fig:hole1}. -\begin{figure}[!htb] - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-4,...,8}, - ytick={-8,-4,...,8}, - grid=both, - width=\textwidth, - ] - \addplot expression[domain=-10:7]{x+3}; - \addplot[soldot] coordinates{(-3,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:hole} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-4,...,8}, - ytick={-8,-4,...,8}, - grid=both, - width=\textwidth, - ] - \addplot expression[domain=-10:7]{x+3}; - \addplot[holdot] coordinates{(2,5)}; - \addplot[soldot] coordinates{(-3,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:hole1} - \end{minipage}% -\end{figure} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{pccexample} -Consider the function $f$ that has formula -\[ - f(x)=\frac{x(x+3)}{x^2-4x} -\] -The domain of $f$ is $(-\infty,0)\cup(0,4)\cup(4,\infty)$ because both $0$ and $4$ -make the denominator equal to $0$. Notice that -\begin{align*} - f(x) & = \frac{x(x+3)}{x(x-4)} \\ - & = \frac{x+3}{x-4} -\end{align*} -provided that $x\ne 0$. Since $0$ makes the numerator -and the denominator 0 at the same time, we say that $f$ has a hole at $(0,-\nicefrac{3}{4})$. -Note that this necessarily means that $f$ does not have a vertical intercept. - -We also note $f$ has a vertical asymptote at $4$; the function is graphed in \cref{rat:fig:holeex}. -\begin{figure}[!htb] - \centering - \begin{tikzpicture}[/pgf/declare function={f=(x+3)/(x-4);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=both, - ] - \addplot[pccplot] expression[domain=-10:3.36364,samples=50]{f}; - \addplot[pccplot] expression[domain=4.77:10]{f}; - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[holdot]coordinates{(0,-0.75)}; - \addplot[soldot] coordinates{(-3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x(x+3)}{x^2-4x}$} - \label{rat:fig:holeex} -\end{figure} -\end{pccexample} - - - -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{pccexample}[Minimums and maximums] -\pccname{Seamus} and \pccname{Trang} are discussing rational functions. Seamus says that -if a rational function has a vertical asymptote, then it can -not possibly have local minimums and maximums, nor can it have -global minimums and maximums. - -Trang says this statement is not always true. She plots the functions -$f$ and $g$ that have formulas -\[ - f(x)=-\frac{32(x-1)(x+1)}{(x-2)^2(x+2)^2}, \qquad g(x)=\frac{32(x-1)(x+1)}{(x-2)^2(x+2)^2} -\] -in \cref{rat:fig:minmax1,rat:fig:minmax2} and shows them to Seamus. On seeing the graphs, -Seamus quickly corrects himself, and says that $f$ has a local (and global) -maximum of $2$ at $0$, and that $g$ has a local (and global) minimum of $-2$ at $0$. - -\begin{figure}[!htb] - \begin{minipage}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=-32*(x-1)*(x+1)/(( x-2)^2*(x+2)^2);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-3.01]{f}; - \addplot[pccplot] expression[domain=-1.45:1.45]{f}; - \addplot[pccplot] expression[domain=3.01:10]{f}; - \addplot[soldot] coordinates{(-1,0)(1,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=f(x)$} - \label{rat:fig:minmax1} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=32*(x-1)*(x+1)/(( x-2)^2*(x+2)^2);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-3.01]{f}; - \addplot[pccplot] expression[domain=-1.45:1.45]{f}; - \addplot[pccplot] expression[domain=3.01:10]{f}; - \addplot[soldot] coordinates{(-1,0)(1,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=g(x)$} - \label{rat:fig:minmax2} - \end{minipage}% -\end{figure} - -Seamus also notes that (in its domain) the function $f$ is always concave down, and -that (in its domain) the function $g$ is always concave up. Furthermore, Trang -observes that each function behaves like $\frac{1}{x^2}$ around each of its vertical -asymptotes, because each linear factor in the denominator is raised to the power $2$. - -\pccname{Oscar} stops by and reminds both students about the long-run behavior; according -to \cref{rat:def:longrun} since the degree of the denominator is greater than the -degree of the numerator (in both functions), each function has a horizontal asymptote -at $y=0$. -\end{pccexample} - - -\investigation*{} -%=================================== -% Author: Pettit/Hughes -% Date: March 2012 -%=================================== -\begin{problem}[The spaghetti incident] -The same Queen from \vref{exp:prob:queenschessboard} has recovered from -the rice experiments, and has called her loyal jester for another challenge. - -The jester has an $11-$inch piece of uncooked spaghetti that he puts on a table; -he uses a book to cover $\unit[1]{inch}$ of it so that -$\unit[10]{inches}$ hang over the edge. The jester then produces a box of $\unit{mg}$ -weights that can be hung from the spaghetti. - -The jester says it will take $\unit[y]{mg}$ to break the spaghetti when hung -$\unit[x]{inches}$ from the edge, according to the rule $y=\frac{100}{x}$. -\begin{margintable} - \centering - \captionof{table}{} - \label{rat:tab:spaghetti} - \begin{tabular}{cc} - \beforeheading - \heading{$x$} & \heading{$y$} \\ - \afterheading - $1$ & \\\normalline - $2$ & \\\normalline - $3$ & \\\normalline - $4$ & \\\normalline - $5$ & \\\normalline - $6$ & \\\normalline - $7$ & \\\normalline - $8$ & \\\normalline - $9$ & \\\normalline - $10$ & \\\lastline - \end{tabular} -\end{margintable} -\begin{subproblem}\label{rat:prob:spaggt1} - Help the Queen complete \cref{rat:tab:spaghetti}, and use $2$ digits after the decimal - where appropriate. - \begin{shortsolution} - \begin{tabular}[t]{ld{2}} - \beforeheading - \heading{$x$} & \heading{$y$} \\ - \afterheading - $1$ & 100 \\\normalline - $2$ & 50 \\\normalline - $3$ & 33.33 \\\normalline - $4$ & 25 \\\normalline - $5$ & 20 \\\normalline - $6$ & 16.67 \\\normalline - $7$ & 14.29 \\\normalline - $8$ & 12.50 \\\normalline - $9$ & 11.11 \\\normalline - $10$ & 10 \\\lastline - \end{tabular} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - What do you notice about the number of $\unit{mg}$ that it takes to break - the spaghetti as $x$ increases? - \begin{shortsolution} - It seems that the number of $\unit{mg}$ that it takes to break the spaghetti decreases - as $x$ increases. - \end{shortsolution} -\end{subproblem} -\begin{subproblem}\label{rat:prob:spaglt1} - The Queen wonders what happens when $x$ gets very small| help the Queen construct - a table of values for $x$ and $y$ when $x=0.0001, 0.001, 0.01, 0.1, 0.5, 1$. - \begin{shortsolution} - \begin{tabular}[t]{d{2}l} - \beforeheading - \heading{$x$} & \heading{$y$} \\ - \afterheading - 0.0001 & $1000000$ \\\normalline - 0.001 & $100000$ \\\normalline - 0.01 & $10000$ \\\normalline - 0.1 & $1000$ \\\normalline - 0.5 & $200$ \\\normalline - 1 & $100$ \\\lastline - \end{tabular} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - What do you notice about the number of $\unit{mg}$ that it takes to break the spaghetti - as $x\rightarrow 0$? Would it ever make sense to let $x=0$? - \begin{shortsolution} - The number of $\unit{mg}$ required to break the spaghetti increases as $x\rightarrow 0$. - We can not allow $x$ to be $0$, as we can not divide by $0$, and we can not - be $0$ inches from the edge of the table. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Plot your results from \cref{rat:prob:spaggt1,rat:prob:spaglt1} on the same graph, - and join the points using a smooth curve| set the maximum value of $y$ as $200$, and - note that this necessarily means that you will not be able to plot all of the points. - \begin{shortsolution} - The graph of $y=\frac{100}{x}$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-2,xmax=11, - ymin=-20,ymax=200, - xtick={2,4,...,10}, - ytick={20,40,...,180}, - grid=major, - width=\solutionfigurewidth, - ] - \addplot+[-] expression[domain=0.5:10]{100/x}; - \addplot[soldot] coordinates{(0.5,200)(1,100)(2,50)(3,33.33) - (4,25)(5,20)(16.67)(7,14.29)(8,12.50)(9,11.11)(10,10)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Using your graph, observe what happens to $y$ as $x$ increases. If we could somehow - construct a piece of uncooked spaghetti that was $\unit[101]{inches}$ long, how many - $\unit{mg}$ would it take to break the spaghetti? - \begin{shortsolution} - As $x$ increases, $y\rightarrow 0$. If we could construct a piece of spaghetti - $\unit[101]{inches}$ long, it would only take $\unit[1]{mg}$ to break it $\left(\frac{100}{100}=1\right)$. Of course, - the weight of spaghetti would probably cause it to break without the weight. - \end{shortsolution} -\end{subproblem} -The Queen looks forward to more food-related investigations from her jester. -\end{problem} - - - -%=================================== -% Author: Adams (Hughes) -% Date: March 2012 -%=================================== -\begin{problem}[Debt Amortization] -To amortize a debt means to pay it off in a given length of time using -equal periodic payments. The payments include interest on the unpaid -balance. The following formula gives the monthly payment, $M$, in dollars -that is necessary to amortize a debt of $P$ dollars in $n$ months -at a monthly interest rate of $i$ -\[ - M=\frac{P\cdot i}{1-(1+i)^{-n}} -\] -Use this formula in each of the following problems. -\begin{subproblem} - What monthly payments are necessary on a credit card debt of \$2000 at - $\unit[1.5]{\%}$ monthly if you want to pay off the debt in $2$ years? - In one year? How much money will you save by paying off the debt in the - shorter amount of time? - \begin{shortsolution} - Paying off the debt in $2$ years, we use - \begin{align*} - M & = \frac{2000\cdot 0.015}{1-(1+0.015)^{-24}} \\ - & \approx 99.85 - \end{align*} - The monthly payments are \$99.85. - - Paying off the debt in $1$ year, we use - \begin{align*} - M & = \frac{2000\cdot 0.015}{1-(1+0.015)^{-12}} \\ - & \approx 183.36 - \end{align*} - The monthly payments are \$183.36 - - In the $2$-year model we would pay a total of $\$99.85\cdot 12=\$2396.40$. In the - $1$-year model we would pay a total of $\$183.36\cdot 12=\$2200.32$. We would therefore - save $\$196.08$ if we went with the $1$-year model instead of the $2$-year model. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - To purchase a home, a family needs a loan of \$300,000 at $\unit[5.2]{\%}$ - annual interest. Compare a $20$ year loan to a $30$ year loan and make - a recommendation for the family. - (Note: when given an annual interest rate, it is a common business practice to divide by - $12$ to get a monthly rate.) - \begin{shortsolution} - For the $20$-year loan we use - \begin{align*} - M & = \frac{300000\cdot \frac{0.052}{12}}{1-\left( 1+\frac{0.052}{12} \right)^{-12\cdot 20}} \\ - & \approx 2013.16 - \end{align*} - The monthly payments are \$2013.16. - - For the $30$-year loan we use - \begin{align*} - M & = \frac{300000\cdot \frac{0.052}{12}}{1-\left( 1+\frac{0.052}{12} \right)^{-12\cdot 30}} \\ - & \approx 1647.33 - \end{align*} - The monthly payments are \$1647.33. - - The total amount paid during the $20$-year loan is $\$2013.16\cdot 12\cdot 20=\$483,158.40$. - The total amount paid during the $30$-year loan is $\$1647.33\cdot 12\cdot 30=\$593,038.80$. - - Recommendation: if you can afford the payments, choose the $20$-year loan. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - \pccname{Ellen} wants to make monthly payments of \$100 to pay off a debt of \$3000 - at \unit[12]{\%} annual interest. How long will it take her to pay off the - debt? - \begin{shortsolution} - We are given $M=100$, $P=3000$, $i=0.01$, and we need to find $n$ - in the equation - \[ - 100 = \frac{3000\cdot 0.01}{1-(1+0.01)^{-n}} - \] - Using logarithms, we find that $n\approx 36$. It will take - Ellen about $3$ years to pay off the debt. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - \pccname{Jake} is going to buy a new car. He puts \$2000 down and wants to finance the - remaining \$14,000. The dealer will offer him \unit[4]{\%} annual interest for - $5$ years, or a \$2000 - rebate which he can use to reduce the amount of the loan and \unit[8]{\%} - annual interest for 5 years. Which should he choose? - \begin{shortsolution} - \begin{description} - \item[Option 1:] $\unit[4]{\%}$ annual interest for $5$ years on \$14,000. - This means that the monthly payments will be calculated using - \begin{align*} - M & = \frac{14000\cdot \frac{0.04}{12}}{1-\left( 1+\frac{0.04}{12} \right)^{-12\cdot 5}} \\ - & \approx 257.83 - \end{align*} - The monthly payments will be $\$257.83$. The total amount paid will be - $\$257.83\cdot 5\cdot 12=\$15,469.80$, of which $\$1469.80$ is interest. - \item[Option 2:] $\unit[8]{\%}$ annual interest for $5$ years on \$12,000. - This means that the monthly payments will be calculated using - \begin{align*} - M & = \frac{12000\cdot \frac{0.08}{12}}{1-\left( 1+\frac{0.08}{12} \right)^{-12\cdot 5}} \\ - & \approx 243.32 - \end{align*} - The monthly payments will be $\$243.32$. The total amount paid - will be $\$243.32\cdot 5\cdot 12 =\$14,599.20$, of which $\$2599.2$ is - interest. - \end{description} - Jake should choose option 1 to minimize the amount of interest - he has to pay. - \end{shortsolution} -\end{subproblem} -\end{problem} - -\begin{exercises} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Rational or not] -Decide if each of the following functions are rational or not. If -they are rational, state their domain. -\begin{multicols}{3} - \begin{subproblem} - $r(x)=\dfrac{3}{x}$ - \begin{shortsolution} - $r$ is rational; the domain of $r$ is $(-\infty,0)\cup (0,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $s(y)=\dfrac{y}{6}$ - \begin{shortsolution} - $s$ is not rational ($s$ is linear). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $t(z)=\dfrac{4-x}{7-8z}$ - \begin{shortsolution} - $t$ is rational; the domain of $t$ is $\left( -\infty,\dfrac{7}{8} \right)\cup \left( \dfrac{7}{8},\infty \right)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $u(w)=\dfrac{w^2}{(w-3)(w+4)}$ - \begin{shortsolution} - $u$ is rational; the domain of $w$ is $(-\infty,-4)\cup(-4,3)\cup(3,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $v(x)=\dfrac{4}{(x-2)^2}$ - \begin{shortsolution} - $v$ is rational; the domain of $v$ is $(-\infty,2)\cup(2,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $w(x)=\dfrac{9-x}{x+17}$ - \begin{shortsolution} - $w$ is rational; the domain of $w$ is $(-\infty,-17)\cup(-17,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $a(x)=x^2+4$ - \begin{shortsolution} - $a$ is not rational ($a$ is quadratic, or a polynomial of degree $2$). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $b(y)=3^y$ - \begin{shortsolution} - $b$ is not rational ($b$ is exponential). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $c(z)=\dfrac{z^2}{z^3}$ - \begin{shortsolution} - $c$ is rational; the domain of $c$ is $(-\infty,0)\cup (0,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $d(x)=x^2(x+3)(5x-7)$ - \begin{shortsolution} - $d$ is not rational ($d$ is a polynomial). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $e(\alpha)=\dfrac{\alpha^2}{\alpha^2-1}$ - \begin{shortsolution} - $e$ is rational; the domain of $e$ is $(-\infty,-1)\cup(-1,1)\cup(1,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $f(\beta)=\dfrac{3}{4}$ - \begin{shortsolution} - $f$ is not rational ($f$ is constant). - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Function evaluation] -Let $r$ be the function that has formula -\[ - r(x)=\frac{(x-2)(x+3)}{(x+5)(x-7)} -\] -Evaluate each of the following (if possible); if the value is undefined, -then state so. -\begin{multicols}{4} - \begin{subproblem} - $r(0)$ - \begin{shortsolution} - $\begin{aligned}[t] - r(0)&=\frac{(0-2)(0+3)}{(0+5)(0-7)}\\ - &=\frac{-6}{-35}\\ - &=\frac{6}{35} - \end{aligned}$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - $r(1)$ - \begin{shortsolution} - $\begin{aligned}[t] - r(1)&=\frac{(1-2)(1+3)}{(1+5)(1-7)}\\ - &=\frac{-4}{-36}\\ - &=\frac{1}{9} - \end{aligned}$ -\end{shortsolution} -\end{subproblem} -\begin{subproblem} - $r(2)$ - \begin{shortsolution} - $\begin{aligned}[t] - r(2)&=\frac{(2-2)(2+3)}{(2+5)(2-7)}\\ - & = \frac{0}{-50}\\ - &=0 - \end{aligned}$ -\end{shortsolution} -\end{subproblem} -\begin{subproblem} - $r(4)$ - \begin{shortsolution} - $\begin{aligned}[t] - r(4)&=\frac{(4-2)(4+3)}{(4+5)(4-7)}\\ - &=\frac{14}{-27}\\ - &=-\frac{14}{27} - \end{aligned}$ -\end{shortsolution} -\end{subproblem} -\begin{subproblem} - $r(7)$ - \begin{shortsolution} - $\begin{aligned}[t] - r(7)&=\frac{(7-2)(7+3)}{(7+5)(7-7)}\\ - & =\frac{50}{0} - \end{aligned}$ - - $r(7)$ is undefined. -\end{shortsolution} -\end{subproblem} -\begin{subproblem} - $r(-3)$ - \begin{shortsolution} - $\begin{aligned}[t] - r(-3)&=\frac{(-3-2)(-3+3)}{(-3+5)(-3-7)}\\ - &=\frac{0}{-20}\\ - &=0 - \end{aligned}$ -\end{shortsolution} -\end{subproblem} -\begin{subproblem} - $r(-5)$ - \begin{shortsolution} - $\begin{aligned}[t] - r(-5)&=\frac{(-5-2)(-5+3)}{(-5+5)(-5-7)}\\ - &=\frac{14}{0} - \end{aligned}$ - - $r(-5)$ is undefined. -\end{shortsolution} -\end{subproblem} -\begin{subproblem} - $r\left( \frac{1}{2} \right)$ - \begin{shortsolution} - $\begin{aligned}[t] - r\left( \frac{1}{2} \right)& = \frac{\left( \frac{1}{2}-2 \right)\left( \frac{1}{2}+3 \right)}{\left( \frac{1}{2}+5 \right)\left( \frac{1}{2}-7 \right)}\\ - &=\frac{-\frac{3}{2}\cdot\frac{7}{2}}{\frac{11}{2}\left( -\frac{13}{2} \right)}\\ - &=\frac{-\frac{21}{4}}{-\frac{143}{4}}\\ - &=\frac{37}{143} - \end{aligned}$ -\end{shortsolution} -\end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Holes or asymptotes?] -State the domain of each of the following rational functions. Identify -any holes or asymptotes. -\begin{multicols}{3} - \begin{subproblem} - $f(x)=\dfrac{12}{x-2}$ - \begin{shortsolution} - $f$ has a vertical asymptote at $2$; the domain of $f$ is $(-\infty,2)\cup (2,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $g(x)=\dfrac{x^2+x}{(x+1)(x-2)}$ - \begin{shortsolution} - $g$ has a vertical asymptote at $2$, and a hole at $-1$; the domain of $g$ is $(-\infty,-1)\cup(-1,2)\cup(2,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $h(x)=\dfrac{x^2+5x+4}{x^2+x-12}$ - \begin{shortsolution} - $h$ has a vertical asymptote at $3$, and a whole at $-4$; the domain of $h$ is $(-\infty,-4)\cup(-4,3)\cup(3,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $k(z)=\dfrac{z+2}{2z-3}$ - \begin{shortsolution} - $k$ has a vertical asymptote at $\dfrac{3}{2}$; the domain of $k$ is $\left( -\infty,\dfrac{3}{2} \right)\cup\left( \dfrac{3}{2},\infty \right)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $l(w)=\dfrac{w}{w^2+1}$ - \begin{shortsolution} - $l$ does not have any vertical asymptotes nor holes; the domain of $w$ is $(-\infty,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $m(t)=\dfrac{14}{13-t^2}$ - \begin{shortsolution} - $m$ has vertical asymptotes at $\pm\sqrt{13}$; the domain of $m$ is $(-\infty,\sqrt{13})\cup(-\sqrt{13},\sqrt{13})\cup(\sqrt{13},\infty)$. - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Find a formula from a graph] -Consider the rational functions graphed in \cref{rat:fig:findformula}. Find -the vertical asymptotes for each function, together with any zeros, and -give a possible formula for each. -\begin{shortsolution} - \begin{itemize} - \item \Vref{rat:fig:formula1}: possible formula is $r(x)=\dfrac{1}{x+5}$ - \item \Vref{rat:fig:formula2}: possible formula is $r(x)=\dfrac{(x+3)}{(x-5)}$ - \item \Vref{rat:fig:formula3}: possible formula is $r(x)=\dfrac{1}{(x-4)(x+3)}$. - \end{itemize} -\end{shortsolution} -\end{problem} - -\begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=1/(x+4);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-6,ymax=6, - xtick={-8,-6,...,8}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-4.16667,samples=50]{f}; - \addplot[pccplot] expression[domain=-3.83333:10,samples=50]{f}; - \addplot[asymptote,domain=-6:6]({-4},{x}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:formula1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x+3)/(x-5);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-6,ymax=6, - xtick={-8,-6,...,8}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:3.85714]{f}; - \addplot[pccplot] expression[domain=6.6:10]{f}; - \addplot[soldot] coordinates{(-3,0)}; - \addplot[asymptote,domain=-6:6]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{1}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:formula2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=1/((x-4)*(x+3));}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-3,ymax=3, - xtick={-8,-6,...,8}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-3.0473]{f}; - \addplot[pccplot] expression[domain=-2.95205:3.95205]{f}; - \addplot[pccplot] expression[domain=4.0473:10]{f}; - \addplot[asymptote,domain=-3:3]({-3},{x}); - \addplot[asymptote,domain=-3:3]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{0}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:formula3} - \end{subfigure} - \caption{} - \label{rat:fig:findformula} - \end{widepage} -\end{figure} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Find a formula from a description] -In each of the following problems, give a formula of a rational -function that has the listed properties. -\begin{subproblem} - Vertical asymptote at $2$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{1}{x-2}$. Note that we could multiply the - numerator or denominator by any real number and still have the desired properties. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Vertical asymptote at $5$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{1}{x-5}$. Note that we could multiply the - numerator or denominator by any real number and still have the desired properties. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Vertical asymptote at $-2$, and zero at $6$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{x-6}{x+2}$. Note that we could multiply the - numerator or denominator by any real number and still have the desired properties. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Zeros at $2$ and $-5$ and vertical asymptotes at $1$ and $-7$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{(x-2)(x+5)}{(x-1)(x+7)}$. Note that we could multiply the - numerator or denominator by any real number and still have the desired properties. - \end{shortsolution} -\end{subproblem} -\end{problem} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Given formula, find horizontal asymptotes] -Each of the following functions has a horizontal asymptote. Write the equation -of the horizontal asymptote for each function. -\begin{multicols}{3} - \begin{subproblem} - $f(x) = \dfrac{1}{x}$ - \begin{shortsolution} - $y=0$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $g(x) = \dfrac{2x+3}{x}$ - \begin{shortsolution} - $y=2$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $h(x) = \dfrac{x^2+2x}{x^2+3}$ - \begin{shortsolution} - $y=1$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $k(x) = \dfrac{x^2+7}{x}$ - \begin{shortsolution} - $y=1$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $l(x)=\dfrac{3x-2}{5x+8}$ - \begin{shortsolution} - $y=\dfrac{3}{5}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $m(x)=\dfrac{3x-2}{5x^2+8}$ - \begin{shortsolution} - $y=0$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $n(x)=\dfrac{(6x+1)(x-7)}{(11x-8)(x-5)}$ - \begin{shortsolution} - $y=\dfrac{6}{11}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $p(x)=\dfrac{19x^3}{5-x^4}$ - \begin{shortsolution} - $y=0$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $q(x)=\dfrac{14x^2+x}{1-7x^2}$ - \begin{shortsolution} - $y=-2$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{problem}[Given horizontal asymptotes, find formula] -In each of the following problems, give a formula for a function that -has the given horizontal asymptote. Note that there may be more than one option. -\begin{multicols}{4} - \begin{subproblem} - $y=7$ - \begin{shortsolution} - Possible option: $f(x)=\dfrac{7(x-2)}{x+1}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $7$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=-1$ - \begin{shortsolution} - Possible option: $f(x)=\dfrac{5-x^2}{x^2+10}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $10$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=53$ - \begin{shortsolution} - Possible option: $f(x)=\dfrac{53x^3}{x^3+4x^2-7}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $53$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=-17$ - \begin{shortsolution} - Possible option: $f(x)=\dfrac{34(x+2)}{7-2x}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $-17$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=\dfrac{3}{2}$ - \begin{shortsolution} - Possible option: $f(x)=\dfrac{3x+4}{2(x+1)}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $\dfrac{3}{2}$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=0$ - \begin{shortsolution} - Possible option: $f(x)=\dfrac{4}{x}$. Note that there - are other options, provided that the degree of the numerator is less than the degree - of the denominator. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=-1$ - \begin{shortsolution} - Possible option: $f(x)=\dfrac{10x}{5-10x}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $-1$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=2$ - \begin{shortsolution} - Possible option: $f(x)=\dfrac{8x-3}{4x+1}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $2$. - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Find a formula from a description] -In each of the following problems, give a formula for a function that -has the prescribed properties. Note that there may be more than one option. -\begin{subproblem} - $f(x)\rightarrow 3$ as $x\rightarrow\pm\infty$. - \begin{shortsolution} - Possible option: $f(x)=\dfrac{3(x-2)}{x+7}$. Note that - the zero and asymptote of $f$ could be changed, and $f$ would still have the desired properties. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - $r(x)\rightarrow -4$ as $x\rightarrow\pm\infty$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{-4(x-2)}{x+7}$. Note that - the zero and asymptote of $r$ could be changed, and $r$ would still have the desired properties. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - $k(x)\rightarrow 2$ as $x\rightarrow\pm\infty$, and $k$ has vertical asymptotes at $-3$ and $5$. - \begin{shortsolution} - Possible option: $k(x)=\dfrac{2x^2}{(x+3)(x-5)}$. Note that the denominator - must have the given factors; the numerator could be any degree $2$ polynomial, provided the - leading coefficient is $2$. - \end{shortsolution} -\end{subproblem} -\end{problem} - -%=================================== -% Author: Hughes -% Date: Feb 2011 -%=================================== -\begin{problem} -Let $r$ be the rational function that has -\[ - r(x) = \frac{(x+2)(x-1)}{(x+3)(x-4)} -\] -Each of the following questions are in relation to this function. -\begin{subproblem} - What is the vertical intercept of this function? State your answer as an - ordered pair. \index{rational functions!vertical intercept} - \begin{shortsolution} - $\left(0,\frac{1}{6}\right)$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem}\label{rat:prob:rational} - What values of $x$ make the denominator equal to $0$? - \begin{shortsolution} - $-3,4$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Use your answer to \cref{rat:prob:rational} to write the domain of the function in - both interval, and set builder notation. %\index{rational functions!domain}\index{domain!rational functions} - \begin{shortsolution} - Interval notation: $(-\infty,-3)\cup (-3,4)\cup (4,\infty)$. - Set builder: $\{x|x\ne -3, \mathrm{and}\, x\ne 4\}$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - What are the vertical asymptotes of the function? State your answers in - the form $x=$ - \begin{shortsolution} - $x=-3$ and $x=4$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem}\label{rat:prob:zeroes} - What values of $x$ make the numerator equal to $0$? - \begin{shortsolution} - $-2,1$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Use your answer to \cref{rat:prob:zeroes} to write the horizontal intercepts of - $r$ as ordered pairs. - \begin{shortsolution} - $(-2,0)$ and $(1,0)$ - \end{shortsolution} -\end{subproblem} -\end{problem} - - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Holes] -\pccname{Josh} and \pccname{Pedro} are discussing the function -\[ - r(x)=\frac{x^2-1}{(x+3)(x-1)} -\] -\begin{subproblem} - What is the domain of $r$? - \begin{shortsolution} - The domain of $r$ is $(-\infty,-3)\cup(-3,1)\cup(1,\infty)$. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Josh notices that the numerator can be factored- can you see how? - \begin{shortsolution} - $(x^2-1)=(x-1)(x+1)$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Pedro asks, `Doesn't that just mean that - \[ - r(x)=\frac{x+1}{x+3} - \] - for all values of $x$?' Josh says, `Nearly\ldots but not for all values of $x$'. - What does Josh mean? - \begin{shortsolution} - $r(x)=\dfrac{x+1}{x+3}$ provided that $x\ne -1$. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Where does $r$ have vertical asymptotes, and where does it have holes? - \begin{shortsolution} - The function $r$ has a vertical asymptote at $-3$, and a hole at $1$. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Sketch a graph of $r$. - \begin{shortsolution} - A graph of $r$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot] expression[domain=-10:-3.25]{(x+1)/(x+3)}; - \addplot[pccplot] expression[domain=-2.75:10]{(x+1)/(x+3)}; - \addplot[asymptote,domain=-10:10]({-3},{x}); - \addplot[holdot]coordinates{(1,0.5)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} -\end{subproblem} -\end{problem} - -%=================================== -% Author: Hughes -% Date: July 2012 -%=================================== -\begin{problem}[Function algebra] -Let $r$ and $s$ be the rational functions that have formulas -\[ - r(x)=\frac{2-x}{x+3}, \qquad s(x)=\frac{x^2}{x-4} -\] -Evaluate each of the following (if possible). -\begin{multicols}{4} - \begin{subproblem} - $(r+s)(5)$ - \begin{shortsolution} - $\frac{197}{8}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(r-s)(3)$ - \begin{shortsolution} - $\frac{53}{6}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(r\cdot s)(4)$ - \begin{shortsolution} - Undefined. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $\left( \frac{r}{s} \right)(1)$ - \begin{shortsolution} - $-\frac{3}{4}$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - - -%=================================== -% Author: Hughes -% Date: July 2012 -%=================================== -\begin{problem}[Transformations: given the transformation, find the formula] -Let $r$ be the rational function that has formula. -\[ - r(x)=\frac{x+5}{2x-3} -\] -In each of the following problems apply the given transformation to the function $r$ and -write a formula for the transformed version of $r$. -\begin{multicols}{2} - \begin{subproblem} - Shift $r$ to the right by $3$ units. - \begin{shortsolution} - $r(x-3)=\frac{x+2}{2x-9}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $r$ to the left by $4$ units. - \begin{shortsolution} - $r(x+4)=\frac{x+9}{2x+5}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $r$ up by $\pi$ units. - \begin{shortsolution} - $r(x)+\pi=\frac{x+5}{2x-3}+\pi$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $r$ down by $17$ units. - \begin{shortsolution} - $r(x)-17=\frac{x+5}{2x-3}-17$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Reflect $r$ over the horizontal axis. - \begin{shortsolution} - $-r(x)=-\frac{x+5}{2x-3}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Reflect $r$ over the vertical axis. - \begin{shortsolution} - $r(-x)=\frac{x-5}{2x+3}$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Find a formula from a table]\label{rat:prob:findformula} -\Crefrange{rat:tab:findformular}{rat:tab:findformulau} show values of rational functions $r$, $q$, $s$, -and $t$. Assume that any values marked with an X are undefined. - -\begin{table}[!htb] - \begin{widepage} - \centering - \caption{Tables for \cref{rat:prob:findformula}} - \label{rat:tab:findformula} - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=r(x)$} - \label{rat:tab:findformular} - \begin{tabular}{rr} - \beforeheading - $x$ & $y$ \\ \afterheading - $-4$ & $\nicefrac{7}{2}$ \\\normalline - $-3$ & $-18$ \\\normalline - $-2$ & X \\\normalline - $-1$ & $-4$ \\\normalline - $0$ & $\nicefrac{-3}{2}$ \\\normalline - $1$ & $\nicefrac{-2}{3}$ \\\normalline - $2$ & $\nicefrac{-1}{4}$ \\\normalline - $3$ & $0$ \\\normalline - $4$ & $\nicefrac{1}{6}$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=s(x)$} - \label{rat:tab:findformulas} - \begin{tabular}{rr} - \beforeheading - $x$ & $y$ \\ \afterheading - $-4$ & $\nicefrac{-2}{21}$ \\\normalline - $-3$ & $\nicefrac{-1}{12}$ \\\normalline - $-2$ & $0$ \\\normalline - $-1$ & X \\\normalline - $0$ & $\nicefrac{-2}{3}$ \\\normalline - $1$ & $\nicefrac{-3}{4}$ \\\normalline - $2$ & $\nicefrac{-4}{3}$ \\\normalline - $3$ & X \\\normalline - $4$ & $\nicefrac{6}{5}$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=t(x)$} - \label{rat:tab:findformulat} - \begin{tabular}{rr} - \beforeheading - $x$ & $y$ \\ \afterheading - $-4$ & $\nicefrac{3}{5}$ \\\normalline - $-3$ & $0$ \\\normalline - $-2$ & X \\\normalline - $-1$ & $3$ \\\normalline - $0$ & $3$ \\\normalline - $1$ & X \\\normalline - $2$ & $0$ \\\normalline - $3$ & $\nicefrac{3}{5}$ \\\normalline - $4$ & $\nicefrac{7}{9}$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=u(x)$} - \label{rat:tab:findformulau} - \begin{tabular}{rr} - \beforeheading - $x$ & $y$ \\ \afterheading - $-4$ & $\nicefrac{16}{7}$ \\\normalline - $-3$ & X \\\normalline - $-2$ & $-\nicefrac{4}{5}$ \\\normalline - $-1$ & $-\nicefrac{1}{8}$ \\\normalline - $0$ & $0$ \\\normalline - $1$ & $-\nicefrac{1}{8}$ \\\normalline - $2$ & $-\nicefrac{4}{5}$ \\\normalline - $3$ & X \\\normalline - $4$ & $\nicefrac{16}{7}$ \\\lastline - \end{tabular} - \end{subtable} - \end{widepage} -\end{table} -\begin{subproblem} - Given that the formula for $r(x)$ has the form $r(x)=\dfrac{x-A}{x-B}$, use \cref{rat:tab:findformular} - to find values of $A$ and $B$. - \begin{shortsolution} - $A=3$ and $B=-2$, so $r(x)=\dfrac{x-3}{x+2}$. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Check your formula by computing $r(x)$ at the values specified in the table. - \begin{shortsolution} - $\begin{aligned}[t] - r(-4)&= \frac{-4-3}{-4+2}\\ - &= \frac{7}{2}\\ - \end{aligned}$ - - $r(-3)=\ldots$ etc -\end{shortsolution} -\end{subproblem} -\begin{subproblem} - The function $s$ in \cref{rat:tab:findformulas} has two vertical asymptotes and one zero. - Can you find a formula for $s(x)$? - \begin{shortsolution} - $s(x)=\dfrac{x+2}{(x-3)(x+1)}$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Check your formula by computing $s(x)$ at the values specified in the table. - \begin{shortsolution} - $\begin{aligned}[t] - s(-4)&=\frac{-4+2}{(-4-3)(-4+1)}\\ - &=-\frac{2}{21} - \end{aligned}$ - - $s(-3)=\ldots$ etc -\end{shortsolution} -\end{subproblem} -\begin{subproblem} - Given that the formula for $t(x)$ has the form $t(x)=\dfrac{(x-A)(x-B)}{(x-C)(x-D)}$, use \cref{rat:tab:findformulat} to find the - values of $A$, $B$, $C$, and $D$; hence write a formula for $t(x)$. - \begin{shortsolution} - $t(x)=\dfrac{(x+3)(x-2)}{(x+2)(x+1)}$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Given that the formula for $u(x)$ has the form $u(x)=\dfrac{(x-A)^2}{(x-B)(x-C)}$, use \cref{rat:tab:findformulau} to find the - values of $A$, $B$, and $C$; hence write a formula for $u(x)$. - \begin{shortsolution} - $u(x)=\dfrac{x^2}{(x+3)(x-3)}$ - \end{shortsolution} -\end{subproblem} -\end{problem} -\end{exercises} + \subsection*{Power functions with negative exponents} + The study of rational functions will rely upon a good knowledge + of power functions with negative exponents. \Cref{rat:ex:oddpow,rat:ex:evenpow} are + simple but fundamental to understanding the behavior of rational functions. + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Power functions with odd negative exponents]\label{rat:ex:oddpow} + Graph each of the following functions on your calculator, state their domain in interval notation, and their + behavior as $x\rightarrow 0^-$ and $x\rightarrow 0^+$. + \[ + f(x)=\frac{1}{x},\qquad g(x)=\dfrac{1}{x^3},\qquad h(x)=\dfrac{1}{x^5} + \] + \begin{pccsolution} + The functions $f$, $g$, and $k$ are plotted in \cref{rat:fig:oddpow}. + The domain of each of the functions $f$, $g$, and $h$ is $(-\infty,0)\cup (0,\infty)$. Note that + the long-run behavior of each of the functions is the same, and in particular + \begin{align*} + f(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} f(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty + \end{align*} + The same results hold for $g$ and $h$. Note also that each of the functions + has a \emph{vertical asymptote} at $0$. We see that + \begin{align*} + f(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^- \\ + \mathllap{\text{and }} f(x)\rightarrow \infty & \text{ as } x\rightarrow 0^+ + \end{align*} + The same results hold for $g$ and $h$. + + The curve of a function that has a vertical asymptote is necessarily separated + into \emph{branches}| each of the functions $f$, $g$, and $h$ have $2$ branches. + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htb] + \begin{minipage}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-3,xmax=3, + ymin=-5,ymax=5, + xtick={-2,-1,...,2}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\textwidth, + legend pos=north west, + ] + \addplot expression[domain=-3:-0.2]{1/x}; + \addplot expression[domain=-3:-0.584]{1/x^3}; + \addplot expression[domain=-3:-0.724]{1/x^5}; + \addplot expression[domain=0.2:3]{1/x}; + \addplot expression[domain=0.584:3]{1/x^3}; + \addplot expression[domain=0.724:3]{1/x^5}; + \addplot[soldot]coordinates{(-1,-1)}node[axisnode,anchor=north east]{$(-1,-1)$}; + \addplot[soldot]coordinates{(1,1)}node[axisnode,anchor=south west]{$(1,1)$}; + \legend{$f$,$g$,$h$} + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:oddpow} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-3,xmax=3, + ymin=-5,ymax=5, + xtick={-2,-1,...,2}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\textwidth, + legend pos=south east, + ] + \addplot expression[domain=-3:-0.447]{1/x^2}; + \addplot expression[domain=-3:-0.668]{1/x^4}; + \addplot expression[domain=-3:-0.764]{1/x^6}; + \addplot expression[domain=0.447:3]{1/x^2}; + \addplot expression[domain=0.668:3]{1/x^4}; + \addplot expression[domain=0.764:3]{1/x^6}; + \addplot[soldot]coordinates{(-1,1)}node[axisnode,anchor=south east]{$(-1,1)$}; + \addplot[soldot]coordinates{(1,1)}node[axisnode,anchor=south west]{$(1,1)$}; + \legend{$F$,$G$,$H$} + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:evenpow} + \end{minipage}% + \end{figure} + + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Power functions with even negative exponents]\label{rat:ex:evenpow}% + Graph each of the following functions, state their domain, and their + behavior as $x\rightarrow 0^-$ and $x\rightarrow 0^+$. + \[ + f(x)=\frac{1}{x^2},\qquad g(x)=\frac{1}{x^4},\qquad h(x)=\frac{1}{x^6} + \] + \begin{pccsolution} + The functions $F$, $G$, and $H$ are plotted in \cref{rat:fig:evenpow}. + The domain of each of the functions $F$, $G$, and $H$ is $(-\infty,0)\cup (0,\infty)$. Note that + the long-run behavior of each of the functions is the same, and in particular + \begin{align*} + F(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} f(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty + \end{align*} + As in \cref{rat:ex:oddpow}, $F$ has a horizontal asymptote that + has equation $y=0$. + The same results hold for $G$ and $H$. Note also that each of the functions + has a \emph{vertical asymptote} at $0$. We see that + \begin{align*} + F(x)\rightarrow \infty & \text{ as } x\rightarrow 0^- \\ + \mathllap{\text{and }} F(x)\rightarrow \infty & \text{ as } x\rightarrow 0^+ + \end{align*} + The same results hold for $G$ and $H$. Each of the functions $F$, $G$, and $H$ + have $2$ branches. + \end{pccsolution} + \end{pccexample} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{doyouunderstand} + \begin{problem} + Repeat \cref{rat:ex:oddpow,rat:ex:evenpow} using (respectively) + \begin{subproblem} + $k(x)=-\dfrac{1}{x}$, $ m(x)=-\dfrac{1}{x^3}$, $ n(x)=-\dfrac{1}{x^5}$ + \begin{shortsolution} + The functions $k$, $m$, and $n$ have domain $(-\infty,0)\cup (0,\infty)$, and + are graphed below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-3,xmax=3, + ymin=-5,ymax=5, + xtick={-2,-1,...,2}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + legend pos=north east, + ] + \addplot expression[domain=-3:-0.2]{-1/x}; + \addplot expression[domain=-3:-0.584]{-1/x^3}; + \addplot expression[domain=-3:-0.724]{-1/x^5}; + \addplot expression[domain=0.2:3]{-1/x}; + \addplot expression[domain=0.584:3]{-1/x^3}; + \addplot expression[domain=0.724:3]{-1/x^5}; + \legend{$k$,$m$,$n$} + \end{axis} + \end{tikzpicture} + + Note that + \begin{align*} + k(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} k(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \\ + \intertext{and also} + k(x)\rightarrow \infty & \text{ as } x\rightarrow 0^- \\ + \mathllap{\text{and }} k(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^+ + \end{align*} + The same are true for $m$ and $n$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $ K(x)=-\dfrac{1}{x^2}$, $ M(x)=-\dfrac{1}{x^4}$, $ N(x)=-\dfrac{1}{x^6}$ + \begin{shortsolution} + The functions $K$, $M$, and $N$ have domain $(-\infty,0)\cup (0,\infty)$, and + are graphed below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-3,xmax=3, + ymin=-5,ymax=5, + xtick={-2,-1,...,2}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + legend pos=north east, + ] + \addplot expression[domain=-3:-0.447]{-1/x^2}; + \addplot expression[domain=-3:-0.668]{-1/x^4}; + \addplot expression[domain=-3:-0.764]{-1/x^6}; + \addplot expression[domain=0.447:3]{-1/x^2}; + \addplot expression[domain=0.668:3]{-1/x^4}; + \addplot expression[domain=0.764:3]{-1/x^6}; + \legend{$K$,$M$,$N$} + \end{axis} + \end{tikzpicture} + + Note that + \begin{align*} + K(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} K(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \\ + \intertext{and also} + K(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^- \\ + \mathllap{\text{and }} K(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^+ + \end{align*} + The same are true for $M$ and $N$. + \end{shortsolution} + \end{subproblem} + \end{problem} + \end{doyouunderstand} + + \subsection*{Rational functions} + \begin{pccdefinition}[Rational functions]\label{rat:def:function} + Rational functions have the form + \[ + r(x) = \frac{p(x)}{q(x)} + \] + where both $p$ and $q$ are polynomials. + + Note that + \begin{itemize} + \item the domain or $r$ will be all real numbers, except those that + make the \emph{denominator}, $q(x)$, equal to $0$; + \item the zeros of $r$ are the zeros of $p$, i.e the real numbers + that make the \emph{numerator}, $p(x)$, equal to $0$. + \end{itemize} + + \Cref{rat:ex:oddpow,rat:ex:evenpow} are particularly important because $r$ + will behave like $\frac{1}{x}$, or $\frac{1}{x^2}$ around its vertical asymptotes, + depending on the power that the relevant term is raised to| we will demonstrate + this in what follows. + \end{pccdefinition} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Rational or not] + Identify whether each of the following functions is a rational or not. If + the function is rational, state the domain. + \begin{multicols}{3} + \begin{enumerate} + \item $r(x)=\dfrac{1}{x}$ + \item $f(x)=2^x+3$ + \item $g(x)=19$ + \item $h(x)=\dfrac{3+x}{4-x}$ + \item $k(x)=\dfrac{x^3+2x}{x-15}$ + \item $l(x)=9-4x$ + \item $m(x)=\dfrac{x+5}{(x-7)(x+9)}$ + \item $n(x)=x^2+6x+7$ + \item $q(x)=1-\dfrac{3}{x+1}$ + \end{enumerate} + \end{multicols} + \begin{pccsolution} + \begin{enumerate} + \item $r$ is rational; the domain of $r$ is $(-\infty,0)\cup(0,\infty)$. + \item $f$ is not rational. + \item $g$ is not rational; $g$ is constant. + \item $h$ is rational; the domain of $h$ is $(-\infty,4)\cup(4,\infty)$. + \item $k$ is rational; the domain of $k$ is $(-\infty,15)\cup(15,\infty)$. + \item $l$ is not rational; $l$ is linear. + \item $m$ is rational; the domain of $m$ is $(-\infty,-9)\cup(-9,7)\cup(7,\infty)$. + \item $n$ is not rational; $n$ is quadratic (or you might describe $n$ as a polynomial). + \item $q$ is rational; the domain of $q$ is $(-\infty,-1)\cup (-1,\infty)$. + \end{enumerate} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Match formula to graph] + Each of the following functions is graphed in \cref{rat:fig:whichiswhich}. + Which is which? + \[ + r(x)=\frac{1}{x-3}, \qquad q(x)=\frac{x-2}{x+5}, \qquad k(x)=\frac{1}{(x+2)(x-3)} + \] + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/(x+5);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-6,ymax=6, + xtick={-8,-6,...,8}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-6.37]{f}; + \addplot[pccplot] expression[domain=-3.97:10]{f}; + \addplot[soldot] coordinates{(2,0)}; + \addplot[asymptote,domain=-6:6]({-5},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:which1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=1/(x-3);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-5,ymax=6, + xtick={-8,-6,...,8}, + ytick={-4,4}, + minor ytick={-3,...,5}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:2.8]{f}; + \addplot[pccplot] expression[domain=3.17:10]{f}; + \addplot[asymptote,domain=-6:6]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:which2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=1/((x-3)*(x+2));}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-5,ymax=5, + xtick={-8,-6,...,8}, + ytick={-4,4}, + minor ytick={-3,...,3}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-2.03969]{f}; + \addplot[pccplot] expression[domain=-1.95967:2.95967]{f}; + \addplot[pccplot] expression[domain=3.03969:10]{f}; + \addplot[asymptote,domain=-5:5]({-2},{x}); + \addplot[asymptote,domain=-5:5]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:which3} + \end{subfigure} + \caption{} + \label{rat:fig:whichiswhich} + \end{figure} + + \begin{pccsolution} + Let's start with the function $r$. Note that domain of $r$ is $(-\infty,3)\cup(0,3)$, so + we search for a function that has a vertical asymptote at $3$. There + are two possible choices: the functions graphed in \cref{rat:fig:which2,rat:fig:which3}, + but note that the function in \cref{rat:fig:which3} also has a vertical asymptote at $-2$ + which is not consistent with the formula for $r(x)$. Therefore, $y=r(x)$ + is graphed in \cref{rat:fig:which2}. + + The function $q$ has domain $(-\infty,-5)\cup(-5,\infty)$, so we search + for a function that has a vertical asymptote at $-5$. The only candidate + is the curve shown in \cref{rat:fig:which1}; note that the curve also goes through $(2,0)$, + which is consistent with the formula for $q(x)$, since $q(2)=0$, i.e $q$ + has a zero at $2$. + + The function $k$ has domain $(-\infty,-2)\cup(-2,3)\cup(3,\infty)$, and + has vertical asymptotes at $-2$ and $3$. This is consistent with + the graph in \cref{rat:fig:which3} (and is the only curve that + has $3$ branches). + + We note that each function behaves like $\frac{1}{x}$ around its vertical asymptotes, + because each linear factor in each denominator is raised to the power $1$; if (for example) + the definition of $r$ was instead + \[ + r(x)=\frac{1}{(x-3)^2} + \] + then we would see that $r$ behaves like $\frac{1}{x^2}$ around its vertical asymptote, and + the graph of $r$ would be very different. We will deal with these cases in the examples that follow. + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Repeated factors in the denominator] + Consider the functions $f$, $g$, and $h$ that have formulas + \[ + f(x)=\frac{x-2}{(x-3)(x+2)}, \qquad g(x)=\frac{x-2}{(x-3)^2(x+2)}, \qquad h(x)=\frac{x-2}{(x-3)(x+2)^2} + \] + which are graphed in \cref{rat:fig:repfactd}. Note that each function has $2$ + vertical asymptotes, and the domain of each function is + \[ + (-\infty,-2)\cup(-2,3)\cup(3,\infty) + \] + so we are not surprised to see that each curve has $3$ branches. We also note that + the numerator of each function is the same, which tells us that each function has + only $1$ zero at $2$. + + The functions $g$ and $h$ are different from those that we have considered previously, + because they have a repeated factor in the denominator. Notice in particular + the way that the functions behave around their asymptotes: + \begin{itemize} + \item $f$ behaves like $\frac{1}{x}$ around both of its asymptotes; + \item $g$ behaves like $\frac{1}{x}$ around $-2$, and like $\frac{1}{x^2}$ around $3$; + \item $h$ behaves like $\frac{1}{x^2}$ around $-2$, and like $\frac{1}{x}$ around $3$. + \end{itemize} + \end{pccexample} + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-4,ymax=4, + xtick={-4,-2,...,4}, + ytick={-2,2}, + % grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-5:-2.201]{f}; + \addplot[pccplot] expression[domain=-1.802:2.951]{f}; + \addplot[pccplot] expression[domain=3.052:5]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-6:6]({-2},{x}); + % \addplot[asymptote,domain=-6:6]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x-2}{(x+2)(x-3)}$} + \label{rat:fig:repfactd1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)*(x-3)^2);}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-4,ymax=4, + xtick={-4,-2,...,4}, + ytick={-2,2}, + % grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-5:-2.039]{f}; + \addplot[pccplot] expression[domain=-1.959:2.796]{f}; + \addplot[pccplot] expression[domain=3.243:5]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-4:4]({-2},{x}); + % \addplot[asymptote,domain=-4:4]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x-2}{(x+2)(x-3)^2}$} + \label{rat:fig:repfactd2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)^2*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-4,ymax=4, + xtick={-4,-2,...,2}, + ytick={-2,2}, + % grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-5:-2.451]{f}; + \addplot[pccplot] expression[domain=-1.558:2.990]{f}; + \addplot[pccplot] expression[domain=3.010:6]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-4:4]({-2},{x}); + % \addplot[asymptote,domain=-4:4]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x-2}{(x+2)^2(x-3)}$} + \label{rat:fig:repfactd3} + \end{subfigure} + \caption{} + \label{rat:fig:repfactd} + \end{figure} + + \Cref{rat:def:function} says that the zeros of + the rational function $r$ that has formula $r(x)=\frac{p(x)}{q(x)}$ are + the zeros of $p$. Let's explore this a little more. + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}[Zeros] Find the zeros of each of the following functions + \[ + \alpha(x)=\frac{x+5}{3x-7}, \qquad \beta(x)=\frac{9-x}{x+1}, \qquad \gamma(x)=\frac{17x^2-10}{2x+1} + \] + \begin{pccsolution} + We find the zeros of each function in turn by setting the numerator equal to $0$. The zeros of + $\alpha$ are found by solving + \[ + x+5=0 + \] + The zero of $\alpha$ is $-5$. + + Similarly, we may solve $9-x=0$ to find the zero of $\beta$, which is clearly $9$. + + The zeros of $\gamma$ satisfy the equation + \[ + 17x^2-10=0 + \] + which we can solve using the square root property to obtain + \[ + x=\pm\frac{10}{17} + \] + The zeros of $\gamma$ are $\pm\frac{10}{17}$. + \end{pccsolution} + \end{pccexample} + + \subsection*{Long-run behavior} + Our focus so far has been on the behavior of rational functions around + their \emph{vertical} asymptotes. In fact, rational functions also + have interesting long-run behavior around their \emph{horizontal} or + \emph{oblique} asymptotes. A rational function will always have either + a horizontal or an oblique asymptote| the case is determined by the degree + of the numerator and the degree of the denominator. + \begin{pccdefinition}[Long-run behavior]\label{rat:def:longrun} + Let $r$ be the rational function that has formula + \[ + r(x) = \frac{a_n x^n + a_{n-1}x^{n-1}+\ldots + a_0}{b_m x^m + b_{m-1}x^{m-1}+\ldots+b_0} + \] + We can classify the long-run behavior of the rational function $r$ + according to the following criteria: + \begin{itemize} + \item if $n<m$ then $r$ has a horizontal asymptote with equation $y=0$; + \item if $n=m$ then $r$ has a horizontal asymptote with equation $y=\dfrac{a_n}{b_m}$; + \item if $n>m$ then $r$ will have an oblique asymptote as $x\rightarrow\pm\infty$ (more on this in \cref{rat:sec:oblique}) + \end{itemize} + \end{pccdefinition} + We will concentrate on functions that have horizontal asymptotes until + we reach \cref{rat:sec:oblique}. + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}[Long-run behavior graphically]\label{rat:ex:horizasymp} + \pccname{Kebede} has graphed the following functions in his graphing calculator + \[ + r(x)=\frac{x+1}{x-3}, \qquad s(x)=\frac{2(x+1)}{x-3}, \qquad t(x)=\frac{3(x+1)}{x-3} + \] + and obtained the curves shown in \cref{rat:fig:horizasymp}. Kebede decides + to test his knowledgeable friend \pccname{Oscar}, and asks him + to match the formulas to the graphs. + + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=2*(x+1)/(x-3);}] + \begin{axis}[ + framed, + xmin=-15,xmax=15, + ymin=-6,ymax=6, + xtick={-12,-8,...,12}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-15:2]{f}; + \addplot[pccplot] expression[domain=5:15]{f}; + \addplot[soldot] coordinates{(-1,0)}; + \addplot[asymptote,domain=-6:6]({3},{x}); + \addplot[asymptote,domain=-15:15]({x},{2}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:horizasymp1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x+1)/(x-3);}] + \begin{axis}[ + framed, + xmin=-15,xmax=15, + ymin=-6,ymax=6, + xtick={-12,-8,...,12}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-15:2.42857,samples=50]{f}; + \addplot[pccplot] expression[domain=3.8:15,samples=50]{f}; + \addplot[soldot] coordinates{(-1,0)}; + \addplot[asymptote,domain=-6:6]({3},{x}); + \addplot[asymptote,domain=-15:15]({x},{1}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:horizasymp2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=3*(x+1)/(x-3);}] + \begin{axis}[ + framed, + xmin=-15,xmax=15, + ymin=-6,ymax=6, + xtick={-12,-8,...,12}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-15:1.6666,samples=50]{f}; + \addplot[pccplot] expression[domain=7:15]{f}; + \addplot[soldot] coordinates{(-1,0)}; + \addplot[asymptote,domain=-6:6]({3},{x}); + \addplot[asymptote,domain=-15:15]({x},{3}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:horizasymp3} + \end{subfigure} + \caption{Horizontal asymptotes} + \label{rat:fig:horizasymp} + \end{figure} + + Oscar notices that each function has a vertical asymptote at $3$ and a zero at $-1$. + The main thing that catches Oscar's eye is that each function has a different + coefficient in the numerator, and that each curve has a different horizontal asymptote. + In particular, Oscar notes that + \begin{itemize} + \item the curve shown in \cref{rat:fig:horizasymp1} has a horizontal asymptote with equation $y=2$; + \item the curve shown in \cref{rat:fig:horizasymp2} has a horizontal asymptote with equation $y=1$; + \item the curve shown in \cref{rat:fig:horizasymp3} has a horizontal asymptote with equation $y=3$. + \end{itemize} + Oscar is able to tie it all together for Kebede by referencing \cref{rat:def:longrun}. He says + that since the degree of the numerator and the degree of the denominator is the same + for each of the functions $r$, $s$, and $t$, the horizontal asymptote will be determined + by evaluating the ratio of their leading coefficients. + + Oscar therefore says that $r$ should have a horizontal asymptote $y=\frac{1}{1}=1$, $s$ should + have a horizontal asymptote $y=\frac{2}{1}=2$, and $t$ should have a horizontal asymptote + $y=\frac{3}{1}=3$. Kebede is able to finish the problem from here, and says that $r$ is + shown in \cref{rat:fig:horizasymp2}, $s$ is shown in \cref{rat:fig:horizasymp1}, and + $t$ is shown in \cref{rat:fig:horizasymp3}. + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}[Long-run behavior numerically] + \pccname{Xiao} and \pccname{Dwayne} saw \cref{rat:ex:horizasymp} but are a little confused + about horizontal asymptotes. What does it mean to say that a function $r$ has a horizontal + asymptote? + + They decide to explore the concept by + constructing a table of values for the rational functions $R$ and $S$ that have formulas + \[ + R(x)=\frac{-5(x+1)}{x-3}, \qquad S(x)=\frac{7(x-5)}{2(x+1)} + \] + In \cref{rat:tab:plusinfty} they model the behavior of $R$ and $S$ as $x\rightarrow\infty$, + and in \cref{rat:tab:minusinfty} they model the behavior of $R$ and $S$ as $x\rightarrow-\infty$ + by substituting very large values of $|x|$ into each function. + \begin{table}[!htb] + \begin{minipage}{.5\textwidth} + \centering + \caption{$R$ and $S$ as $x\rightarrow\infty$} + \label{rat:tab:plusinfty} + \begin{tabular}{crr} + \beforeheading + $x$ & $R(x)$ & $S(x)$ \\ \afterheading + $1\times 10^2$ & $-5.20619$ & $3.29208$ \\\normalline + $1\times 10^3$ & $-5.02006$ & $3.47902$ \\\normalline + $1\times 10^4$ & $-5.00200$ & $3.49790$ \\\normalline + $1\times 10^5$ & $-5.00020$ & $3.49979$ \\\normalline + $1\times 10^6$ & $-5.00002$ & $3.49998$ \\\lastline + \end{tabular} + \end{minipage}% + \begin{minipage}{.5\textwidth} + \centering + \caption{$R$ and $S$ as $x\rightarrow-\infty$} + \label{rat:tab:minusinfty} + \begin{tabular}{crr} + \beforeheading + $x$ & $R(x)$ & $S(x)$ \\ \afterheading + $-1\times 10^2$ & $-4.80583$ & $3.71212$ \\\normalline + $-1\times 10^3$ & $-4.98006$ & $3.52102$ \\\normalline + $-1\times 10^4$ & $-4.99800$ & $3.50210$ \\\normalline + $-1\times 10^5$ & $-4.99980$ & $3.50021$ \\\normalline + $-1\times 10^6$ & $-4.99998$ & $3.50002$ \\\lastline + \end{tabular} + \end{minipage} + \end{table} + + Xiao and Dwayne study \cref{rat:tab:plusinfty,rat:tab:minusinfty} and decide that + the functions $R$ and $S$ never actually touch their horizontal asymptotes, but they + do get infinitely close. They also feel as if they have a better understanding of + what it means to study the behavior of a function as $x\rightarrow\pm\infty$. + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Repeated factors in the numerator] + Consider the functions $f$, $g$, and $h$ that have formulas + \[ + f(x)=\frac{(x-2)^2}{(x-3)(x+1)}, \qquad g(x)=\frac{x-2}{(x-3)(x+1)}, \qquad h(x)=\frac{(x-2)^3}{(x-3)(x+1)} + \] + which are graphed in \cref{rat:fig:repfactn}. We note that each function has vertical + asymptotes at $-1$ and $3$, and so the domain of each function is + \[ + (-\infty,-1)\cup(-1,3)\cup(3,\infty) + \] + We also notice that the numerators of each function are quite similar| indeed, each + function has a zero at $2$, but how does each function behave around their zero? + + Using \cref{rat:fig:repfactn} to guide us, we note that + \begin{itemize} + \item $f$ has a horizontal intercept $(2,0)$, but the curve of + $f$ does not cut the horizontal axis| it bounces off it; + \item $g$ also has a horizontal intercept $(2,0)$, and the curve + of $g$ \emph{does} cut the horizontal axis; + \item $h$ has a horizontal intercept $(2,0)$, and the curve of $h$ + also cuts the axis, but appears flattened as it does so. + \end{itemize} + + We can further enrich our study by discussing the long-run behavior of each function. + Using the tools of \cref{rat:def:longrun}, we can deduce that + \begin{itemize} + \item $f$ has a horizontal asymptote with equation $y=1$; + \item $g$ has a horizontal asymptote with equation $y=0$; + \item $h$ does \emph{not} have a horizontal asymptote| it has an oblique asymptote (we'll + study this more in \cref{rat:sec:oblique}). + \end{itemize} + \end{pccexample} + + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)^2/((x+1)*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-10,ymax=10, + xtick={-4,-2,...,4}, + ytick={-8,-4,...,8}, + % grid=both, + width=\figurewidth, + ] + \addplot[pccplot] expression[domain=-5:-1.248,samples=50]{f}; + \addplot[pccplot] expression[domain=-0.794:2.976,samples=50]{f}; + \addplot[pccplot] expression[domain=3.026:5,samples=50]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-6:6]({-1},{x}); + % \addplot[asymptote,domain=-6:6]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{(x-2)^2}{(x+1)(x-3)}$} + \label{rat:fig:repfactn1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+1)*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-10,ymax=10, + xtick={-4,-2,...,4}, + ytick={-8,-4,...,8}, + % grid=both, + width=\figurewidth, + ] + \addplot[pccplot] expression[domain=-5:-1.075]{f}; + \addplot[pccplot] expression[domain=-0.925:2.975]{f}; + \addplot[pccplot] expression[domain=3.025:5]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-6:6]({-1},{x}); + % \addplot[asymptote,domain=-6:6]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x-2}{(x+1)(x-3)}$} + \label{rat:fig:repfactn2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)^3/((x+1)*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + xtick={-8,-6,...,8}, + % grid=both, + ymin=-30,ymax=30, + width=\figurewidth, + ] + \addplot[pccplot] expression[domain=-5:-1.27]{f}; + \addplot[pccplot] expression[domain=-0.806:2.99185]{f}; + \addplot[pccplot] expression[domain=3.0085:5]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-30:30]({-1},{x}); + % \addplot[asymptote,domain=-30:30]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{(x-2)^3}{(x+1)(x-3)}$} + \label{rat:fig:repfactn3} + \end{subfigure} + \caption{} + \label{rat:fig:repfactn} + \end{figure} + + \subsection*{Holes} + Rational functions have a vertical asymptote at $a$ if the denominator is $0$ at $a$. + What happens if the numerator is $0$ at the same place? In this case, we say that the rational + function has a \emph{hole} at $a$. + \begin{pccdefinition}[Holes] + The rational function + \[ + r(x)=\frac{p(x)}{q(x)} + \] + has a hole at $a$ if $p(a)=q(a)=0$. Note that holes are different from + a vertical asymptotes. We represent that $r$ has a hole at the point + $(a,r(a))$ on the curve $y=r(x)$ by + using a hollow circle, $\circ$. + \end{pccdefinition} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample} + \pccname{Mohammed} and \pccname{Sue} have graphed the function $r$ that has formula + \[ + r(x)=\frac{x^2+x-6}{(x-2)} + \] + in their calculators, and can not decide if the correct graph + is \cref{rat:fig:hole} or \cref{rat:fig:hole1}. + + Luckily for them, Oscar is nearby, and can help them settle the debate. + Oscar demonstrates that + \begin{align*} + r(x) & =\frac{(x+3)(x-2)}{(x-2)} \\ + & = x+3 + \end{align*} + but only when $x\ne 2$, because the function is undefined at $2$. Oscar + says that this necessarily means that the domain or $r$ is + \[ + (-\infty,2)\cup(2,\infty) + \] + and that $r$ must have a hole at $2$. + + Mohammed and Sue are very grateful for the clarification, and conclude that + the graph of $r$ is shown in \cref{rat:fig:hole1}. + \begin{figure}[!htb] + \begin{minipage}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-4,...,8}, + ytick={-8,-4,...,8}, + grid=both, + width=\textwidth, + ] + \addplot expression[domain=-10:7]{x+3}; + \addplot[soldot] coordinates{(-3,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:hole} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-4,...,8}, + ytick={-8,-4,...,8}, + grid=both, + width=\textwidth, + ] + \addplot expression[domain=-10:7]{x+3}; + \addplot[holdot] coordinates{(2,5)}; + \addplot[soldot] coordinates{(-3,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:hole1} + \end{minipage}% + \end{figure} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample} + Consider the function $f$ that has formula + \[ + f(x)=\frac{x(x+3)}{x^2-4x} + \] + The domain of $f$ is $(-\infty,0)\cup(0,4)\cup(4,\infty)$ because both $0$ and $4$ + make the denominator equal to $0$. Notice that + \begin{align*} + f(x) & = \frac{x(x+3)}{x(x-4)} \\ + & = \frac{x+3}{x-4} + \end{align*} + provided that $x\ne 0$. Since $0$ makes the numerator + and the denominator 0 at the same time, we say that $f$ has a hole at $(0,-\nicefrac{3}{4})$. + Note that this necessarily means that $f$ does not have a vertical intercept. + + We also note $f$ has a vertical asymptote at $4$; the function is graphed in \cref{rat:fig:holeex}. + \begin{figure}[!htb] + \centering + \begin{tikzpicture}[/pgf/declare function={f=(x+3)/(x-4);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=both, + ] + \addplot[pccplot] expression[domain=-10:3.36364,samples=50]{f}; + \addplot[pccplot] expression[domain=4.77:10]{f}; + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[holdot]coordinates{(0,-0.75)}; + \addplot[soldot] coordinates{(-3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x(x+3)}{x^2-4x}$} + \label{rat:fig:holeex} + \end{figure} + \end{pccexample} + + + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Minimums and maximums] + \pccname{Seamus} and \pccname{Trang} are discussing rational functions. Seamus says that + if a rational function has a vertical asymptote, then it can + not possibly have local minimums and maximums, nor can it have + global minimums and maximums. + + Trang says this statement is not always true. She plots the functions + $f$ and $g$ that have formulas + \[ + f(x)=-\frac{32(x-1)(x+1)}{(x-2)^2(x+2)^2}, \qquad g(x)=\frac{32(x-1)(x+1)}{(x-2)^2(x+2)^2} + \] + in \cref{rat:fig:minmax1,rat:fig:minmax2} and shows them to Seamus. On seeing the graphs, + Seamus quickly corrects himself, and says that $f$ has a local (and global) + maximum of $2$ at $0$, and that $g$ has a local (and global) minimum of $-2$ at $0$. + + \begin{figure}[!htb] + \begin{minipage}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=-32*(x-1)*(x+1)/(( x-2)^2*(x+2)^2);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-3.01]{f}; + \addplot[pccplot] expression[domain=-1.45:1.45]{f}; + \addplot[pccplot] expression[domain=3.01:10]{f}; + \addplot[soldot] coordinates{(-1,0)(1,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=f(x)$} + \label{rat:fig:minmax1} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=32*(x-1)*(x+1)/(( x-2)^2*(x+2)^2);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-3.01]{f}; + \addplot[pccplot] expression[domain=-1.45:1.45]{f}; + \addplot[pccplot] expression[domain=3.01:10]{f}; + \addplot[soldot] coordinates{(-1,0)(1,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=g(x)$} + \label{rat:fig:minmax2} + \end{minipage}% + \end{figure} + + Seamus also notes that (in its domain) the function $f$ is always concave down, and + that (in its domain) the function $g$ is always concave up. Furthermore, Trang + observes that each function behaves like $\frac{1}{x^2}$ around each of its vertical + asymptotes, because each linear factor in the denominator is raised to the power $2$. + + \pccname{Oscar} stops by and reminds both students about the long-run behavior; according + to \cref{rat:def:longrun} since the degree of the denominator is greater than the + degree of the numerator (in both functions), each function has a horizontal asymptote + at $y=0$. + \end{pccexample} + + + \investigation*{} + %=================================== + % Author: Pettit/Hughes + % Date: March 2012 + %=================================== + \begin{problem}[The spaghetti incident] + The same Queen from \vref{exp:prob:queenschessboard} has recovered from + the rice experiments, and has called her loyal jester for another challenge. + + The jester has an $11-$inch piece of uncooked spaghetti that he puts on a table; + he uses a book to cover $\unit[1]{inch}$ of it so that + $\unit[10]{inches}$ hang over the edge. The jester then produces a box of $\unit{mg}$ + weights that can be hung from the spaghetti. + + The jester says it will take $\unit[y]{mg}$ to break the spaghetti when hung + $\unit[x]{inches}$ from the edge, according to the rule $y=\frac{100}{x}$. + \begin{margintable} + \centering + \captionof{table}{} + \label{rat:tab:spaghetti} + \begin{tabular}{cc} + \beforeheading + \heading{$x$} & \heading{$y$} \\ + \afterheading + $1$ & \\\normalline + $2$ & \\\normalline + $3$ & \\\normalline + $4$ & \\\normalline + $5$ & \\\normalline + $6$ & \\\normalline + $7$ & \\\normalline + $8$ & \\\normalline + $9$ & \\\normalline + $10$ & \\\lastline + \end{tabular} + \end{margintable} + \begin{subproblem}\label{rat:prob:spaggt1} + Help the Queen complete \cref{rat:tab:spaghetti}, and use $2$ digits after the decimal + where appropriate. + \begin{shortsolution} + \begin{tabular}[t]{ld{2}} + \beforeheading + \heading{$x$} & \heading{$y$} \\ + \afterheading + $1$ & 100 \\\normalline + $2$ & 50 \\\normalline + $3$ & 33.33 \\\normalline + $4$ & 25 \\\normalline + $5$ & 20 \\\normalline + $6$ & 16.67 \\\normalline + $7$ & 14.29 \\\normalline + $8$ & 12.50 \\\normalline + $9$ & 11.11 \\\normalline + $10$ & 10 \\\lastline + \end{tabular} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + What do you notice about the number of $\unit{mg}$ that it takes to break + the spaghetti as $x$ increases? + \begin{shortsolution} + It seems that the number of $\unit{mg}$ that it takes to break the spaghetti decreases + as $x$ increases. + \end{shortsolution} + \end{subproblem} + \begin{subproblem}\label{rat:prob:spaglt1} + The Queen wonders what happens when $x$ gets very small| help the Queen construct + a table of values for $x$ and $y$ when $x=0.0001, 0.001, 0.01, 0.1, 0.5, 1$. + \begin{shortsolution} + \begin{tabular}[t]{d{2}l} + \beforeheading + \heading{$x$} & \heading{$y$} \\ + \afterheading + 0.0001 & $1000000$ \\\normalline + 0.001 & $100000$ \\\normalline + 0.01 & $10000$ \\\normalline + 0.1 & $1000$ \\\normalline + 0.5 & $200$ \\\normalline + 1 & $100$ \\\lastline + \end{tabular} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + What do you notice about the number of $\unit{mg}$ that it takes to break the spaghetti + as $x\rightarrow 0$? Would it ever make sense to let $x=0$? + \begin{shortsolution} + The number of $\unit{mg}$ required to break the spaghetti increases as $x\rightarrow 0$. + We can not allow $x$ to be $0$, as we can not divide by $0$, and we can not + be $0$ inches from the edge of the table. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Plot your results from \cref{rat:prob:spaggt1,rat:prob:spaglt1} on the same graph, + and join the points using a smooth curve| set the maximum value of $y$ as $200$, and + note that this necessarily means that you will not be able to plot all of the points. + \begin{shortsolution} + The graph of $y=\frac{100}{x}$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-2,xmax=11, + ymin=-20,ymax=200, + xtick={2,4,...,10}, + ytick={20,40,...,180}, + grid=major, + width=\solutionfigurewidth, + ] + \addplot+[-] expression[domain=0.5:10]{100/x}; + \addplot[soldot] coordinates{(0.5,200)(1,100)(2,50)(3,33.33) + (4,25)(5,20)(16.67)(7,14.29)(8,12.50)(9,11.11)(10,10)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Using your graph, observe what happens to $y$ as $x$ increases. If we could somehow + construct a piece of uncooked spaghetti that was $\unit[101]{inches}$ long, how many + $\unit{mg}$ would it take to break the spaghetti? + \begin{shortsolution} + As $x$ increases, $y\rightarrow 0$. If we could construct a piece of spaghetti + $\unit[101]{inches}$ long, it would only take $\unit[1]{mg}$ to break it $\left(\frac{100}{100}=1\right)$. Of course, + the weight of spaghetti would probably cause it to break without the weight. + \end{shortsolution} + \end{subproblem} + The Queen looks forward to more food-related investigations from her jester. + \end{problem} + + + + %=================================== + % Author: Adams (Hughes) + % Date: March 2012 + %=================================== + \begin{problem}[Debt Amortization] + To amortize a debt means to pay it off in a given length of time using + equal periodic payments. The payments include interest on the unpaid + balance. The following formula gives the monthly payment, $M$, in dollars + that is necessary to amortize a debt of $P$ dollars in $n$ months + at a monthly interest rate of $i$ + \[ + M=\frac{P\cdot i}{1-(1+i)^{-n}} + \] + Use this formula in each of the following problems. + \begin{subproblem} + What monthly payments are necessary on a credit card debt of \$2000 at + $\unit[1.5]{\%}$ monthly if you want to pay off the debt in $2$ years? + In one year? How much money will you save by paying off the debt in the + shorter amount of time? + \begin{shortsolution} + Paying off the debt in $2$ years, we use + \begin{align*} + M & = \frac{2000\cdot 0.015}{1-(1+0.015)^{-24}} \\ + & \approx 99.85 + \end{align*} + The monthly payments are \$99.85. + + Paying off the debt in $1$ year, we use + \begin{align*} + M & = \frac{2000\cdot 0.015}{1-(1+0.015)^{-12}} \\ + & \approx 183.36 + \end{align*} + The monthly payments are \$183.36 + + In the $2$-year model we would pay a total of $\$99.85\cdot 12=\$2396.40$. In the + $1$-year model we would pay a total of $\$183.36\cdot 12=\$2200.32$. We would therefore + save $\$196.08$ if we went with the $1$-year model instead of the $2$-year model. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + To purchase a home, a family needs a loan of \$300,000 at $\unit[5.2]{\%}$ + annual interest. Compare a $20$ year loan to a $30$ year loan and make + a recommendation for the family. + (Note: when given an annual interest rate, it is a common business practice to divide by + $12$ to get a monthly rate.) + \begin{shortsolution} + For the $20$-year loan we use + \begin{align*} + M & = \frac{300000\cdot \frac{0.052}{12}}{1-\left( 1+\frac{0.052}{12} \right)^{-12\cdot 20}} \\ + & \approx 2013.16 + \end{align*} + The monthly payments are \$2013.16. + + For the $30$-year loan we use + \begin{align*} + M & = \frac{300000\cdot \frac{0.052}{12}}{1-\left( 1+\frac{0.052}{12} \right)^{-12\cdot 30}} \\ + & \approx 1647.33 + \end{align*} + The monthly payments are \$1647.33. + + The total amount paid during the $20$-year loan is $\$2013.16\cdot 12\cdot 20=\$483,158.40$. + The total amount paid during the $30$-year loan is $\$1647.33\cdot 12\cdot 30=\$593,038.80$. + + Recommendation: if you can afford the payments, choose the $20$-year loan. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + \pccname{Ellen} wants to make monthly payments of \$100 to pay off a debt of \$3000 + at \unit[12]{\%} annual interest. How long will it take her to pay off the + debt? + \begin{shortsolution} + We are given $M=100$, $P=3000$, $i=0.01$, and we need to find $n$ + in the equation + \[ + 100 = \frac{3000\cdot 0.01}{1-(1+0.01)^{-n}} + \] + Using logarithms, we find that $n\approx 36$. It will take + Ellen about $3$ years to pay off the debt. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + \pccname{Jake} is going to buy a new car. He puts \$2000 down and wants to finance the + remaining \$14,000. The dealer will offer him \unit[4]{\%} annual interest for + $5$ years, or a \$2000 + rebate which he can use to reduce the amount of the loan and \unit[8]{\%} + annual interest for 5 years. Which should he choose? + \begin{shortsolution} + \begin{description} + \item[Option 1:] $\unit[4]{\%}$ annual interest for $5$ years on \$14,000. + This means that the monthly payments will be calculated using + \begin{align*} + M & = \frac{14000\cdot \frac{0.04}{12}}{1-\left( 1+\frac{0.04}{12} \right)^{-12\cdot 5}} \\ + & \approx 257.83 + \end{align*} + The monthly payments will be $\$257.83$. The total amount paid will be + $\$257.83\cdot 5\cdot 12=\$15,469.80$, of which $\$1469.80$ is interest. + \item[Option 2:] $\unit[8]{\%}$ annual interest for $5$ years on \$12,000. + This means that the monthly payments will be calculated using + \begin{align*} + M & = \frac{12000\cdot \frac{0.08}{12}}{1-\left( 1+\frac{0.08}{12} \right)^{-12\cdot 5}} \\ + & \approx 243.32 + \end{align*} + The monthly payments will be $\$243.32$. The total amount paid + will be $\$243.32\cdot 5\cdot 12 =\$14,599.20$, of which $\$2599.2$ is + interest. + \end{description} + Jake should choose option 1 to minimize the amount of interest + he has to pay. + \end{shortsolution} + \end{subproblem} + \end{problem} + + \begin{exercises} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Rational or not] + Decide if each of the following functions are rational or not. If + they are rational, state their domain. + \begin{multicols}{3} + \begin{subproblem} + $r(x)=\dfrac{3}{x}$ + \begin{shortsolution} + $r$ is rational; the domain of $r$ is $(-\infty,0)\cup (0,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $s(y)=\dfrac{y}{6}$ + \begin{shortsolution} + $s$ is not rational ($s$ is linear). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $t(z)=\dfrac{4-x}{7-8z}$ + \begin{shortsolution} + $t$ is rational; the domain of $t$ is $\left( -\infty,\dfrac{7}{8} \right)\cup \left( \dfrac{7}{8},\infty \right)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $u(w)=\dfrac{w^2}{(w-3)(w+4)}$ + \begin{shortsolution} + $u$ is rational; the domain of $w$ is $(-\infty,-4)\cup(-4,3)\cup(3,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $v(x)=\dfrac{4}{(x-2)^2}$ + \begin{shortsolution} + $v$ is rational; the domain of $v$ is $(-\infty,2)\cup(2,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $w(x)=\dfrac{9-x}{x+17}$ + \begin{shortsolution} + $w$ is rational; the domain of $w$ is $(-\infty,-17)\cup(-17,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $a(x)=x^2+4$ + \begin{shortsolution} + $a$ is not rational ($a$ is quadratic, or a polynomial of degree $2$). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $b(y)=3^y$ + \begin{shortsolution} + $b$ is not rational ($b$ is exponential). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $c(z)=\dfrac{z^2}{z^3}$ + \begin{shortsolution} + $c$ is rational; the domain of $c$ is $(-\infty,0)\cup (0,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $d(x)=x^2(x+3)(5x-7)$ + \begin{shortsolution} + $d$ is not rational ($d$ is a polynomial). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $e(\alpha)=\dfrac{\alpha^2}{\alpha^2-1}$ + \begin{shortsolution} + $e$ is rational; the domain of $e$ is $(-\infty,-1)\cup(-1,1)\cup(1,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $f(\beta)=\dfrac{3}{4}$ + \begin{shortsolution} + $f$ is not rational ($f$ is constant). + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Function evaluation] + Let $r$ be the function that has formula + \[ + r(x)=\frac{(x-2)(x+3)}{(x+5)(x-7)} + \] + Evaluate each of the following (if possible); if the value is undefined, + then state so. + \begin{multicols}{4} + \begin{subproblem} + $r(0)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(0) & =\frac{(0-2)(0+3)}{(0+5)(0-7)} \\ + & =\frac{-6}{-35} \\ + & =\frac{6}{35} + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(1)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(1) & =\frac{(1-2)(1+3)}{(1+5)(1-7)} \\ + & =\frac{-4}{-36} \\ + & =\frac{1}{9} + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(2)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(2) & =\frac{(2-2)(2+3)}{(2+5)(2-7)} \\ + & = \frac{0}{-50} \\ + & =0 + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(4)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(4) & =\frac{(4-2)(4+3)}{(4+5)(4-7)} \\ + & =\frac{14}{-27} \\ + & =-\frac{14}{27} + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(7)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(7) & =\frac{(7-2)(7+3)}{(7+5)(7-7)} \\ + & =\frac{50}{0} + \end{aligned}$ + + $r(7)$ is undefined. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(-3)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(-3) & =\frac{(-3-2)(-3+3)}{(-3+5)(-3-7)} \\ + & =\frac{0}{-20} \\ + & =0 + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(-5)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(-5) & =\frac{(-5-2)(-5+3)}{(-5+5)(-5-7)} \\ + & =\frac{14}{0} + \end{aligned}$ + + $r(-5)$ is undefined. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r\left( \frac{1}{2} \right)$ + \begin{shortsolution} + $\begin{aligned}[t] + r\left( \frac{1}{2} \right) & = \frac{\left( \frac{1}{2}-2 \right)\left( \frac{1}{2}+3 \right)}{\left( \frac{1}{2}+5 \right)\left( \frac{1}{2}-7 \right)} \\ + & =\frac{-\frac{3}{2}\cdot\frac{7}{2}}{\frac{11}{2}\left( -\frac{13}{2} \right)} \\ + & =\frac{-\frac{21}{4}}{-\frac{143}{4}} \\ + & =\frac{37}{143} + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Holes or asymptotes?] + State the domain of each of the following rational functions. Identify + any holes or asymptotes. + \begin{multicols}{3} + \begin{subproblem} + $f(x)=\dfrac{12}{x-2}$ + \begin{shortsolution} + $f$ has a vertical asymptote at $2$; the domain of $f$ is $(-\infty,2)\cup (2,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $g(x)=\dfrac{x^2+x}{(x+1)(x-2)}$ + \begin{shortsolution} + $g$ has a vertical asymptote at $2$, and a hole at $-1$; the domain of $g$ is $(-\infty,-1)\cup(-1,2)\cup(2,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $h(x)=\dfrac{x^2+5x+4}{x^2+x-12}$ + \begin{shortsolution} + $h$ has a vertical asymptote at $3$, and a whole at $-4$; the domain of $h$ is $(-\infty,-4)\cup(-4,3)\cup(3,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $k(z)=\dfrac{z+2}{2z-3}$ + \begin{shortsolution} + $k$ has a vertical asymptote at $\dfrac{3}{2}$; the domain of $k$ is $\left( -\infty,\dfrac{3}{2} \right)\cup\left( \dfrac{3}{2},\infty \right)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $l(w)=\dfrac{w}{w^2+1}$ + \begin{shortsolution} + $l$ does not have any vertical asymptotes nor holes; the domain of $w$ is $(-\infty,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $m(t)=\dfrac{14}{13-t^2}$ + \begin{shortsolution} + $m$ has vertical asymptotes at $\pm\sqrt{13}$; the domain of $m$ is $(-\infty,\sqrt{13})\cup(-\sqrt{13},\sqrt{13})\cup(\sqrt{13},\infty)$. + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a graph] + Consider the rational functions graphed in \cref{rat:fig:findformula}. Find + the vertical asymptotes for each function, together with any zeros, and + give a possible formula for each. + \begin{shortsolution} + \begin{itemize} + \item \Vref{rat:fig:formula1}: possible formula is $r(x)=\dfrac{1}{x+5}$ + \item \Vref{rat:fig:formula2}: possible formula is $r(x)=\dfrac{(x+3)}{(x-5)}$ + \item \Vref{rat:fig:formula3}: possible formula is $r(x)=\dfrac{1}{(x-4)(x+3)}$. + \end{itemize} + \end{shortsolution} + \end{problem} + + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=1/(x+4);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-6,ymax=6, + xtick={-8,-6,...,8}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-4.16667,samples=50]{f}; + \addplot[pccplot] expression[domain=-3.83333:10,samples=50]{f}; + \addplot[asymptote,domain=-6:6]({-4},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:formula1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x+3)/(x-5);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-6,ymax=6, + xtick={-8,-6,...,8}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:3.85714]{f}; + \addplot[pccplot] expression[domain=6.6:10]{f}; + \addplot[soldot] coordinates{(-3,0)}; + \addplot[asymptote,domain=-6:6]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{1}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:formula2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=1/((x-4)*(x+3));}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-3,ymax=3, + xtick={-8,-6,...,8}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-3.0473]{f}; + \addplot[pccplot] expression[domain=-2.95205:3.95205]{f}; + \addplot[pccplot] expression[domain=4.0473:10]{f}; + \addplot[asymptote,domain=-3:3]({-3},{x}); + \addplot[asymptote,domain=-3:3]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{0}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:formula3} + \end{subfigure} + \caption{} + \label{rat:fig:findformula} + \end{widepage} + \end{figure} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a description] + In each of the following problems, give a formula of a rational + function that has the listed properties. + \begin{subproblem} + Vertical asymptote at $2$. + \begin{shortsolution} + Possible option: $r(x)=\dfrac{1}{x-2}$. Note that we could multiply the + numerator or denominator by any real number and still have the desired properties. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Vertical asymptote at $5$. + \begin{shortsolution} + Possible option: $r(x)=\dfrac{1}{x-5}$. Note that we could multiply the + numerator or denominator by any real number and still have the desired properties. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Vertical asymptote at $-2$, and zero at $6$. + \begin{shortsolution} + Possible option: $r(x)=\dfrac{x-6}{x+2}$. Note that we could multiply the + numerator or denominator by any real number and still have the desired properties. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Zeros at $2$ and $-5$ and vertical asymptotes at $1$ and $-7$. + \begin{shortsolution} + Possible option: $r(x)=\dfrac{(x-2)(x+5)}{(x-1)(x+7)}$. Note that we could multiply the + numerator or denominator by any real number and still have the desired properties. + \end{shortsolution} + \end{subproblem} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Given formula, find horizontal asymptotes] + Each of the following functions has a horizontal asymptote. Write the equation + of the horizontal asymptote for each function. + \begin{multicols}{3} + \begin{subproblem} + $f(x) = \dfrac{1}{x}$ + \begin{shortsolution} + $y=0$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $g(x) = \dfrac{2x+3}{x}$ + \begin{shortsolution} + $y=2$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $h(x) = \dfrac{x^2+2x}{x^2+3}$ + \begin{shortsolution} + $y=1$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $k(x) = \dfrac{x^2+7}{x}$ + \begin{shortsolution} + $y=1$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $l(x)=\dfrac{3x-2}{5x+8}$ + \begin{shortsolution} + $y=\dfrac{3}{5}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $m(x)=\dfrac{3x-2}{5x^2+8}$ + \begin{shortsolution} + $y=0$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $n(x)=\dfrac{(6x+1)(x-7)}{(11x-8)(x-5)}$ + \begin{shortsolution} + $y=\dfrac{6}{11}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=\dfrac{19x^3}{5-x^4}$ + \begin{shortsolution} + $y=0$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $q(x)=\dfrac{14x^2+x}{1-7x^2}$ + \begin{shortsolution} + $y=-2$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{problem}[Given horizontal asymptotes, find formula] + In each of the following problems, give a formula for a function that + has the given horizontal asymptote. Note that there may be more than one option. + \begin{multicols}{4} + \begin{subproblem} + $y=7$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{7(x-2)}{x+1}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $7$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=-1$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{5-x^2}{x^2+10}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $10$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=53$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{53x^3}{x^3+4x^2-7}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $53$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=-17$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{34(x+2)}{7-2x}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $-17$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=\dfrac{3}{2}$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{3x+4}{2(x+1)}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $\dfrac{3}{2}$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=0$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{4}{x}$. Note that there + are other options, provided that the degree of the numerator is less than the degree + of the denominator. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=-1$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{10x}{5-10x}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $-1$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=2$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{8x-3}{4x+1}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $2$. + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a description] + In each of the following problems, give a formula for a function that + has the prescribed properties. Note that there may be more than one option. + \begin{subproblem} + $f(x)\rightarrow 3$ as $x\rightarrow\pm\infty$. + \begin{shortsolution} + Possible option: $f(x)=\dfrac{3(x-2)}{x+7}$. Note that + the zero and asymptote of $f$ could be changed, and $f$ would still have the desired properties. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(x)\rightarrow -4$ as $x\rightarrow\pm\infty$. + \begin{shortsolution} + Possible option: $r(x)=\dfrac{-4(x-2)}{x+7}$. Note that + the zero and asymptote of $r$ could be changed, and $r$ would still have the desired properties. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $k(x)\rightarrow 2$ as $x\rightarrow\pm\infty$, and $k$ has vertical asymptotes at $-3$ and $5$. + \begin{shortsolution} + Possible option: $k(x)=\dfrac{2x^2}{(x+3)(x-5)}$. Note that the denominator + must have the given factors; the numerator could be any degree $2$ polynomial, provided the + leading coefficient is $2$. + \end{shortsolution} + \end{subproblem} + \end{problem} + + %=================================== + % Author: Hughes + % Date: Feb 2011 + %=================================== + \begin{problem} + Let $r$ be the rational function that has + \[ + r(x) = \frac{(x+2)(x-1)}{(x+3)(x-4)} + \] + Each of the following questions are in relation to this function. + \begin{subproblem} + What is the vertical intercept of this function? State your answer as an + ordered pair. \index{rational functions!vertical intercept} + \begin{shortsolution} + $\left(0,\frac{1}{6}\right)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem}\label{rat:prob:rational} + What values of $x$ make the denominator equal to $0$? + \begin{shortsolution} + $-3,4$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Use your answer to \cref{rat:prob:rational} to write the domain of the function in + both interval, and set builder notation. %\index{rational functions!domain}\index{domain!rational functions} + \begin{shortsolution} + Interval notation: $(-\infty,-3)\cup (-3,4)\cup (4,\infty)$. + Set builder: $\{x|x\ne -3, \mathrm{and}\, x\ne 4\}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + What are the vertical asymptotes of the function? State your answers in + the form $x=$ + \begin{shortsolution} + $x=-3$ and $x=4$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem}\label{rat:prob:zeroes} + What values of $x$ make the numerator equal to $0$? + \begin{shortsolution} + $-2,1$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Use your answer to \cref{rat:prob:zeroes} to write the horizontal intercepts of + $r$ as ordered pairs. + \begin{shortsolution} + $(-2,0)$ and $(1,0)$ + \end{shortsolution} + \end{subproblem} + \end{problem} + + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Holes] + \pccname{Josh} and \pccname{Pedro} are discussing the function + \[ + r(x)=\frac{x^2-1}{(x+3)(x-1)} + \] + \begin{subproblem} + What is the domain of $r$? + \begin{shortsolution} + The domain of $r$ is $(-\infty,-3)\cup(-3,1)\cup(1,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Josh notices that the numerator can be factored- can you see how? + \begin{shortsolution} + $(x^2-1)=(x-1)(x+1)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Pedro asks, `Doesn't that just mean that + \[ + r(x)=\frac{x+1}{x+3} + \] + for all values of $x$?' Josh says, `Nearly\ldots but not for all values of $x$'. + What does Josh mean? + \begin{shortsolution} + $r(x)=\dfrac{x+1}{x+3}$ provided that $x\ne -1$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Where does $r$ have vertical asymptotes, and where does it have holes? + \begin{shortsolution} + The function $r$ has a vertical asymptote at $-3$, and a hole at $1$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Sketch a graph of $r$. + \begin{shortsolution} + A graph of $r$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot] expression[domain=-10:-3.25]{(x+1)/(x+3)}; + \addplot[pccplot] expression[domain=-2.75:10]{(x+1)/(x+3)}; + \addplot[asymptote,domain=-10:10]({-3},{x}); + \addplot[holdot]coordinates{(1,0.5)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \end{problem} + + %=================================== + % Author: Hughes + % Date: July 2012 + %=================================== + \begin{problem}[Function algebra] + Let $r$ and $s$ be the rational functions that have formulas + \[ + r(x)=\frac{2-x}{x+3}, \qquad s(x)=\frac{x^2}{x-4} + \] + Evaluate each of the following (if possible). + \begin{multicols}{4} + \begin{subproblem} + $(r+s)(5)$ + \begin{shortsolution} + $\frac{197}{8}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(r-s)(3)$ + \begin{shortsolution} + $\frac{53}{6}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(r\cdot s)(4)$ + \begin{shortsolution} + Undefined. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\left( \frac{r}{s} \right)(1)$ + \begin{shortsolution} + $-\frac{3}{4}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + + %=================================== + % Author: Hughes + % Date: July 2012 + %=================================== + \begin{problem}[Transformations: given the transformation, find the formula] + Let $r$ be the rational function that has formula. + \[ + r(x)=\frac{x+5}{2x-3} + \] + In each of the following problems apply the given transformation to the function $r$ and + write a formula for the transformed version of $r$. + \begin{multicols}{2} + \begin{subproblem} + Shift $r$ to the right by $3$ units. + \begin{shortsolution} + $r(x-3)=\frac{x+2}{2x-9}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $r$ to the left by $4$ units. + \begin{shortsolution} + $r(x+4)=\frac{x+9}{2x+5}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $r$ up by $\pi$ units. + \begin{shortsolution} + $r(x)+\pi=\frac{x+5}{2x-3}+\pi$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $r$ down by $17$ units. + \begin{shortsolution} + $r(x)-17=\frac{x+5}{2x-3}-17$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Reflect $r$ over the horizontal axis. + \begin{shortsolution} + $-r(x)=-\frac{x+5}{2x-3}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Reflect $r$ over the vertical axis. + \begin{shortsolution} + $r(-x)=\frac{x-5}{2x+3}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a table]\label{rat:prob:findformula} + \Crefrange{rat:tab:findformular}{rat:tab:findformulau} show values of rational functions $r$, $q$, $s$, + and $t$. Assume that any values marked with an X are undefined. + + \begin{table}[!htb] + \begin{widepage} + \centering + \caption{Tables for \cref{rat:prob:findformula}} + \label{rat:tab:findformula} + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=r(x)$} + \label{rat:tab:findformular} + \begin{tabular}{rr} + \beforeheading + $x$ & $y$ \\ \afterheading + $-4$ & $\nicefrac{7}{2}$ \\\normalline + $-3$ & $-18$ \\\normalline + $-2$ & X \\\normalline + $-1$ & $-4$ \\\normalline + $0$ & $\nicefrac{-3}{2}$ \\\normalline + $1$ & $\nicefrac{-2}{3}$ \\\normalline + $2$ & $\nicefrac{-1}{4}$ \\\normalline + $3$ & $0$ \\\normalline + $4$ & $\nicefrac{1}{6}$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=s(x)$} + \label{rat:tab:findformulas} + \begin{tabular}{rr} + \beforeheading + $x$ & $y$ \\ \afterheading + $-4$ & $\nicefrac{-2}{21}$ \\\normalline + $-3$ & $\nicefrac{-1}{12}$ \\\normalline + $-2$ & $0$ \\\normalline + $-1$ & X \\\normalline + $0$ & $\nicefrac{-2}{3}$ \\\normalline + $1$ & $\nicefrac{-3}{4}$ \\\normalline + $2$ & $\nicefrac{-4}{3}$ \\\normalline + $3$ & X \\\normalline + $4$ & $\nicefrac{6}{5}$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=t(x)$} + \label{rat:tab:findformulat} + \begin{tabular}{rr} + \beforeheading + $x$ & $y$ \\ \afterheading + $-4$ & $\nicefrac{3}{5}$ \\\normalline + $-3$ & $0$ \\\normalline + $-2$ & X \\\normalline + $-1$ & $3$ \\\normalline + $0$ & $3$ \\\normalline + $1$ & X \\\normalline + $2$ & $0$ \\\normalline + $3$ & $\nicefrac{3}{5}$ \\\normalline + $4$ & $\nicefrac{7}{9}$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=u(x)$} + \label{rat:tab:findformulau} + \begin{tabular}{rr} + \beforeheading + $x$ & $y$ \\ \afterheading + $-4$ & $\nicefrac{16}{7}$ \\\normalline + $-3$ & X \\\normalline + $-2$ & $-\nicefrac{4}{5}$ \\\normalline + $-1$ & $-\nicefrac{1}{8}$ \\\normalline + $0$ & $0$ \\\normalline + $1$ & $-\nicefrac{1}{8}$ \\\normalline + $2$ & $-\nicefrac{4}{5}$ \\\normalline + $3$ & X \\\normalline + $4$ & $\nicefrac{16}{7}$ \\\lastline + \end{tabular} + \end{subtable} + \end{widepage} + \end{table} + \begin{subproblem} + Given that the formula for $r(x)$ has the form $r(x)=\dfrac{x-A}{x-B}$, use \cref{rat:tab:findformular} + to find values of $A$ and $B$. + \begin{shortsolution} + $A=3$ and $B=-2$, so $r(x)=\dfrac{x-3}{x+2}$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Check your formula by computing $r(x)$ at the values specified in the table. + \begin{shortsolution} + $\begin{aligned}[t] + r(-4) & = \frac{-4-3}{-4+2} \\ + & = \frac{7}{2} \\ + \end{aligned}$ + + $r(-3)=\ldots$ etc + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + The function $s$ in \cref{rat:tab:findformulas} has two vertical asymptotes and one zero. + Can you find a formula for $s(x)$? + \begin{shortsolution} + $s(x)=\dfrac{x+2}{(x-3)(x+1)}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Check your formula by computing $s(x)$ at the values specified in the table. + \begin{shortsolution} + $\begin{aligned}[t] + s(-4) & =\frac{-4+2}{(-4-3)(-4+1)} \\ + & =-\frac{2}{21} + \end{aligned}$ + + $s(-3)=\ldots$ etc + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Given that the formula for $t(x)$ has the form $t(x)=\dfrac{(x-A)(x-B)}{(x-C)(x-D)}$, use \cref{rat:tab:findformulat} to find the + values of $A$, $B$, $C$, and $D$; hence write a formula for $t(x)$. + \begin{shortsolution} + $t(x)=\dfrac{(x+3)(x-2)}{(x+2)(x+1)}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Given that the formula for $u(x)$ has the form $u(x)=\dfrac{(x-A)^2}{(x-B)(x-C)}$, use \cref{rat:tab:findformulau} to find the + values of $A$, $B$, and $C$; hence write a formula for $u(x)$. + \begin{shortsolution} + $u(x)=\dfrac{x^2}{(x+3)(x-3)}$ + \end{shortsolution} + \end{subproblem} + \end{problem} + \end{exercises} \section{Graphing rational functions (horizontal asymptotes)} -\reformatstepslist{R} % the steps list should be R1, R2, \ldots -We studied rational functions in the previous section, but were -not asked to graph them; in this section we will demonstrate the -steps to be followed in order to sketch graphs of the functions. - -Remember from \vref{rat:def:function} that rational functions have -the form -\[ - r(x)=\frac{p(x)}{q(x)} -\] -In this section we will restrict attention to the case when -\[ - \text{degree of }p\leq \text{degree of }q -\] -Note that this necessarily means that each function that we consider -in this section \emph{will have a horizontal asymptote} (see \vref{rat:def:longrun}). -The cases in which the degree of $p$ is greater than the degree of $q$ -is covered in the next section. - -Before we begin, it is important to remember the following: -\begin{itemize} - \item Our sketches will give a good representation of the overall - shape of the graph, but until we have the tools of calculus (from MTH 251) - we can not find local minimums, local maximums, and inflection points algebraically. This - means that we will make our best guess as to where these points are. - \item We will not concern ourselves too much with the vertical scale (because of - our previous point)| we will, however, mark the vertical intercept (assuming there is one), - and any horizontal asymptotes. -\end{itemize} -\begin{pccspecialcomment}[Steps to follow when sketching rational functions]\label{rat:def:stepsforsketch} - \begin{steps} - \item \label{rat:step:first} Find all vertical asymptotes and holes, and mark them on the - graph using dashed vertical lines and open circles $\circ$ respectively. - \item Find any intercepts, and mark them using solid circles $\bullet$; - determine if the curve cuts the axis, or bounces off it at each zero. - \item Determine the behavior of the function around each asymptote| does - it behave like $\frac{1}{x}$ or $\frac{1}{x^2}$? - \item \label{rat:step:penultimate} Determine the long-run behavior of the function, and mark the horizontal - asymptote using a dashed horizontal line. - \item \label{rat:step:last} Deduce the overall shape of the curve, and sketch it. If there isn't - enough information from the previous steps, then construct a table of values - including sample points from each branch. - \end{steps} - Remember that until we have the tools of calculus, we won't be able to - find the exact coordinates of local minimums, local maximums, and points - of inflection. -\end{pccspecialcomment} - -The examples that follow show how \crefrange{rat:step:first}{rat:step:last} can be -applied to a variety of different rational functions. - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}\label{rat:ex:1overxminus2p2} -Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $r$ -that has formula -\[ - r(x)=\frac{1}{x-2} -\] -\begin{pccsolution} -\begin{steps} - \item $r$ has a vertical asymptote at $2$; $r$ does not have any holes. The curve of - $r$ will have $2$ branches. - \item $r$ does not have any zeros since the numerator is never equal to $0$. The - vertical intercept of $r$ is $\left( 0,-\frac{1}{2} \right)$. - \item $r$ behaves like $\frac{1}{x}$ around its vertical asymptote since $(x-2)$ - is raised to the power $1$. - \item Since the degree of the numerator is less than the degree of the denominator, - according to \vref{rat:def:longrun} the horizontal asymptote of $r$ has equation $y=0$. - \item We put the details we have obtained so far on \cref{rat:fig:1overxminus2p1}. Notice - that there is only one way to complete the graph, which we have done in \cref{rat:fig:1overxminus2p2}. -\end{steps} -\end{pccsolution} -\end{pccexample} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-5,ymax=5, - width=\textwidth, - ] - \addplot[asymptote,domain=-5:5]({2},{x}); - \addplot[asymptote,domain=-5:5]({x},{0}); - \addplot[soldot] coordinates{(0,-0.5)}node[axisnode,anchor=north east]{$\left( 0,-\frac{1}{2} \right)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:1overxminus2p1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=1/(x-2);}] - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-5,ymax=5, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-5:1.8,samples=50]{f}; - \addplot[pccplot] expression[domain=2.2:5]{f}; - \addplot[asymptote,domain=-5:5]({2},{x}); - \addplot[asymptote,domain=-5:5]({x},{0}); - \addplot[soldot] coordinates{(0,-0.5)}node[axisnode,anchor=north east]{$\left( 0,-\frac{1}{2} \right)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:1overxminus2p2} - \end{subfigure}% - \caption{$y=\dfrac{1}{x-2}$} -\end{figure} - -The function $r$ in \cref{rat:ex:1overxminus2p2} has a horizontal asymptote which has equation $y=0$. -This asymptote lies on the horizontal axis, and you might (understandably) find it hard -to distinguish between the two lines (\cref{rat:fig:1overxminus2p2}). When faced -with such a situation, it is perfectly acceptable to draw the horizontal axis -as a dashed line| just make sure to label it correctly. We will demonstrate this -in the next example. - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}\label{rat:ex:1overxp1} -Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $v$ -that has formula -\[ - v(x)=\frac{10}{x} -\] -\begin{pccsolution} -\begin{steps} - \item $v$ has a vertical asymptote at $0$. $v$ does not have - any holes. The curve of $v$ will have $2$ branches. - \item $v$ does not have any zeros (since $10\ne 0$). Furthermore, $v$ - does not have a vertical intercept since $v(0)$ is undefined. - \item $v$ behaves like $\frac{1}{x}$ around its vertical asymptote. - \item $v$ has a horizontal asymptote with equation $y=0$. - \item We put the details we have obtained so far in \cref{rat:fig:1overxp1}. - We do not have enough information to sketch $v$ yet (because $v$ does - not have any intercepts), so let's pick a sample - point in either of the $2$ branches| it doesn't matter where our sample point - is, because we know what the overall shape will be. Let's compute $v(2)$ - \begin{align*} - v(2) & =\dfrac{10}{2} \\ - & = 5 - \end{align*} - We therefore mark the point $(2,5)$ on \cref{rat:fig:1overxp2}, and then complete the sketch using - the details we found in the previous steps. -\end{steps} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-5,5}, - ytick={-5,5}, - axis line style={color=white}, - width=\textwidth, - ] - \addplot[asymptote,<->,domain=-10:10]({0},{x}); - \addplot[asymptote,<->,domain=-10:10]({x},{0}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:1overxp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=10/x;}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-5,5}, - ytick={-5,5}, - axis line style={color=white}, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-1]{f}; - \addplot[pccplot] expression[domain=1:10]{f}; - \addplot[soldot] coordinates{(2,5)}node[axisnode,anchor=south west]{$(2,5)$}; - \addplot[asymptote,<->,domain=-10:10]({0},{x}); - \addplot[asymptote,<->,domain=-10:10]({x},{0}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:1overxp2} - \end{subfigure}% - \caption{$y=\dfrac{10}{x}$} -\end{figure} -\end{pccsolution} -\end{pccexample} - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}\label{rat:ex:asympandholep1} -Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $u$ -that has formula -\[ - u(x)=\frac{-4(x^2-9)}{x^2-8x+15} -\] -\begin{pccsolution} -\begin{steps} - \item We begin by factoring both the numerator and denominator of $u$ to help - us find any vertical asymptotes or holes - \begin{align*} - u(x) & =\frac{-4(x^2-9)}{x^2-8x+15} \\ - & =\frac{-4(x+3)(x-3)}{(x-5)(x-3)} \\ - & =\frac{-4(x+3)}{x-5} - \end{align*} - provided that $x\ne 3$. Therefore $u$ has a vertical asymptote at $5$ and - a hole at $3$. The curve of $u$ has $2$ branches. - \item $u$ has a simple zero at $-3$. The vertical intercept of $u$ is $\left( 0,\frac{12}{5} \right)$. - \item $u$ behaves like $\frac{1}{x}$ around its vertical asymptote at $4$. - \item Using \vref{rat:def:longrun} the equation of the horizontal asymptote of $u$ is $y=-4$. - \item We put the details we have obtained so far on \cref{rat:fig:1overxminus2p1}. Notice - that there is only one way to complete the graph, which we have done in \cref{rat:fig:1overxminus2p2}. -\end{steps} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-20,ymax=20, - xtick={-8,-6,...,8}, - ytick={-10,10}, - width=\textwidth, - ] - \addplot[asymptote,domain=-20:20]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{-4}); - \addplot[soldot] coordinates{(-3,0)(0,2.4)}node[axisnode,anchor=south east]{$\left( 0,\frac{12}{5} \right)$}; - \addplot[holdot] coordinates{(3,12)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:asympandholep1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=-4*(x+3)/(x-5);}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-20,ymax=20, - xtick={-8,-6,...,8}, - ytick={-10,10}, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:3.6666,samples=50]{f}; - \addplot[pccplot] expression[domain=7:10]{f}; - \addplot[asymptote,domain=-20:20]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{-4}); - \addplot[soldot] coordinates{(-3,0)(0,2.4)}node[axisnode,anchor=south east]{$\left( 0,\frac{12}{5} \right)$}; - \addplot[holdot] coordinates{(3,12)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:asympandholep2} - \end{subfigure}% - \caption{$y=\dfrac{-4(x+3)}{x-5}$} -\end{figure} -\end{pccsolution} -\end{pccexample} - -\Cref{rat:ex:1overxminus2p2,rat:ex:1overxp1,rat:ex:asympandholep1} have focused on functions -that only have one vertical asymptote; the remaining examples in this section -concern functions that have more than one vertical asymptote. We will demonstrate -that \crefrange{rat:step:first}{rat:step:last} still apply. - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}\label{rat:ex:sketchtwoasymp} -Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $w$ -that has formula -\[ - w(x)=\frac{2(x+3)(x-5)}{(x+5)(x-4)} -\] -\begin{pccsolution} -\begin{steps} - \item $w$ has vertical asymptotes at $-5$ and $4$. $w$ does not have - any holes. The curve of $w$ will have $3$ branches. - \item $w$ has simple zeros at $-3$ and $5$. The vertical intercept of $w$ - is $\left( 0,\frac{3}{2} \right)$. - \item $w$ behaves like $\frac{1}{x}$ around both of its vertical - asymptotes. - \item The degree of the numerator of $w$ is $2$ and the degree of the - denominator of $w$ is also $2$. Using the ratio of the leading coefficients - of the numerator and denominator, we say that $w$ has a horizontal - asymptote with equation $y=\frac{2}{1}=2$. - \item We put the details we have obtained so far on \cref{rat:fig:sketchtwoasymptp1}. - - The function $w$ is a little more complicated than the functions that - we have considered in the previous examples because the curve has $3$ - branches. When graphing such functions, it is generally a good idea to start with the branch - for which you have the most information| in this case, that is the \emph{middle} branch - on the interval $(-5,4)$. - - Once we have drawn the middle branch, there is only one way to complete the graph - (because of our observations about the behavior of $w$ around its vertical asymptotes), - which we have done in \cref{rat:fig:sketchtwoasymptp2}. -\end{steps} -\end{pccsolution} -\end{pccexample} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[asymptote,domain=-10:10]({-5},{x}); - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{2}); - \addplot[soldot] coordinates{(-3,0)(5,0)}; - \addplot[soldot] coordinates{(0,1.5)}node[axisnode,anchor=north west]{$\left( 0,\frac{3}{2} \right)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:sketchtwoasymptp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=2*(x+3)*(x-5)/( (x+5)*(x-4));}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[asymptote,domain=-10:10]({-5},{x}); - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{2}); - \addplot[soldot] coordinates{(-3,0)(5,0)}; - \addplot[soldot] coordinates{(0,1.5)}node[axisnode,anchor=north west]{$\left( 0,\frac{3}{2} \right)$}; - \addplot[pccplot] expression[domain=-10:-5.56708]{f}; - \addplot[pccplot] expression[domain=-4.63511:3.81708]{f}; - \addplot[pccplot] expression[domain=4.13511:10]{f}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:sketchtwoasymptp2} - \end{subfigure}% - \caption{$y=\dfrac{2(x+3)(x-5)}{(x+5)(x-4)}$} -\end{figure} - -The rational functions that we have considered so far have had simple -factors in the denominator; each function has behaved like $\frac{1}{x}$ -around each of its vertical asymptotes. \Cref{rat:ex:2asympnozeros,rat:ex:2squaredasymp} -consider functions that have a repeated factor in the denominator. - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}\label{rat:ex:2asympnozeros} -Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $f$ -that has formula -\[ - f(x)=\frac{100}{(x+5)(x-4)^2} -\] -\begin{pccsolution} -\begin{steps} - \item $f$ has vertical asymptotes at $-5$ and $4$. $f$ does not have - any holes. The curve of $f$ will have $3$ branches. - \item $f$ does not have any zeros (since $100\ne 0$). The vertical intercept of $f$ - is $\left( 0,\frac{5}{4} \right)$. - \item $f$ behaves like $\frac{1}{x}$ around $-5$ and behaves like $\frac{1}{x^2}$ - around $4$. - \item The degree of the numerator of $f$ is $0$ and the degree of the - denominator of $f$ is $2$. $f$ has a horizontal asymptote with - equation $y=0$. - \item We put the details we have obtained so far on \cref{rat:fig:2asympnozerosp1}. - - The function $f$ is similar to the function $w$ that we considered in \cref{rat:ex:sketchtwoasymp}| - it has two vertical asymptotes and $3$ branches, but in contrast to $w$ it does not have any zeros. - - We sketch $f$ in \cref{rat:fig:2asympnozerosp2}, using the middle branch as our guide - because we have the most information about the function on the interval $(-5,4)$. - - Once we have drawn the middle branch, there is only one way to complete the graph - because of our observations about the behavior of $f$ around its vertical asymptotes (it behaves like $\frac{1}{x}$), - which we have done in \cref{rat:fig:2asympnozerosp2}. - - Note that we are not yet able to find the local minimum of $f$ algebraically on the interval $(-5,4)$, - so we make a reasonable guess as to where it is| we can be confident that it is above the horizontal axis - since $f$ has no zeros. You may think that this is unsatisfactory, but once we have the tools of calculus, we will - be able to find local minimums more precisely. -\end{steps} -\end{pccsolution} -\end{pccexample} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[asymptote,domain=-10:10]({-5},{x}); - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{0}); - \addplot[soldot] coordinates{(0,1.25)}node[axisnode,anchor=south east]{$\left( 0,\frac{5}{4} \right)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:2asympnozerosp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=100/( (x+5)*(x-4)^2);}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[asymptote,domain=-10:10]({-5},{x}); - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{0}); - \addplot[soldot] coordinates{(0,1.25)}node[axisnode,anchor=south east]{$\left( 0,\frac{5}{4} \right)$}; - \addplot[pccplot] expression[domain=-10:-5.12022]{f}; - \addplot[pccplot] expression[domain=-4.87298:2.87298,samples=50]{f}; - \addplot[pccplot] expression[domain=5:10]{f}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:2asympnozerosp2} - \end{subfigure}% - \caption{$y=\dfrac{100}{(x+5)(x-4)^2}$} -\end{figure} - -%=================================== -% Author: Hughes -% Date: May 2012 -%=================================== -\begin{pccexample}\label{rat:ex:2squaredasymp} -Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $g$ -that has formula -\[ - g(x)=\frac{50(2-x)}{(x+3)^2(x-5)^2} -\] -\begin{pccsolution} -\begin{steps} - \item $g$ has vertical asymptotes at $-3$ and $5$. $g$ does - not have any holes. The curve of $g$ will have $3$ branches. - \item $g$ has a simple zero at $2$. The vertical intercept of $g$ is - $\left( 0,\frac{4}{9} \right)$. - \item $g$ behaves like $\frac{1}{x^2}$ around both of its - vertical asymptotes. - \item The degree of the numerator of $g$ is $1$ and the degree of the denominator - of $g$ is $4$. Using \vref{rat:def:longrun}, we calculate that - the horizontal asymptote of $g$ has equation $y=0$. - \item The details that we have found so far have been drawn in - \cref{rat:fig:2squaredasymp1}. The function $g$ is similar to the functions - we considered in \cref{rat:ex:sketchtwoasymp,rat:ex:2asympnozeros} because - it has $2$ vertical asymptotes and $3$ branches. - - We sketch $g$ using the middle branch as our guide because we have the most information - about $g$ on the interval $(-3,5)$. Note that there is no other way to draw this branch - without introducing other zeros which $g$ does not have. - - Once we have drawn the middle branch, there is only one way to complete the graph - because of our observations about the behavior of $g$ around its vertical asymptotes| it - behaves like $\frac{1}{x^2}$. - -\end{steps} -\end{pccsolution} -\end{pccexample} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[asymptote,domain=-10:10]({-3},{x}); - \addplot[asymptote,domain=-10:10]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{0}); - \addplot[soldot] coordinates{(2,0)(0,4/9)}node[axisnode,anchor=south west]{$\left( 0,\frac{4}{9} \right)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:2squaredasymp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=50*(2-x)/( (x+3)^2*(x-5)^2);}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[asymptote,domain=-10:10]({-3},{x}); - \addplot[asymptote,domain=-10:10]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{0}); - \addplot[soldot] coordinates{(2,0)(0,4/9)}node[axisnode,anchor=south west]{$\left( 0,\frac{4}{9} \right)$}; - \addplot[pccplot] expression[domain=-10:-3.61504]{f}; - \addplot[pccplot] expression[domain=-2.3657:4.52773]{f}; - \addplot[pccplot] expression[domain=5.49205:10]{f}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:2squaredasymp2} - \end{subfigure}% - \caption{$y=\dfrac{50(2-x)}{(x+3)^2(x-5)^2}$} -\end{figure} - -Each of the rational functions that we have considered so far has had either -a \emph{simple} zero, or no zeros at all. Remember from our work on polynomial -functions, and particularly \vref{poly:def:multzero}, that a \emph{repeated} zero -corresponds to the curve of the function behaving differently at the zero -when compared to how the curve behaves at a simple zero. \Cref{rat:ex:doublezero} details a -function that has a non-simple zero. - -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{pccexample}\label{rat:ex:doublezero} -Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $g$ -that has formula -\[ - h(x)=\frac{(x-3)^2}{(x+4)(x-6)} -\] -\begin{pccsolution} -\begin{steps} - \item $h$ has vertical asymptotes at $-4$ and $6$. $h$ does - not have any holes. The curve of $h$ will have $3$ branches. - \item $h$ has a zero at $3$ that has \emph{multiplicity $2$}. - The vertical intercept of $h$ is - $\left( 0,-\frac{3}{8} \right)$. - \item $h$ behaves like $\frac{1}{x}$ around both of its - vertical asymptotes. - \item The degree of the numerator of $h$ is $2$ and the degree of the denominator - of $h$ is $2$. Using \vref{rat:def:longrun}, we calculate that - the horizontal asymptote of $h$ has equation $y=1$. - \item The details that we have found so far have been drawn in - \cref{rat:fig:doublezerop1}. The function $h$ is different - from the functions that we have considered in previous examples because - of the multiplicity of the zero at $3$. - - We sketch $h$ using the middle branch as our guide because we have the most information - about $h$ on the interval $(-4,6)$. Note that there is no other way to draw this branch - without introducing other zeros which $h$ does not have| also note how - the curve bounces off the horizontal axis at $3$. - - Once we have drawn the middle branch, there is only one way to complete the graph - because of our observations about the behavior of $h$ around its vertical asymptotes| it - behaves like $\frac{1}{x}$. - -\end{steps} -\end{pccsolution} -\end{pccexample} - -\begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-5,ymax=5, - xtick={-8,-6,...,8}, - ytick={-3,3}, - width=\textwidth, - ] - \addplot[asymptote,domain=-10:10]({-4},{x}); - \addplot[asymptote,domain=-10:10]({6},{x}); - \addplot[asymptote,domain=-10:10]({x},{1}); - \addplot[soldot] coordinates{(3,0)(0,-3/8)}node[axisnode,anchor=north west]{$\left( 0,-\frac{3}{8} \right)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:doublezerop1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-3)^2/((x+4)*(x-6));}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-5,ymax=5, - xtick={-8,-6,...,8}, - ytick={-3,3}, - width=\textwidth, - ] - \addplot[asymptote,domain=-10:10]({-4},{x}); - \addplot[asymptote,domain=-10:10]({6},{x}); - \addplot[asymptote,domain=-10:10]({x},{1}); - \addplot[soldot] coordinates{(3,0)(0,-3/8)}node[axisnode,anchor=north west]{$\left( 0,-\frac{3}{8} \right)$}; - \addplot[pccplot] expression[domain=-10:-5.20088]{f}; - \addplot[pccplot] expression[domain=-3.16975:5.83642,samples=50]{f}; - \addplot[pccplot] expression[domain=6.20088:10]{f}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:doublezerop2} - \end{subfigure}% - \caption{$y=\dfrac{(x-3)^2}{(x+4)(x-6)}$} -\end{figure} -\begin{exercises} -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{problem}[\Cref{rat:step:last}]\label{rat:prob:deduce} -\pccname{Katie} is working on graphing rational functions. She -has been concentrating on functions that have the form -\begin{equation}\label{rat:eq:deducecurve} - f(x)=\frac{a(x-b)}{x-c} -\end{equation} -Katie notes that functions with this type of formula have a zero -at $b$, and a vertical asymptote at $c$. Furthermore, these functions -behave like $\frac{1}{x}$ around their vertical asymptote, and the -curve of each function will have $2$ branches. - -Katie has been working with $3$ functions that have the form given -in \cref{rat:eq:deducecurve}, and has followed \crefrange{rat:step:first}{rat:step:penultimate}; -her results are shown in \cref{rat:fig:deducecurve}. There is just one -more thing to do to complete the graphs| follow \cref{rat:step:last}. -Help Katie finish each graph by deducing the curve of each function. -\begin{shortsolution} - \Vref{rat:fig:deducecurve1} - - \begin{tikzpicture}[/pgf/declare function={f=3*(x+4)/(x+5);}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\solutionfigurewidth, - ] - \addplot[soldot] coordinates{(-4,0)(0,12/5)}; - \addplot[asymptote,domain=-10:10]({-5},{x}); - \addplot[asymptote,domain=-10:10]({x},{3}); - \addplot[pccplot] expression[domain=-10:-5.42857]{f}; - \addplot[pccplot] expression[domain=-4.76923:10,samples=50]{f}; - \end{axis} - \end{tikzpicture} - - \Vref{rat:fig:deducecurve2} - - \begin{tikzpicture}[/pgf/declare function={f=-3*(x-2)/(x-4);}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\solutionfigurewidth, - ] - \addplot[soldot] coordinates{(2,0)(0,-3/2)}; - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{-3}); - \addplot[pccplot] expression[domain=-10:3.53846,samples=50]{f}; - \addplot[pccplot] expression[domain=4.85714:10]{f}; - \end{axis} - \end{tikzpicture} - - \Vref{rat:fig:deducecurve4} - - \begin{tikzpicture}[/pgf/declare function={f=2*(x-6)/(x-4);}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\solutionfigurewidth, - ] - \addplot[soldot] coordinates{(6,0)(0,3)}; - \addplot[asymptote,domain=-10:10]({x},{2}); - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[pccplot] expression[domain=-10:3.5,samples=50]{f}; - \addplot[pccplot] expression[domain=4.3333:10]{f}; - \end{axis} - \end{tikzpicture} -\end{shortsolution} -\end{problem} - -\begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-4,0)(0,12/5)}; - \addplot[asymptote,domain=-10:10]({-5},{x}); - \addplot[asymptote,domain=-10:10]({x},{3}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:deducecurve1} - \end{subfigure}% - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(2,0)(0,-3/2)}; - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{-3}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:deducecurve2} - \end{subfigure}% - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(6,0)(0,3)}; - \addplot[asymptote,domain=-10:10]({x},{2}); - \addplot[asymptote,domain=-10:10]({4},{x}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:deducecurve4} - \end{subfigure} - \caption{Graphs for \cref{rat:prob:deduce}} - \label{rat:fig:deducecurve} - \end{widepage} -\end{figure} - -%=================================== -% Author: Hughes -% Date: June 2012 -%=================================== -\begin{problem}[\Cref{rat:step:last} for more complicated rational functions]\label{rat:prob:deducehard} -\pccname{David} is also working on graphing rational functions, and -has been concentrating on functions that have the form -\[ - r(x)=\frac{a(x-b)(x-c)}{(x-d)(x-e)} -\] -David notices that functions with this type of formula have simple zeros -at $b$ and $c$, and vertical asymptotes at $d$ and $e$. Furthermore, -these functions behave like $\frac{1}{x}$ around both vertical asymptotes, -and the curve of the function will have $3$ branches. - -David has followed \crefrange{rat:step:first}{rat:step:penultimate} for -$3$ separate functions, and drawn the results in \cref{rat:fig:deducehard}. -Help David finish each graph by deducing the curve of each function. -\begin{shortsolution} - \Vref{rat:fig:deducehard1} - - \begin{tikzpicture}[/pgf/declare function={f=(x-6)*(x+3)/( (x-4)*(x+1));}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\solutionfigurewidth, - ] - \addplot[soldot] coordinates{(-3,0)(6,0)(0,9/2)}; - \addplot[asymptote,domain=-10:10]({-1},{x}); - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{2}); - \addplot[pccplot] expression[domain=-10:-1.24276]{f}; - \addplot[pccplot] expression[domain=-0.6666:3.66667]{f}; - \addplot[pccplot] expression[domain=4.24276:10]{f}; - \end{axis} - \end{tikzpicture} - - \Vref{rat:fig:deducehard2} - - \begin{tikzpicture}[/pgf/declare function={f=3*(x-2)*(x+3)/( (x-6)*(x+5));}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\solutionfigurewidth, - ] - \addplot[soldot] coordinates{(-3,0)(2,0)(0,3/5)}; - \addplot[asymptote,domain=-10:10]({-5},{x}); - \addplot[asymptote,domain=-10:10]({6},{x}); - \addplot[asymptote,domain=-10:10]({x},{3}); - \addplot[pccplot] expression[domain=-10:-5.4861]{f}; - \addplot[pccplot] expression[domain=-4.68395:5.22241]{f}; - \addplot[pccplot] expression[domain=7.34324:10]{f}; - \end{axis} - \end{tikzpicture} - - \Vref{rat:fig:deducehard3} - - \begin{tikzpicture}[/pgf/declare function={f=2*(x-7)*(x+3)/( (x+6)*(x-5));}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\solutionfigurewidth, - ] - \addplot[soldot] coordinates{(-3,0)(7,0)(0,1.4)}; - \addplot[asymptote,domain=-10:10]({-6},{x}); - \addplot[asymptote,domain=-10:10]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{2}); - \addplot[pccplot] expression[domain=-10:-6.91427]{f}; - \addplot[pccplot] expression[domain=-5.42252:4.66427]{f}; - \addplot[pccplot] expression[domain=5.25586:10]{f}; - \end{axis} - \end{tikzpicture} - -\end{shortsolution} -\end{problem} - -\begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-3,0)(6,0)(0,9/2)}; - \addplot[asymptote,domain=-10:10]({-1},{x}); - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{2}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:deducehard1} - \end{subfigure}% - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-3,0)(2,0)(0,3/5)}; - \addplot[asymptote,domain=-10:10]({-5},{x}); - \addplot[asymptote,domain=-10:10]({6},{x}); - \addplot[asymptote,domain=-10:10]({x},{3}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:deducehard2} - \end{subfigure}% - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-3,0)(7,0)(0,1.4)}; - \addplot[asymptote,domain=-10:10]({-6},{x}); - \addplot[asymptote,domain=-10:10]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{2}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:deducehard3} - \end{subfigure}% - \hfill - \caption{Graphs for \cref{rat:prob:deducehard}} - \label{rat:fig:deducehard} - \end{widepage} -\end{figure} -%=================================== -% Author: Adams (Hughes) -% Date: March 2012 -%=================================== -\begin{problem}[\Crefrange{rat:step:first}{rat:step:last}] -Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of -each of the following functions -\fixthis{need 2 more subproblems here} -\begin{multicols}{4} - \begin{subproblem} - $y=\dfrac{4}{x+2}$ - \begin{shortsolution} - Vertical intercept: $(0,2)$; vertical asymptote: $x=-2$, horizontal asymptote: $y=0$. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-5,xmax=5, - ymin=-5,ymax=5, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot] expression[domain=-5:-2.8]{4/(x+2)}; - \addplot[pccplot] expression[domain=-1.2:5]{4/(x+2)}; - \addplot[soldot]coordinates{(0,2)}; - \addplot[asymptote,domain=-5:5]({-2},{x}); - \addplot[asymptote,domain=-5:5]({x},{0}); - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=\dfrac{2x-1}{x^2-9}$ - \begin{shortsolution} - Vertical intercept:$\left( 0,\frac{1}{9} \right)$; - horizontal intercept: $\left( \frac{1}{2},0 \right)$; - vertical asymptotes: $x=-3$, $x=3$, horizontal asymptote: $y=0$. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-5,xmax=5, - ymin=-5,ymax=5, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot] expression[domain=-5:-3.23974]{(2*x-1)/(x^2-9)}; - \addplot[pccplot,samples=50] expression[domain=-2.77321:2.83974]{(2*x-1)/(x^2-9)}; - \addplot[pccplot] expression[domain=3.17321:5]{(2*x-1)/(x^2-9)}; - \addplot[soldot]coordinates{(0,1/9)(1/2,0)}; - \addplot[asymptote,domain=-5:5]({-3},{x}); - \addplot[asymptote,domain=-5:5]({3},{x}); - \addplot[asymptote,domain=-5:5]({x},{0}); - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=\dfrac{x+3}{x-5}$ - \begin{shortsolution} - Vertical intercept $\left( 0,-\frac{3}{5} \right)$; horizontal - intercept: $(-3,0)$; vertical asymptote: $x=5$; horizontal asymptote: $y=1$. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-5,ymax=5, - xtick={-8,-6,...,8}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot] expression[domain=-10:3.666]{(x+3)/(x-5)}; - \addplot[pccplot] expression[domain=7:10]{(x+3)/(x-5)}; - \addplot[asymptote,domain=-5:5]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{1}); - \addplot[soldot]coordinates{(0,-3/5)(-3,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=\dfrac{2x+3}{3x-1}$ - \begin{shortsolution} - Vertical intercept: $(0,-3)$; horizontal intercept: $\left( -\frac{3}{2},0 \right)$; - vertical asymptote: $x=\frac{1}{3}$, horizontal asymptote: $y=\frac{2}{3}$. - - \begin{tikzpicture}[/pgf/declare function={f=(2*x+3)/(3*x-1);}] - \begin{axis}[ - framed, - xmin=-5,xmax=5, - ymin=-5,ymax=5, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot] expression[domain=-5:0.1176]{f}; - \addplot[pccplot] expression[domain=0.6153:5]{f}; - \addplot[asymptote,domain=-5:5]({1/3},{x}); - \addplot[asymptote,domain=-5:5]({x},{2/3}); - \addplot[soldot]coordinates{(0,-3)(-3/2,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=\dfrac{4-x^2}{x^2-9}$ - \begin{shortsolution} - Vertical intercept: $\left( 0,-\frac{4}{9} \right)$; - horizontal intercepts: $(2,0)$, $(-2,0)$; - vertical asymptotes: $x=-3$, $x=3$; horizontal asymptote: $y=-1$. - - \begin{tikzpicture}[/pgf/declare function={f=(4-x^2)/(x^2-9);}] - \begin{axis}[ - framed, - xmin=-5,xmax=5, - ymin=-5,ymax=5, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot] expression[domain=-5:-3.20156]{f}; - \addplot[pccplot,samples=50] expression[domain=-2.85774:2.85774]{f}; - \addplot[pccplot] expression[domain=3.20156:5]{f}; - \addplot[asymptote,domain=-5:5]({-3},{x}); - \addplot[asymptote,domain=-5:5]({3},{x}); - \addplot[asymptote,domain=-5:5]({x},{-1}); - \addplot[soldot] coordinates{(-2,0)(2,0)(0,-4/9)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $y=\dfrac{(4x+5)(3x-4)}{(2x+5)(x-5)}$ - \begin{shortsolution} - Vertical intercept: $\left( 0,\frac{4}{5} \right)$; - horizontal intercepts: $\left( -\frac{5}{4},0 \right)$, $\left( \frac{4}{3},0 \right)$; - vertical asymptotes: $x=-\frac{5}{2}$, $x=5$; horizontal asymptote: $y=6$. - - \begin{tikzpicture}[/pgf/declare function={f=(4*x+5)*(3*x-4)/((2*x+5)*(x-5));}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-20,ymax=20, - xtick={-8,-6,...,8}, - ytick={-10,0,...,10}, - minor ytick={-15,-5,...,15}, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot] expression[domain=-10:-2.73416]{f}; - \addplot[pccplot] expression[domain=-2.33689:4.2792]{f}; - \addplot[pccplot] expression[domain=6.26988:10]{f}; - \addplot[asymptote,domain=-20:20]({-5/2},{x}); - \addplot[asymptote,domain=-20:20]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{6}); - \addplot[soldot]coordinates{(0,4/5)(-5/4,0)(4/3,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Inverse functions] -Each of the following rational functions are invertible -\[ - F(x)=\frac{2x+1}{x-3}, \qquad G(x)= \frac{1-4x}{x+3} -\] -\begin{subproblem} - State the domain of each function. - \begin{shortsolution} - \begin{itemize} - \item The domain of $F$ is $(-\infty,3)\cup(3,\infty)$. - \item The domain of $G$ is $(-\infty,-3)\cup(-3,\infty)$. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Find the inverse of each function, and state its domain. - \begin{shortsolution} - \begin{itemize} - \item $F^{-1}(x)=\frac{3x+1}{x-2}$; the domain of $F^{-1}$ is $(-\infty,2)\cup(2,\infty)$. - \item $G^{-1}(x)=\frac{3x+1}{x+4}$; the domain of $G^{-1}$ is $(-\infty,-4)\cup(-4,\infty)$. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Hence state the range of the original functions. - \begin{shortsolution} - \begin{itemize} - \item The range of $F$ is the domain of $F^{-1}$, which is $(-\infty,2)\cup(2,\infty)$. - \item The range of $G$ is the domain of $G^{-1}$, which is $(-\infty,-4)\cup(-4,\infty)$. - \end{itemize} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - State the range of each inverse function. - \begin{shortsolution} - \begin{itemize} - \item The range of $F^{-1}$ is the domain of $F$, which is $(-\infty,3)\cup(3,\infty)$. - \item The range of $G^{-1}$ is the domain of $G$, which is $(-\infty,-3)\cup(-3,\infty)$. - \end{itemize}<++> - \end{shortsolution} -\end{subproblem} -\end{problem} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Composition] -Let $r$ and $s$ be the rational functions that have formulas -\[ - r(x)=\frac{3}{x^2},\qquad s(x)=\frac{4-x}{x+5} -\] -Evaluate each of the following. -\begin{multicols}{3} - \begin{subproblem} - $(r\circ s)(0)$ - \begin{shortsolution} - $\frac{75}{16}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(s\circ r)(0)$ - \begin{shortsolution} - $(s\circ r)(0)$ is undefined. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(r\circ s)(2)$ - \begin{shortsolution} - $\frac{147}{4}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(s\circ r)(3)$ - \begin{shortsolution} - $192$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(s\circ r)(4)$ - \begin{shortsolution} - $(s\circ r)(4)$ is undefined. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(s\circ r)(x)$ - \begin{shortsolution} - $\dfrac{4x^2-3}{1+5x^2}$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} -%=================================== -% Author: Hughes -% Date: March 2012 -%=================================== -\begin{problem}[Piecewise rational functions] -The function $R$ has formula -\[ - R(x)= - \begin{dcases} - \frac{2}{x+3}, & x<-5 \\ - \frac{x-4}{x-10}, & x\geq -5 - \end{dcases} -\] -Evaluate each of the following. -\begin{multicols}{4} - \begin{subproblem} - $R(-6)$ - \begin{shortsolution} - $-\frac{2}{3}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $R(-5)$ - \begin{shortsolution} - $\frac{3}{5}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $R(-3)$ - \begin{shortsolution} - $\frac{7}{13}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $R(5)$ - \begin{shortsolution} - $-\frac{1}{5}$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\begin{subproblem} - What is the domain of $R$? - \begin{shortsolution} - $(-\infty,10)\cup(10,\infty)$ - \end{shortsolution} -\end{subproblem} -\end{problem} -\end{exercises} + \reformatstepslist{R} % the steps list should be R1, R2, \ldots + We studied rational functions in the previous section, but were + not asked to graph them; in this section we will demonstrate the + steps to be followed in order to sketch graphs of the functions. + + Remember from \vref{rat:def:function} that rational functions have + the form + \[ + r(x)=\frac{p(x)}{q(x)} + \] + In this section we will restrict attention to the case when + \[ + \text{degree of }p\leq \text{degree of }q + \] + Note that this necessarily means that each function that we consider + in this section \emph{will have a horizontal asymptote} (see \vref{rat:def:longrun}). + The cases in which the degree of $p$ is greater than the degree of $q$ + is covered in the next section. + + Before we begin, it is important to remember the following: + \begin{itemize} + \item Our sketches will give a good representation of the overall + shape of the graph, but until we have the tools of calculus (from MTH 251) + we can not find local minimums, local maximums, and inflection points algebraically. This + means that we will make our best guess as to where these points are. + \item We will not concern ourselves too much with the vertical scale (because of + our previous point)| we will, however, mark the vertical intercept (assuming there is one), + and any horizontal asymptotes. + \end{itemize} + \begin{pccspecialcomment}[Steps to follow when sketching rational functions]\label{rat:def:stepsforsketch} + \begin{steps} + \item \label{rat:step:first} Find all vertical asymptotes and holes, and mark them on the + graph using dashed vertical lines and open circles $\circ$ respectively. + \item Find any intercepts, and mark them using solid circles $\bullet$; + determine if the curve cuts the axis, or bounces off it at each zero. + \item Determine the behavior of the function around each asymptote| does + it behave like $\frac{1}{x}$ or $\frac{1}{x^2}$? + \item \label{rat:step:penultimate} Determine the long-run behavior of the function, and mark the horizontal + asymptote using a dashed horizontal line. + \item \label{rat:step:last} Deduce the overall shape of the curve, and sketch it. If there isn't + enough information from the previous steps, then construct a table of values + including sample points from each branch. + \end{steps} + Remember that until we have the tools of calculus, we won't be able to + find the exact coordinates of local minimums, local maximums, and points + of inflection. + \end{pccspecialcomment} + + The examples that follow show how \crefrange{rat:step:first}{rat:step:last} can be + applied to a variety of different rational functions. + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{rat:ex:1overxminus2p2} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $r$ + that has formula + \[ + r(x)=\frac{1}{x-2} + \] + \begin{pccsolution} + \begin{steps} + \item $r$ has a vertical asymptote at $2$; $r$ does not have any holes. The curve of + $r$ will have $2$ branches. + \item $r$ does not have any zeros since the numerator is never equal to $0$. The + vertical intercept of $r$ is $\left( 0,-\frac{1}{2} \right)$. + \item $r$ behaves like $\frac{1}{x}$ around its vertical asymptote since $(x-2)$ + is raised to the power $1$. + \item Since the degree of the numerator is less than the degree of the denominator, + according to \vref{rat:def:longrun} the horizontal asymptote of $r$ has equation $y=0$. + \item We put the details we have obtained so far on \cref{rat:fig:1overxminus2p1}. Notice + that there is only one way to complete the graph, which we have done in \cref{rat:fig:1overxminus2p2}. + \end{steps} + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-5,ymax=5, + width=\textwidth, + ] + \addplot[asymptote,domain=-5:5]({2},{x}); + \addplot[asymptote,domain=-5:5]({x},{0}); + \addplot[soldot] coordinates{(0,-0.5)}node[axisnode,anchor=north east]{$\left( 0,-\frac{1}{2} \right)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:1overxminus2p1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=1/(x-2);}] + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-5,ymax=5, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-5:1.8,samples=50]{f}; + \addplot[pccplot] expression[domain=2.2:5]{f}; + \addplot[asymptote,domain=-5:5]({2},{x}); + \addplot[asymptote,domain=-5:5]({x},{0}); + \addplot[soldot] coordinates{(0,-0.5)}node[axisnode,anchor=north east]{$\left( 0,-\frac{1}{2} \right)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:1overxminus2p2} + \end{subfigure}% + \caption{$y=\dfrac{1}{x-2}$} + \end{figure} + + The function $r$ in \cref{rat:ex:1overxminus2p2} has a horizontal asymptote which has equation $y=0$. + This asymptote lies on the horizontal axis, and you might (understandably) find it hard + to distinguish between the two lines (\cref{rat:fig:1overxminus2p2}). When faced + with such a situation, it is perfectly acceptable to draw the horizontal axis + as a dashed line| just make sure to label it correctly. We will demonstrate this + in the next example. + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{rat:ex:1overxp1} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $v$ + that has formula + \[ + v(x)=\frac{10}{x} + \] + \begin{pccsolution} + \begin{steps} + \item $v$ has a vertical asymptote at $0$. $v$ does not have + any holes. The curve of $v$ will have $2$ branches. + \item $v$ does not have any zeros (since $10\ne 0$). Furthermore, $v$ + does not have a vertical intercept since $v(0)$ is undefined. + \item $v$ behaves like $\frac{1}{x}$ around its vertical asymptote. + \item $v$ has a horizontal asymptote with equation $y=0$. + \item We put the details we have obtained so far in \cref{rat:fig:1overxp1}. + We do not have enough information to sketch $v$ yet (because $v$ does + not have any intercepts), so let's pick a sample + point in either of the $2$ branches| it doesn't matter where our sample point + is, because we know what the overall shape will be. Let's compute $v(2)$ + \begin{align*} + v(2) & =\dfrac{10}{2} \\ + & = 5 + \end{align*} + We therefore mark the point $(2,5)$ on \cref{rat:fig:1overxp2}, and then complete the sketch using + the details we found in the previous steps. + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-5,5}, + ytick={-5,5}, + axis line style={color=white}, + width=\textwidth, + ] + \addplot[asymptote,<->,domain=-10:10]({0},{x}); + \addplot[asymptote,<->,domain=-10:10]({x},{0}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:1overxp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=10/x;}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-5,5}, + ytick={-5,5}, + axis line style={color=white}, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-1]{f}; + \addplot[pccplot] expression[domain=1:10]{f}; + \addplot[soldot] coordinates{(2,5)}node[axisnode,anchor=south west]{$(2,5)$}; + \addplot[asymptote,<->,domain=-10:10]({0},{x}); + \addplot[asymptote,<->,domain=-10:10]({x},{0}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:1overxp2} + \end{subfigure}% + \caption{$y=\dfrac{10}{x}$} + \end{figure} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{rat:ex:asympandholep1} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $u$ + that has formula + \[ + u(x)=\frac{-4(x^2-9)}{x^2-8x+15} + \] + \begin{pccsolution} + \begin{steps} + \item We begin by factoring both the numerator and denominator of $u$ to help + us find any vertical asymptotes or holes + \begin{align*} + u(x) & =\frac{-4(x^2-9)}{x^2-8x+15} \\ + & =\frac{-4(x+3)(x-3)}{(x-5)(x-3)} \\ + & =\frac{-4(x+3)}{x-5} + \end{align*} + provided that $x\ne 3$. Therefore $u$ has a vertical asymptote at $5$ and + a hole at $3$. The curve of $u$ has $2$ branches. + \item $u$ has a simple zero at $-3$. The vertical intercept of $u$ is $\left( 0,\frac{12}{5} \right)$. + \item $u$ behaves like $\frac{1}{x}$ around its vertical asymptote at $4$. + \item Using \vref{rat:def:longrun} the equation of the horizontal asymptote of $u$ is $y=-4$. + \item We put the details we have obtained so far on \cref{rat:fig:1overxminus2p1}. Notice + that there is only one way to complete the graph, which we have done in \cref{rat:fig:1overxminus2p2}. + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-20,ymax=20, + xtick={-8,-6,...,8}, + ytick={-10,10}, + width=\textwidth, + ] + \addplot[asymptote,domain=-20:20]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{-4}); + \addplot[soldot] coordinates{(-3,0)(0,2.4)}node[axisnode,anchor=south east]{$\left( 0,\frac{12}{5} \right)$}; + \addplot[holdot] coordinates{(3,12)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:asympandholep1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=-4*(x+3)/(x-5);}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-20,ymax=20, + xtick={-8,-6,...,8}, + ytick={-10,10}, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:3.6666,samples=50]{f}; + \addplot[pccplot] expression[domain=7:10]{f}; + \addplot[asymptote,domain=-20:20]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{-4}); + \addplot[soldot] coordinates{(-3,0)(0,2.4)}node[axisnode,anchor=south east]{$\left( 0,\frac{12}{5} \right)$}; + \addplot[holdot] coordinates{(3,12)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:asympandholep2} + \end{subfigure}% + \caption{$y=\dfrac{-4(x+3)}{x-5}$} + \end{figure} + \end{pccsolution} + \end{pccexample} + + \Cref{rat:ex:1overxminus2p2,rat:ex:1overxp1,rat:ex:asympandholep1} have focused on functions + that only have one vertical asymptote; the remaining examples in this section + concern functions that have more than one vertical asymptote. We will demonstrate + that \crefrange{rat:step:first}{rat:step:last} still apply. + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{rat:ex:sketchtwoasymp} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $w$ + that has formula + \[ + w(x)=\frac{2(x+3)(x-5)}{(x+5)(x-4)} + \] + \begin{pccsolution} + \begin{steps} + \item $w$ has vertical asymptotes at $-5$ and $4$. $w$ does not have + any holes. The curve of $w$ will have $3$ branches. + \item $w$ has simple zeros at $-3$ and $5$. The vertical intercept of $w$ + is $\left( 0,\frac{3}{2} \right)$. + \item $w$ behaves like $\frac{1}{x}$ around both of its vertical + asymptotes. + \item The degree of the numerator of $w$ is $2$ and the degree of the + denominator of $w$ is also $2$. Using the ratio of the leading coefficients + of the numerator and denominator, we say that $w$ has a horizontal + asymptote with equation $y=\frac{2}{1}=2$. + \item We put the details we have obtained so far on \cref{rat:fig:sketchtwoasymptp1}. + + The function $w$ is a little more complicated than the functions that + we have considered in the previous examples because the curve has $3$ + branches. When graphing such functions, it is generally a good idea to start with the branch + for which you have the most information| in this case, that is the \emph{middle} branch + on the interval $(-5,4)$. + + Once we have drawn the middle branch, there is only one way to complete the graph + (because of our observations about the behavior of $w$ around its vertical asymptotes), + which we have done in \cref{rat:fig:sketchtwoasymptp2}. + \end{steps} + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[asymptote,domain=-10:10]({-5},{x}); + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{2}); + \addplot[soldot] coordinates{(-3,0)(5,0)}; + \addplot[soldot] coordinates{(0,1.5)}node[axisnode,anchor=north west]{$\left( 0,\frac{3}{2} \right)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:sketchtwoasymptp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=2*(x+3)*(x-5)/( (x+5)*(x-4));}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[asymptote,domain=-10:10]({-5},{x}); + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{2}); + \addplot[soldot] coordinates{(-3,0)(5,0)}; + \addplot[soldot] coordinates{(0,1.5)}node[axisnode,anchor=north west]{$\left( 0,\frac{3}{2} \right)$}; + \addplot[pccplot] expression[domain=-10:-5.56708]{f}; + \addplot[pccplot] expression[domain=-4.63511:3.81708]{f}; + \addplot[pccplot] expression[domain=4.13511:10]{f}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:sketchtwoasymptp2} + \end{subfigure}% + \caption{$y=\dfrac{2(x+3)(x-5)}{(x+5)(x-4)}$} + \end{figure} + + The rational functions that we have considered so far have had simple + factors in the denominator; each function has behaved like $\frac{1}{x}$ + around each of its vertical asymptotes. \Cref{rat:ex:2asympnozeros,rat:ex:2squaredasymp} + consider functions that have a repeated factor in the denominator. + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{rat:ex:2asympnozeros} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $f$ + that has formula + \[ + f(x)=\frac{100}{(x+5)(x-4)^2} + \] + \begin{pccsolution} + \begin{steps} + \item $f$ has vertical asymptotes at $-5$ and $4$. $f$ does not have + any holes. The curve of $f$ will have $3$ branches. + \item $f$ does not have any zeros (since $100\ne 0$). The vertical intercept of $f$ + is $\left( 0,\frac{5}{4} \right)$. + \item $f$ behaves like $\frac{1}{x}$ around $-5$ and behaves like $\frac{1}{x^2}$ + around $4$. + \item The degree of the numerator of $f$ is $0$ and the degree of the + denominator of $f$ is $2$. $f$ has a horizontal asymptote with + equation $y=0$. + \item We put the details we have obtained so far on \cref{rat:fig:2asympnozerosp1}. + + The function $f$ is similar to the function $w$ that we considered in \cref{rat:ex:sketchtwoasymp}| + it has two vertical asymptotes and $3$ branches, but in contrast to $w$ it does not have any zeros. + + We sketch $f$ in \cref{rat:fig:2asympnozerosp2}, using the middle branch as our guide + because we have the most information about the function on the interval $(-5,4)$. + + Once we have drawn the middle branch, there is only one way to complete the graph + because of our observations about the behavior of $f$ around its vertical asymptotes (it behaves like $\frac{1}{x}$), + which we have done in \cref{rat:fig:2asympnozerosp2}. + + Note that we are not yet able to find the local minimum of $f$ algebraically on the interval $(-5,4)$, + so we make a reasonable guess as to where it is| we can be confident that it is above the horizontal axis + since $f$ has no zeros. You may think that this is unsatisfactory, but once we have the tools of calculus, we will + be able to find local minimums more precisely. + \end{steps} + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[asymptote,domain=-10:10]({-5},{x}); + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{0}); + \addplot[soldot] coordinates{(0,1.25)}node[axisnode,anchor=south east]{$\left( 0,\frac{5}{4} \right)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:2asympnozerosp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=100/( (x+5)*(x-4)^2);}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[asymptote,domain=-10:10]({-5},{x}); + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{0}); + \addplot[soldot] coordinates{(0,1.25)}node[axisnode,anchor=south east]{$\left( 0,\frac{5}{4} \right)$}; + \addplot[pccplot] expression[domain=-10:-5.12022]{f}; + \addplot[pccplot] expression[domain=-4.87298:2.87298,samples=50]{f}; + \addplot[pccplot] expression[domain=5:10]{f}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:2asympnozerosp2} + \end{subfigure}% + \caption{$y=\dfrac{100}{(x+5)(x-4)^2}$} + \end{figure} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{rat:ex:2squaredasymp} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $g$ + that has formula + \[ + g(x)=\frac{50(2-x)}{(x+3)^2(x-5)^2} + \] + \begin{pccsolution} + \begin{steps} + \item $g$ has vertical asymptotes at $-3$ and $5$. $g$ does + not have any holes. The curve of $g$ will have $3$ branches. + \item $g$ has a simple zero at $2$. The vertical intercept of $g$ is + $\left( 0,\frac{4}{9} \right)$. + \item $g$ behaves like $\frac{1}{x^2}$ around both of its + vertical asymptotes. + \item The degree of the numerator of $g$ is $1$ and the degree of the denominator + of $g$ is $4$. Using \vref{rat:def:longrun}, we calculate that + the horizontal asymptote of $g$ has equation $y=0$. + \item The details that we have found so far have been drawn in + \cref{rat:fig:2squaredasymp1}. The function $g$ is similar to the functions + we considered in \cref{rat:ex:sketchtwoasymp,rat:ex:2asympnozeros} because + it has $2$ vertical asymptotes and $3$ branches. + + We sketch $g$ using the middle branch as our guide because we have the most information + about $g$ on the interval $(-3,5)$. Note that there is no other way to draw this branch + without introducing other zeros which $g$ does not have. + + Once we have drawn the middle branch, there is only one way to complete the graph + because of our observations about the behavior of $g$ around its vertical asymptotes| it + behaves like $\frac{1}{x^2}$. + + \end{steps} + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[asymptote,domain=-10:10]({-3},{x}); + \addplot[asymptote,domain=-10:10]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{0}); + \addplot[soldot] coordinates{(2,0)(0,4/9)}node[axisnode,anchor=south west]{$\left( 0,\frac{4}{9} \right)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:2squaredasymp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=50*(2-x)/( (x+3)^2*(x-5)^2);}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[asymptote,domain=-10:10]({-3},{x}); + \addplot[asymptote,domain=-10:10]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{0}); + \addplot[soldot] coordinates{(2,0)(0,4/9)}node[axisnode,anchor=south west]{$\left( 0,\frac{4}{9} \right)$}; + \addplot[pccplot] expression[domain=-10:-3.61504]{f}; + \addplot[pccplot] expression[domain=-2.3657:4.52773]{f}; + \addplot[pccplot] expression[domain=5.49205:10]{f}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:2squaredasymp2} + \end{subfigure}% + \caption{$y=\dfrac{50(2-x)}{(x+3)^2(x-5)^2}$} + \end{figure} + + Each of the rational functions that we have considered so far has had either + a \emph{simple} zero, or no zeros at all. Remember from our work on polynomial + functions, and particularly \vref{poly:def:multzero}, that a \emph{repeated} zero + corresponds to the curve of the function behaving differently at the zero + when compared to how the curve behaves at a simple zero. \Cref{rat:ex:doublezero} details a + function that has a non-simple zero. + + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccexample}\label{rat:ex:doublezero} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $g$ + that has formula + \[ + h(x)=\frac{(x-3)^2}{(x+4)(x-6)} + \] + \begin{pccsolution} + \begin{steps} + \item $h$ has vertical asymptotes at $-4$ and $6$. $h$ does + not have any holes. The curve of $h$ will have $3$ branches. + \item $h$ has a zero at $3$ that has \emph{multiplicity $2$}. + The vertical intercept of $h$ is + $\left( 0,-\frac{3}{8} \right)$. + \item $h$ behaves like $\frac{1}{x}$ around both of its + vertical asymptotes. + \item The degree of the numerator of $h$ is $2$ and the degree of the denominator + of $h$ is $2$. Using \vref{rat:def:longrun}, we calculate that + the horizontal asymptote of $h$ has equation $y=1$. + \item The details that we have found so far have been drawn in + \cref{rat:fig:doublezerop1}. The function $h$ is different + from the functions that we have considered in previous examples because + of the multiplicity of the zero at $3$. + + We sketch $h$ using the middle branch as our guide because we have the most information + about $h$ on the interval $(-4,6)$. Note that there is no other way to draw this branch + without introducing other zeros which $h$ does not have| also note how + the curve bounces off the horizontal axis at $3$. + + Once we have drawn the middle branch, there is only one way to complete the graph + because of our observations about the behavior of $h$ around its vertical asymptotes| it + behaves like $\frac{1}{x}$. + + \end{steps} + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-5,ymax=5, + xtick={-8,-6,...,8}, + ytick={-3,3}, + width=\textwidth, + ] + \addplot[asymptote,domain=-10:10]({-4},{x}); + \addplot[asymptote,domain=-10:10]({6},{x}); + \addplot[asymptote,domain=-10:10]({x},{1}); + \addplot[soldot] coordinates{(3,0)(0,-3/8)}node[axisnode,anchor=north west]{$\left( 0,-\frac{3}{8} \right)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:doublezerop1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-3)^2/((x+4)*(x-6));}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-5,ymax=5, + xtick={-8,-6,...,8}, + ytick={-3,3}, + width=\textwidth, + ] + \addplot[asymptote,domain=-10:10]({-4},{x}); + \addplot[asymptote,domain=-10:10]({6},{x}); + \addplot[asymptote,domain=-10:10]({x},{1}); + \addplot[soldot] coordinates{(3,0)(0,-3/8)}node[axisnode,anchor=north west]{$\left( 0,-\frac{3}{8} \right)$}; + \addplot[pccplot] expression[domain=-10:-5.20088]{f}; + \addplot[pccplot] expression[domain=-3.16975:5.83642,samples=50]{f}; + \addplot[pccplot] expression[domain=6.20088:10]{f}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:doublezerop2} + \end{subfigure}% + \caption{$y=\dfrac{(x-3)^2}{(x+4)(x-6)}$} + \end{figure} + \begin{exercises} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[\Cref{rat:step:last}]\label{rat:prob:deduce} + \pccname{Katie} is working on graphing rational functions. She + has been concentrating on functions that have the form + \begin{equation}\label{rat:eq:deducecurve} + f(x)=\frac{a(x-b)}{x-c} + \end{equation} + Katie notes that functions with this type of formula have a zero + at $b$, and a vertical asymptote at $c$. Furthermore, these functions + behave like $\frac{1}{x}$ around their vertical asymptote, and the + curve of each function will have $2$ branches. + + Katie has been working with $3$ functions that have the form given + in \cref{rat:eq:deducecurve}, and has followed \crefrange{rat:step:first}{rat:step:penultimate}; + her results are shown in \cref{rat:fig:deducecurve}. There is just one + more thing to do to complete the graphs| follow \cref{rat:step:last}. + Help Katie finish each graph by deducing the curve of each function. + \begin{shortsolution} + \Vref{rat:fig:deducecurve1} + + \begin{tikzpicture}[/pgf/declare function={f=3*(x+4)/(x+5);}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\solutionfigurewidth, + ] + \addplot[soldot] coordinates{(-4,0)(0,12/5)}; + \addplot[asymptote,domain=-10:10]({-5},{x}); + \addplot[asymptote,domain=-10:10]({x},{3}); + \addplot[pccplot] expression[domain=-10:-5.42857]{f}; + \addplot[pccplot] expression[domain=-4.76923:10,samples=50]{f}; + \end{axis} + \end{tikzpicture} + + \Vref{rat:fig:deducecurve2} + + \begin{tikzpicture}[/pgf/declare function={f=-3*(x-2)/(x-4);}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\solutionfigurewidth, + ] + \addplot[soldot] coordinates{(2,0)(0,-3/2)}; + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{-3}); + \addplot[pccplot] expression[domain=-10:3.53846,samples=50]{f}; + \addplot[pccplot] expression[domain=4.85714:10]{f}; + \end{axis} + \end{tikzpicture} + + \Vref{rat:fig:deducecurve4} + + \begin{tikzpicture}[/pgf/declare function={f=2*(x-6)/(x-4);}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\solutionfigurewidth, + ] + \addplot[soldot] coordinates{(6,0)(0,3)}; + \addplot[asymptote,domain=-10:10]({x},{2}); + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[pccplot] expression[domain=-10:3.5,samples=50]{f}; + \addplot[pccplot] expression[domain=4.3333:10]{f}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{problem} + + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-4,0)(0,12/5)}; + \addplot[asymptote,domain=-10:10]({-5},{x}); + \addplot[asymptote,domain=-10:10]({x},{3}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:deducecurve1} + \end{subfigure}% + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(2,0)(0,-3/2)}; + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{-3}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:deducecurve2} + \end{subfigure}% + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(6,0)(0,3)}; + \addplot[asymptote,domain=-10:10]({x},{2}); + \addplot[asymptote,domain=-10:10]({4},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:deducecurve4} + \end{subfigure} + \caption{Graphs for \cref{rat:prob:deduce}} + \label{rat:fig:deducecurve} + \end{widepage} + \end{figure} + + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[\Cref{rat:step:last} for more complicated rational functions]\label{rat:prob:deducehard} + \pccname{David} is also working on graphing rational functions, and + has been concentrating on functions that have the form + \[ + r(x)=\frac{a(x-b)(x-c)}{(x-d)(x-e)} + \] + David notices that functions with this type of formula have simple zeros + at $b$ and $c$, and vertical asymptotes at $d$ and $e$. Furthermore, + these functions behave like $\frac{1}{x}$ around both vertical asymptotes, + and the curve of the function will have $3$ branches. + + David has followed \crefrange{rat:step:first}{rat:step:penultimate} for + $3$ separate functions, and drawn the results in \cref{rat:fig:deducehard}. + Help David finish each graph by deducing the curve of each function. + \begin{shortsolution} + \Vref{rat:fig:deducehard1} + + \begin{tikzpicture}[/pgf/declare function={f=(x-6)*(x+3)/( (x-4)*(x+1));}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\solutionfigurewidth, + ] + \addplot[soldot] coordinates{(-3,0)(6,0)(0,9/2)}; + \addplot[asymptote,domain=-10:10]({-1},{x}); + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{2}); + \addplot[pccplot] expression[domain=-10:-1.24276]{f}; + \addplot[pccplot] expression[domain=-0.6666:3.66667]{f}; + \addplot[pccplot] expression[domain=4.24276:10]{f}; + \end{axis} + \end{tikzpicture} + + \Vref{rat:fig:deducehard2} + + \begin{tikzpicture}[/pgf/declare function={f=3*(x-2)*(x+3)/( (x-6)*(x+5));}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\solutionfigurewidth, + ] + \addplot[soldot] coordinates{(-3,0)(2,0)(0,3/5)}; + \addplot[asymptote,domain=-10:10]({-5},{x}); + \addplot[asymptote,domain=-10:10]({6},{x}); + \addplot[asymptote,domain=-10:10]({x},{3}); + \addplot[pccplot] expression[domain=-10:-5.4861]{f}; + \addplot[pccplot] expression[domain=-4.68395:5.22241]{f}; + \addplot[pccplot] expression[domain=7.34324:10]{f}; + \end{axis} + \end{tikzpicture} + + \Vref{rat:fig:deducehard3} + + \begin{tikzpicture}[/pgf/declare function={f=2*(x-7)*(x+3)/( (x+6)*(x-5));}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\solutionfigurewidth, + ] + \addplot[soldot] coordinates{(-3,0)(7,0)(0,1.4)}; + \addplot[asymptote,domain=-10:10]({-6},{x}); + \addplot[asymptote,domain=-10:10]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{2}); + \addplot[pccplot] expression[domain=-10:-6.91427]{f}; + \addplot[pccplot] expression[domain=-5.42252:4.66427]{f}; + \addplot[pccplot] expression[domain=5.25586:10]{f}; + \end{axis} + \end{tikzpicture} + + \end{shortsolution} + \end{problem} + + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-3,0)(6,0)(0,9/2)}; + \addplot[asymptote,domain=-10:10]({-1},{x}); + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{2}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:deducehard1} + \end{subfigure}% + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-3,0)(2,0)(0,3/5)}; + \addplot[asymptote,domain=-10:10]({-5},{x}); + \addplot[asymptote,domain=-10:10]({6},{x}); + \addplot[asymptote,domain=-10:10]({x},{3}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:deducehard2} + \end{subfigure}% + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-3,0)(7,0)(0,1.4)}; + \addplot[asymptote,domain=-10:10]({-6},{x}); + \addplot[asymptote,domain=-10:10]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{2}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:deducehard3} + \end{subfigure}% + \hfill + \caption{Graphs for \cref{rat:prob:deducehard}} + \label{rat:fig:deducehard} + \end{widepage} + \end{figure} + %=================================== + % Author: Adams (Hughes) + % Date: March 2012 + %=================================== + \begin{problem}[\Crefrange{rat:step:first}{rat:step:last}] + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of + each of the following functions + \fixthis{need 2 more subproblems here} + \begin{multicols}{4} + \begin{subproblem} + $y=\dfrac{4}{x+2}$ + \begin{shortsolution} + Vertical intercept: $(0,2)$; vertical asymptote: $x=-2$, horizontal asymptote: $y=0$. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-5,xmax=5, + ymin=-5,ymax=5, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot] expression[domain=-5:-2.8]{4/(x+2)}; + \addplot[pccplot] expression[domain=-1.2:5]{4/(x+2)}; + \addplot[soldot]coordinates{(0,2)}; + \addplot[asymptote,domain=-5:5]({-2},{x}); + \addplot[asymptote,domain=-5:5]({x},{0}); + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=\dfrac{2x-1}{x^2-9}$ + \begin{shortsolution} + Vertical intercept:$\left( 0,\frac{1}{9} \right)$; + horizontal intercept: $\left( \frac{1}{2},0 \right)$; + vertical asymptotes: $x=-3$, $x=3$, horizontal asymptote: $y=0$. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-5,xmax=5, + ymin=-5,ymax=5, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot] expression[domain=-5:-3.23974]{(2*x-1)/(x^2-9)}; + \addplot[pccplot,samples=50] expression[domain=-2.77321:2.83974]{(2*x-1)/(x^2-9)}; + \addplot[pccplot] expression[domain=3.17321:5]{(2*x-1)/(x^2-9)}; + \addplot[soldot]coordinates{(0,1/9)(1/2,0)}; + \addplot[asymptote,domain=-5:5]({-3},{x}); + \addplot[asymptote,domain=-5:5]({3},{x}); + \addplot[asymptote,domain=-5:5]({x},{0}); + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=\dfrac{x+3}{x-5}$ + \begin{shortsolution} + Vertical intercept $\left( 0,-\frac{3}{5} \right)$; horizontal + intercept: $(-3,0)$; vertical asymptote: $x=5$; horizontal asymptote: $y=1$. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-5,ymax=5, + xtick={-8,-6,...,8}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot] expression[domain=-10:3.666]{(x+3)/(x-5)}; + \addplot[pccplot] expression[domain=7:10]{(x+3)/(x-5)}; + \addplot[asymptote,domain=-5:5]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{1}); + \addplot[soldot]coordinates{(0,-3/5)(-3,0)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=\dfrac{2x+3}{3x-1}$ + \begin{shortsolution} + Vertical intercept: $(0,-3)$; horizontal intercept: $\left( -\frac{3}{2},0 \right)$; + vertical asymptote: $x=\frac{1}{3}$, horizontal asymptote: $y=\frac{2}{3}$. + + \begin{tikzpicture}[/pgf/declare function={f=(2*x+3)/(3*x-1);}] + \begin{axis}[ + framed, + xmin=-5,xmax=5, + ymin=-5,ymax=5, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot] expression[domain=-5:0.1176]{f}; + \addplot[pccplot] expression[domain=0.6153:5]{f}; + \addplot[asymptote,domain=-5:5]({1/3},{x}); + \addplot[asymptote,domain=-5:5]({x},{2/3}); + \addplot[soldot]coordinates{(0,-3)(-3/2,0)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=\dfrac{4-x^2}{x^2-9}$ + \begin{shortsolution} + Vertical intercept: $\left( 0,-\frac{4}{9} \right)$; + horizontal intercepts: $(2,0)$, $(-2,0)$; + vertical asymptotes: $x=-3$, $x=3$; horizontal asymptote: $y=-1$. + + \begin{tikzpicture}[/pgf/declare function={f=(4-x^2)/(x^2-9);}] + \begin{axis}[ + framed, + xmin=-5,xmax=5, + ymin=-5,ymax=5, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot] expression[domain=-5:-3.20156]{f}; + \addplot[pccplot,samples=50] expression[domain=-2.85774:2.85774]{f}; + \addplot[pccplot] expression[domain=3.20156:5]{f}; + \addplot[asymptote,domain=-5:5]({-3},{x}); + \addplot[asymptote,domain=-5:5]({3},{x}); + \addplot[asymptote,domain=-5:5]({x},{-1}); + \addplot[soldot] coordinates{(-2,0)(2,0)(0,-4/9)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=\dfrac{(4x+5)(3x-4)}{(2x+5)(x-5)}$ + \begin{shortsolution} + Vertical intercept: $\left( 0,\frac{4}{5} \right)$; + horizontal intercepts: $\left( -\frac{5}{4},0 \right)$, $\left( \frac{4}{3},0 \right)$; + vertical asymptotes: $x=-\frac{5}{2}$, $x=5$; horizontal asymptote: $y=6$. + + \begin{tikzpicture}[/pgf/declare function={f=(4*x+5)*(3*x-4)/((2*x+5)*(x-5));}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-20,ymax=20, + xtick={-8,-6,...,8}, + ytick={-10,0,...,10}, + minor ytick={-15,-5,...,15}, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot] expression[domain=-10:-2.73416]{f}; + \addplot[pccplot] expression[domain=-2.33689:4.2792]{f}; + \addplot[pccplot] expression[domain=6.26988:10]{f}; + \addplot[asymptote,domain=-20:20]({-5/2},{x}); + \addplot[asymptote,domain=-20:20]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{6}); + \addplot[soldot]coordinates{(0,4/5)(-5/4,0)(4/3,0)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Inverse functions] + Each of the following rational functions are invertible + \[ + F(x)=\frac{2x+1}{x-3}, \qquad G(x)= \frac{1-4x}{x+3} + \] + \begin{subproblem} + State the domain of each function. + \begin{shortsolution} + \begin{itemize} + \item The domain of $F$ is $(-\infty,3)\cup(3,\infty)$. + \item The domain of $G$ is $(-\infty,-3)\cup(-3,\infty)$. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Find the inverse of each function, and state its domain. + \begin{shortsolution} + \begin{itemize} + \item $F^{-1}(x)=\frac{3x+1}{x-2}$; the domain of $F^{-1}$ is $(-\infty,2)\cup(2,\infty)$. + \item $G^{-1}(x)=\frac{3x+1}{x+4}$; the domain of $G^{-1}$ is $(-\infty,-4)\cup(-4,\infty)$. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Hence state the range of the original functions. + \begin{shortsolution} + \begin{itemize} + \item The range of $F$ is the domain of $F^{-1}$, which is $(-\infty,2)\cup(2,\infty)$. + \item The range of $G$ is the domain of $G^{-1}$, which is $(-\infty,-4)\cup(-4,\infty)$. + \end{itemize} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + State the range of each inverse function. + \begin{shortsolution} + \begin{itemize} + \item The range of $F^{-1}$ is the domain of $F$, which is $(-\infty,3)\cup(3,\infty)$. + \item The range of $G^{-1}$ is the domain of $G$, which is $(-\infty,-3)\cup(-3,\infty)$. + \end{itemize}<++> + \end{shortsolution} + \end{subproblem} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Composition] + Let $r$ and $s$ be the rational functions that have formulas + \[ + r(x)=\frac{3}{x^2},\qquad s(x)=\frac{4-x}{x+5} + \] + Evaluate each of the following. + \begin{multicols}{3} + \begin{subproblem} + $(r\circ s)(0)$ + \begin{shortsolution} + $\frac{75}{16}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(s\circ r)(0)$ + \begin{shortsolution} + $(s\circ r)(0)$ is undefined. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(r\circ s)(2)$ + \begin{shortsolution} + $\frac{147}{4}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(s\circ r)(3)$ + \begin{shortsolution} + $192$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(s\circ r)(4)$ + \begin{shortsolution} + $(s\circ r)(4)$ is undefined. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(s\circ r)(x)$ + \begin{shortsolution} + $\dfrac{4x^2-3}{1+5x^2}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Piecewise rational functions] + The function $R$ has formula + \[ + R(x)= + \begin{dcases} + \frac{2}{x+3}, & x<-5 \\ + \frac{x-4}{x-10}, & x\geq -5 + \end{dcases} + \] + Evaluate each of the following. + \begin{multicols}{4} + \begin{subproblem} + $R(-6)$ + \begin{shortsolution} + $-\frac{2}{3}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $R(-5)$ + \begin{shortsolution} + $\frac{3}{5}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $R(-3)$ + \begin{shortsolution} + $\frac{7}{13}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $R(5)$ + \begin{shortsolution} + $-\frac{1}{5}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \begin{subproblem} + What is the domain of $R$? + \begin{shortsolution} + $(-\infty,10)\cup(10,\infty)$ + \end{shortsolution} + \end{subproblem} + \end{problem} + \end{exercises} \section{Graphing rational functions (oblique asymptotes)}\label{rat:sec:oblique} -\begin{subproblem} - $y=\dfrac{x^2+1}{x-4}$ - \begin{shortsolution} - \begin{enumerate} - \item $\left( 0,-\frac{1}{4} \right)$ - \item Vertical asymptote: $x=4$. - \item A graph of the function is shown below - - \begin{tikzpicture}[/pgf/declare function={f=(x^2+1)/(x-4);}] - \begin{axis}[ - framed, - xmin=-20,xmax=20, - ymin=-30,ymax=30, - xtick={-10,10}, - minor xtick={-15,-5,...,15}, - minor ytick={-10,10}, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot,samples=50] expression[domain=-20:3.54724]{f}; - \addplot[pccplot,samples=50] expression[domain=4.80196:20]{f}; - \addplot[asymptote,domain=-30:30]({4},{x}); - \end{axis} - \end{tikzpicture} - \end{enumerate} - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - $y=\dfrac{x^3(x+3)}{x-5}$ - \begin{shortsolution} - \begin{enumerate} - \item $(0,0)$, $(-3,0)$ - \item Vertical asymptote: $x=5$, horizontal asymptote: none. - \item A graph of the function is shown below - - \begin{tikzpicture}[/pgf/declare function={f=x^3*(x+3)/(x-5);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-500,ymax=2500, - xtick={-8,-6,...,8}, - ytick={500,1000,1500,2000}, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot,samples=50] expression[domain=-10:4]{f}; - \addplot[pccplot] expression[domain=5.6068:9.777]{f}; - \addplot[asymptote,domain=-500:2500]({5},{x}); - \end{axis} - \end{tikzpicture} - \end{enumerate} - \end{shortsolution} -\end{subproblem} + \begin{subproblem} + $y=\dfrac{x^2+1}{x-4}$ + \begin{shortsolution} + \begin{enumerate} + \item $\left( 0,-\frac{1}{4} \right)$ + \item Vertical asymptote: $x=4$. + \item A graph of the function is shown below + + \begin{tikzpicture}[/pgf/declare function={f=(x^2+1)/(x-4);}] + \begin{axis}[ + framed, + xmin=-20,xmax=20, + ymin=-30,ymax=30, + xtick={-10,10}, + minor xtick={-15,-5,...,15}, + minor ytick={-10,10}, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot,samples=50] expression[domain=-20:3.54724]{f}; + \addplot[pccplot,samples=50] expression[domain=4.80196:20]{f}; + \addplot[asymptote,domain=-30:30]({4},{x}); + \end{axis} + \end{tikzpicture} + \end{enumerate} + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=\dfrac{x^3(x+3)}{x-5}$ + \begin{shortsolution} + \begin{enumerate} + \item $(0,0)$, $(-3,0)$ + \item Vertical asymptote: $x=5$, horizontal asymptote: none. + \item A graph of the function is shown below + + \begin{tikzpicture}[/pgf/declare function={f=x^3*(x+3)/(x-5);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-500,ymax=2500, + xtick={-8,-6,...,8}, + ytick={500,1000,1500,2000}, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot,samples=50] expression[domain=-10:4]{f}; + \addplot[pccplot] expression[domain=5.6068:9.777]{f}; + \addplot[asymptote,domain=-500:2500]({5},{x}); + \end{axis} + \end{tikzpicture} + \end{enumerate} + \end{shortsolution} + \end{subproblem} diff --git a/Master/texmf-dist/doc/support/latexindent/success/sampleBEFORE.tex b/Master/texmf-dist/doc/support/latexindent/success/sampleBEFORE.tex index 757f65c557e..bf62bb9ee1f 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/sampleBEFORE.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/sampleBEFORE.tex @@ -1,8 +1,8 @@ % arara: indent: {overwrite: true, trace: on} -% A sample chapter file- it contains a lot of +% A sample chapter file- it contains a lot of % environments, including tabulars, align, etc -% -% Don't try and compile this file using pdflatex etc, just +% +% Don't try and compile this file using pdflatex etc, just % compare the *format* of it to the format of the % sampleAFTER.tex % @@ -11,21 +11,21 @@ \section{Polynomial functions} \reformatstepslist{P} % the steps list should be P1, P2, \ldots - In your previous mathematics classes you have studied \emph{linear} and - \emph{quadratic} functions. The most general forms of these types of - functions can be represented (respectively) by the functions $f$ + In your previous mathematics classes you have studied \emph{linear} and + \emph{quadratic} functions. The most general forms of these types of + functions can be represented (respectively) by the functions $f$ and $g$ that have formulas \begin{equation}\label{poly:eq:linquad} f(x)=mx+b, \qquad g(x)=ax^2+bx+c \end{equation} - We know that $m$ is the slope of $f$, and that $a$ is the \emph{leading coefficient} - of $g$. We also know that the \emph{signs} of $m$ and $a$ completely + We know that $m$ is the slope of $f$, and that $a$ is the \emph{leading coefficient} + of $g$. We also know that the \emph{signs} of $m$ and $a$ completely determine the behavior of the functions $f$ and $g$. For example, if $m>0$ - then $f$ is an \emph{increasing} function, and if $m<0$ then $f$ is - a \emph{decreasing} function. Similarly, if $a>0$ then $g$ is - \emph{concave up} and if $a<0$ then $g$ is \emph{concave down}. Graphical + then $f$ is an \emph{increasing} function, and if $m<0$ then $f$ is + a \emph{decreasing} function. Similarly, if $a>0$ then $g$ is + \emph{concave up} and if $a<0$ then $g$ is \emph{concave down}. Graphical representations of these statements are given in \cref{poly:fig:linquad}. - + \begin{figure}[!htb] \setlength{\figurewidth}{.2\textwidth} \begin{subfigure}{\figurewidth} @@ -94,18 +94,18 @@ \caption{Typical graphs of linear and quadratic functions.} \label{poly:fig:linquad} \end{figure} - - Let's look a little more closely at the formulas for $f$ and $g$ in - \cref{poly:eq:linquad}. Note that the \emph{degree} - of $f$ is $1$ since the highest power of $x$ that is present in the + + Let's look a little more closely at the formulas for $f$ and $g$ in + \cref{poly:eq:linquad}. Note that the \emph{degree} + of $f$ is $1$ since the highest power of $x$ that is present in the formula for $f(x)$ is $1$. Similarly, the degree of $g$ is $2$ since - the highest power of $x$ that is present in the formula for $g(x)$ + the highest power of $x$ that is present in the formula for $g(x)$ is $2$. - + In this section we will build upon our knowledge of these elementary - functions. In particular, we will generalize the functions $f$ and $g$ to a function $p$ that has + functions. In particular, we will generalize the functions $f$ and $g$ to a function $p$ that has any degree that we wish. - + %=================================== % Author: Hughes % Date: March 2012 @@ -116,2460 +116,2362 @@ % Date: March 2012 %=================================== \begin{problem}[Quadratic functions] - Every quadratic function has the form $y=ax^2+bx+c$; state the value - of $a$ for each of the following functions, and hence decide if the + Every quadratic function has the form $y=ax^2+bx+c$; state the value + of $a$ for each of the following functions, and hence decide if the parabola that represents the function opens upward or downward. \begin{multicols}{2} \begin{subproblem} - $F(x)=x^2+3$ + $F(x)=x^2+3$ \begin{shortsolution} - $a=1$; the parabola opens upward. + $a=1$; the parabola opens upward. \end{shortsolution} \end{subproblem} \begin{subproblem} - $G(t)=4-5t^2$ + $G(t)=4-5t^2$ \begin{shortsolution} - $a=-5$; the parabola opens downward. + $a=-5$; the parabola opens downward. \end{shortsolution} \end{subproblem} \begin{subproblem} - $H(y)=4y^2-96y+8$ + $H(y)=4y^2-96y+8$ \begin{shortsolution} - $a=4$; the parabola opens upward. + $a=4$; the parabola opens upward. \end{shortsolution} \end{subproblem} \begin{subproblem} - $K(z)=-19z^2$ + $K(z)=-19z^2$ \begin{shortsolution} - $m=-19$; the parabola opens downward. + $m=-19$; the parabola opens downward. \end{shortsolution} \end{subproblem} \end{multicols} Now let's generalize our findings for the most general quadratic function $g$ that has formula $g(x)=a_2x^2+a_1x+a_0$. Complete the following sentences. \begin{subproblem} - When $a_2>0$, the parabola that represents $y=g(x)$ opens $\ldots$ + When $a_2>0$, the parabola that represents $y=g(x)$ opens $\ldots$ \begin{shortsolution} When $a_2>0$, the parabola that represents the function opens upward. \end{shortsolution} \end{subproblem} \begin{subproblem} - When $a_2<0$, the parabola that represents $y=g(x)$ opens $\ldots$ + When $a_2<0$, the parabola that represents $y=g(x)$ opens $\ldots$ \begin{shortsolution} When $a_2<0$, the parabola that represents the function opens downward. \end{shortsolution} \end{subproblem} \end{problem} \end{essentialskills} - + \subsection*{Power functions with positive exponents} - The study of polynomials will rely upon a good knowledge - of power functions| you may reasonably ask, what is a power function? - \begin{pccdefinition}[Power functions] - Power functions have the form - \[ - f(x) = a_n x^n - \] - where $n$ can be any real number. - - Note that for this section we will only be concerned with the - case when $n$ is a positive integer. - \end{pccdefinition} - - You may find assurance in the fact that you are already very comfortable - with power functions that have $n=1$ (linear) and $n=2$ (quadratic). Let's - explore some power functions that you might not be so familiar with. - As you read \cref{poly:ex:oddpow,poly:ex:evenpow}, try and spot - as many patterns and similarities as you can. - - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{pccexample}[Power functions with odd positive exponents] - \label{poly:ex:oddpow} - Graph each of the following functions, state their domain, and their - long-run behavior as $x\rightarrow\pm\infty$ - \[ - f(x)=x^3, \qquad g(x)=x^5, \qquad h(x)=x^7 - \] - \begin{pccsolution} - The functions $f$, $g$, and $h$ are plotted in \cref{poly:fig:oddpow}. - The domain of each of the functions $f$, $g$, and $h$ is $(-\infty,\infty)$. Note that - the long-run behavior of each of the functions is the same, and in particular - \begin{align*} - f(x)\rightarrow\infty & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} f(x)\rightarrow-\infty & \text{ as } x\rightarrow-\infty - \end{align*} - The same results hold for $g$ and $h$. - \end{pccsolution} - \end{pccexample} - - \begin{figure}[!htb] - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-1.5,xmax=1.5, - ymin=-5,ymax=5, - xtick={-1.0,-0.5,...,1.0}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\textwidth, - legend pos=north west, - ] - \addplot expression[domain=-1.5:1.5]{x^3}; - \addplot expression[domain=-1.379:1.379]{x^5}; - \addplot expression[domain=-1.258:1.258]{x^7}; - \addplot[soldot]coordinates{(-1,-1)} node[axisnode,anchor=north west]{$(-1,-1)$}; - \addplot[soldot]coordinates{(1,1)} node[axisnode,anchor=south east]{$(1,1)$}; - \legend{$f$,$g$,$h$} - \end{axis} - \end{tikzpicture} - \caption{Odd power functions} - \label{poly:fig:oddpow} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-2.5,xmax=2.5, - ymin=-5,ymax=5, - xtick={-2.0,-1.5,...,2.0}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\textwidth, - legend pos=south east, - ] - \addplot expression[domain=-2.236:2.236]{x^2}; - \addplot expression[domain=-1.495:1.495]{x^4}; - \addplot expression[domain=-1.307:1.307]{x^6}; - \addplot[soldot]coordinates{(-1,1)} node[axisnode,anchor=east]{$(-1,1)$}; - \addplot[soldot]coordinates{(1,1)} node[axisnode,anchor=west]{$(1,1)$}; - \legend{$F$,$G$,$H$} - \end{axis} - \end{tikzpicture} - \caption{Even power functions} - \label{poly:fig:evenpow} - \end{minipage}% - \end{figure} - - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{pccexample}[Power functions with even positive exponents]\label{poly:ex:evenpow}% - Graph each of the following functions, state their domain, and their - long-run behavior as $x\rightarrow\pm\infty$ - \[ - F(x)=x^2, \qquad G(x)=x^4, \qquad H(x)=x^6 - \] - \begin{pccsolution} - The functions $F$, $G$, and $H$ are plotted in \cref{poly:fig:evenpow}. The domain - of each of the functions is $(-\infty,\infty)$. Note that the long-run behavior - of each of the functions is the same, and in particular - \begin{align*} - F(x)\rightarrow\infty & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} F(x)\rightarrow\infty & \text{ as } x\rightarrow-\infty - \end{align*} - The same result holds for $G$ and $H$. - \end{pccsolution} - \end{pccexample} - - \begin{doyouunderstand} - \begin{problem} - Repeat \cref{poly:ex:oddpow,poly:ex:evenpow} using (respectively) - \begin{subproblem} - $f(x)=-x^3, \qquad g(x)=-x^5, \qquad h(x)=-x^7$ - \begin{shortsolution} - The functions $f$, $g$, and $h$ have domain $(-\infty,\infty)$ and - are graphed below. - + The study of polynomials will rely upon a good knowledge + of power functions| you may reasonably ask, what is a power function? + \begin{pccdefinition}[Power functions] + Power functions have the form + \[ + f(x) = a_n x^n + \] + where $n$ can be any real number. + + Note that for this section we will only be concerned with the + case when $n$ is a positive integer. + \end{pccdefinition} + + You may find assurance in the fact that you are already very comfortable + with power functions that have $n=1$ (linear) and $n=2$ (quadratic). Let's + explore some power functions that you might not be so familiar with. + As you read \cref{poly:ex:oddpow,poly:ex:evenpow}, try and spot + as many patterns and similarities as you can. + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Power functions with odd positive exponents] + \label{poly:ex:oddpow} + Graph each of the following functions, state their domain, and their + long-run behavior as $x\rightarrow\pm\infty$ + \[ + f(x)=x^3, \qquad g(x)=x^5, \qquad h(x)=x^7 + \] + \begin{pccsolution} + The functions $f$, $g$, and $h$ are plotted in \cref{poly:fig:oddpow}. + The domain of each of the functions $f$, $g$, and $h$ is $(-\infty,\infty)$. Note that + the long-run behavior of each of the functions is the same, and in particular + \begin{align*} + f(x)\rightarrow\infty & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} f(x)\rightarrow-\infty & \text{ as } x\rightarrow-\infty + \end{align*} + The same results hold for $g$ and $h$. + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htb] + \begin{minipage}{.45\textwidth} \begin{tikzpicture} \begin{axis}[ framed, xmin=-1.5,xmax=1.5, ymin=-5,ymax=5, - xtick={-1.0,-0.5,...,0.5}, + xtick={-1.0,-0.5,...,1.0}, minor ytick={-3,-1,...,3}, grid=both, - width=\solutionfigurewidth, - legend pos=north east, + width=\textwidth, + legend pos=north west, ] - \addplot expression[domain=-1.5:1.5]{-x^3}; - \addplot expression[domain=-1.379:1.379]{-x^5}; - \addplot expression[domain=-1.258:1.258]{-x^7}; + \addplot expression[domain=-1.5:1.5]{x^3}; + \addplot expression[domain=-1.379:1.379]{x^5}; + \addplot expression[domain=-1.258:1.258]{x^7}; + \addplot[soldot]coordinates{(-1,-1)} node[axisnode,anchor=north west]{$(-1,-1)$}; + \addplot[soldot]coordinates{(1,1)} node[axisnode,anchor=south east]{$(1,1)$}; \legend{$f$,$g$,$h$} \end{axis} \end{tikzpicture} - - Note that - \begin{align*} - f(x)\rightarrow-\infty & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} f(x)\rightarrow\infty & \text{ as } x\rightarrow-\infty - \end{align*} - The same is true for $g$ and $h$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $F(x)=-x^2, \qquad G(x)=-x^4, \qquad H(x)=-x^6$ - \begin{shortsolution} - The functions $F$, $G$, and $H$ have domain $(-\infty,\infty)$ and - are graphed below. - + \caption{Odd power functions} + \label{poly:fig:oddpow} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} \begin{tikzpicture} \begin{axis}[ framed, xmin=-2.5,xmax=2.5, ymin=-5,ymax=5, - xtick={-1.0,-0.5,...,0.5}, + xtick={-2.0,-1.5,...,2.0}, minor ytick={-3,-1,...,3}, grid=both, - width=\solutionfigurewidth, - legend pos=north east, + width=\textwidth, + legend pos=south east, ] - \addplot expression[domain=-2.236:2.236]{-x^2}; - \addplot expression[domain=-1.495:1.495]{-x^4}; - \addplot expression[domain=-1.307:1.307]{-x^6}; + \addplot expression[domain=-2.236:2.236]{x^2}; + \addplot expression[domain=-1.495:1.495]{x^4}; + \addplot expression[domain=-1.307:1.307]{x^6}; + \addplot[soldot]coordinates{(-1,1)} node[axisnode,anchor=east]{$(-1,1)$}; + \addplot[soldot]coordinates{(1,1)} node[axisnode,anchor=west]{$(1,1)$}; \legend{$F$,$G$,$H$} \end{axis} \end{tikzpicture} - - Note that + \caption{Even power functions} + \label{poly:fig:evenpow} + \end{minipage}% + \end{figure} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Power functions with even positive exponents]\label{poly:ex:evenpow}% + Graph each of the following functions, state their domain, and their + long-run behavior as $x\rightarrow\pm\infty$ + \[ + F(x)=x^2, \qquad G(x)=x^4, \qquad H(x)=x^6 + \] + \begin{pccsolution} + The functions $F$, $G$, and $H$ are plotted in \cref{poly:fig:evenpow}. The domain + of each of the functions is $(-\infty,\infty)$. Note that the long-run behavior + of each of the functions is the same, and in particular \begin{align*} - F(x)\rightarrow-\infty & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} F(x)\rightarrow-\infty & \text{ as } x\rightarrow-\infty + F(x)\rightarrow\infty & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} F(x)\rightarrow\infty & \text{ as } x\rightarrow-\infty \end{align*} - The same is true for $G$ and $H$. - \end{shortsolution} - \end{subproblem} - \end{problem} - \end{doyouunderstand} - + The same result holds for $G$ and $H$. + \end{pccsolution} + \end{pccexample} + + \begin{doyouunderstand} + \begin{problem} + Repeat \cref{poly:ex:oddpow,poly:ex:evenpow} using (respectively) + \begin{subproblem} + $f(x)=-x^3, \qquad g(x)=-x^5, \qquad h(x)=-x^7$ + \begin{shortsolution} + The functions $f$, $g$, and $h$ have domain $(-\infty,\infty)$ and + are graphed below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-1.5,xmax=1.5, + ymin=-5,ymax=5, + xtick={-1.0,-0.5,...,0.5}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + legend pos=north east, + ] + \addplot expression[domain=-1.5:1.5]{-x^3}; + \addplot expression[domain=-1.379:1.379]{-x^5}; + \addplot expression[domain=-1.258:1.258]{-x^7}; + \legend{$f$,$g$,$h$} + \end{axis} + \end{tikzpicture} + + Note that + \begin{align*} + f(x)\rightarrow-\infty & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} f(x)\rightarrow\infty & \text{ as } x\rightarrow-\infty + \end{align*} + The same is true for $g$ and $h$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $F(x)=-x^2, \qquad G(x)=-x^4, \qquad H(x)=-x^6$ + \begin{shortsolution} + The functions $F$, $G$, and $H$ have domain $(-\infty,\infty)$ and + are graphed below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-2.5,xmax=2.5, + ymin=-5,ymax=5, + xtick={-1.0,-0.5,...,0.5}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + legend pos=north east, + ] + \addplot expression[domain=-2.236:2.236]{-x^2}; + \addplot expression[domain=-1.495:1.495]{-x^4}; + \addplot expression[domain=-1.307:1.307]{-x^6}; + \legend{$F$,$G$,$H$} + \end{axis} + \end{tikzpicture} + + Note that + \begin{align*} + F(x)\rightarrow-\infty & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} F(x)\rightarrow-\infty & \text{ as } x\rightarrow-\infty + \end{align*} + The same is true for $G$ and $H$. + \end{shortsolution} + \end{subproblem} + \end{problem} + \end{doyouunderstand} + \subsection*{Polynomial functions} - Now that we have a little more familiarity with power functions, - we can define polynomial functions. Provided that you were comfortable - with our opening discussion about linear and quadratic functions (see - $f$ and $g$ in \cref{poly:eq:linquad}) then there is every chance - that you'll be able to master polynomial functions as well; just remember - that polynomial functions are a natural generalization of linear - and quadratic functions. Once you've studied the examples and problems - in this section, you'll hopefully agree that polynomial functions - are remarkably predictable. - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccdefinition}[Polynomial functions] - Polynomial functions have the form - \[ - p(x)=a_nx^n+a_{n-1}x^{n-1}+\ldots+a_1x+a_0 - \] - where $a_n$, $a_{n-1}$, $a_{n-2}$, \ldots, $a_0$ are real numbers. - \begin{itemize} - \item We call $n$ the degree of the polynomial, and require that $n$ - is a non-negative integer; - \item $a_n$, $a_{n-1}$, $a_{n-2}$, \ldots, $a_0$ are called the coefficients; - \item We typically write polynomial functions in descending powers of $x$. - \end{itemize} - In particular, we call $a_n$ the \emph{leading} coefficient, and $a_nx^n$ the - \emph{leading term}. - - Note that if a polynomial is given in factored form, then the degree can be found - by counting the number of linear factors. - \end{pccdefinition} - - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{pccexample}[Polynomial or not] - Identify the following functions as polynomial or not; if the function - is a polynomial, state its degree. - \begin{multicols}{3} - \begin{enumerate} - \item $p(x)=x^2-3$ - \item $q(x)=-4x^{\nicefrac{1}{2}}+10$ - \item $r(x)=10x^5$ - \item $s(x)=x^{-2}+x^{23}$ - \item $f(x)=-8$ - \item $g(x)=3^x$ - \item $h(x)=\sqrt[3]{x^7}-x^2+x$ - \item $k(x)=4x(x+2)(x-3)$ - \item $j(x)=x^2(x-4)(5-x)$ - \end{enumerate} - \end{multicols} - \begin{pccsolution} - \begin{enumerate} - \item $p$ is a polynomial, and its degree is $2$. - \item $q$ is \emph{not} a polynomial, because $\frac{1}{2}$ is not an integer. - \item $r$ is a polynomial, and its degree is $5$. - \item $s$ is \emph{not} a polynomial, because $-2$ is not a positive integer. - \item $f$ is a polynomial, and its degree is $0$. - \item $g$ is \emph{not} a polynomial, because the independent - variable, $x$, is in the exponent. - \item $h$ is \emph{not} a polynomial, because $\frac{7}{3}$ is not an integer. - \item $k$ is a polynomial, and its degree is $3$. - \item $j$ is a polynomial, and its degree is $4$. - \end{enumerate} - \end{pccsolution} - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{pccexample}[Typical graphs]\label{poly:ex:typical} - \Cref{poly:fig:typical} shows graphs of some polynomial functions; - the ticks have deliberately been left off the axis to allow us to concentrate - on the features of each graph. Note in particular that: - \begin{itemize} - \item \cref{poly:fig:typical1} shows a degree-$1$ polynomial (you might also - classify the function as linear) whose leading coefficient, $a_1$, is positive. - \item \cref{poly:fig:typical2} shows a degree-$2$ polynomial (you might also - classify the function as quadratic) whose leading coefficient, $a_2$, is positive. - \item \cref{poly:fig:typical3} shows a degree-$3$ polynomial whose leading coefficient, $a_3$, - is positive| compare its overall - shape and long-run behavior to the functions described in \cref{poly:ex:oddpow}. - \item \cref{poly:fig:typical4} shows a degree-$4$ polynomial whose leading coefficient, $a_4$, - is positive|compare its overall shape and long-run behavior to the functions described in \cref{poly:ex:evenpow}. - \item \cref{poly:fig:typical5} shows a degree-$5$ polynomial whose leading coefficient, $a_5$, - is positive| compare its overall - shape and long-run behavior to the functions described in \cref{poly:ex:oddpow}. - \end{itemize} - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{\textwidth/6} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-10:8]{(x+2)}; - \end{axis} - \end{tikzpicture} - \caption{$a_1>0$} - \label{poly:fig:typical1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-4:4]{(x^2-6)}; - \end{axis} - \end{tikzpicture} - \caption{$a_2>0$} - \label{poly:fig:typical2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-7.5:7.5]{0.05*(x+6)*x*(x-6)}; - \end{axis} - \end{tikzpicture} - \caption{$a_3>0$} - \label{poly:fig:typical3} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-2.35:5.35,samples=100]{0.2*(x-5)*x*(x-3)*(x+2)}; - \end{axis} - \end{tikzpicture} - \caption{$a_4>0$} - \label{poly:fig:typical4} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\textwidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-5.5:6.3,samples=100]{0.01*(x+2)*x*(x-3)*(x+5)*(x-6)}; - \end{axis} - \end{tikzpicture} - \caption{$a_5>0$} - \label{poly:fig:typical5} - \end{subfigure} - \end{widepage} - \caption{Graphs to illustrate typical curves of polynomial functions.} - \label{poly:fig:typical} - \end{figure} - - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{doyouunderstand} - \begin{problem} - Use \cref{poly:ex:typical} and \cref{poly:fig:typical} to help you sketch - the graphs of polynomial functions that have negative leading coefficients| note - that there are many ways to do this! The intention with this problem - is to use your knowledge of transformations- in particular, \emph{reflections}- - to guide you. - \begin{shortsolution} - $a_1<0$: - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-10:8]{-(x+2)}; - \end{axis} - \end{tikzpicture} - - $a_2<0$ - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-4:4]{-(x^2-6)}; - \end{axis} - \end{tikzpicture} - - $a_3<0$ - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-7.5:7.5]{-0.05*(x+6)*x*(x-6)}; - \end{axis} - \end{tikzpicture} - - $a_4<0$ - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-2.35:5.35,samples=100]{-0.2*(x-5)*x*(x-3)*(x+2)}; - \end{axis} - \end{tikzpicture} - - $a_5<0$ - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - xtick={-11}, - ytick={-11}, - ] - \addplot expression[domain=-5.5:6.3,samples=100]{-0.01*(x+2)*x*(x-3)*(x+5)*(x-6)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{problem} - \end{doyouunderstand} - - \fixthis{poly: Need a more basic example here- it can have a similar - format to the multiple zeros example, but just keep it simple; it should - be halfway between the 2 examples surrounding it} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample}[Multiple zeros] - Consider the polynomial functions $p$, $q$, and $r$ which are - graphed in \cref{poly:fig:moremultiple}. - The formulas for $p$, $q$, and $r$ are as follows - \begin{align*} - p(x) & =(x-3)^2(x+4)^2 \\ - q(x) & =x(x+2)^2(x-1)^2(x-3) \\ - r(x) & =x(x-3)^3(x+1)^2 - \end{align*} - Find the degree of $p$, $q$, and $r$, and decide if the functions bounce off or cut - through the horizontal axis at each of their zeros. - \begin{pccsolution} - The degree of $p$ is 4. Referring to \cref{poly:fig:bouncep}, - the curve bounces off the horizontal axis at both zeros, $3$ and $4$. - - The degree of $q$ is 6. Referring to \cref{poly:fig:bounceq}, - the curve bounces off the horizontal axis at $-2$ and $1$, and cuts - through the horizontal axis at $0$ and $3$. - - The degree of $r$ is 6. Referring to \cref{poly:fig:bouncer}, - the curve bounces off the horizontal axis at $-1$, and cuts through - the horizontal axis at $0$ and at $3$, although is flattened immediately to the left and right of $3$. - \end{pccsolution} - \end{pccexample} - - \setlength{\figurewidth}{0.25\textwidth} - \begin{figure}[!htb] - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-6,xmax=5, - ymin=-30,ymax=200, - xtick={-4,-2,...,4}, - width=\textwidth, - ] - \addplot expression[domain=-5.63733:4.63733,samples=50]{(x-3)^2*(x+4)^2}; - \addplot[soldot]coordinates{(3,0)(-4,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=p(x)$} - \label{poly:fig:bouncep} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-3,xmax=4, - xtick={-2,...,3}, - ymin=-60,ymax=40, - width=\textwidth, - ] - \addplot+[samples=50] expression[domain=-2.49011:3.11054]{x*(x+2)^2*(x-1)^2*(x-3)}; - \addplot[soldot]coordinates{(-2,0)(0,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=q(x)$} - \label{poly:fig:bounceq} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-2,xmax=4, - xtick={-1,...,3}, - ymin=-40,ymax=40, - width=\textwidth, - ] - \addplot expression[domain=-1.53024:3.77464,samples=50]{x*(x-3)^3*(x+1)^2}; - \addplot[soldot]coordinates{(-1,0)(0,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=r(x)$} - \label{poly:fig:bouncer} - \end{subfigure} - \caption{} - \label{poly:fig:moremultiple} - \end{figure} - - \begin{pccdefinition}[Multiple zeros]\label{poly:def:multzero} - Let $p$ be a polynomial that has a repeated linear factor $(x-a)^n$. Then we say - that $p$ has a multiple zero at $a$ of multiplicity $n$ and - \begin{itemize} - \item if the factor $(x-a)$ is repeated an even number of times, the graph of $y=p(x)$ does not - cross the $x$ axis at $a$, but `bounces' off the horizontal axis at $a$. - \item if the factor $(x-a)$ is repeated an odd number of times, the graph of $y=p(x)$ crosses the - horizontal axis at $a$, but it looks `flattened' there - \end{itemize} - If $n=1$, then we say that $p$ has a \emph{simple} zero at $a$. - \end{pccdefinition} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample}[Find a formula] - Find formulas for the polynomial functions, $p$ and $q$, graphed in \cref{poly:fig:findformulademoboth}. - \begin{figure}[!htb] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[framed, - xmin=-5,xmax=5, - ymin=-10,ymax=10, - xtick={-4,-2,...,4}, - minor xtick={-3,-1,...,3}, - ytick={-8,-6,...,8}, - width=\textwidth, - grid=both] - \addplot expression[domain=-3.25842:2.25842,samples=50]{-x*(x-2)*(x+3)*(x+1)}; - \addplot[soldot]coordinates{(1,8)}node[axisnode,inner sep=.35cm,anchor=west]{$(1,8)$}; - \addplot[soldot]coordinates{(-3,0)(-1,0)(0,0)(2,0)}; - \end{axis} - \end{tikzpicture} - \caption{$p$} - \label{poly:fig:findformulademo} - \end{subfigure} - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[framed, - xmin=-5,xmax=5, - ymin=-10,ymax=10, - xtick={-4,-2,...,4}, - minor xtick={-3,-1,...,3}, - ytick={-8,-6,...,8}, - width=\textwidth, - grid=both] - \addplot expression[domain=-4.33:4.08152]{-.25*(x+2)^2*(x-3)}; - \addplot[soldot]coordinates{(2,4)}node[axisnode,anchor=south west]{$(2,4)$}; - \addplot[soldot]coordinates{(-2,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$q$} - \label{poly:fig:findformulademo1} - \end{subfigure} - \caption{} - \label{poly:fig:findformulademoboth} - \end{figure} - \begin{pccsolution} - \begin{enumerate} - \item We begin by noting that the horizontal intercepts of $p$ are $(-3,0)$, $(-1,0)$, $(0,0)$ and $(2,0)$. - We also note that each zero is simple (multiplicity $1$). - If we assume that $p$ has no other zeros, then we can start by writing - \begin{align*} - p(x) & =(x+3)(x+1)(x-0)(x-2) \\ - & =x(x+3)(x+1)(x-2) \\ - \end{align*} - According to \cref{poly:fig:findformulademo}, the point $(1,8)$ lies - on the curve $y=p(x)$. - Let's check if the formula we have written satisfies this requirement - \begin{align*} - p(1) & = (1)(4)(2)(-1) \\ - & = -8 - \end{align*} - which is clearly not correct| it is close though. We can correct this by - multiplying $p$ by a constant $k$; so let's assume that - \[ - p(x)=kx(x+3)(x+1)(x-2) - \] - Then $p(1)=-8k$, and if this is to equal $8$, then $k=-1$. Therefore - the formula for $p(x)$ is - \[ - p(x)=-x(x+3)(x+1)(x-2) - \] - \item The function $q$ has a zero at $-2$ of multiplicity $2$, and zero of - multiplicity $1$ at $3$ (so $3$ is a simple zero of $q$); we can therefore assume that $q$ has the form - \[ - q(x)=k(x+2)^2(x-3) - \] - where $k$ is some real number. In order to find $k$, we use the given ordered pair, $(2,4)$, and - evaluate $p(2)$ - \begin{align*} - p(2) & =k(4)^2(-1) \\ - & =-16k - \end{align*} - We solve the equation $4=-8k$ and obtain $k=-\frac{1}{4}$ and conclude that the - formula for $q(x)$ is - \[ - q(x)=-\frac{1}{4}(x+2)^2(x-3) - \] - \end{enumerate} - \end{pccsolution} - \end{pccexample} - - - \fixthis{Chris: need sketching polynomial problems} - \begin{pccspecialcomment}[Steps to follow when sketching polynomial functions] - \begin{steps} - \item \label{poly:step:first} Determine the degree of the polynomial, - its leading term and leading coefficient, and hence determine - the long-run behavior of the polynomial| does it behave like $\pm x^2$ or $\pm x^3$ - as $x\rightarrow\pm\infty$? - \item Determine the zeros and their multiplicity. Mark all zeros - and the vertical intercept on the graph using solid circles $\bullet$. - \item \label{poly:step:last} Deduce the overall shape of the curve, and sketch it. If there isn't - enough information from the previous steps, then construct a table of values. - \end{steps} - Remember that until we have the tools of calculus, we won't be able to - find the exact coordinates of local minimums, local maximums, and points - of inflection. - \end{pccspecialcomment} - Before we demonstrate some examples, it is important to remember the following: - \begin{itemize} - \item our sketches will give a good representation of the overall - shape of the graph, but until we have the tools of calculus (from MTH 251) - we can not find local minimums, local maximums, and inflection points algebraically. This - means that we will make our best guess as to where these points are. - \item we will not concern ourselves too much with the vertical scale (because of - our previous point)| we will, however, mark the vertical intercept (assuming there is one), - and any horizontal asymptotes. - \end{itemize} - %=================================== - % Author: Hughes - % Date: May 2012 - %=================================== - \begin{pccexample}\label{poly:ex:simplecubic} - Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $p$ - that has formula - \[ - p(x)=\frac{1}{2}(x-4)(x-1)(x+3) - \] - \begin{pccsolution} - \begin{steps} - \item $p$ has degree $3$. The leading term of $p$ is $\frac{1}{2}x^3$, so the leading coefficient of $p$ - is $\frac{1}{2}$. The long-run behavior of $p$ is therefore similar to that of $x^3$. - \item The zeros of $p$ are $-3$, $1$, and $4$; each zero is simple (i.e, it has multiplicity $1$). - This means that the curve of $p$ cuts the horizontal axis at each zero. The vertical - intercept of $p$ is $(0,6)$. - \item We draw the details we have obtained so far on \cref{poly:fig:simplecubicp1}. Given - that the curve of $p$ looks like the curve of $x^3$ in the long-run, we are able to complete a sketch of the - graph of $p$ in \cref{poly:fig:simplecubicp2}. - - Note that we can not find the coordinates of the local minimums, local maximums, and inflection - points| for the moment we make reasonable guesses as to where these points are (you'll find how - to do this in calculus). - \end{steps} - - \begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=15, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-3,0)(1,0)(4,0)(0,6)}node[axisnode,anchor=south west]{$(0,6)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:simplecubicp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=15, - xtick={-8,-6,...,8}, - ytick={-5,5}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-3,0)(1,0)(4,0)(0,6)}node[axisnode,anchor=south west]{$(0,6)$}; - \addplot[pccplot] expression[domain=-3.57675:4.95392,samples=100]{.5*(x-4)*(x-1)*(x+3)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:simplecubicp2} - \end{subfigure}% - \caption{$y=\dfrac{1}{2}(x-4)(x-1)(x+3)$} - \label{poly:fig:simplecubic} - \end{figure} - \end{pccsolution} - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: May 2012 - %=================================== - \begin{pccexample}\label{poly:ex:degree5} - Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $q$ - that has formula - \[ - q(x)=\frac{1}{200}(x+7)^2(2-x)(x-6)^2 - \] - \begin{pccsolution} - \begin{steps} - \item $q$ has degree $4$. The leading term of $q$ is - \[ - -\frac{1}{200}x^5 - \] - so the leading coefficient of $q$ is $-\frac{1}{200}$. The long-run behavior of $q$ - is therefore similar to that of $-x^5$. - \item The zeros of $q$ are $-7$ (multiplicity 2), $2$ (simple), and $6$ (multiplicity $2$). - The curve of $q$ bounces off the horizontal axis at the zeros with multiplicity $2$ and - cuts the horizontal axis at the simple zeros. The vertical intercept of $q$ is $\left( 0,\frac{441}{25} \right)$. - \item We mark the details we have found so far on \cref{poly:fig:degree5p1}. Given that - the curve of $q$ looks like the curve of $-x^5$ in the long-run, we can complete \cref{poly:fig:degree5p2}. - \end{steps} - - \begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=40, - xtick={-8,-6,...,8}, - ytick={-5,0,...,35}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-7,0)(2,0)(6,0)(0,441/25)}node[axisnode,anchor=south west]{$\left( 0, \frac{441}{25} \right)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:degree5p1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=40, - xtick={-8,-6,...,8}, - ytick={-5,0,...,35}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-7,0)(2,0)(6,0)(0,441/25)}node[axisnode,anchor=south west]{$\left( 0, \frac{441}{25} \right)$}; - \addplot[pccplot] expression[domain=-8.83223:7.34784,samples=50]{1/200*(x+7)^2*(2-x)*(x-6)^2}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:degree5p2} - \end{subfigure}% - \caption{$y=\dfrac{1}{200}(x+7)^2(2-x)(x-6)^2$} - \label{poly:fig:degree5} - \end{figure} - \end{pccsolution} - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: May 2012 - %=================================== - \begin{pccexample} - Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $r$ - that has formula - \[ - r(x)=\frac{1}{100}x^3(x+4)(x-4)(x-6) - \] - \begin{pccsolution} - \begin{steps} - \item $r$ has degree $6$. The leading term of $r$ is - \[ - \frac{1}{100}x^6 - \] - so the leading coefficient of $r$ is $\frac{1}{100}$. The long-run behavior of $r$ - is therefore similar to that of $x^6$. - \item The zeros of $r$ are $-4$ (simple), $0$ (multiplicity $3$), $4$ (simple), - and $6$ (simple). The vertical intercept of $r$ is $(0,0)$. The curve of $r$ - cuts the horizontal axis at the simple zeros, and goes through the axis - at $(0,0)$, but does so in a flattened way. - \item We mark the zeros and vertical intercept on \cref{poly:fig:degree6p1}. Given that - the curve of $r$ looks like the curve of $x^6$ in the long-run, we complete the graph - of $r$ in \cref{poly:fig:degree6p2}. - \end{steps} - - \begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=10, - ymin=-20,ymax=10, - xtick={-4,-2,...,8}, - ytick={-15,-10,...,5}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-4,0)(0,0)(4,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:degree6p1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=10, - ymin=-20,ymax=10, - xtick={-4,-2,...,8}, - ytick={-15,-10,...,5}, - width=\textwidth, - ] - \addplot[soldot] coordinates{(-4,0)(0,0)(4,0)(6,0)}; - \addplot[pccplot] expression[domain=-4.16652:6.18911,samples=100]{1/100*(x+4)*x^3*(x-4)*(x-6)}; - \end{axis} - \end{tikzpicture} + Now that we have a little more familiarity with power functions, + we can define polynomial functions. Provided that you were comfortable + with our opening discussion about linear and quadratic functions (see + $f$ and $g$ in \cref{poly:eq:linquad}) then there is every chance + that you'll be able to master polynomial functions as well; just remember + that polynomial functions are a natural generalization of linear + and quadratic functions. Once you've studied the examples and problems + in this section, you'll hopefully agree that polynomial functions + are remarkably predictable. + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccdefinition}[Polynomial functions] + Polynomial functions have the form + \[ + p(x)=a_nx^n+a_{n-1}x^{n-1}+\ldots+a_1x+a_0 + \] + where $a_n$, $a_{n-1}$, $a_{n-2}$, \ldots, $a_0$ are real numbers. + \begin{itemize} + \item We call $n$ the degree of the polynomial, and require that $n$ + is a non-negative integer; + \item $a_n$, $a_{n-1}$, $a_{n-2}$, \ldots, $a_0$ are called the coefficients; + \item We typically write polynomial functions in descending powers of $x$. + \end{itemize} + In particular, we call $a_n$ the \emph{leading} coefficient, and $a_nx^n$ the + \emph{leading term}. + + Note that if a polynomial is given in factored form, then the degree can be found + by counting the number of linear factors. + \end{pccdefinition} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Polynomial or not] + Identify the following functions as polynomial or not; if the function + is a polynomial, state its degree. + \begin{multicols}{3} + \begin{enumerate} + \item $p(x)=x^2-3$ + \item $q(x)=-4x^{\nicefrac{1}{2}}+10$ + \item $r(x)=10x^5$ + \item $s(x)=x^{-2}+x^{23}$ + \item $f(x)=-8$ + \item $g(x)=3^x$ + \item $h(x)=\sqrt[3]{x^7}-x^2+x$ + \item $k(x)=4x(x+2)(x-3)$ + \item $j(x)=x^2(x-4)(5-x)$ + \end{enumerate} + \end{multicols} + \begin{pccsolution} + \begin{enumerate} + \item $p$ is a polynomial, and its degree is $2$. + \item $q$ is \emph{not} a polynomial, because $\frac{1}{2}$ is not an integer. + \item $r$ is a polynomial, and its degree is $5$. + \item $s$ is \emph{not} a polynomial, because $-2$ is not a positive integer. + \item $f$ is a polynomial, and its degree is $0$. + \item $g$ is \emph{not} a polynomial, because the independent + variable, $x$, is in the exponent. + \item $h$ is \emph{not} a polynomial, because $\frac{7}{3}$ is not an integer. + \item $k$ is a polynomial, and its degree is $3$. + \item $j$ is a polynomial, and its degree is $4$. + \end{enumerate} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Typical graphs]\label{poly:ex:typical} + \Cref{poly:fig:typical} shows graphs of some polynomial functions; + the ticks have deliberately been left off the axis to allow us to concentrate + on the features of each graph. Note in particular that: + \begin{itemize} + \item \cref{poly:fig:typical1} shows a degree-$1$ polynomial (you might also + classify the function as linear) whose leading coefficient, $a_1$, is positive. + \item \cref{poly:fig:typical2} shows a degree-$2$ polynomial (you might also + classify the function as quadratic) whose leading coefficient, $a_2$, is positive. + \item \cref{poly:fig:typical3} shows a degree-$3$ polynomial whose leading coefficient, $a_3$, + is positive| compare its overall + shape and long-run behavior to the functions described in \cref{poly:ex:oddpow}. + \item \cref{poly:fig:typical4} shows a degree-$4$ polynomial whose leading coefficient, $a_4$, + is positive|compare its overall shape and long-run behavior to the functions described in \cref{poly:ex:evenpow}. + \item \cref{poly:fig:typical5} shows a degree-$5$ polynomial whose leading coefficient, $a_5$, + is positive| compare its overall + shape and long-run behavior to the functions described in \cref{poly:ex:oddpow}. + \end{itemize} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{\textwidth/6} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-10:8]{(x+2)}; + \end{axis} + \end{tikzpicture} + \caption{$a_1>0$} + \label{poly:fig:typical1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-4:4]{(x^2-6)}; + \end{axis} + \end{tikzpicture} + \caption{$a_2>0$} + \label{poly:fig:typical2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-7.5:7.5]{0.05*(x+6)*x*(x-6)}; + \end{axis} + \end{tikzpicture} + \caption{$a_3>0$} + \label{poly:fig:typical3} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-2.35:5.35,samples=100]{0.2*(x-5)*x*(x-3)*(x+2)}; + \end{axis} + \end{tikzpicture} + \caption{$a_4>0$} + \label{poly:fig:typical4} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\textwidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-5.5:6.3,samples=100]{0.01*(x+2)*x*(x-3)*(x+5)*(x-6)}; + \end{axis} + \end{tikzpicture} + \caption{$a_5>0$} + \label{poly:fig:typical5} + \end{subfigure} + \end{widepage} + \caption{Graphs to illustrate typical curves of polynomial functions.} + \label{poly:fig:typical} + \end{figure} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{doyouunderstand} + \begin{problem} + Use \cref{poly:ex:typical} and \cref{poly:fig:typical} to help you sketch + the graphs of polynomial functions that have negative leading coefficients| note + that there are many ways to do this! The intention with this problem + is to use your knowledge of transformations- in particular, \emph{reflections}- + to guide you. + \begin{shortsolution} + $a_1<0$: + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-10:8]{-(x+2)}; + \end{axis} + \end{tikzpicture} + + $a_2<0$ + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-4:4]{-(x^2-6)}; + \end{axis} + \end{tikzpicture} + + $a_3<0$ + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-7.5:7.5]{-0.05*(x+6)*x*(x-6)}; + \end{axis} + \end{tikzpicture} + + $a_4<0$ + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-2.35:5.35,samples=100]{-0.2*(x-5)*x*(x-3)*(x+2)}; + \end{axis} + \end{tikzpicture} + + $a_5<0$ + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + xtick={-11}, + ytick={-11}, + ] + \addplot expression[domain=-5.5:6.3,samples=100]{-0.01*(x+2)*x*(x-3)*(x+5)*(x-6)}; + \end{axis} + \end{tikzpicture} + \end{shortsolution} + \end{problem} + \end{doyouunderstand} + + \fixthis{poly: Need a more basic example here- it can have a similar + format to the multiple zeros example, but just keep it simple; it should + be halfway between the 2 examples surrounding it} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Multiple zeros] + Consider the polynomial functions $p$, $q$, and $r$ which are + graphed in \cref{poly:fig:moremultiple}. + The formulas for $p$, $q$, and $r$ are as follows + \begin{align*} + p(x) & =(x-3)^2(x+4)^2 \\ + q(x) & =x(x+2)^2(x-1)^2(x-3) \\ + r(x) & =x(x-3)^3(x+1)^2 + \end{align*} + Find the degree of $p$, $q$, and $r$, and decide if the functions bounce off or cut + through the horizontal axis at each of their zeros. + \begin{pccsolution} + The degree of $p$ is 4. Referring to \cref{poly:fig:bouncep}, + the curve bounces off the horizontal axis at both zeros, $3$ and $4$. + + The degree of $q$ is 6. Referring to \cref{poly:fig:bounceq}, + the curve bounces off the horizontal axis at $-2$ and $1$, and cuts + through the horizontal axis at $0$ and $3$. + + The degree of $r$ is 6. Referring to \cref{poly:fig:bouncer}, + the curve bounces off the horizontal axis at $-1$, and cuts through + the horizontal axis at $0$ and at $3$, although is flattened immediately to the left and right of $3$. + \end{pccsolution} + \end{pccexample} + + \setlength{\figurewidth}{0.25\textwidth} + \begin{figure}[!htb] + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-6,xmax=5, + ymin=-30,ymax=200, + xtick={-4,-2,...,4}, + width=\textwidth, + ] + \addplot expression[domain=-5.63733:4.63733,samples=50]{(x-3)^2*(x+4)^2}; + \addplot[soldot]coordinates{(3,0)(-4,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=p(x)$} + \label{poly:fig:bouncep} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-3,xmax=4, + xtick={-2,...,3}, + ymin=-60,ymax=40, + width=\textwidth, + ] + \addplot+[samples=50] expression[domain=-2.49011:3.11054]{x*(x+2)^2*(x-1)^2*(x-3)}; + \addplot[soldot]coordinates{(-2,0)(0,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=q(x)$} + \label{poly:fig:bounceq} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-2,xmax=4, + xtick={-1,...,3}, + ymin=-40,ymax=40, + width=\textwidth, + ] + \addplot expression[domain=-1.53024:3.77464,samples=50]{x*(x-3)^3*(x+1)^2}; + \addplot[soldot]coordinates{(-1,0)(0,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=r(x)$} + \label{poly:fig:bouncer} + \end{subfigure} \caption{} - \label{poly:fig:degree6p2} - \end{subfigure}% - \caption{$y=\dfrac{1}{100}(x+4)x^3(x-4)(x-6)$} - \end{figure} - \end{pccsolution} - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{pccexample}[An open-topped box] - A cardboard company makes open-topped boxes for their clients. The specifications - dictate that the box must have a square base, and that it must be open-topped. - The company uses sheets of cardboard that are $\unit[1200]{cm^2}$. Assuming that - the base of each box has side $x$ (measured in cm), it can be shown that the volume of each box, $V(x)$, - has formula - \[ - V(x)=\frac{x}{4}(1200-x^2) - \] - Find the dimensions of the box that maximize the volume. - \begin{pccsolution} - We graph $y=V(x)$ in \cref{poly:fig:opentoppedbox}. Note that because - $x$ represents the length of a side, and $V(x)$ represents the volume - of the box, we necessarily require both values to be positive; we illustrate - the part of the curve that applies to this problem using a solid line. - - \begin{figure}[!htb] - \centering - \begin{tikzpicture} - \begin{axis}[framed, - xmin=-50,xmax=50, - ymin=-5000,ymax=5000, - xtick={-40,-30,...,40}, - minor xtick={-45,-35,...,45}, - minor ytick={-3000,-1000,1000,3000}, - width=.75\textwidth, - height=.5\textwidth, - grid=both] - \addplot[pccplot,dashed,<-] expression[domain=-40:0,samples=50]{x/4*(1200-x^2)}; - \addplot[pccplot,-] expression[domain=0:34.64,samples=50]{x/4*(1200-x^2)}; - \addplot[pccplot,dashed,->] expression[domain=34.64:40,samples=50]{x/4*(1200-x^2)}; - \addplot[soldot] coordinates{(20,4000)}; - \end{axis} - \end{tikzpicture} - \caption{$y=V(x)$} - \label{poly:fig:opentoppedbox} - \end{figure} - - According to \cref{poly:fig:opentoppedbox}, the maximum volume of such a box is - approximately $\unit[4000]{cm^2}$, and we achieve it using a base of length - approximately $\unit[20]{cm}$. Since the base is square and each sheet of cardboard - is $\unit[1200]{cm^2}$, we conclude that the dimensions of each box are $\unit[20]{cm}\times\unit[20]{cm}\times\unit[30]{cm}$. - \end{pccsolution} - \end{pccexample} - - \subsection*{Complex zeros} - There has been a pattern to all of the examples that we have seen so far| - the degree of the polynomial has dictated the number of \emph{real} zeros that the - polynomial has. For example, the function $p$ in \cref{poly:ex:simplecubic} - has degree $3$, and $p$ has $3$ real zeros; the function $q$ in \cref{poly:ex:degree5} - has degree $5$ and $q$ has $5$ real zeros. - - You may wonder if this result can be generalized| does every polynomial that - has degree $n$ have $n$ real zeros? Before we tackle the general result, - let's consider an example that may help motivate it. - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{pccexample}\label{poly:ex:complx} - Consider the polynomial function $c$ that has formula - \[ - c(x)=x(x^2+1) - \] - It is clear that $c$ has degree $3$, and that $c$ has a (simple) zero at $0$. Does - $c$ have any other zeros, i.e, can we find any values of $x$ that satisfy the equation - \begin{equation}\label{poly:eq:complx} - x^2+1=0 - \end{equation} - The solutions to \cref{poly:eq:complx} are $\pm i$. - - We conclude that $c$ has $3$ zeros: $0$ and $\pm i$; we note that \emph{not - all of them are real}. - \end{pccexample} - \Cref{poly:ex:complx} shows that not every degree-$3$ polynomial has $3$ - \emph{real} zeros; however, if we are prepared to venture into the complex numbers, - then we can state the following theorem. - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{pccspecialcomment}[The fundamental theorem of algebra] - Every polynomial function of degree $n$ has $n$ roots, some of which may - be complex, and some may be repeated. - \end{pccspecialcomment} - \fixthis{Fundamental theorem of algebra: is this wording ok? do we want - it as a theorem?} - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{pccexample} - Find all the zeros of the polynomial function $p$ that has formula - \[ - p(x)=x^4-2x^3+5x^2 - \] - \begin{pccsolution} - We begin by factoring $p$ - \begin{align*} - p(x) & =x^4-2x^3+5x^2 \\ - & =x^2(x^2-2x+5) - \end{align*} - We note that $0$ is a zero of $p$ with multiplicity $2$. The other zeros of $p$ - can be found by solving the equation - \[ - x^2-2x+5=0 - \] - This equation can not be factored, so we use the quadratic formula - \begin{align*} - x & =\frac{2\pm\sqrt{(-2)^2}-20}{2(1)} \\ - & =\frac{2\pm\sqrt{-16}}{2} \\ - & =1\pm 2i - \end{align*} - We conclude that $p$ has $4$ zeros: $0$ (multiplicity $2$), and $1\pm 2i$ (simple). - \end{pccsolution} - \end{pccexample} - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{pccexample} - Find a polynomial that has zeros at $2\pm i\sqrt{2}$. - \begin{pccsolution} - We know that the zeros of a polynomial can be found by analyzing the linear - factors. We are given the zeros, and have to work backwards to find the - linear factors. - - We begin by assuming that $p$ has the form - \begin{align*} - p(x) & =(x-(2-i\sqrt{2}))(x-(2+i\sqrt{2})) \\ - & =x^2-x(2+i\sqrt{2})-x(2-i\sqrt{2})+(2-i\sqrt{2})(2+i\sqrt{2}) \\ - & =x^2-4x+(4-2i^2) \\ - & =x^2-4x+6 - \end{align*} - We conclude that a possible formula for a polynomial function, $p$, - that has zeros at $2\pm i\sqrt{2}$ is - \[ - p(x)=x^2-4x+6 - \] - Note that we could multiply $p$ by any real number and still ensure - that $p$ has the same zeros. - \end{pccsolution} - \end{pccexample} - \investigation*{} - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Find a formula from a graph] - For each of the polynomials in \cref{poly:fig:findformula} - \begin{enumerate} - \item count the number of times the curve turns round, and cuts/bounces off the $x$ axis; - \item approximate the degree of the polynomial; - \item use your information to find the linear factors of each polynomial, and therefore write a possible formula for each; - \item make sure your polynomial goes through the given ordered pair. - \end{enumerate} - \begin{shortsolution} - \Vref{poly:fig:findformdeg2}: - \begin{enumerate} - \item the curve turns round once; - \item the degree could be 2; - \item based on the zeros, the linear factors are $(x+5)$ and $(x-3)$; since the - graph opens downwards, we will assume the leading coefficient is negative: $p(x)=-k(x+5)(x-3)$; - \item $p$ goes through $(2,2)$, so we need to solve $2=-k(7)(-1)$ and therefore $k=\nicefrac{2}{7}$, so + \label{poly:fig:moremultiple} + \end{figure} + + \begin{pccdefinition}[Multiple zeros]\label{poly:def:multzero} + Let $p$ be a polynomial that has a repeated linear factor $(x-a)^n$. Then we say + that $p$ has a multiple zero at $a$ of multiplicity $n$ and + \begin{itemize} + \item if the factor $(x-a)$ is repeated an even number of times, the graph of $y=p(x)$ does not + cross the $x$ axis at $a$, but `bounces' off the horizontal axis at $a$. + \item if the factor $(x-a)$ is repeated an odd number of times, the graph of $y=p(x)$ crosses the + horizontal axis at $a$, but it looks `flattened' there + \end{itemize} + If $n=1$, then we say that $p$ has a \emph{simple} zero at $a$. + \end{pccdefinition} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Find a formula] + Find formulas for the polynomial functions, $p$ and $q$, graphed in \cref{poly:fig:findformulademoboth}. + \begin{figure}[!htb] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[framed, + xmin=-5,xmax=5, + ymin=-10,ymax=10, + xtick={-4,-2,...,4}, + minor xtick={-3,-1,...,3}, + ytick={-8,-6,...,8}, + width=\textwidth, + grid=both] + \addplot expression[domain=-3.25842:2.25842,samples=50]{-x*(x-2)*(x+3)*(x+1)}; + \addplot[soldot]coordinates{(1,8)}node[axisnode,inner sep=.35cm,anchor=west]{$(1,8)$}; + \addplot[soldot]coordinates{(-3,0)(-1,0)(0,0)(2,0)}; + \end{axis} + \end{tikzpicture} + \caption{$p$} + \label{poly:fig:findformulademo} + \end{subfigure} + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[framed, + xmin=-5,xmax=5, + ymin=-10,ymax=10, + xtick={-4,-2,...,4}, + minor xtick={-3,-1,...,3}, + ytick={-8,-6,...,8}, + width=\textwidth, + grid=both] + \addplot expression[domain=-4.33:4.08152]{-.25*(x+2)^2*(x-3)}; + \addplot[soldot]coordinates{(2,4)}node[axisnode,anchor=south west]{$(2,4)$}; + \addplot[soldot]coordinates{(-2,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$q$} + \label{poly:fig:findformulademo1} + \end{subfigure} + \caption{} + \label{poly:fig:findformulademoboth} + \end{figure} + \begin{pccsolution} + \begin{enumerate} + \item We begin by noting that the horizontal intercepts of $p$ are $(-3,0)$, $(-1,0)$, $(0,0)$ and $(2,0)$. + We also note that each zero is simple (multiplicity $1$). + If we assume that $p$ has no other zeros, then we can start by writing + \begin{align*} + p(x) & =(x+3)(x+1)(x-0)(x-2) \\ + & =x(x+3)(x+1)(x-2) \\ + \end{align*} + According to \cref{poly:fig:findformulademo}, the point $(1,8)$ lies + on the curve $y=p(x)$. + Let's check if the formula we have written satisfies this requirement + \begin{align*} + p(1) & = (1)(4)(2)(-1) \\ + & = -8 + \end{align*} + which is clearly not correct| it is close though. We can correct this by + multiplying $p$ by a constant $k$; so let's assume that + \[ + p(x)=kx(x+3)(x+1)(x-2) + \] + Then $p(1)=-8k$, and if this is to equal $8$, then $k=-1$. Therefore + the formula for $p(x)$ is + \[ + p(x)=-x(x+3)(x+1)(x-2) + \] + \item The function $q$ has a zero at $-2$ of multiplicity $2$, and zero of + multiplicity $1$ at $3$ (so $3$ is a simple zero of $q$); we can therefore assume that $q$ has the form + \[ + q(x)=k(x+2)^2(x-3) + \] + where $k$ is some real number. In order to find $k$, we use the given ordered pair, $(2,4)$, and + evaluate $p(2)$ + \begin{align*} + p(2) & =k(4)^2(-1) \\ + & =-16k + \end{align*} + We solve the equation $4=-8k$ and obtain $k=-\frac{1}{4}$ and conclude that the + formula for $q(x)$ is + \[ + q(x)=-\frac{1}{4}(x+2)^2(x-3) + \] + \end{enumerate} + \end{pccsolution} + \end{pccexample} + + + \fixthis{Chris: need sketching polynomial problems} + \begin{pccspecialcomment}[Steps to follow when sketching polynomial functions] + \begin{steps} + \item \label{poly:step:first} Determine the degree of the polynomial, + its leading term and leading coefficient, and hence determine + the long-run behavior of the polynomial| does it behave like $\pm x^2$ or $\pm x^3$ + as $x\rightarrow\pm\infty$? + \item Determine the zeros and their multiplicity. Mark all zeros + and the vertical intercept on the graph using solid circles $\bullet$. + \item \label{poly:step:last} Deduce the overall shape of the curve, and sketch it. If there isn't + enough information from the previous steps, then construct a table of values. + \end{steps} + Remember that until we have the tools of calculus, we won't be able to + find the exact coordinates of local minimums, local maximums, and points + of inflection. + \end{pccspecialcomment} + Before we demonstrate some examples, it is important to remember the following: + \begin{itemize} + \item our sketches will give a good representation of the overall + shape of the graph, but until we have the tools of calculus (from MTH 251) + we can not find local minimums, local maximums, and inflection points algebraically. This + means that we will make our best guess as to where these points are. + \item we will not concern ourselves too much with the vertical scale (because of + our previous point)| we will, however, mark the vertical intercept (assuming there is one), + and any horizontal asymptotes. + \end{itemize} + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{poly:ex:simplecubic} + Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $p$ + that has formula \[ - p(x)=-\frac{2}{7}(x+5)(x-3) + p(x)=\frac{1}{2}(x-4)(x-1)(x+3) \] - \end{enumerate} - \Vref{poly:fig:findformdeg3}: - \begin{enumerate} - \item the curve turns around twice; - \item the degree could be 3; - \item based on the zeros, the linear factors are $(x+2)^2$, and $(x-1)$; - based on the behavior of $p$, we assume that the leading coefficient is positive, and try $p(x)=k(x+2)^2(x-1)$; - \item $p$ goes through $(0,-2)$, so we need to solve $-2=k(4)(-1)$ and therefore $k=\nicefrac{1}{2}$, so + \begin{pccsolution} + \begin{steps} + \item $p$ has degree $3$. The leading term of $p$ is $\frac{1}{2}x^3$, so the leading coefficient of $p$ + is $\frac{1}{2}$. The long-run behavior of $p$ is therefore similar to that of $x^3$. + \item The zeros of $p$ are $-3$, $1$, and $4$; each zero is simple (i.e, it has multiplicity $1$). + This means that the curve of $p$ cuts the horizontal axis at each zero. The vertical + intercept of $p$ is $(0,6)$. + \item We draw the details we have obtained so far on \cref{poly:fig:simplecubicp1}. Given + that the curve of $p$ looks like the curve of $x^3$ in the long-run, we are able to complete a sketch of the + graph of $p$ in \cref{poly:fig:simplecubicp2}. + + Note that we can not find the coordinates of the local minimums, local maximums, and inflection + points| for the moment we make reasonable guesses as to where these points are (you'll find how + to do this in calculus). + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=15, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-3,0)(1,0)(4,0)(0,6)}node[axisnode,anchor=south west]{$(0,6)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:simplecubicp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=15, + xtick={-8,-6,...,8}, + ytick={-5,5}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-3,0)(1,0)(4,0)(0,6)}node[axisnode,anchor=south west]{$(0,6)$}; + \addplot[pccplot] expression[domain=-3.57675:4.95392,samples=100]{.5*(x-4)*(x-1)*(x+3)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:simplecubicp2} + \end{subfigure}% + \caption{$y=\dfrac{1}{2}(x-4)(x-1)(x+3)$} + \label{poly:fig:simplecubic} + \end{figure} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}\label{poly:ex:degree5} + Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $q$ + that has formula \[ - p(x)=\frac{1}{2}(x+2)^2(x-1) + q(x)=\frac{1}{200}(x+7)^2(2-x)(x-6)^2 \] - \end{enumerate} - \Vref{poly:fig:findformdeg5}: - \begin{enumerate} - \item the curve turns around 4 times; - \item the degree could be 5; - \item based on the zeros, the linear factors are $(x+5)^2$, $(x+1)$, $(x-2)$, $(x-3)$; - based on the behavior of $p$, we assume that the leading coefficient is positive, and try $p(x)=k(x+5)^2(x+1)(x-2)(x-3)$; - \item $p$ goes through $(-3,-50)$, so we need to solve $-50=k(64)(-2)(-5)(-6)$ and therefore $k=\nicefrac{5}{384}$, so + \begin{pccsolution} + \begin{steps} + \item $q$ has degree $4$. The leading term of $q$ is + \[ + -\frac{1}{200}x^5 + \] + so the leading coefficient of $q$ is $-\frac{1}{200}$. The long-run behavior of $q$ + is therefore similar to that of $-x^5$. + \item The zeros of $q$ are $-7$ (multiplicity 2), $2$ (simple), and $6$ (multiplicity $2$). + The curve of $q$ bounces off the horizontal axis at the zeros with multiplicity $2$ and + cuts the horizontal axis at the simple zeros. The vertical intercept of $q$ is $\left( 0,\frac{441}{25} \right)$. + \item We mark the details we have found so far on \cref{poly:fig:degree5p1}. Given that + the curve of $q$ looks like the curve of $-x^5$ in the long-run, we can complete \cref{poly:fig:degree5p2}. + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=40, + xtick={-8,-6,...,8}, + ytick={-5,0,...,35}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-7,0)(2,0)(6,0)(0,441/25)}node[axisnode,anchor=south west]{$\left( 0, \frac{441}{25} \right)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:degree5p1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=40, + xtick={-8,-6,...,8}, + ytick={-5,0,...,35}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-7,0)(2,0)(6,0)(0,441/25)}node[axisnode,anchor=south west]{$\left( 0, \frac{441}{25} \right)$}; + \addplot[pccplot] expression[domain=-8.83223:7.34784,samples=50]{1/200*(x+7)^2*(2-x)*(x-6)^2}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:degree5p2} + \end{subfigure}% + \caption{$y=\dfrac{1}{200}(x+7)^2(2-x)(x-6)^2$} + \label{poly:fig:degree5} + \end{figure} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample} + Use \crefrange{poly:step:first}{poly:step:last} to sketch a graph of the function $r$ + that has formula + \[ + r(x)=\frac{1}{100}x^3(x+4)(x-4)(x-6) + \] + \begin{pccsolution} + \begin{steps} + \item $r$ has degree $6$. The leading term of $r$ is + \[ + \frac{1}{100}x^6 + \] + so the leading coefficient of $r$ is $\frac{1}{100}$. The long-run behavior of $r$ + is therefore similar to that of $x^6$. + \item The zeros of $r$ are $-4$ (simple), $0$ (multiplicity $3$), $4$ (simple), + and $6$ (simple). The vertical intercept of $r$ is $(0,0)$. The curve of $r$ + cuts the horizontal axis at the simple zeros, and goes through the axis + at $(0,0)$, but does so in a flattened way. + \item We mark the zeros and vertical intercept on \cref{poly:fig:degree6p1}. Given that + the curve of $r$ looks like the curve of $x^6$ in the long-run, we complete the graph + of $r$ in \cref{poly:fig:degree6p2}. + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=10, + ymin=-20,ymax=10, + xtick={-4,-2,...,8}, + ytick={-15,-10,...,5}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-4,0)(0,0)(4,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:degree6p1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=10, + ymin=-20,ymax=10, + xtick={-4,-2,...,8}, + ytick={-15,-10,...,5}, + width=\textwidth, + ] + \addplot[soldot] coordinates{(-4,0)(0,0)(4,0)(6,0)}; + \addplot[pccplot] expression[domain=-4.16652:6.18911,samples=100]{1/100*(x+4)*x^3*(x-4)*(x-6)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:degree6p2} + \end{subfigure}% + \caption{$y=\dfrac{1}{100}(x+4)x^3(x-4)(x-6)$} + \end{figure} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[An open-topped box] + A cardboard company makes open-topped boxes for their clients. The specifications + dictate that the box must have a square base, and that it must be open-topped. + The company uses sheets of cardboard that are $\unit[1200]{cm^2}$. Assuming that + the base of each box has side $x$ (measured in cm), it can be shown that the volume of each box, $V(x)$, + has formula + \[ + V(x)=\frac{x}{4}(1200-x^2) + \] + Find the dimensions of the box that maximize the volume. + \begin{pccsolution} + We graph $y=V(x)$ in \cref{poly:fig:opentoppedbox}. Note that because + $x$ represents the length of a side, and $V(x)$ represents the volume + of the box, we necessarily require both values to be positive; we illustrate + the part of the curve that applies to this problem using a solid line. + + \begin{figure}[!htb] + \centering + \begin{tikzpicture} + \begin{axis}[framed, + xmin=-50,xmax=50, + ymin=-5000,ymax=5000, + xtick={-40,-30,...,40}, + minor xtick={-45,-35,...,45}, + minor ytick={-3000,-1000,1000,3000}, + width=.75\textwidth, + height=.5\textwidth, + grid=both] + \addplot[pccplot,dashed,<-] expression[domain=-40:0,samples=50]{x/4*(1200-x^2)}; + \addplot[pccplot,-] expression[domain=0:34.64,samples=50]{x/4*(1200-x^2)}; + \addplot[pccplot,dashed,->] expression[domain=34.64:40,samples=50]{x/4*(1200-x^2)}; + \addplot[soldot] coordinates{(20,4000)}; + \end{axis} + \end{tikzpicture} + \caption{$y=V(x)$} + \label{poly:fig:opentoppedbox} + \end{figure} + + According to \cref{poly:fig:opentoppedbox}, the maximum volume of such a box is + approximately $\unit[4000]{cm^2}$, and we achieve it using a base of length + approximately $\unit[20]{cm}$. Since the base is square and each sheet of cardboard + is $\unit[1200]{cm^2}$, we conclude that the dimensions of each box are $\unit[20]{cm}\times\unit[20]{cm}\times\unit[30]{cm}$. + \end{pccsolution} + \end{pccexample} + + \subsection*{Complex zeros} + There has been a pattern to all of the examples that we have seen so far| + the degree of the polynomial has dictated the number of \emph{real} zeros that the + polynomial has. For example, the function $p$ in \cref{poly:ex:simplecubic} + has degree $3$, and $p$ has $3$ real zeros; the function $q$ in \cref{poly:ex:degree5} + has degree $5$ and $q$ has $5$ real zeros. + + You may wonder if this result can be generalized| does every polynomial that + has degree $n$ have $n$ real zeros? Before we tackle the general result, + let's consider an example that may help motivate it. + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccexample}\label{poly:ex:complx} + Consider the polynomial function $c$ that has formula + \[ + c(x)=x(x^2+1) + \] + It is clear that $c$ has degree $3$, and that $c$ has a (simple) zero at $0$. Does + $c$ have any other zeros, i.e, can we find any values of $x$ that satisfy the equation + \begin{equation}\label{poly:eq:complx} + x^2+1=0 + \end{equation} + The solutions to \cref{poly:eq:complx} are $\pm i$. + + We conclude that $c$ has $3$ zeros: $0$ and $\pm i$; we note that \emph{not + all of them are real}. + \end{pccexample} + \Cref{poly:ex:complx} shows that not every degree-$3$ polynomial has $3$ + \emph{real} zeros; however, if we are prepared to venture into the complex numbers, + then we can state the following theorem. + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccspecialcomment}[The fundamental theorem of algebra] + Every polynomial function of degree $n$ has $n$ roots, some of which may + be complex, and some may be repeated. + \end{pccspecialcomment} + \fixthis{Fundamental theorem of algebra: is this wording ok? do we want + it as a theorem?} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccexample} + Find all the zeros of the polynomial function $p$ that has formula \[ - p(x)=\frac{5}{384}(x+5)^2(x+1)(x-2)(x-3) + p(x)=x^4-2x^3+5x^2 \] + \begin{pccsolution} + We begin by factoring $p$ + \begin{align*} + p(x) & =x^4-2x^3+5x^2 \\ + & =x^2(x^2-2x+5) + \end{align*} + We note that $0$ is a zero of $p$ with multiplicity $2$. The other zeros of $p$ + can be found by solving the equation + \[ + x^2-2x+5=0 + \] + This equation can not be factored, so we use the quadratic formula + \begin{align*} + x & =\frac{2\pm\sqrt{(-2)^2}-20}{2(1)} \\ + & =\frac{2\pm\sqrt{-16}}{2} \\ + & =1\pm 2i + \end{align*} + We conclude that $p$ has $4$ zeros: $0$ (multiplicity $2$), and $1\pm 2i$ (simple). + \end{pccsolution} + \end{pccexample} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{pccexample} + Find a polynomial that has zeros at $2\pm i\sqrt{2}$. + \begin{pccsolution} + We know that the zeros of a polynomial can be found by analyzing the linear + factors. We are given the zeros, and have to work backwards to find the + linear factors. + + We begin by assuming that $p$ has the form + \begin{align*} + p(x) & =(x-(2-i\sqrt{2}))(x-(2+i\sqrt{2})) \\ + & =x^2-x(2+i\sqrt{2})-x(2-i\sqrt{2})+(2-i\sqrt{2})(2+i\sqrt{2}) \\ + & =x^2-4x+(4-2i^2) \\ + & =x^2-4x+6 + \end{align*} + We conclude that a possible formula for a polynomial function, $p$, + that has zeros at $2\pm i\sqrt{2}$ is + \[ + p(x)=x^2-4x+6 + \] + Note that we could multiply $p$ by any real number and still ensure + that $p$ has the same zeros. + \end{pccsolution} + \end{pccexample} + \investigation*{} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a graph] + For each of the polynomials in \cref{poly:fig:findformula} + \begin{enumerate} + \item count the number of times the curve turns round, and cuts/bounces off the $x$ axis; + \item approximate the degree of the polynomial; + \item use your information to find the linear factors of each polynomial, and therefore write a possible formula for each; + \item make sure your polynomial goes through the given ordered pair. \end{enumerate} - \end{shortsolution} - \end{problem} - - - \begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-2,ymax=5, - width=\textwidth, - ] - \addplot expression[domain=-4.5:3.75]{-1/3*(x+4)*(x-3)}; - \addplot[soldot] coordinates{(-4,0)(3,0)(2,2)} node[axisnode,above right]{$(2,2)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:findformdeg2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-3,xmax=2, - ymin=-2,ymax=4, - xtick={-2,...,1}, - width=\textwidth, - ] - \addplot expression[domain=-2.95:1.75]{1/3*(x+2)^2*(x-1)}; - \addplot[soldot]coordinates{(-2,0)(1,0)(0,-1.33)}node[axisnode,anchor=north west]{$(0,-2)$}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:findformdeg3} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-100,ymax=150, - width=\textwidth, - ] - \addplot expression[domain=-4.5:3.4,samples=50]{(x+4)^2*(x+1)*(x-2)*(x-3)}; - \addplot[soldot]coordinates{(-4,0)(-1,0)(2,0)(3,0)(-3,-60)}node[axisnode,anchor=north]{$(-3,-50)$}; - \end{axis} - \end{tikzpicture} + \begin{shortsolution} + \Vref{poly:fig:findformdeg2}: + \begin{enumerate} + \item the curve turns round once; + \item the degree could be 2; + \item based on the zeros, the linear factors are $(x+5)$ and $(x-3)$; since the + graph opens downwards, we will assume the leading coefficient is negative: $p(x)=-k(x+5)(x-3)$; + \item $p$ goes through $(2,2)$, so we need to solve $2=-k(7)(-1)$ and therefore $k=\nicefrac{2}{7}$, so + \[ + p(x)=-\frac{2}{7}(x+5)(x-3) + \] + \end{enumerate} + \Vref{poly:fig:findformdeg3}: + \begin{enumerate} + \item the curve turns around twice; + \item the degree could be 3; + \item based on the zeros, the linear factors are $(x+2)^2$, and $(x-1)$; + based on the behavior of $p$, we assume that the leading coefficient is positive, and try $p(x)=k(x+2)^2(x-1)$; + \item $p$ goes through $(0,-2)$, so we need to solve $-2=k(4)(-1)$ and therefore $k=\nicefrac{1}{2}$, so + \[ + p(x)=\frac{1}{2}(x+2)^2(x-1) + \] + \end{enumerate} + \Vref{poly:fig:findformdeg5}: + \begin{enumerate} + \item the curve turns around 4 times; + \item the degree could be 5; + \item based on the zeros, the linear factors are $(x+5)^2$, $(x+1)$, $(x-2)$, $(x-3)$; + based on the behavior of $p$, we assume that the leading coefficient is positive, and try $p(x)=k(x+5)^2(x+1)(x-2)(x-3)$; + \item $p$ goes through $(-3,-50)$, so we need to solve $-50=k(64)(-2)(-5)(-6)$ and therefore $k=\nicefrac{5}{384}$, so + \[ + p(x)=\frac{5}{384}(x+5)^2(x+1)(x-2)(x-3) + \] + \end{enumerate} + \end{shortsolution} + \end{problem} + + + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-2,ymax=5, + width=\textwidth, + ] + \addplot expression[domain=-4.5:3.75]{-1/3*(x+4)*(x-3)}; + \addplot[soldot] coordinates{(-4,0)(3,0)(2,2)} node[axisnode,above right]{$(2,2)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:findformdeg2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-3,xmax=2, + ymin=-2,ymax=4, + xtick={-2,...,1}, + width=\textwidth, + ] + \addplot expression[domain=-2.95:1.75]{1/3*(x+2)^2*(x-1)}; + \addplot[soldot]coordinates{(-2,0)(1,0)(0,-1.33)}node[axisnode,anchor=north west]{$(0,-2)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:findformdeg3} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-100,ymax=150, + width=\textwidth, + ] + \addplot expression[domain=-4.5:3.4,samples=50]{(x+4)^2*(x+1)*(x-2)*(x-3)}; + \addplot[soldot]coordinates{(-4,0)(-1,0)(2,0)(3,0)(-3,-60)}node[axisnode,anchor=north]{$(-3,-50)$}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:findformdeg5} + \end{subfigure} \caption{} - \label{poly:fig:findformdeg5} - \end{subfigure} - \caption{} - \label{poly:fig:findformula} - \end{figure} - - - - - \begin{exercises} - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{problem}[Prerequisite classifacation skills] - Decide if each of the following functions are linear or quadratic. - \begin{multicols}{3} - \begin{subproblem} - $f(x)=2x+3$ - \begin{shortsolution} - $f$ is linear. - \end{shortsolution} - \end{subproblem} + \label{poly:fig:findformula} + \end{figure} + + + + + \begin{exercises} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Prerequisite classifacation skills] + Decide if each of the following functions are linear or quadratic. + \begin{multicols}{3} + \begin{subproblem} + $f(x)=2x+3$ + \begin{shortsolution} + $f$ is linear. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $g(x)=10-7x$ + \begin{shortsolution} + $g$ is linear + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $h(x)=-x^2+3x-9$ + \begin{shortsolution} + $h$ is quadratic. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $k(x)=-17$ + \begin{shortsolution} + $k$ is linear. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $l(x)=-82x^2-4$ + \begin{shortsolution} + $l$ is quadratic + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $m(x)=6^2x-8$ + \begin{shortsolution} + $m$ is linear. + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Prerequisite slope identification] + State the slope of each of the following linear functions, and + hence decide if each function is increasing or decreasing. + \begin{multicols}{4} + \begin{subproblem} + $\alpha(x)=4x+1$ + \begin{shortsolution} + $m=4$; $\alpha$ is increasing. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\beta(x)=-9x$ + \begin{shortsolution} + $m=-9$; $\beta$ is decreasing. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\gamma(t)=18t+100$ + \begin{shortsolution} + $m=18$; $\gamma$ is increasing. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\delta(y)=23-y$ + \begin{shortsolution} + $m=-1$; $\delta$ is decreasing. + \end{shortsolution} + \end{subproblem} + \end{multicols} + Now let's generalize our findings for the most general linear function $f$ + that has formula $f(x)=mx+b$. Complete the following sentences. \begin{subproblem} - $g(x)=10-7x$ + When $m>0$, the function $f$ is $\ldots$ \begin{shortsolution} - $g$ is linear + When $m>0$, the function $f$ is $\ldots$ \emph{increasing}. \end{shortsolution} \end{subproblem} \begin{subproblem} - $h(x)=-x^2+3x-9$ + When $m<0$, the function $f$ is $\ldots$ \begin{shortsolution} - $h$ is quadratic. + When $m<0$, the function $f$ is $\ldots$ \emph{decreasing}. \end{shortsolution} \end{subproblem} + \end{problem} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Polynomial or not?] + Identify whether each of the following functions is a polynomial or not. + If the function is a polynomial, state its degree. + \begin{multicols}{3} + \begin{subproblem} + $p(x)=2x+1$ + \begin{shortsolution} + $p$ is a polynomial (you might also describe $p$ as linear). The degree of $p$ is 1. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=7x^2+4x$ + \begin{shortsolution} + $p$ is a polynomial (you might also describe $p$ as quadratic). The degree of $p$ is 2. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=\sqrt{x}+2x+1$ + \begin{shortsolution} + $p$ is not a polynomial; we require the powers of $x$ to be integer values. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=2^x-45$ + \begin{shortsolution} + $p$ is not a polynomial; the $2^x$ term is exponential. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=6x^4-5x^3+9$ + \begin{shortsolution} + $p$ is a polynomial, and the degree of $p$ is $6$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=-5x^{17}+9x+2$ + \begin{shortsolution} + $p$ is a polynomial, and the degree of $p$ is 17. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=4x(x+7)^2(x-3)^3$ + \begin{shortsolution} + $p$ is a polynomial, and the degree of $p$ is $6$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=4x^{-5}-x^2+x$ + \begin{shortsolution} + $p$ is not a polynomial because $-5$ is not a positive integer. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=-x^6(x^2+1)(x^3-2)$ + \begin{shortsolution} + $p$ is a polynomial, and the degree of $p$ is $11$. + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Polynomial graphs] + Three polynomial functions $p$, $m$, and $n$ are shown in \crefrange{poly:fig:functionp}{poly:fig:functionn}. + The functions have the following formulas + \begin{align*} + p(x) & = (x-1)(x+2)(x-3) \\ + m(x) & = -(x-1)(x+2)(x-3) \\ + n(x) & = (x-1)(x+2)(x-3)(x+1)(x+4) + \end{align*} + Note that for our present purposes we are not concerned with the vertical scale of the graphs. \begin{subproblem} - $k(x)=-17$ + Identify both on the graph {\em and} algebraically, the zeros of each polynomial. \begin{shortsolution} - $k$ is linear. + $y=p(x)$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-2.5:3.5,samples=50]{(x-1)*(x+2)*(x-3)}; + \addplot[soldot] coordinates{(-2,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + + $y=m(x)$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-10,ymax=10, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-2.5:3.5,samples=50]{-1*(x-1)*(x+2)*(x-3)}; + \addplot[soldot] coordinates{(-2,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + + $y=n(x)$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-90,ymax=70, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-4.15:3.15,samples=50]{(x-1)*(x+2)*(x-3)*(x+1)*(x+4)}; + \addplot[soldot] coordinates{(-4,0)(-2,0)(-1,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + + The zeros of $p$ are $-2$, $1$, and $3$; the zeros of $m$ are $-2$, $1$, and $3$; the zeros of $n$ are + $-4$, $-2$, $-1$, and $3$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $l(x)=-82x^2-4$ + Write down the degree, how many times the curve of each function `turns around', + and how many zeros it has \begin{shortsolution} - $l$ is quadratic + \begin{itemize} + \item The degree of $p$ is 3, and the curve $y=p(x)$ turns around twice. + \item The degree of $q$ is also 3, and the curve $y=q(x)$ turns around twice. + \item The degree of $n$ is $5$, and the curve $y=n(x)$ turns around 4 times. + \end{itemize} \end{shortsolution} \end{subproblem} + \end{problem} + + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-10,ymax=10, + ytick={-5,5}, + width=\textwidth, + ] + \addplot expression[domain=-2.5:3.5,samples=50]{(x-1)*(x+2)*(x-3)}; + \addplot[soldot]coordinates{(-2,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=p(x)$} + \label{poly:fig:functionp} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-10,ymax=10, + ytick={-5,5}, + width=\textwidth, + ] + \addplot expression[domain=-2.5:3.5,samples=50]{-1*(x-1)*(x+2)*(x-3)}; + \addplot[soldot]coordinates{(-2,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=m(x)$} + \label{poly:fig:functionm} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-5,xmax=5, + ymin=-90,ymax=70, + width=\textwidth, + ] + \addplot expression[domain=-4.15:3.15,samples=100]{(x-1)*(x+2)*(x-3)*(x+1)*(x+4)}; + \addplot[soldot]coordinates{(-4,0)(-2,0)(-1,0)(1,0)(3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=n(x)$} + \label{poly:fig:functionn} + \end{subfigure} + \caption{} + \end{widepage} + \end{figure} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Horizontal intercepts]\label{poly:prob:matchpolys}% + State the horizontal intercepts (as ordered pairs) of the following polynomials. + \begin{multicols}{2} + \begin{subproblem}\label{poly:prob:degree5} + $p(x)=(x-1)(x+2)(x-3)(x+1)(x+4)$ + \begin{shortsolution} + $(-4,0)$, $(-2,0)$, $(-1,0)$, $(1,0)$, $(3,0)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $q(x)=-(x-1)(x+2)(x-3)$ + \begin{shortsolution} + $(-2,0)$, $(1,0)$, $(3,0)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(x)=(x-1)(x+2)(x-3)$ + \begin{shortsolution} + $(-2,0)$, $(1,0)$, $(3,0)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem}\label{poly:prob:degree2} + $s(x)=(x-2)(x+2)$ + \begin{shortsolution} + $(-2,0)$, $(2,0)$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Minimums, maximums, and concavity]\label{poly:prob:incdec} + Four polynomial functions are graphed in \cref{poly:fig:incdec}. The formulas + for these functions are (not respectively) + \begin{gather*} + p(x)=\frac{x^3}{6}-\frac{x^2}{4}-3x, \qquad q(x)=\frac{x^4}{20}+\frac{x^3}{15}-\frac{6}{5}x^2+1\\ + r(x)=-\frac{x^5}{50}-\frac{x^4}{40}+\frac{2x^3}{5}+6, \qquad s(x)=-\frac{x^6}{6000}-\frac{x^5}{2500}+\frac{67x^4}{4000}+\frac{17x^3}{750}-\frac{42x^2}{125} + \end{gather*} + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{.23\textwidth} + \centering + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + width=\textwidth, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=major, + ] + \addplot expression[domain=-5.28:4.68,samples=50]{-x^5/50-x^4/40+2*x^3/5+6}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:incdec3} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + width=\textwidth, + xmin=-10,xmax=10,ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=major, + ] + \addplot expression[domain=-6.08:4.967,samples=50]{x^4/20+x^3/15-6/5*x^2+1}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:incdec2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + width=\textwidth, + xmin=-6,xmax=8,ymin=-10,ymax=10, + xtick={-4,-2,...,6}, + ytick={-8,-4,4,8}, + minor ytick={-6,-2,...,6}, + grid=both, + ] + \addplot expression[domain=-4.818:6.081,samples=50]{x^3/6-x^2/4-3*x}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:incdec1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + width=\textwidth, + xmin=-10,xmax=10,ymin=-10,ymax=10, + xtick={-8,-4,4,8}, + ytick={-8,-4,4,8}, + minor xtick={-6,-2,...,6}, + minor ytick={-6,-2,...,6}, + grid=both, + ] + \addplot expression[domain=-9.77:8.866,samples=50]{-x^6/6000-x^5/2500+67*x^4/4000+17/750*x^3-42/125*x^2}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:incdec4} + \end{subfigure} + \caption{Graphs for \cref{poly:prob:incdec}.} + \label{poly:fig:incdec} + \end{widepage} + \end{figure} \begin{subproblem} - $m(x)=6^2x-8$ + Match each of the formulas with one of the given graphs. \begin{shortsolution} - $m$ is linear. + \begin{itemize} + \item $p$ is graphed in \vref{poly:fig:incdec1}; + \item $q$ is graphed in \vref{poly:fig:incdec2}; + \item $r$ is graphed in \vref{poly:fig:incdec3}; + \item $s$ is graphed in \vref{poly:fig:incdec4}. + \end{itemize} \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{problem}[Prerequisite slope identification] - State the slope of each of the following linear functions, and - hence decide if each function is increasing or decreasing. - \begin{multicols}{4} \begin{subproblem} - $\alpha(x)=4x+1$ + Approximate the zeros of each function using the appropriate graph. \begin{shortsolution} - $m=4$; $\alpha$ is increasing. + \begin{itemize} + \item $p$ has simple zeros at about $-3.8$, $0$, and $5$. + \item $q$ has simple zeros at about $-5.9$, $-1$, $1$, and $4$. + \item $r$ has simple zeros at about $-5$, $-2.9$, and $4.1$. + \item $s$ has simple zeros at about $-9$, $-6$, $4.2$, $8.1$, and a zero of multiplicity $2$ at $0$. + \end{itemize} \end{shortsolution} \end{subproblem} \begin{subproblem} - $\beta(x)=-9x$ + Approximate the local maximums and minimums of each of the functions. \begin{shortsolution} - $m=-9$; $\beta$ is decreasing. + \begin{itemize} + \item $p$ has a local maximum of approximately $3.9$ at $-2$, and a local minimum of approximately $-6.5$ at $3$. + \item $q$ has a local minimum of approximately $-10$ at $-4$, and $-4$ at $3$; $q$ has a local maximum of approximately $1$ at $0$. + \item $r$ has a local minimum of approximately $-5.5$ at $-4$, and a local maximum of approximately $10$ at $3$. + \item $s$ has a local maximum of approximately $5$ at $-8$, $0$ at $0$, and $5$ at $7$; $s$ has local minimums + of approximately $-3$ at $-4$, and $-1$ at $3$. + \end{itemize} \end{shortsolution} \end{subproblem} \begin{subproblem} - $\gamma(t)=18t+100$ + Approximate the global maximums and minimums of each of the functions. \begin{shortsolution} - $m=18$; $\gamma$ is increasing. + \begin{itemize} + \item $p$ does not have a global maximum, nor a global minimum. + \item $q$ has a global minimum of approximately $-10$; it does not have a global maximum. + \item $r$ does not have a global maximum, nor a global minimum. + \item $s$ has a global maximum of approximately $5$; it does not have a global minimum. + \end{itemize} \end{shortsolution} \end{subproblem} \begin{subproblem} - $\delta(y)=23-y$ + Approximate the intervals on which each function is increasing and decreasing. \begin{shortsolution} - $m=-1$; $\delta$ is decreasing. + \begin{itemize} + \item $p$ is increasing on $(-\infty,-2)\cup (3,\infty)$, and decreasing on $(-2,3)$. + \item $q$ is increasing on $(-4,0)\cup (3,\infty)$, and decreasing on $(-\infty,-4)\cup (0,3)$. + \item $r$ is increasing on $(-4,3)$, and decreasing on $(-\infty,-4)\cup (3,\infty)$. + \item $s$ is increasing on $(-\infty,-8)\cup (-4,0)\cup (3,5)$, and decreasing on $(-8,-4)\cup (0,3)\cup (5,\infty)$. + \end{itemize} \end{shortsolution} \end{subproblem} - \end{multicols} - Now let's generalize our findings for the most general linear function $f$ - that has formula $f(x)=mx+b$. Complete the following sentences. - \begin{subproblem} - When $m>0$, the function $f$ is $\ldots$ - \begin{shortsolution} - When $m>0$, the function $f$ is $\ldots$ \emph{increasing}. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - When $m<0$, the function $f$ is $\ldots$ - \begin{shortsolution} - When $m<0$, the function $f$ is $\ldots$ \emph{decreasing}. - \end{shortsolution} - \end{subproblem} - \end{problem} - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Polynomial or not?] - Identify whether each of the following functions is a polynomial or not. - If the function is a polynomial, state its degree. - \begin{multicols}{3} \begin{subproblem} - $p(x)=2x+1$ + Approximate the intervals on which each function is concave up and concave down. \begin{shortsolution} - $p$ is a polynomial (you might also describe $p$ as linear). The degree of $p$ is 1. + \begin{itemize} + \item $p$ is concave up on $(1,\infty)$, and concave down on $(-\infty,1)$. + \item $q$ is concave up on $(-\infty,-1)\cup (1,\infty)$, and concave down on $(-1,1)$. + \item $r$ is concave up on $(-\infty,-3)\cup (0,2)$, and concave down on $(-3,0)\cup (2,\infty)$. + \item $s$ is concave up on $(-6,-2)\cup (2,5)$, and concave down on $(-\infty,-6)\cup (-2,2)\cup (5,\infty)$. + \end{itemize} \end{shortsolution} \end{subproblem} \begin{subproblem} - $p(x)=7x^2+4x$ + The degree of $q$ is $5$. Assuming that all of the real zeros of $q$ are + shown in its graph, how many complex zeros does $q$ have? \begin{shortsolution} - $p$ is a polynomial (you might also describe $p$ as quadratic). The degree of $p$ is 2. + \Vref{poly:fig:incdec2} shows that $q$ has $3$ real zeros + since the curve of $q$ cuts the horizontal axis $3$ times. + Since $q$ has degree $5$, $q$ must have $2$ complex zeros. \end{shortsolution} \end{subproblem} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Long-run behaviour of polynomials] + Describe the long-run behavior of each of polynomial functions in + \crefrange{poly:prob:degree5}{poly:prob:degree2}. + \begin{shortsolution} + $\dd\lim_{x\rightarrow-\infty}p(x)=-\infty$, + $\dd\lim_{x\rightarrow\infty}p(x)=\infty$, + $\dd\lim_{x\rightarrow-\infty}q(x)=\infty$, + $\dd\lim_{x\rightarrow\infty}q(x)=-\infty$, + $\dd\lim_{x\rightarrow-\infty}r(x)=-\infty$, + $\dd\lim_{x\rightarrow\infty}r(x)=\infty$, + $\dd\lim_{x\rightarrow-\infty}s(x)=\infty$, + $\dd\lim_{x\rightarrow\infty}s(x)=\infty$, + \end{shortsolution} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[True of false?] + Let $p$ be a polynomial function. + Label each of the following statements as true (T) or false (F); if they are false, + provide an example that supports your answer. \begin{subproblem} - $p(x)=\sqrt{x}+2x+1$ + If $p$ has degree $3$, then $p$ has $3$ distinct zeros. \begin{shortsolution} - $p$ is not a polynomial; we require the powers of $x$ to be integer values. + False. Consider $p(x)=x^2(x+1)$ which has only 2 distinct zeros. \end{shortsolution} \end{subproblem} \begin{subproblem} - $p(x)=2^x-45$ + If $p$ has degree $4$, then $\dd\lim_{x\rightarrow-\infty}p(x)=\infty$ and $\dd\lim_{x\rightarrow\infty}p(x)=\infty$. \begin{shortsolution} - $p$ is not a polynomial; the $2^x$ term is exponential. + False. Consider $p(x)=-x^4$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $p(x)=6x^4-5x^3+9$ + If $p$ has even degree, then it is possible that $p$ can have no real zeros. \begin{shortsolution} - $p$ is a polynomial, and the degree of $p$ is $6$. + True. \end{shortsolution} \end{subproblem} \begin{subproblem} - $p(x)=-5x^{17}+9x+2$ + If $p$ has odd degree, then it is possible that $p$ can have no real zeros. \begin{shortsolution} - $p$ is a polynomial, and the degree of $p$ is 17. + False. All odd degree polynomials will cut the horizontal axis at least once. \end{shortsolution} \end{subproblem} + \end{problem} + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a description] + In each of the following problems, give a possible formula for a polynomial + function that has the specified properties. \begin{subproblem} - $p(x)=4x(x+7)^2(x-3)^3$ + Degree 2 and has zeros at $4$ and $5$. \begin{shortsolution} - $p$ is a polynomial, and the degree of $p$ is $6$. + Possible option: $p(x)=(x-4)(x-5)$. Note we could multiply $p$ by any real number, and still meet the requirements. \end{shortsolution} \end{subproblem} \begin{subproblem} - $p(x)=4x^{-5}-x^2+x$ + Degree 3 and has zeros at $4$,$5$ and $-3$. \begin{shortsolution} - $p$ is not a polynomial because $-5$ is not a positive integer. + Possible option: $p(x)=(x-4)(x-5)(x+3)$. Note we could multiply $p$ by any real number, and still meet the requirements. \end{shortsolution} \end{subproblem} \begin{subproblem} - $p(x)=-x^6(x^2+1)(x^3-2)$ - \begin{shortsolution} - $p$ is a polynomial, and the degree of $p$ is $11$. - \end{shortsolution} - \end{subproblem} - \end{multicols} - \end{problem} - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Polynomial graphs] - Three polynomial functions $p$, $m$, and $n$ are shown in \crefrange{poly:fig:functionp}{poly:fig:functionn}. - The functions have the following formulas - \begin{align*} - p(x) & = (x-1)(x+2)(x-3) \\ - m(x) & = -(x-1)(x+2)(x-3) \\ - n(x) & = (x-1)(x+2)(x-3)(x+1)(x+4) - \end{align*} - Note that for our present purposes we are not concerned with the vertical scale of the graphs. - \begin{subproblem} - Identify both on the graph {\em and} algebraically, the zeros of each polynomial. - \begin{shortsolution} - $y=p(x)$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-2.5:3.5,samples=50]{(x-1)*(x+2)*(x-3)}; - \addplot[soldot] coordinates{(-2,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - - $y=m(x)$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-10,ymax=10, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-2.5:3.5,samples=50]{-1*(x-1)*(x+2)*(x-3)}; - \addplot[soldot] coordinates{(-2,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - - $y=n(x)$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-90,ymax=70, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-4.15:3.15,samples=50]{(x-1)*(x+2)*(x-3)*(x+1)*(x+4)}; - \addplot[soldot] coordinates{(-4,0)(-2,0)(-1,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - - The zeros of $p$ are $-2$, $1$, and $3$; the zeros of $m$ are $-2$, $1$, and $3$; the zeros of $n$ are - $-4$, $-2$, $-1$, and $3$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Write down the degree, how many times the curve of each function `turns around', - and how many zeros it has - \begin{shortsolution} - \begin{itemize} - \item The degree of $p$ is 3, and the curve $y=p(x)$ turns around twice. - \item The degree of $q$ is also 3, and the curve $y=q(x)$ turns around twice. - \item The degree of $n$ is $5$, and the curve $y=n(x)$ turns around 4 times. - \end{itemize} - \end{shortsolution} - \end{subproblem} - \end{problem} - - \begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-10,ymax=10, - ytick={-5,5}, - width=\textwidth, - ] - \addplot expression[domain=-2.5:3.5,samples=50]{(x-1)*(x+2)*(x-3)}; - \addplot[soldot]coordinates{(-2,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=p(x)$} - \label{poly:fig:functionp} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-10,ymax=10, - ytick={-5,5}, - width=\textwidth, - ] - \addplot expression[domain=-2.5:3.5,samples=50]{-1*(x-1)*(x+2)*(x-3)}; - \addplot[soldot]coordinates{(-2,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=m(x)$} - \label{poly:fig:functionm} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-5,xmax=5, - ymin=-90,ymax=70, - width=\textwidth, - ] - \addplot expression[domain=-4.15:3.15,samples=100]{(x-1)*(x+2)*(x-3)*(x+1)*(x+4)}; - \addplot[soldot]coordinates{(-4,0)(-2,0)(-1,0)(1,0)(3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=n(x)$} - \label{poly:fig:functionn} - \end{subfigure} - \caption{} - \end{widepage} - \end{figure} - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Horizontal intercepts]\label{poly:prob:matchpolys}% - State the horizontal intercepts (as ordered pairs) of the following polynomials. - \begin{multicols}{2} - \begin{subproblem}\label{poly:prob:degree5} - $p(x)=(x-1)(x+2)(x-3)(x+1)(x+4)$ + Degree 4 and has zeros at $0$, $4$, $5$, $-3$. \begin{shortsolution} - $(-4,0)$, $(-2,0)$, $(-1,0)$, $(1,0)$, $(3,0)$ + Possible option: $p(x)=x(x-4)(x-5)(x+3)$. Note we could multiply $p$ by any real number, and still meet the requirements. \end{shortsolution} \end{subproblem} \begin{subproblem} - $q(x)=-(x-1)(x+2)(x-3)$ + Degree 4, with zeros that make the graph cut at $2$, $-5$, and a zero that makes the graph touch at $-2$; \begin{shortsolution} - $(-2,0)$, $(1,0)$, $(3,0)$ + Possible option: $p(x)=(x-2)(x+5)(x+2)^2$. Note we could multiply $p$ by any real number, and still meet the requirements. \end{shortsolution} \end{subproblem} \begin{subproblem} - $r(x)=(x-1)(x+2)(x-3)$ + Degree 3, with only one zero at $-1$. \begin{shortsolution} - $(-2,0)$, $(1,0)$, $(3,0)$ + Possible option: $p(x)=(x+1)^3$. Note we could multiply $p$ by any real number, and still meet the requirements. \end{shortsolution} \end{subproblem} - \begin{subproblem}\label{poly:prob:degree2} - $s(x)=(x-2)(x+2)$ - \begin{shortsolution} - $(-2,0)$, $(2,0)$ - \end{shortsolution} - \end{subproblem} - \end{multicols} - \end{problem} - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{problem}[Minimums, maximums, and concavity]\label{poly:prob:incdec} - Four polynomial functions are graphed in \cref{poly:fig:incdec}. The formulas - for these functions are (not respectively) - \begin{gather*} - p(x)=\frac{x^3}{6}-\frac{x^2}{4}-3x, \qquad q(x)=\frac{x^4}{20}+\frac{x^3}{15}-\frac{6}{5}x^2+1\\ - r(x)=-\frac{x^5}{50}-\frac{x^4}{40}+\frac{2x^3}{5}+6, \qquad s(x)=-\frac{x^6}{6000}-\frac{x^5}{2500}+\frac{67x^4}{4000}+\frac{17x^3}{750}-\frac{42x^2}{125} - \end{gather*} - \begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{.23\textwidth} - \centering - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - width=\textwidth, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=major, - ] - \addplot expression[domain=-5.28:4.68,samples=50]{-x^5/50-x^4/40+2*x^3/5+6}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:incdec3} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - width=\textwidth, - xmin=-10,xmax=10,ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=major, - ] - \addplot expression[domain=-6.08:4.967,samples=50]{x^4/20+x^3/15-6/5*x^2+1}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:incdec2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - width=\textwidth, - xmin=-6,xmax=8,ymin=-10,ymax=10, - xtick={-4,-2,...,6}, - ytick={-8,-4,4,8}, - minor ytick={-6,-2,...,6}, - grid=both, - ] - \addplot expression[domain=-4.818:6.081,samples=50]{x^3/6-x^2/4-3*x}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:incdec1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - width=\textwidth, - xmin=-10,xmax=10,ymin=-10,ymax=10, - xtick={-8,-4,4,8}, - ytick={-8,-4,4,8}, - minor xtick={-6,-2,...,6}, - minor ytick={-6,-2,...,6}, - grid=both, - ] - \addplot expression[domain=-9.77:8.866,samples=50]{-x^6/6000-x^5/2500+67*x^4/4000+17/750*x^3-42/125*x^2}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:incdec4} - \end{subfigure} - \caption{Graphs for \cref{poly:prob:incdec}.} - \label{poly:fig:incdec} - \end{widepage} - \end{figure} - \begin{subproblem} - Match each of the formulas with one of the given graphs. - \begin{shortsolution} - \begin{itemize} - \item $p$ is graphed in \vref{poly:fig:incdec1}; - \item $q$ is graphed in \vref{poly:fig:incdec2}; - \item $r$ is graphed in \vref{poly:fig:incdec3}; - \item $s$ is graphed in \vref{poly:fig:incdec4}. - \end{itemize} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Approximate the zeros of each function using the appropriate graph. - \begin{shortsolution} - \begin{itemize} - \item $p$ has simple zeros at about $-3.8$, $0$, and $5$. - \item $q$ has simple zeros at about $-5.9$, $-1$, $1$, and $4$. - \item $r$ has simple zeros at about $-5$, $-2.9$, and $4.1$. - \item $s$ has simple zeros at about $-9$, $-6$, $4.2$, $8.1$, and a zero of multiplicity $2$ at $0$. - \end{itemize} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Approximate the local maximums and minimums of each of the functions. - \begin{shortsolution} - \begin{itemize} - \item $p$ has a local maximum of approximately $3.9$ at $-2$, and a local minimum of approximately $-6.5$ at $3$. - \item $q$ has a local minimum of approximately $-10$ at $-4$, and $-4$ at $3$; $q$ has a local maximum of approximately $1$ at $0$. - \item $r$ has a local minimum of approximately $-5.5$ at $-4$, and a local maximum of approximately $10$ at $3$. - \item $s$ has a local maximum of approximately $5$ at $-8$, $0$ at $0$, and $5$ at $7$; $s$ has local minimums - of approximately $-3$ at $-4$, and $-1$ at $3$. - \end{itemize} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Approximate the global maximums and minimums of each of the functions. - \begin{shortsolution} - \begin{itemize} - \item $p$ does not have a global maximum, nor a global minimum. - \item $q$ has a global minimum of approximately $-10$; it does not have a global maximum. - \item $r$ does not have a global maximum, nor a global minimum. - \item $s$ has a global maximum of approximately $5$; it does not have a global minimum. - \end{itemize} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Approximate the intervals on which each function is increasing and decreasing. - \begin{shortsolution} - \begin{itemize} - \item $p$ is increasing on $(-\infty,-2)\cup (3,\infty)$, and decreasing on $(-2,3)$. - \item $q$ is increasing on $(-4,0)\cup (3,\infty)$, and decreasing on $(-\infty,-4)\cup (0,3)$. - \item $r$ is increasing on $(-4,3)$, and decreasing on $(-\infty,-4)\cup (3,\infty)$. - \item $s$ is increasing on $(-\infty,-8)\cup (-4,0)\cup (3,5)$, and decreasing on $(-8,-4)\cup (0,3)\cup (5,\infty)$. - \end{itemize} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Approximate the intervals on which each function is concave up and concave down. - \begin{shortsolution} - \begin{itemize} - \item $p$ is concave up on $(1,\infty)$, and concave down on $(-\infty,1)$. - \item $q$ is concave up on $(-\infty,-1)\cup (1,\infty)$, and concave down on $(-1,1)$. - \item $r$ is concave up on $(-\infty,-3)\cup (0,2)$, and concave down on $(-3,0)\cup (2,\infty)$. - \item $s$ is concave up on $(-6,-2)\cup (2,5)$, and concave down on $(-\infty,-6)\cup (-2,2)\cup (5,\infty)$. - \end{itemize} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - The degree of $q$ is $5$. Assuming that all of the real zeros of $q$ are - shown in its graph, how many complex zeros does $q$ have? - \begin{shortsolution} - \Vref{poly:fig:incdec2} shows that $q$ has $3$ real zeros - since the curve of $q$ cuts the horizontal axis $3$ times. - Since $q$ has degree $5$, $q$ must have $2$ complex zeros. - \end{shortsolution} - \end{subproblem} - \end{problem} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Long-run behaviour of polynomials] - Describe the long-run behavior of each of polynomial functions in - \crefrange{poly:prob:degree5}{poly:prob:degree2}. - \begin{shortsolution} - $\dd\lim_{x\rightarrow-\infty}p(x)=-\infty$, - $\dd\lim_{x\rightarrow\infty}p(x)=\infty$, - $\dd\lim_{x\rightarrow-\infty}q(x)=\infty$, - $\dd\lim_{x\rightarrow\infty}q(x)=-\infty$, - $\dd\lim_{x\rightarrow-\infty}r(x)=-\infty$, - $\dd\lim_{x\rightarrow\infty}r(x)=\infty$, - $\dd\lim_{x\rightarrow-\infty}s(x)=\infty$, - $\dd\lim_{x\rightarrow\infty}s(x)=\infty$, - \end{shortsolution} - \end{problem} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[True of false?] - Let $p$ be a polynomial function. - Label each of the following statements as true (T) or false (F); if they are false, - provide an example that supports your answer. - \begin{subproblem} - If $p$ has degree $3$, then $p$ has $3$ distinct zeros. - \begin{shortsolution} - False. Consider $p(x)=x^2(x+1)$ which has only 2 distinct zeros. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - If $p$ has degree $4$, then $\dd\lim_{x\rightarrow-\infty}p(x)=\infty$ and $\dd\lim_{x\rightarrow\infty}p(x)=\infty$. - \begin{shortsolution} - False. Consider $p(x)=-x^4$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - If $p$ has even degree, then it is possible that $p$ can have no real zeros. - \begin{shortsolution} - True. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - If $p$ has odd degree, then it is possible that $p$ can have no real zeros. - \begin{shortsolution} - False. All odd degree polynomials will cut the horizontal axis at least once. - \end{shortsolution} - \end{subproblem} - \end{problem} - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Find a formula from a description] - In each of the following problems, give a possible formula for a polynomial - function that has the specified properties. - \begin{subproblem} - Degree 2 and has zeros at $4$ and $5$. - \begin{shortsolution} - Possible option: $p(x)=(x-4)(x-5)$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Degree 3 and has zeros at $4$,$5$ and $-3$. - \begin{shortsolution} - Possible option: $p(x)=(x-4)(x-5)(x+3)$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Degree 4 and has zeros at $0$, $4$, $5$, $-3$. - \begin{shortsolution} - Possible option: $p(x)=x(x-4)(x-5)(x+3)$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Degree 4, with zeros that make the graph cut at $2$, $-5$, and a zero that makes the graph touch at $-2$; - \begin{shortsolution} - Possible option: $p(x)=(x-2)(x+5)(x+2)^2$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Degree 3, with only one zero at $-1$. - \begin{shortsolution} - Possible option: $p(x)=(x+1)^3$. Note we could multiply $p$ by any real number, and still meet the requirements. - \end{shortsolution} - \end{subproblem} - \end{problem} - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{problem}[\Cref{poly:step:last}] - \pccname{Saheed} is graphing a polynomial function, $p$. - He is following \crefrange{poly:step:first}{poly:step:last} and has so far - marked the zeros of $p$ on \cref{poly:fig:optionsp1}. Saheed tells you that - $p$ has degree $3$, but does \emph{not} say if the leading coefficient - of $p$ is positive or negative. - \begin{figure}[!htbp] - \begin{widepage} - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\textwidth, - height=.5\textwidth, - ] - \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{poly:fig:optionsp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\textwidth, - height=.5\textwidth, - ] - \addplot[soldot] coordinates{(-5,0)(6,0)}; - \end{axis} - \end{tikzpicture} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[\Cref{poly:step:last}] + \pccname{Saheed} is graphing a polynomial function, $p$. + He is following \crefrange{poly:step:first}{poly:step:last} and has so far + marked the zeros of $p$ on \cref{poly:fig:optionsp1}. Saheed tells you that + $p$ has degree $3$, but does \emph{not} say if the leading coefficient + of $p$ is positive or negative. + \begin{figure}[!htbp] + \begin{widepage} + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\textwidth, + height=.5\textwidth, + ] + \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:optionsp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\textwidth, + height=.5\textwidth, + ] + \addplot[soldot] coordinates{(-5,0)(6,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{poly:fig:optionsp2} + \end{subfigure}% \caption{} - \label{poly:fig:optionsp2} - \end{subfigure}% - \caption{} - \end{widepage} - \end{figure} - \begin{subproblem} - Use the information in \cref{poly:fig:optionsp1} to help sketch $p$, assuming that the leading coefficient - is positive. - \begin{shortsolution} - Assuming that $a_3>0$: - - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-6.78179:8.35598,samples=50]{1/20*(x+5)*(x-2)*(x-6)}; - \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Use the information in \cref{poly:fig:optionsp1} to help sketch $p$, assuming that the leading coefficient - is negative. - \begin{shortsolution} - Assuming that $a_3<0$: - - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-6.78179:8.35598,samples=50]{-1/20*(x+5)*(x-2)*(x-6)}; - \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - Saheed now turns his attention to another polynomial function, $q$. He finds - the zeros of $q$ (there are only $2$) and marks them on \cref{poly:fig:optionsp2}. - Saheed knows that $q$ has degree $3$, but doesn't know if the leading - coefficient is positive or negative. - \begin{subproblem} - Use the information in \cref{poly:fig:optionsp2} to help sketch $q$, assuming that the leading - coefficient of $q$ is positive. Hint: only one of the zeros is simple. - \begin{shortsolution} - Assuming that $a_4>0$ there are $2$ different options: - - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-8.68983:7.31809,samples=50]{1/20*(x+5)^2*(x-6)}; - \addplot expression[domain=-6.31809:9.68893,samples=50]{1/20*(x+5)*(x-6)^2}; - \addplot[soldot] coordinates{(-5,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Use the information in \cref{poly:fig:optionsp2} to help sketch $q$, assuming that the leading - coefficient of $q$ is negative. - \begin{shortsolution} - Assuming that $a_4<0$ there are $2$ different options: - - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-15}, - width=\solutionfigurewidth, - ] - \addplot expression[domain=-8.68983:7.31809,samples=50]{-1/20*(x+5)^2*(x-6)}; - \addplot expression[domain=-6.31809:9.68893,samples=50]{-1/20*(x+5)*(x-6)^2}; - \addplot[soldot] coordinates{(-5,0)(6,0)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \end{problem} - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{problem}[Zeros] - Find all zeros of each of the following polynomial functions, making - sure to detail their multiplicity. Note that - you may need to use factoring, or the quadratic formula, or both! Also note - that some zeros may be repeated, and some may be complex. - \begin{multicols}{3} - \begin{subproblem} - $p(x)=x^2+1$ - \begin{shortsolution} - $\pm i$ (simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $q(y)=(y^2-9)(y^2-7)$ - \begin{shortsolution} - $\pm 3$, $\pm \sqrt{7}$ (all are simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $r(z)=-4z^3(z^2+3)(z^2+64)$ - \begin{shortsolution} - $0$ (multiplicity $3$), $\pm\sqrt{3}$ (simple), $\pm\sqrt{8}$ (simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $a(x)=x^4-81$ - \begin{shortsolution} - $\pm 3$, $\pm 3i$ (all are simple). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $b(y)=y^3-8$ - \begin{shortsolution} - $2$, $-1\pm i\sqrt{3}$ (all are simple). - \end{shortsolution} - \end{subproblem} + \end{widepage} + \end{figure} \begin{subproblem} - $c(m)=m^3-m^2$ + Use the information in \cref{poly:fig:optionsp1} to help sketch $p$, assuming that the leading coefficient + is positive. \begin{shortsolution} - $0$ (multiplicity $2$), $1$ (simple). + Assuming that $a_3>0$: + + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-6.78179:8.35598,samples=50]{1/20*(x+5)*(x-2)*(x-6)}; + \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; + \end{axis} + \end{tikzpicture} \end{shortsolution} \end{subproblem} \begin{subproblem} - $h(n)=(n+1)(n^2+4)$ + Use the information in \cref{poly:fig:optionsp1} to help sketch $p$, assuming that the leading coefficient + is negative. \begin{shortsolution} - $-1$, $\pm 2i$ (all are simple). + Assuming that $a_3<0$: + + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-6.78179:8.35598,samples=50]{-1/20*(x+5)*(x-2)*(x-6)}; + \addplot[soldot] coordinates{(-5,0)(2,0)(6,0)}; + \end{axis} + \end{tikzpicture} \end{shortsolution} \end{subproblem} + Saheed now turns his attention to another polynomial function, $q$. He finds + the zeros of $q$ (there are only $2$) and marks them on \cref{poly:fig:optionsp2}. + Saheed knows that $q$ has degree $3$, but doesn't know if the leading + coefficient is positive or negative. \begin{subproblem} - $f(\alpha)=(\alpha^2-16)(\alpha^2-5\alpha+4)$ + Use the information in \cref{poly:fig:optionsp2} to help sketch $q$, assuming that the leading + coefficient of $q$ is positive. Hint: only one of the zeros is simple. \begin{shortsolution} - $-4$ (simple), $4$ (multiplicity $2$), $1$ (simple). + Assuming that $a_4>0$ there are $2$ different options: + + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-8.68983:7.31809,samples=50]{1/20*(x+5)^2*(x-6)}; + \addplot expression[domain=-6.31809:9.68893,samples=50]{1/20*(x+5)*(x-6)^2}; + \addplot[soldot] coordinates{(-5,0)(6,0)}; + \end{axis} + \end{tikzpicture} \end{shortsolution} \end{subproblem} \begin{subproblem} - $g(\beta)=(\beta^2-25)(\beta^2-5\beta-4)$ + Use the information in \cref{poly:fig:optionsp2} to help sketch $q$, assuming that the leading + coefficient of $q$ is negative. \begin{shortsolution} - $\pm 5$, $\dfrac{5\pm\sqrt{41}}{2}$ (all are simple). + Assuming that $a_4<0$ there are $2$ different options: + + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-15}, + width=\solutionfigurewidth, + ] + \addplot expression[domain=-8.68983:7.31809,samples=50]{-1/20*(x+5)^2*(x-6)}; + \addplot expression[domain=-6.31809:9.68893,samples=50]{-1/20*(x+5)*(x-6)^2}; + \addplot[soldot] coordinates{(-5,0)(6,0)}; + \end{axis} + \end{tikzpicture} \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{problem}[Given zeros, find a formula] - In each of the following problems you are given the zeros of a polynomial. - Write a possible formula for each polynomial| you may leave your - answer in factored form, but it may not contain complex numbers. Unless - otherwise stated, assume that the zeros are simple. - \begin{multicols}{3} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[Zeros] + Find all zeros of each of the following polynomial functions, making + sure to detail their multiplicity. Note that + you may need to use factoring, or the quadratic formula, or both! Also note + that some zeros may be repeated, and some may be complex. + \begin{multicols}{3} + \begin{subproblem} + $p(x)=x^2+1$ + \begin{shortsolution} + $\pm i$ (simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $q(y)=(y^2-9)(y^2-7)$ + \begin{shortsolution} + $\pm 3$, $\pm \sqrt{7}$ (all are simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(z)=-4z^3(z^2+3)(z^2+64)$ + \begin{shortsolution} + $0$ (multiplicity $3$), $\pm\sqrt{3}$ (simple), $\pm\sqrt{8}$ (simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $a(x)=x^4-81$ + \begin{shortsolution} + $\pm 3$, $\pm 3i$ (all are simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $b(y)=y^3-8$ + \begin{shortsolution} + $2$, $-1\pm i\sqrt{3}$ (all are simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $c(m)=m^3-m^2$ + \begin{shortsolution} + $0$ (multiplicity $2$), $1$ (simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $h(n)=(n+1)(n^2+4)$ + \begin{shortsolution} + $-1$, $\pm 2i$ (all are simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $f(\alpha)=(\alpha^2-16)(\alpha^2-5\alpha+4)$ + \begin{shortsolution} + $-4$ (simple), $4$ (multiplicity $2$), $1$ (simple). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $g(\beta)=(\beta^2-25)(\beta^2-5\beta-4)$ + \begin{shortsolution} + $\pm 5$, $\dfrac{5\pm\sqrt{41}}{2}$ (all are simple). + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[Given zeros, find a formula] + In each of the following problems you are given the zeros of a polynomial. + Write a possible formula for each polynomial| you may leave your + answer in factored form, but it may not contain complex numbers. Unless + otherwise stated, assume that the zeros are simple. + \begin{multicols}{3} + \begin{subproblem} + $1$, $2$ + \begin{shortsolution} + $p(x)=(x-1)(x-2)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $0$, $5$, $13$ + \begin{shortsolution} + $p(x)=x(x-5)(x-13)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $-7$, $2$ (multiplicity $3$), $5$ + \begin{shortsolution} + $p(x)=(x+7)(x-2)^3(x-5)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $0$, $\pm i$ + \begin{shortsolution} + $p(x)=x(x^2+1)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\pm 2i$, $\pm 7$ + \begin{shortsolution} + $p(x)=(x^2+4)(x^2-49)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $-2\pm i\sqrt{6}$ + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[Composition of polynomials] + Let $p$ and $q$ be polynomial functions that have formulas + \[ + p(x)=(x+1)(x+2)(x+5), \qquad q(x)=3-x^4 + \] + Evaluate each of the following. + \begin{multicols}{4} + \begin{subproblem} + $(p\circ q)(0)$ + \begin{shortsolution} + $160$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(q\circ p)(0)$ + \begin{shortsolution} + $-9997$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(p\circ q)(1)$ + \begin{shortsolution} + $84$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(p\circ p)(0)$ + \begin{shortsolution} + $1980$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: June 2012 + %=================================== + \begin{problem}[Piecewise polynomial functions] + Let $P$ be the piecewise-defined function with formula + \[ + P(x)=\begin{cases} + (1-x)(2x+5)(x^2+1), & x\leq -3\\ + 4-x^2, & -3<x < 4\\ + x^3 & x\geq 4 + \end{cases} + \] + Evaluate each of the following + \begin{multicols}{5} + \begin{subproblem} + $P(-4)$ + \begin{shortsolution} + $-255$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $P(0)$ + \begin{shortsolution} + $4$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $P(4)$ + \begin{shortsolution} + $64$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $P(-3)$ + \begin{shortsolution} + $-40$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(P\circ P)(0)$ + \begin{shortsolution} + $64$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: July 2012 + %=================================== + \begin{problem}[Function algebra] + Let $p$ and $q$ be the polynomial functions that have formulas + \[ + p(x)=x(x+1)(x-3)^2, \qquad q(x)=7-x^2 + \] + Evaluate each of the following (if possible). + \begin{multicols}{4} + \begin{subproblem} + $(p+q)(1)$ + \begin{shortsolution} + $14$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(p-q)(0)$ + \begin{shortsolution} + $7$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(p\cdot q)(\sqrt{7})$ + \begin{shortsolution} + $0$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\left( \frac{q}{p} \right)(1)$ + \begin{shortsolution} + $\frac{3}{4}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} \begin{subproblem} - $1$, $2$ + What is the domain of the function $\frac{q}{p}$? \begin{shortsolution} - $p(x)=(x-1)(x-2)$ + $(-\infty,-1)\cup (-1,0)\cup (0,3)\cup (3,\infty)$ \end{shortsolution} \end{subproblem} + \end{problem} + + %=================================== + % Author: Hughes + % Date: July 2012 + %=================================== + \begin{problem}[Transformations: given the transformation, find the formula] + Let $p$ be the polynomial function that has formula. + \[ + p(x)=4x(x^2-1)(x+3) + \] + In each of the following + problems apply the given transformation to the function $p$ and + write a formula for the transformed version of $p$. + \begin{multicols}{2} + \begin{subproblem} + Shift $p$ to the right by $5$ units. + \begin{shortsolution} + $p(x-5)=4(x-5)(x-2)(x^2-10x+24)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $p$ to the left by $6$ units. + \begin{shortsolution} + $p(x+6)=4(x+6)(x+9)(x^2+12x+35)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $p$ up by $12$ units. + \begin{shortsolution} + $p(x)+12=4x(x^2-1)(x+3)+12$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $p$ down by $2$ units. + \begin{shortsolution} + $p(x)-2=4x(x^2-1)(x+3)-2$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Reflect $p$ over the horizontal axis. + \begin{shortsolution} + $-p(x)=-4x(x^2-1)(x+3)$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Reflect $p$ over the vertical axis. + \begin{shortsolution} + $p(-x)=-4x(x^2-1)(3-x)$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a table]\label{poly:prob:findformula} + \Crefrange{poly:tab:findformulap}{poly:tab:findformulas} show values of polynomial functions, $p$, $q$, + $r$, and $s$. + + \begin{table}[!htb] + \centering + \begin{widepage} + \caption{Tables for \cref{poly:prob:findformula}} + \label{poly:tab:findformula} + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=p(x)$} + \label{poly:tab:findformulap} + \begin{tabular}{rr} + \beforeheading + \heading{$x$} & \heading{$y$} \\ + \afterheading + $-4$ & $-56$ \\\normalline + $-3$ & $-18$ \\\normalline + $-2$ & $0$ \\\normalline + $-1$ & $4$ \\\normalline + $0$ & $0$ \\\normalline + $1$ & $-6$ \\\normalline + $2$ & $-8$ \\\normalline + $3$ & $0$ \\\normalline + $4$ & $24$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=q(x)$} + \label{poly:tab:findformulaq} + \begin{tabular}{rr} + \beforeheading + \heading{$x$} & \heading{$y$} \\ \afterheading + $-4$ & $-16$ \\\normalline + $-3$ & $-3$ \\\normalline + $-2$ & $0$ \\\normalline + $-1$ & $-1$ \\\normalline + $0$ & $0$ \\\normalline + $1$ & $9$ \\\normalline + $2$ & $32$ \\\normalline + $3$ & $75$ \\\normalline + $4$ & $144$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=r(x)$} + \label{poly:tab:findformular} + \begin{tabular}{rr} + \beforeheading + \heading{$x$} & \heading{$y$} \\ \afterheading + $-4$ & $105$ \\\normalline + $-3$ & $0$ \\\normalline + $-2$ & $-15$ \\\normalline + $-1$ & $0$ \\\normalline + $0$ & $9$ \\\normalline + $1$ & $0$ \\\normalline + $2$ & $-15$ \\\normalline + $3$ & $0$ \\\normalline + $4$ & $105$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=s(x)$} + \label{poly:tab:findformulas} + \begin{tabular}{rr} + \beforeheading + \heading{$x$} & \heading{$y$} \\ \afterheading + $-4$ & $75$ \\\normalline + $-3$ & $0$ \\\normalline + $-2$ & $-9$ \\\normalline + $-1$ & $0$ \\\normalline + $0$ & $3$ \\\normalline + $1$ & $0$ \\\normalline + $2$ & $15$ \\\normalline + $3$ & $96$ \\\normalline + $4$ & $760$ \\\lastline + \end{tabular} + \end{subtable} + \end{widepage} + \end{table} + \begin{subproblem} - $0$, $5$, $13$ + Assuming that all of the zeros of $p$ are shown (in \cref{poly:tab:findformulap}), how many zeros does $p$ have? \begin{shortsolution} - $p(x)=x(x-5)(x-13)$ + $p$ has 3 zeros. \end{shortsolution} \end{subproblem} \begin{subproblem} - $-7$, $2$ (multiplicity $3$), $5$ + What is the degree of $p$? \begin{shortsolution} - $p(x)=(x+7)(x-2)^3(x-5)$ + $p$ is degree 3. \end{shortsolution} \end{subproblem} \begin{subproblem} - $0$, $\pm i$ + Write a formula for $p(x)$. \begin{shortsolution} - $p(x)=x(x^2+1)$ + $p(x)=x(x+2)(x-3)$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $\pm 2i$, $\pm 7$ + Assuming that all of the zeros of $q$ are shown (in \cref{poly:tab:findformulaq}), how many zeros does $q$ have? \begin{shortsolution} - $p(x)=(x^2+4)(x^2-49)$ + $q$ has 2 zeros. \end{shortsolution} \end{subproblem} \begin{subproblem} - $-2\pm i\sqrt{6}$ - \end{subproblem} - \end{multicols} - \end{problem} - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{problem}[Composition of polynomials] - Let $p$ and $q$ be polynomial functions that have formulas - \[ - p(x)=(x+1)(x+2)(x+5), \qquad q(x)=3-x^4 - \] - Evaluate each of the following. - \begin{multicols}{4} - \begin{subproblem} - $(p\circ q)(0)$ + Describe the difference in behavior of $p$ and $q$ at $-2$. \begin{shortsolution} - $160$ + $p$ changes sign at $-2$, and $q$ does not change sign at $-2$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $(q\circ p)(0)$ + Given that $q$ is a degree-$3$ polynomial, write a formula for $q(x)$. \begin{shortsolution} - $-9997$ + $q(x)=x(x+2)^2$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $(p\circ q)(1)$ + Assuming that all of the zeros of $r$ are shown (in \cref{poly:tab:findformular}), find a formula for $r(x)$. \begin{shortsolution} - $84$ + $r(x)=(x+3)(x+1)(x-1)(x-3)$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $(p\circ p)(0)$ + Assuming that all of the zeros of $s$ are shown (in \cref{poly:tab:findformulas}), find a formula for $s(x)$. \begin{shortsolution} - $1980$ + $s(x)=(x+3)(x+1)(x-1)^2$ \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - %=================================== - % Author: Hughes - % Date: June 2012 - %=================================== - \begin{problem}[Piecewise polynomial functions] - Let $P$ be the piecewise-defined function with formula - \[ - P(x)=\begin{cases} - (1-x)(2x+5)(x^2+1), & x\leq -3\\ - 4-x^2, & -3<x < 4\\ - x^3 & x\geq 4 - \end{cases} -\] -Evaluate each of the following -\begin{multicols}{5} - \begin{subproblem} - $P(-4)$ - \begin{shortsolution} - $-255$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $P(0)$ - \begin{shortsolution} - $4$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $P(4)$ - \begin{shortsolution} - $64$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $P(-3)$ - \begin{shortsolution} - $-40$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(P\circ P)(0)$ - \begin{shortsolution} - $64$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - -%=================================== -% Author: Hughes -% Date: July 2012 -%=================================== -\begin{problem}[Function algebra] -Let $p$ and $q$ be the polynomial functions that have formulas -\[ - p(x)=x(x+1)(x-3)^2, \qquad q(x)=7-x^2 -\] -Evaluate each of the following (if possible). -\begin{multicols}{4} - \begin{subproblem} - $(p+q)(1)$ - \begin{shortsolution} - $14$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(p-q)(0)$ - \begin{shortsolution} - $7$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(p\cdot q)(\sqrt{7})$ - \begin{shortsolution} - $0$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $\left( \frac{q}{p} \right)(1)$ - \begin{shortsolution} - $\frac{3}{4}$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\begin{subproblem} - What is the domain of the function $\frac{q}{p}$? - \begin{shortsolution} - $(-\infty,-1)\cup (-1,0)\cup (0,3)\cup (3,\infty)$ - \end{shortsolution} -\end{subproblem} -\end{problem} - -%=================================== -% Author: Hughes -% Date: July 2012 -%=================================== -\begin{problem}[Transformations: given the transformation, find the formula] -Let $p$ be the polynomial function that has formula. -\[ - p(x)=4x(x^2-1)(x+3) -\] -In each of the following -problems apply the given transformation to the function $p$ and -write a formula for the transformed version of $p$. -\begin{multicols}{2} - \begin{subproblem} - Shift $p$ to the right by $5$ units. - \begin{shortsolution} - $p(x-5)=4(x-5)(x-2)(x^2-10x+24)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $p$ to the left by $6$ units. - \begin{shortsolution} - $p(x+6)=4(x+6)(x+9)(x^2+12x+35)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $p$ up by $12$ units. - \begin{shortsolution} - $p(x)+12=4x(x^2-1)(x+3)+12$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Shift $p$ down by $2$ units. - \begin{shortsolution} - $p(x)-2=4x(x^2-1)(x+3)-2$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Reflect $p$ over the horizontal axis. - \begin{shortsolution} - $-p(x)=-4x(x^2-1)(x+3)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Reflect $p$ over the vertical axis. - \begin{shortsolution} - $p(-x)=-4x(x^2-1)(3-x)$ - \end{shortsolution} - \end{subproblem} -\end{multicols} -\end{problem} - -%=================================== -% Author: Hughes -% Date: May 2011 -%=================================== -\begin{problem}[Find a formula from a table]\label{poly:prob:findformula} -\Crefrange{poly:tab:findformulap}{poly:tab:findformulas} show values of polynomial functions, $p$, $q$, -$r$, and $s$. - -\begin{table}[!htb] - \centering - \begin{widepage} - \caption{Tables for \cref{poly:prob:findformula}} - \label{poly:tab:findformula} - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=p(x)$} - \label{poly:tab:findformulap} - \begin{tabular}{rr} - \beforeheading - \heading{$x$} & \heading{$y$} \\ - \afterheading - $-4$ & $-56$ \\\normalline - $-3$ & $-18$ \\\normalline - $-2$ & $0$ \\\normalline - $-1$ & $4$ \\\normalline - $0$ & $0$ \\\normalline - $1$ & $-6$ \\\normalline - $2$ & $-8$ \\\normalline - $3$ & $0$ \\\normalline - $4$ & $24$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=q(x)$} - \label{poly:tab:findformulaq} - \begin{tabular}{rr} - \beforeheading - \heading{$x$} & \heading{$y$} \\ \afterheading - $-4$ & $-16$ \\\normalline - $-3$ & $-3$ \\\normalline - $-2$ & $0$ \\\normalline - $-1$ & $-1$ \\\normalline - $0$ & $0$ \\\normalline - $1$ & $9$ \\\normalline - $2$ & $32$ \\\normalline - $3$ & $75$ \\\normalline - $4$ & $144$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=r(x)$} - \label{poly:tab:findformular} - \begin{tabular}{rr} - \beforeheading - \heading{$x$} & \heading{$y$} \\ \afterheading - $-4$ & $105$ \\\normalline - $-3$ & $0$ \\\normalline - $-2$ & $-15$ \\\normalline - $-1$ & $0$ \\\normalline - $0$ & $9$ \\\normalline - $1$ & $0$ \\\normalline - $2$ & $-15$ \\\normalline - $3$ & $0$ \\\normalline - $4$ & $105$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=s(x)$} - \label{poly:tab:findformulas} - \begin{tabular}{rr} - \beforeheading - \heading{$x$} & \heading{$y$} \\ \afterheading - $-4$ & $75$ \\\normalline - $-3$ & $0$ \\\normalline - $-2$ & $-9$ \\\normalline - $-1$ & $0$ \\\normalline - $0$ & $3$ \\\normalline - $1$ & $0$ \\\normalline - $2$ & $15$ \\\normalline - $3$ & $96$ \\\normalline - $4$ & $760$ \\\lastline - \end{tabular} - \end{subtable} - \end{widepage} -\end{table} - -\begin{subproblem} - Assuming that all of the zeros of $p$ are shown (in \cref{poly:tab:findformulap}), how many zeros does $p$ have? - \begin{shortsolution} - $p$ has 3 zeros. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - What is the degree of $p$? - \begin{shortsolution} - $p$ is degree 3. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Write a formula for $p(x)$. - \begin{shortsolution} - $p(x)=x(x+2)(x-3)$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Assuming that all of the zeros of $q$ are shown (in \cref{poly:tab:findformulaq}), how many zeros does $q$ have? - \begin{shortsolution} - $q$ has 2 zeros. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Describe the difference in behavior of $p$ and $q$ at $-2$. - \begin{shortsolution} - $p$ changes sign at $-2$, and $q$ does not change sign at $-2$. - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Given that $q$ is a degree-$3$ polynomial, write a formula for $q(x)$. - \begin{shortsolution} - $q(x)=x(x+2)^2$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Assuming that all of the zeros of $r$ are shown (in \cref{poly:tab:findformular}), find a formula for $r(x)$. - \begin{shortsolution} - $r(x)=(x+3)(x+1)(x-1)(x-3)$ - \end{shortsolution} -\end{subproblem} -\begin{subproblem} - Assuming that all of the zeros of $s$ are shown (in \cref{poly:tab:findformulas}), find a formula for $s(x)$. - \begin{shortsolution} - $s(x)=(x+3)(x+1)(x-1)^2$ - \end{shortsolution} -\end{subproblem} -\end{problem} -\end{exercises} - + \end{problem} + \end{exercises} + \section{Rational functions} \subsection*{Power functions with negative exponents} - The study of rational functions will rely upon a good knowledge - of power functions with negative exponents. \Cref{rat:ex:oddpow,rat:ex:evenpow} are - simple but fundamental to understanding the behavior of rational functions. - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample}[Power functions with odd negative exponents]\label{rat:ex:oddpow} - Graph each of the following functions on your calculator, state their domain in interval notation, and their - behavior as $x\rightarrow 0^-$ and $x\rightarrow 0^+$. - \[ - f(x)=\frac{1}{x},\qquad g(x)=\dfrac{1}{x^3},\qquad h(x)=\dfrac{1}{x^5} - \] - \begin{pccsolution} - The functions $f$, $g$, and $k$ are plotted in \cref{rat:fig:oddpow}. - The domain of each of the functions $f$, $g$, and $h$ is $(-\infty,0)\cup (0,\infty)$. Note that - the long-run behavior of each of the functions is the same, and in particular - \begin{align*} - f(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} f(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty - \end{align*} - The same results hold for $g$ and $h$. Note also that each of the functions - has a \emph{vertical asymptote} at $0$. We see that - \begin{align*} - f(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^- \\ - \mathllap{\text{and }} f(x)\rightarrow \infty & \text{ as } x\rightarrow 0^+ - \end{align*} - The same results hold for $g$ and $h$. - - The curve of a function that has a vertical asymptote is necessarily separated - into \emph{branches}| each of the functions $f$, $g$, and $h$ have $2$ branches. - \end{pccsolution} - \end{pccexample} - - \begin{figure}[!htb] - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-3,xmax=3, - ymin=-5,ymax=5, - xtick={-2,-1,...,2}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\textwidth, - legend pos=north west, - ] - \addplot expression[domain=-3:-0.2]{1/x}; - \addplot expression[domain=-3:-0.584]{1/x^3}; - \addplot expression[domain=-3:-0.724]{1/x^5}; - \addplot expression[domain=0.2:3]{1/x}; - \addplot expression[domain=0.584:3]{1/x^3}; - \addplot expression[domain=0.724:3]{1/x^5}; - \addplot[soldot]coordinates{(-1,-1)}node[axisnode,anchor=north east]{$(-1,-1)$}; - \addplot[soldot]coordinates{(1,1)}node[axisnode,anchor=south west]{$(1,1)$}; - \legend{$f$,$g$,$h$} - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:oddpow} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-3,xmax=3, - ymin=-5,ymax=5, - xtick={-2,-1,...,2}, - minor ytick={-3,-1,...,3}, - grid=both, - width=\textwidth, - legend pos=south east, - ] - \addplot expression[domain=-3:-0.447]{1/x^2}; - \addplot expression[domain=-3:-0.668]{1/x^4}; - \addplot expression[domain=-3:-0.764]{1/x^6}; - \addplot expression[domain=0.447:3]{1/x^2}; - \addplot expression[domain=0.668:3]{1/x^4}; - \addplot expression[domain=0.764:3]{1/x^6}; - \addplot[soldot]coordinates{(-1,1)}node[axisnode,anchor=south east]{$(-1,1)$}; - \addplot[soldot]coordinates{(1,1)}node[axisnode,anchor=south west]{$(1,1)$}; - \legend{$F$,$G$,$H$} - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:evenpow} - \end{minipage}% - \end{figure} - - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample}[Power functions with even negative exponents]\label{rat:ex:evenpow}% - Graph each of the following functions, state their domain, and their - behavior as $x\rightarrow 0^-$ and $x\rightarrow 0^+$. - \[ - f(x)=\frac{1}{x^2},\qquad g(x)=\frac{1}{x^4},\qquad h(x)=\frac{1}{x^6} - \] - \begin{pccsolution} - The functions $F$, $G$, and $H$ are plotted in \cref{rat:fig:evenpow}. - The domain of each of the functions $F$, $G$, and $H$ is $(-\infty,0)\cup (0,\infty)$. Note that - the long-run behavior of each of the functions is the same, and in particular - \begin{align*} - F(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} f(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty - \end{align*} - As in \cref{rat:ex:oddpow}, $F$ has a horizontal asymptote that - has equation $y=0$. - The same results hold for $G$ and $H$. Note also that each of the functions - has a \emph{vertical asymptote} at $0$. We see that - \begin{align*} - F(x)\rightarrow \infty & \text{ as } x\rightarrow 0^- \\ - \mathllap{\text{and }} F(x)\rightarrow \infty & \text{ as } x\rightarrow 0^+ - \end{align*} - The same results hold for $G$ and $H$. Each of the functions $F$, $G$, and $H$ - have $2$ branches. - \end{pccsolution} - \end{pccexample} - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{doyouunderstand} - \begin{problem} - Repeat \cref{rat:ex:oddpow,rat:ex:evenpow} using (respectively) - \begin{subproblem} - $k(x)=-\dfrac{1}{x}$, $ m(x)=-\dfrac{1}{x^3}$, $ n(x)=-\dfrac{1}{x^5}$ - \begin{shortsolution} - The functions $k$, $m$, and $n$ have domain $(-\infty,0)\cup (0,\infty)$, and - are graphed below. - + The study of rational functions will rely upon a good knowledge + of power functions with negative exponents. \Cref{rat:ex:oddpow,rat:ex:evenpow} are + simple but fundamental to understanding the behavior of rational functions. + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Power functions with odd negative exponents]\label{rat:ex:oddpow} + Graph each of the following functions on your calculator, state their domain in interval notation, and their + behavior as $x\rightarrow 0^-$ and $x\rightarrow 0^+$. + \[ + f(x)=\frac{1}{x},\qquad g(x)=\dfrac{1}{x^3},\qquad h(x)=\dfrac{1}{x^5} + \] + \begin{pccsolution} + The functions $f$, $g$, and $k$ are plotted in \cref{rat:fig:oddpow}. + The domain of each of the functions $f$, $g$, and $h$ is $(-\infty,0)\cup (0,\infty)$. Note that + the long-run behavior of each of the functions is the same, and in particular + \begin{align*} + f(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} f(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty + \end{align*} + The same results hold for $g$ and $h$. Note also that each of the functions + has a \emph{vertical asymptote} at $0$. We see that + \begin{align*} + f(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^- \\ + \mathllap{\text{and }} f(x)\rightarrow \infty & \text{ as } x\rightarrow 0^+ + \end{align*} + The same results hold for $g$ and $h$. + + The curve of a function that has a vertical asymptote is necessarily separated + into \emph{branches}| each of the functions $f$, $g$, and $h$ have $2$ branches. + \end{pccsolution} + \end{pccexample} + + \begin{figure}[!htb] + \begin{minipage}{.45\textwidth} \begin{tikzpicture} \begin{axis}[ framed, @@ -2578,36 +2480,25 @@ $r$, and $s$. xtick={-2,-1,...,2}, minor ytick={-3,-1,...,3}, grid=both, - width=\solutionfigurewidth, - legend pos=north east, + width=\textwidth, + legend pos=north west, ] - \addplot expression[domain=-3:-0.2]{-1/x}; - \addplot expression[domain=-3:-0.584]{-1/x^3}; - \addplot expression[domain=-3:-0.724]{-1/x^5}; - \addplot expression[domain=0.2:3]{-1/x}; - \addplot expression[domain=0.584:3]{-1/x^3}; - \addplot expression[domain=0.724:3]{-1/x^5}; - \legend{$k$,$m$,$n$} + \addplot expression[domain=-3:-0.2]{1/x}; + \addplot expression[domain=-3:-0.584]{1/x^3}; + \addplot expression[domain=-3:-0.724]{1/x^5}; + \addplot expression[domain=0.2:3]{1/x}; + \addplot expression[domain=0.584:3]{1/x^3}; + \addplot expression[domain=0.724:3]{1/x^5}; + \addplot[soldot]coordinates{(-1,-1)}node[axisnode,anchor=north east]{$(-1,-1)$}; + \addplot[soldot]coordinates{(1,1)}node[axisnode,anchor=south west]{$(1,1)$}; + \legend{$f$,$g$,$h$} \end{axis} \end{tikzpicture} - - Note that - \begin{align*} - k(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} k(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \\ - \intertext{and also} - k(x)\rightarrow \infty & \text{ as } x\rightarrow 0^- \\ - \mathllap{\text{and }} k(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^+ - \end{align*} - The same are true for $m$ and $n$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $ K(x)=-\dfrac{1}{x^2}$, $ M(x)=-\dfrac{1}{x^4}$, $ N(x)=-\dfrac{1}{x^6}$ - \begin{shortsolution} - The functions $K$, $M$, and $N$ have domain $(-\infty,0)\cup (0,\infty)$, and - are graphed below. - + \caption{} + \label{rat:fig:oddpow} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} \begin{tikzpicture} \begin{axis}[ framed, @@ -2616,2032 +2507,2141 @@ $r$, and $s$. xtick={-2,-1,...,2}, minor ytick={-3,-1,...,3}, grid=both, - width=\solutionfigurewidth, - legend pos=north east, + width=\textwidth, + legend pos=south east, ] - \addplot expression[domain=-3:-0.447]{-1/x^2}; - \addplot expression[domain=-3:-0.668]{-1/x^4}; - \addplot expression[domain=-3:-0.764]{-1/x^6}; - \addplot expression[domain=0.447:3]{-1/x^2}; - \addplot expression[domain=0.668:3]{-1/x^4}; - \addplot expression[domain=0.764:3]{-1/x^6}; - \legend{$K$,$M$,$N$} + \addplot expression[domain=-3:-0.447]{1/x^2}; + \addplot expression[domain=-3:-0.668]{1/x^4}; + \addplot expression[domain=-3:-0.764]{1/x^6}; + \addplot expression[domain=0.447:3]{1/x^2}; + \addplot expression[domain=0.668:3]{1/x^4}; + \addplot expression[domain=0.764:3]{1/x^6}; + \addplot[soldot]coordinates{(-1,1)}node[axisnode,anchor=south east]{$(-1,1)$}; + \addplot[soldot]coordinates{(1,1)}node[axisnode,anchor=south west]{$(1,1)$}; + \legend{$F$,$G$,$H$} \end{axis} \end{tikzpicture} - - Note that + \caption{} + \label{rat:fig:evenpow} + \end{minipage}% + \end{figure} + + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Power functions with even negative exponents]\label{rat:ex:evenpow}% + Graph each of the following functions, state their domain, and their + behavior as $x\rightarrow 0^-$ and $x\rightarrow 0^+$. + \[ + f(x)=\frac{1}{x^2},\qquad g(x)=\frac{1}{x^4},\qquad h(x)=\frac{1}{x^6} + \] + \begin{pccsolution} + The functions $F$, $G$, and $H$ are plotted in \cref{rat:fig:evenpow}. + The domain of each of the functions $F$, $G$, and $H$ is $(-\infty,0)\cup (0,\infty)$. Note that + the long-run behavior of each of the functions is the same, and in particular \begin{align*} - K(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ - \mathllap{\text{and }} K(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \\ - \intertext{and also} - K(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^- \\ - \mathllap{\text{and }} K(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^+ + F(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} f(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \end{align*} - The same are true for $M$ and $N$. - \end{shortsolution} - \end{subproblem} - \end{problem} - \end{doyouunderstand} - + As in \cref{rat:ex:oddpow}, $F$ has a horizontal asymptote that + has equation $y=0$. + The same results hold for $G$ and $H$. Note also that each of the functions + has a \emph{vertical asymptote} at $0$. We see that + \begin{align*} + F(x)\rightarrow \infty & \text{ as } x\rightarrow 0^- \\ + \mathllap{\text{and }} F(x)\rightarrow \infty & \text{ as } x\rightarrow 0^+ + \end{align*} + The same results hold for $G$ and $H$. Each of the functions $F$, $G$, and $H$ + have $2$ branches. + \end{pccsolution} + \end{pccexample} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{doyouunderstand} + \begin{problem} + Repeat \cref{rat:ex:oddpow,rat:ex:evenpow} using (respectively) + \begin{subproblem} + $k(x)=-\dfrac{1}{x}$, $ m(x)=-\dfrac{1}{x^3}$, $ n(x)=-\dfrac{1}{x^5}$ + \begin{shortsolution} + The functions $k$, $m$, and $n$ have domain $(-\infty,0)\cup (0,\infty)$, and + are graphed below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-3,xmax=3, + ymin=-5,ymax=5, + xtick={-2,-1,...,2}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + legend pos=north east, + ] + \addplot expression[domain=-3:-0.2]{-1/x}; + \addplot expression[domain=-3:-0.584]{-1/x^3}; + \addplot expression[domain=-3:-0.724]{-1/x^5}; + \addplot expression[domain=0.2:3]{-1/x}; + \addplot expression[domain=0.584:3]{-1/x^3}; + \addplot expression[domain=0.724:3]{-1/x^5}; + \legend{$k$,$m$,$n$} + \end{axis} + \end{tikzpicture} + + Note that + \begin{align*} + k(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} k(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \\ + \intertext{and also} + k(x)\rightarrow \infty & \text{ as } x\rightarrow 0^- \\ + \mathllap{\text{and }} k(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^+ + \end{align*} + The same are true for $m$ and $n$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $ K(x)=-\dfrac{1}{x^2}$, $ M(x)=-\dfrac{1}{x^4}$, $ N(x)=-\dfrac{1}{x^6}$ + \begin{shortsolution} + The functions $K$, $M$, and $N$ have domain $(-\infty,0)\cup (0,\infty)$, and + are graphed below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-3,xmax=3, + ymin=-5,ymax=5, + xtick={-2,-1,...,2}, + minor ytick={-3,-1,...,3}, + grid=both, + width=\solutionfigurewidth, + legend pos=north east, + ] + \addplot expression[domain=-3:-0.447]{-1/x^2}; + \addplot expression[domain=-3:-0.668]{-1/x^4}; + \addplot expression[domain=-3:-0.764]{-1/x^6}; + \addplot expression[domain=0.447:3]{-1/x^2}; + \addplot expression[domain=0.668:3]{-1/x^4}; + \addplot expression[domain=0.764:3]{-1/x^6}; + \legend{$K$,$M$,$N$} + \end{axis} + \end{tikzpicture} + + Note that + \begin{align*} + K(x)\rightarrow 0 & \text{ as } x\rightarrow\infty \\ + \mathllap{\text{and }} K(x)\rightarrow 0 & \text{ as } x\rightarrow-\infty \\ + \intertext{and also} + K(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^- \\ + \mathllap{\text{and }} K(x)\rightarrow -\infty & \text{ as } x\rightarrow 0^+ + \end{align*} + The same are true for $M$ and $N$. + \end{shortsolution} + \end{subproblem} + \end{problem} + \end{doyouunderstand} + \subsection*{Rational functions} - \begin{pccdefinition}[Rational functions]\label{rat:def:function} - Rational functions have the form - \[ - r(x) = \frac{p(x)}{q(x)} - \] - where both $p$ and $q$ are polynomials. - - Note that - \begin{itemize} - \item the domain or $r$ will be all real numbers, except those that - make the \emph{denominator}, $q(x)$, equal to $0$; - \item the zeros of $r$ are the zeros of $p$, i.e the real numbers - that make the \emph{numerator}, $p(x)$, equal to $0$. - \end{itemize} - - \Cref{rat:ex:oddpow,rat:ex:evenpow} are particularly important because $r$ - will behave like $\frac{1}{x}$, or $\frac{1}{x^2}$ around its vertical asymptotes, - depending on the power that the relevant term is raised to| we will demonstrate - this in what follows. - \end{pccdefinition} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample}[Rational or not] - Identify whether each of the following functions is a rational or not. If - the function is rational, state the domain. - \begin{multicols}{3} - \begin{enumerate} - \item $r(x)=\dfrac{1}{x}$ - \item $f(x)=2^x+3$ - \item $g(x)=19$ - \item $h(x)=\dfrac{3+x}{4-x}$ - \item $k(x)=\dfrac{x^3+2x}{x-15}$ - \item $l(x)=9-4x$ - \item $m(x)=\dfrac{x+5}{(x-7)(x+9)}$ - \item $n(x)=x^2+6x+7$ - \item $q(x)=1-\dfrac{3}{x+1}$ - \end{enumerate} - \end{multicols} - \begin{pccsolution} - \begin{enumerate} - \item $r$ is rational; the domain of $r$ is $(-\infty,0)\cup(0,\infty)$. - \item $f$ is not rational. - \item $g$ is not rational; $g$ is constant. - \item $h$ is rational; the domain of $h$ is $(-\infty,4)\cup(4,\infty)$. - \item $k$ is rational; the domain of $k$ is $(-\infty,15)\cup(15,\infty)$. - \item $l$ is not rational; $l$ is linear. - \item $m$ is rational; the domain of $m$ is $(-\infty,-9)\cup(-9,7)\cup(7,\infty)$. - \item $n$ is not rational; $n$ is quadratic (or you might describe $n$ as a polynomial). - \item $q$ is rational; the domain of $q$ is $(-\infty,-1)\cup (-1,\infty)$. - \end{enumerate} - \end{pccsolution} - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample}[Match formula to graph] - Each of the following functions is graphed in \cref{rat:fig:whichiswhich}. - Which is which? - \[ - r(x)=\frac{1}{x-3}, \qquad q(x)=\frac{x-2}{x+5}, \qquad k(x)=\frac{1}{(x+2)(x-3)} - \] - \begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/(x+5);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-6,ymax=6, - xtick={-8,-6,...,8}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-6.37]{f}; - \addplot[pccplot] expression[domain=-3.97:10]{f}; - \addplot[soldot] coordinates{(2,0)}; - \addplot[asymptote,domain=-6:6]({-5},{x}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:which1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=1/(x-3);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-5,ymax=6, - xtick={-8,-6,...,8}, - ytick={-4,4}, - minor ytick={-3,...,5}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:2.8]{f}; - \addplot[pccplot] expression[domain=3.17:10]{f}; - \addplot[asymptote,domain=-6:6]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:which2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=1/((x-3)*(x+2));}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-5,ymax=5, - xtick={-8,-6,...,8}, - ytick={-4,4}, - minor ytick={-3,...,3}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-2.03969]{f}; - \addplot[pccplot] expression[domain=-1.95967:2.95967]{f}; - \addplot[pccplot] expression[domain=3.03969:10]{f}; - \addplot[asymptote,domain=-5:5]({-2},{x}); - \addplot[asymptote,domain=-5:5]({3},{x}); - \end{axis} - \end{tikzpicture} + \begin{pccdefinition}[Rational functions]\label{rat:def:function} + Rational functions have the form + \[ + r(x) = \frac{p(x)}{q(x)} + \] + where both $p$ and $q$ are polynomials. + + Note that + \begin{itemize} + \item the domain or $r$ will be all real numbers, except those that + make the \emph{denominator}, $q(x)$, equal to $0$; + \item the zeros of $r$ are the zeros of $p$, i.e the real numbers + that make the \emph{numerator}, $p(x)$, equal to $0$. + \end{itemize} + + \Cref{rat:ex:oddpow,rat:ex:evenpow} are particularly important because $r$ + will behave like $\frac{1}{x}$, or $\frac{1}{x^2}$ around its vertical asymptotes, + depending on the power that the relevant term is raised to| we will demonstrate + this in what follows. + \end{pccdefinition} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Rational or not] + Identify whether each of the following functions is a rational or not. If + the function is rational, state the domain. + \begin{multicols}{3} + \begin{enumerate} + \item $r(x)=\dfrac{1}{x}$ + \item $f(x)=2^x+3$ + \item $g(x)=19$ + \item $h(x)=\dfrac{3+x}{4-x}$ + \item $k(x)=\dfrac{x^3+2x}{x-15}$ + \item $l(x)=9-4x$ + \item $m(x)=\dfrac{x+5}{(x-7)(x+9)}$ + \item $n(x)=x^2+6x+7$ + \item $q(x)=1-\dfrac{3}{x+1}$ + \end{enumerate} + \end{multicols} + \begin{pccsolution} + \begin{enumerate} + \item $r$ is rational; the domain of $r$ is $(-\infty,0)\cup(0,\infty)$. + \item $f$ is not rational. + \item $g$ is not rational; $g$ is constant. + \item $h$ is rational; the domain of $h$ is $(-\infty,4)\cup(4,\infty)$. + \item $k$ is rational; the domain of $k$ is $(-\infty,15)\cup(15,\infty)$. + \item $l$ is not rational; $l$ is linear. + \item $m$ is rational; the domain of $m$ is $(-\infty,-9)\cup(-9,7)\cup(7,\infty)$. + \item $n$ is not rational; $n$ is quadratic (or you might describe $n$ as a polynomial). + \item $q$ is rational; the domain of $q$ is $(-\infty,-1)\cup (-1,\infty)$. + \end{enumerate} + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Match formula to graph] + Each of the following functions is graphed in \cref{rat:fig:whichiswhich}. + Which is which? + \[ + r(x)=\frac{1}{x-3}, \qquad q(x)=\frac{x-2}{x+5}, \qquad k(x)=\frac{1}{(x+2)(x-3)} + \] + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/(x+5);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-6,ymax=6, + xtick={-8,-6,...,8}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-6.37]{f}; + \addplot[pccplot] expression[domain=-3.97:10]{f}; + \addplot[soldot] coordinates{(2,0)}; + \addplot[asymptote,domain=-6:6]({-5},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:which1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=1/(x-3);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-5,ymax=6, + xtick={-8,-6,...,8}, + ytick={-4,4}, + minor ytick={-3,...,5}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:2.8]{f}; + \addplot[pccplot] expression[domain=3.17:10]{f}; + \addplot[asymptote,domain=-6:6]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:which2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=1/((x-3)*(x+2));}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-5,ymax=5, + xtick={-8,-6,...,8}, + ytick={-4,4}, + minor ytick={-3,...,3}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-2.03969]{f}; + \addplot[pccplot] expression[domain=-1.95967:2.95967]{f}; + \addplot[pccplot] expression[domain=3.03969:10]{f}; + \addplot[asymptote,domain=-5:5]({-2},{x}); + \addplot[asymptote,domain=-5:5]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:which3} + \end{subfigure} + \caption{} + \label{rat:fig:whichiswhich} + \end{figure} + + \begin{pccsolution} + Let's start with the function $r$. Note that domain of $r$ is $(-\infty,3)\cup(0,3)$, so + we search for a function that has a vertical asymptote at $3$. There + are two possible choices: the functions graphed in \cref{rat:fig:which2,rat:fig:which3}, + but note that the function in \cref{rat:fig:which3} also has a vertical asymptote at $-2$ + which is not consistent with the formula for $r(x)$. Therefore, $y=r(x)$ + is graphed in \cref{rat:fig:which2}. + + The function $q$ has domain $(-\infty,-5)\cup(-5,\infty)$, so we search + for a function that has a vertical asymptote at $-5$. The only candidate + is the curve shown in \cref{rat:fig:which1}; note that the curve also goes through $(2,0)$, + which is consistent with the formula for $q(x)$, since $q(2)=0$, i.e $q$ + has a zero at $2$. + + The function $k$ has domain $(-\infty,-2)\cup(-2,3)\cup(3,\infty)$, and + has vertical asymptotes at $-2$ and $3$. This is consistent with + the graph in \cref{rat:fig:which3} (and is the only curve that + has $3$ branches). + + We note that each function behaves like $\frac{1}{x}$ around its vertical asymptotes, + because each linear factor in each denominator is raised to the power $1$; if (for example) + the definition of $r$ was instead + \[ + r(x)=\frac{1}{(x-3)^2} + \] + then we would see that $r$ behaves like $\frac{1}{x^2}$ around its vertical asymptote, and + the graph of $r$ would be very different. We will deal with these cases in the examples that follow. + \end{pccsolution} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Repeated factors in the denominator] + Consider the functions $f$, $g$, and $h$ that have formulas + \[ + f(x)=\frac{x-2}{(x-3)(x+2)}, \qquad g(x)=\frac{x-2}{(x-3)^2(x+2)}, \qquad h(x)=\frac{x-2}{(x-3)(x+2)^2} + \] + which are graphed in \cref{rat:fig:repfactd}. Note that each function has $2$ + vertical asymptotes, and the domain of each function is + \[ + (-\infty,-2)\cup(-2,3)\cup(3,\infty) + \] + so we are not surprised to see that each curve has $3$ branches. We also note that + the numerator of each function is the same, which tells us that each function has + only $1$ zero at $2$. + + The functions $g$ and $h$ are different from those that we have considered previously, + because they have a repeated factor in the denominator. Notice in particular + the way that the functions behave around their asymptotes: + \begin{itemize} + \item $f$ behaves like $\frac{1}{x}$ around both of its asymptotes; + \item $g$ behaves like $\frac{1}{x}$ around $-2$, and like $\frac{1}{x^2}$ around $3$; + \item $h$ behaves like $\frac{1}{x^2}$ around $-2$, and like $\frac{1}{x}$ around $3$. + \end{itemize} + \end{pccexample} + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-4,ymax=4, + xtick={-4,-2,...,4}, + ytick={-2,2}, + % grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-5:-2.201]{f}; + \addplot[pccplot] expression[domain=-1.802:2.951]{f}; + \addplot[pccplot] expression[domain=3.052:5]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-6:6]({-2},{x}); + % \addplot[asymptote,domain=-6:6]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x-2}{(x+2)(x-3)}$} + \label{rat:fig:repfactd1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)*(x-3)^2);}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-4,ymax=4, + xtick={-4,-2,...,4}, + ytick={-2,2}, + % grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-5:-2.039]{f}; + \addplot[pccplot] expression[domain=-1.959:2.796]{f}; + \addplot[pccplot] expression[domain=3.243:5]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-4:4]({-2},{x}); + % \addplot[asymptote,domain=-4:4]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x-2}{(x+2)(x-3)^2}$} + \label{rat:fig:repfactd2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)^2*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-4,ymax=4, + xtick={-4,-2,...,2}, + ytick={-2,2}, + % grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-5:-2.451]{f}; + \addplot[pccplot] expression[domain=-1.558:2.990]{f}; + \addplot[pccplot] expression[domain=3.010:6]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-4:4]({-2},{x}); + % \addplot[asymptote,domain=-4:4]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x-2}{(x+2)^2(x-3)}$} + \label{rat:fig:repfactd3} + \end{subfigure} \caption{} - \label{rat:fig:which3} - \end{subfigure} - \caption{} - \label{rat:fig:whichiswhich} - \end{figure} - - \begin{pccsolution} - Let's start with the function $r$. Note that domain of $r$ is $(-\infty,3)\cup(0,3)$, so - we search for a function that has a vertical asymptote at $3$. There - are two possible choices: the functions graphed in \cref{rat:fig:which2,rat:fig:which3}, - but note that the function in \cref{rat:fig:which3} also has a vertical asymptote at $-2$ - which is not consistent with the formula for $r(x)$. Therefore, $y=r(x)$ - is graphed in \cref{rat:fig:which2}. - - The function $q$ has domain $(-\infty,-5)\cup(-5,\infty)$, so we search - for a function that has a vertical asymptote at $-5$. The only candidate - is the curve shown in \cref{rat:fig:which1}; note that the curve also goes through $(2,0)$, - which is consistent with the formula for $q(x)$, since $q(2)=0$, i.e $q$ - has a zero at $2$. - - The function $k$ has domain $(-\infty,-2)\cup(-2,3)\cup(3,\infty)$, and - has vertical asymptotes at $-2$ and $3$. This is consistent with - the graph in \cref{rat:fig:which3} (and is the only curve that - has $3$ branches). - - We note that each function behaves like $\frac{1}{x}$ around its vertical asymptotes, - because each linear factor in each denominator is raised to the power $1$; if (for example) - the definition of $r$ was instead - \[ - r(x)=\frac{1}{(x-3)^2} - \] - then we would see that $r$ behaves like $\frac{1}{x^2}$ around its vertical asymptote, and - the graph of $r$ would be very different. We will deal with these cases in the examples that follow. - \end{pccsolution} - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample}[Repeated factors in the denominator] - Consider the functions $f$, $g$, and $h$ that have formulas - \[ - f(x)=\frac{x-2}{(x-3)(x+2)}, \qquad g(x)=\frac{x-2}{(x-3)^2(x+2)}, \qquad h(x)=\frac{x-2}{(x-3)(x+2)^2} - \] - which are graphed in \cref{rat:fig:repfactd}. Note that each function has $2$ - vertical asymptotes, and the domain of each function is - \[ - (-\infty,-2)\cup(-2,3)\cup(3,\infty) - \] - so we are not surprised to see that each curve has $3$ branches. We also note that - the numerator of each function is the same, which tells us that each function has - only $1$ zero at $2$. - - The functions $g$ and $h$ are different from those that we have considered previously, - because they have a repeated factor in the denominator. Notice in particular - the way that the functions behave around their asymptotes: - \begin{itemize} - \item $f$ behaves like $\frac{1}{x}$ around both of its asymptotes; - \item $g$ behaves like $\frac{1}{x}$ around $-2$, and like $\frac{1}{x^2}$ around $3$; - \item $h$ behaves like $\frac{1}{x^2}$ around $-2$, and like $\frac{1}{x}$ around $3$. - \end{itemize} - \end{pccexample} - \begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-4,ymax=4, - xtick={-4,-2,...,4}, - ytick={-2,2}, - % grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-5:-2.201]{f}; - \addplot[pccplot] expression[domain=-1.802:2.951]{f}; - \addplot[pccplot] expression[domain=3.052:5]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-6:6]({-2},{x}); - % \addplot[asymptote,domain=-6:6]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x-2}{(x+2)(x-3)}$} - \label{rat:fig:repfactd1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)*(x-3)^2);}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-4,ymax=4, - xtick={-4,-2,...,4}, - ytick={-2,2}, - % grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-5:-2.039]{f}; - \addplot[pccplot] expression[domain=-1.959:2.796]{f}; - \addplot[pccplot] expression[domain=3.243:5]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-4:4]({-2},{x}); - % \addplot[asymptote,domain=-4:4]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x-2}{(x+2)(x-3)^2}$} - \label{rat:fig:repfactd2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+2)^2*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-4,ymax=4, - xtick={-4,-2,...,2}, - ytick={-2,2}, - % grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-5:-2.451]{f}; - \addplot[pccplot] expression[domain=-1.558:2.990]{f}; - \addplot[pccplot] expression[domain=3.010:6]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-4:4]({-2},{x}); - % \addplot[asymptote,domain=-4:4]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x-2}{(x+2)^2(x-3)}$} - \label{rat:fig:repfactd3} - \end{subfigure} - \caption{} - \label{rat:fig:repfactd} - \end{figure} - - \Cref{rat:def:function} says that the zeros of - the rational function $r$ that has formula $r(x)=\frac{p(x)}{q(x)}$ are - the zeros of $p$. Let's explore this a little more. - %=================================== - % Author: Hughes - % Date: May 2012 - %=================================== - \begin{pccexample}[Zeros] Find the zeros of each of the following functions - \[ - \alpha(x)=\frac{x+5}{3x-7}, \qquad \beta(x)=\frac{9-x}{x+1}, \qquad \gamma(x)=\frac{17x^2-10}{2x+1} - \] - \begin{pccsolution} - We find the zeros of each function in turn by setting the numerator equal to $0$. The zeros of - $\alpha$ are found by solving - \[ - x+5=0 - \] - The zero of $\alpha$ is $-5$. - - Similarly, we may solve $9-x=0$ to find the zero of $\beta$, which is clearly $9$. - - The zeros of $\gamma$ satisfy the equation - \[ - 17x^2-10=0 - \] - which we can solve using the square root property to obtain - \[ - x=\pm\frac{10}{17} - \] - The zeros of $\gamma$ are $\pm\frac{10}{17}$. - \end{pccsolution} - \end{pccexample} - + \label{rat:fig:repfactd} + \end{figure} + + \Cref{rat:def:function} says that the zeros of + the rational function $r$ that has formula $r(x)=\frac{p(x)}{q(x)}$ are + the zeros of $p$. Let's explore this a little more. + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}[Zeros] Find the zeros of each of the following functions + \[ + \alpha(x)=\frac{x+5}{3x-7}, \qquad \beta(x)=\frac{9-x}{x+1}, \qquad \gamma(x)=\frac{17x^2-10}{2x+1} + \] + \begin{pccsolution} + We find the zeros of each function in turn by setting the numerator equal to $0$. The zeros of + $\alpha$ are found by solving + \[ + x+5=0 + \] + The zero of $\alpha$ is $-5$. + + Similarly, we may solve $9-x=0$ to find the zero of $\beta$, which is clearly $9$. + + The zeros of $\gamma$ satisfy the equation + \[ + 17x^2-10=0 + \] + which we can solve using the square root property to obtain + \[ + x=\pm\frac{10}{17} + \] + The zeros of $\gamma$ are $\pm\frac{10}{17}$. + \end{pccsolution} + \end{pccexample} + \subsection*{Long-run behavior} - Our focus so far has been on the behavior of rational functions around - their \emph{vertical} asymptotes. In fact, rational functions also - have interesting long-run behavior around their \emph{horizontal} or - \emph{oblique} asymptotes. A rational function will always have either - a horizontal or an oblique asymptote| the case is determined by the degree - of the numerator and the degree of the denominator. - \begin{pccdefinition}[Long-run behavior]\label{rat:def:longrun} - Let $r$ be the rational function that has formula - \[ - r(x) = \frac{a_n x^n + a_{n-1}x^{n-1}+\ldots + a_0}{b_m x^m + b_{m-1}x^{m-1}+\ldots+b_0} - \] - We can classify the long-run behavior of the rational function $r$ - according to the following criteria: - \begin{itemize} - \item if $n<m$ then $r$ has a horizontal asymptote with equation $y=0$; - \item if $n=m$ then $r$ has a horizontal asymptote with equation $y=\dfrac{a_n}{b_m}$; - \item if $n>m$ then $r$ will have an oblique asymptote as $x\rightarrow\pm\infty$ (more on this in \cref{rat:sec:oblique}) - \end{itemize} - \end{pccdefinition} - We will concentrate on functions that have horizontal asymptotes until - we reach \cref{rat:sec:oblique}. - - %=================================== - % Author: Hughes - % Date: May 2012 - %=================================== - \begin{pccexample}[Long-run behavior graphically]\label{rat:ex:horizasymp} - \pccname{Kebede} has graphed the following functions in his graphing calculator - \[ - r(x)=\frac{x+1}{x-3}, \qquad s(x)=\frac{2(x+1)}{x-3}, \qquad t(x)=\frac{3(x+1)}{x-3} - \] - and obtained the curves shown in \cref{rat:fig:horizasymp}. Kebede decides - to test his knowledgeable friend \pccname{Oscar}, and asks him - to match the formulas to the graphs. - - \begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=2*(x+1)/(x-3);}] - \begin{axis}[ - framed, - xmin=-15,xmax=15, - ymin=-6,ymax=6, - xtick={-12,-8,...,12}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-15:2]{f}; - \addplot[pccplot] expression[domain=5:15]{f}; - \addplot[soldot] coordinates{(-1,0)}; - \addplot[asymptote,domain=-6:6]({3},{x}); - \addplot[asymptote,domain=-15:15]({x},{2}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:horizasymp1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x+1)/(x-3);}] - \begin{axis}[ - framed, - xmin=-15,xmax=15, - ymin=-6,ymax=6, - xtick={-12,-8,...,12}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-15:2.42857,samples=50]{f}; - \addplot[pccplot] expression[domain=3.8:15,samples=50]{f}; - \addplot[soldot] coordinates{(-1,0)}; - \addplot[asymptote,domain=-6:6]({3},{x}); - \addplot[asymptote,domain=-15:15]({x},{1}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:horizasymp2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=3*(x+1)/(x-3);}] - \begin{axis}[ - framed, - xmin=-15,xmax=15, - ymin=-6,ymax=6, - xtick={-12,-8,...,12}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-15:1.6666,samples=50]{f}; - \addplot[pccplot] expression[domain=7:15]{f}; - \addplot[soldot] coordinates{(-1,0)}; - \addplot[asymptote,domain=-6:6]({3},{x}); - \addplot[asymptote,domain=-15:15]({x},{3}); - \end{axis} - \end{tikzpicture} + Our focus so far has been on the behavior of rational functions around + their \emph{vertical} asymptotes. In fact, rational functions also + have interesting long-run behavior around their \emph{horizontal} or + \emph{oblique} asymptotes. A rational function will always have either + a horizontal or an oblique asymptote| the case is determined by the degree + of the numerator and the degree of the denominator. + \begin{pccdefinition}[Long-run behavior]\label{rat:def:longrun} + Let $r$ be the rational function that has formula + \[ + r(x) = \frac{a_n x^n + a_{n-1}x^{n-1}+\ldots + a_0}{b_m x^m + b_{m-1}x^{m-1}+\ldots+b_0} + \] + We can classify the long-run behavior of the rational function $r$ + according to the following criteria: + \begin{itemize} + \item if $n<m$ then $r$ has a horizontal asymptote with equation $y=0$; + \item if $n=m$ then $r$ has a horizontal asymptote with equation $y=\dfrac{a_n}{b_m}$; + \item if $n>m$ then $r$ will have an oblique asymptote as $x\rightarrow\pm\infty$ (more on this in \cref{rat:sec:oblique}) + \end{itemize} + \end{pccdefinition} + We will concentrate on functions that have horizontal asymptotes until + we reach \cref{rat:sec:oblique}. + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}[Long-run behavior graphically]\label{rat:ex:horizasymp} + \pccname{Kebede} has graphed the following functions in his graphing calculator + \[ + r(x)=\frac{x+1}{x-3}, \qquad s(x)=\frac{2(x+1)}{x-3}, \qquad t(x)=\frac{3(x+1)}{x-3} + \] + and obtained the curves shown in \cref{rat:fig:horizasymp}. Kebede decides + to test his knowledgeable friend \pccname{Oscar}, and asks him + to match the formulas to the graphs. + + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=2*(x+1)/(x-3);}] + \begin{axis}[ + framed, + xmin=-15,xmax=15, + ymin=-6,ymax=6, + xtick={-12,-8,...,12}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-15:2]{f}; + \addplot[pccplot] expression[domain=5:15]{f}; + \addplot[soldot] coordinates{(-1,0)}; + \addplot[asymptote,domain=-6:6]({3},{x}); + \addplot[asymptote,domain=-15:15]({x},{2}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:horizasymp1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x+1)/(x-3);}] + \begin{axis}[ + framed, + xmin=-15,xmax=15, + ymin=-6,ymax=6, + xtick={-12,-8,...,12}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-15:2.42857,samples=50]{f}; + \addplot[pccplot] expression[domain=3.8:15,samples=50]{f}; + \addplot[soldot] coordinates{(-1,0)}; + \addplot[asymptote,domain=-6:6]({3},{x}); + \addplot[asymptote,domain=-15:15]({x},{1}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:horizasymp2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=3*(x+1)/(x-3);}] + \begin{axis}[ + framed, + xmin=-15,xmax=15, + ymin=-6,ymax=6, + xtick={-12,-8,...,12}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-15:1.6666,samples=50]{f}; + \addplot[pccplot] expression[domain=7:15]{f}; + \addplot[soldot] coordinates{(-1,0)}; + \addplot[asymptote,domain=-6:6]({3},{x}); + \addplot[asymptote,domain=-15:15]({x},{3}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:horizasymp3} + \end{subfigure} + \caption{Horizontal asymptotes} + \label{rat:fig:horizasymp} + \end{figure} + + Oscar notices that each function has a vertical asymptote at $3$ and a zero at $-1$. + The main thing that catches Oscar's eye is that each function has a different + coefficient in the numerator, and that each curve has a different horizontal asymptote. + In particular, Oscar notes that + \begin{itemize} + \item the curve shown in \cref{rat:fig:horizasymp1} has a horizontal asymptote with equation $y=2$; + \item the curve shown in \cref{rat:fig:horizasymp2} has a horizontal asymptote with equation $y=1$; + \item the curve shown in \cref{rat:fig:horizasymp3} has a horizontal asymptote with equation $y=3$. + \end{itemize} + Oscar is able to tie it all together for Kebede by referencing \cref{rat:def:longrun}. He says + that since the degree of the numerator and the degree of the denominator is the same + for each of the functions $r$, $s$, and $t$, the horizontal asymptote will be determined + by evaluating the ratio of their leading coefficients. + + Oscar therefore says that $r$ should have a horizontal asymptote $y=\frac{1}{1}=1$, $s$ should + have a horizontal asymptote $y=\frac{2}{1}=2$, and $t$ should have a horizontal asymptote + $y=\frac{3}{1}=3$. Kebede is able to finish the problem from here, and says that $r$ is + shown in \cref{rat:fig:horizasymp2}, $s$ is shown in \cref{rat:fig:horizasymp1}, and + $t$ is shown in \cref{rat:fig:horizasymp3}. + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{pccexample}[Long-run behavior numerically] + \pccname{Xiao} and \pccname{Dwayne} saw \cref{rat:ex:horizasymp} but are a little confused + about horizontal asymptotes. What does it mean to say that a function $r$ has a horizontal + asymptote? + + They decide to explore the concept by + constructing a table of values for the rational functions $R$ and $S$ that have formulas + \[ + R(x)=\frac{-5(x+1)}{x-3}, \qquad S(x)=\frac{7(x-5)}{2(x+1)} + \] + In \cref{rat:tab:plusinfty} they model the behavior of $R$ and $S$ as $x\rightarrow\infty$, + and in \cref{rat:tab:minusinfty} they model the behavior of $R$ and $S$ as $x\rightarrow-\infty$ + by substituting very large values of $|x|$ into each function. + \begin{table}[!htb] + \begin{minipage}{.5\textwidth} + \centering + \caption{$R$ and $S$ as $x\rightarrow\infty$} + \label{rat:tab:plusinfty} + \begin{tabular}{crr} + \beforeheading + $x$ & $R(x)$ & $S(x)$ \\ \afterheading + $1\times 10^2$ & $-5.20619$ & $3.29208$ \\\normalline + $1\times 10^3$ & $-5.02006$ & $3.47902$ \\\normalline + $1\times 10^4$ & $-5.00200$ & $3.49790$ \\\normalline + $1\times 10^5$ & $-5.00020$ & $3.49979$ \\\normalline + $1\times 10^6$ & $-5.00002$ & $3.49998$ \\\lastline + \end{tabular} + \end{minipage}% + \begin{minipage}{.5\textwidth} + \centering + \caption{$R$ and $S$ as $x\rightarrow-\infty$} + \label{rat:tab:minusinfty} + \begin{tabular}{crr} + \beforeheading + $x$ & $R(x)$ & $S(x)$ \\ \afterheading + $-1\times 10^2$ & $-4.80583$ & $3.71212$ \\\normalline + $-1\times 10^3$ & $-4.98006$ & $3.52102$ \\\normalline + $-1\times 10^4$ & $-4.99800$ & $3.50210$ \\\normalline + $-1\times 10^5$ & $-4.99980$ & $3.50021$ \\\normalline + $-1\times 10^6$ & $-4.99998$ & $3.50002$ \\\lastline + \end{tabular} + \end{minipage} + \end{table} + + Xiao and Dwayne study \cref{rat:tab:plusinfty,rat:tab:minusinfty} and decide that + the functions $R$ and $S$ never actually touch their horizontal asymptotes, but they + do get infinitely close. They also feel as if they have a better understanding of + what it means to study the behavior of a function as $x\rightarrow\pm\infty$. + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample}[Repeated factors in the numerator] + Consider the functions $f$, $g$, and $h$ that have formulas + \[ + f(x)=\frac{(x-2)^2}{(x-3)(x+1)}, \qquad g(x)=\frac{x-2}{(x-3)(x+1)}, \qquad h(x)=\frac{(x-2)^3}{(x-3)(x+1)} + \] + which are graphed in \cref{rat:fig:repfactn}. We note that each function has vertical + asymptotes at $-1$ and $3$, and so the domain of each function is + \[ + (-\infty,-1)\cup(-1,3)\cup(3,\infty) + \] + We also notice that the numerators of each function are quite similar| indeed, each + function has a zero at $2$, but how does each function behave around their zero? + + Using \cref{rat:fig:repfactn} to guide us, we note that + \begin{itemize} + \item $f$ has a horizontal intercept $(2,0)$, but the curve of + $f$ does not cut the horizontal axis| it bounces off it; + \item $g$ also has a horizontal intercept $(2,0)$, and the curve + of $g$ \emph{does} cut the horizontal axis; + \item $h$ has a horizontal intercept $(2,0)$, and the curve of $h$ + also cuts the axis, but appears flattened as it does so. + \end{itemize} + + We can further enrich our study by discussing the long-run behavior of each function. + Using the tools of \cref{rat:def:longrun}, we can deduce that + \begin{itemize} + \item $f$ has a horizontal asymptote with equation $y=1$; + \item $g$ has a horizontal asymptote with equation $y=0$; + \item $h$ does \emph{not} have a horizontal asymptote| it has an oblique asymptote (we'll + study this more in \cref{rat:sec:oblique}). + \end{itemize} + \end{pccexample} + + \begin{figure}[!htb] + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)^2/((x+1)*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-10,ymax=10, + xtick={-4,-2,...,4}, + ytick={-8,-4,...,8}, + % grid=both, + width=\figurewidth, + ] + \addplot[pccplot] expression[domain=-5:-1.248,samples=50]{f}; + \addplot[pccplot] expression[domain=-0.794:2.976,samples=50]{f}; + \addplot[pccplot] expression[domain=3.026:5,samples=50]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-6:6]({-1},{x}); + % \addplot[asymptote,domain=-6:6]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{(x-2)^2}{(x+1)(x-3)}$} + \label{rat:fig:repfactn1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+1)*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + ymin=-10,ymax=10, + xtick={-4,-2,...,4}, + ytick={-8,-4,...,8}, + % grid=both, + width=\figurewidth, + ] + \addplot[pccplot] expression[domain=-5:-1.075]{f}; + \addplot[pccplot] expression[domain=-0.925:2.975]{f}; + \addplot[pccplot] expression[domain=3.025:5]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-6:6]({-1},{x}); + % \addplot[asymptote,domain=-6:6]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x-2}{(x+1)(x-3)}$} + \label{rat:fig:repfactn2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x-2)^3/((x+1)*(x-3));}] + \begin{axis}[ + % framed, + xmin=-5,xmax=5, + xtick={-8,-6,...,8}, + % grid=both, + ymin=-30,ymax=30, + width=\figurewidth, + ] + \addplot[pccplot] expression[domain=-5:-1.27]{f}; + \addplot[pccplot] expression[domain=-0.806:2.99185]{f}; + \addplot[pccplot] expression[domain=3.0085:5]{f}; + \addplot[soldot] coordinates{(2,0)}; + % \addplot[asymptote,domain=-30:30]({-1},{x}); + % \addplot[asymptote,domain=-30:30]({3},{x}); + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{(x-2)^3}{(x+1)(x-3)}$} + \label{rat:fig:repfactn3} + \end{subfigure} \caption{} - \label{rat:fig:horizasymp3} - \end{subfigure} - \caption{Horizontal asymptotes} - \label{rat:fig:horizasymp} - \end{figure} - - Oscar notices that each function has a vertical asymptote at $3$ and a zero at $-1$. - The main thing that catches Oscar's eye is that each function has a different - coefficient in the numerator, and that each curve has a different horizontal asymptote. - In particular, Oscar notes that - \begin{itemize} - \item the curve shown in \cref{rat:fig:horizasymp1} has a horizontal asymptote with equation $y=2$; - \item the curve shown in \cref{rat:fig:horizasymp2} has a horizontal asymptote with equation $y=1$; - \item the curve shown in \cref{rat:fig:horizasymp3} has a horizontal asymptote with equation $y=3$. - \end{itemize} - Oscar is able to tie it all together for Kebede by referencing \cref{rat:def:longrun}. He says - that since the degree of the numerator and the degree of the denominator is the same - for each of the functions $r$, $s$, and $t$, the horizontal asymptote will be determined - by evaluating the ratio of their leading coefficients. - - Oscar therefore says that $r$ should have a horizontal asymptote $y=\frac{1}{1}=1$, $s$ should - have a horizontal asymptote $y=\frac{2}{1}=2$, and $t$ should have a horizontal asymptote - $y=\frac{3}{1}=3$. Kebede is able to finish the problem from here, and says that $r$ is - shown in \cref{rat:fig:horizasymp2}, $s$ is shown in \cref{rat:fig:horizasymp1}, and - $t$ is shown in \cref{rat:fig:horizasymp3}. - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: May 2012 - %=================================== - \begin{pccexample}[Long-run behavior numerically] - \pccname{Xiao} and \pccname{Dwayne} saw \cref{rat:ex:horizasymp} but are a little confused - about horizontal asymptotes. What does it mean to say that a function $r$ has a horizontal - asymptote? - - They decide to explore the concept by - constructing a table of values for the rational functions $R$ and $S$ that have formulas - \[ - R(x)=\frac{-5(x+1)}{x-3}, \qquad S(x)=\frac{7(x-5)}{2(x+1)} - \] - In \cref{rat:tab:plusinfty} they model the behavior of $R$ and $S$ as $x\rightarrow\infty$, - and in \cref{rat:tab:minusinfty} they model the behavior of $R$ and $S$ as $x\rightarrow-\infty$ - by substituting very large values of $|x|$ into each function. - \begin{table}[!htb] - \begin{minipage}{.5\textwidth} - \centering - \caption{$R$ and $S$ as $x\rightarrow\infty$} - \label{rat:tab:plusinfty} - \begin{tabular}{crr} - \beforeheading - $x$ & $R(x)$ & $S(x)$ \\ \afterheading - $1\times 10^2$ & $-5.20619$ & $3.29208$ \\\normalline - $1\times 10^3$ & $-5.02006$ & $3.47902$ \\\normalline - $1\times 10^4$ & $-5.00200$ & $3.49790$ \\\normalline - $1\times 10^5$ & $-5.00020$ & $3.49979$ \\\normalline - $1\times 10^6$ & $-5.00002$ & $3.49998$ \\\lastline - \end{tabular} - \end{minipage}% - \begin{minipage}{.5\textwidth} - \centering - \caption{$R$ and $S$ as $x\rightarrow-\infty$} - \label{rat:tab:minusinfty} - \begin{tabular}{crr} - \beforeheading - $x$ & $R(x)$ & $S(x)$ \\ \afterheading - $-1\times 10^2$ & $-4.80583$ & $3.71212$ \\\normalline - $-1\times 10^3$ & $-4.98006$ & $3.52102$ \\\normalline - $-1\times 10^4$ & $-4.99800$ & $3.50210$ \\\normalline - $-1\times 10^5$ & $-4.99980$ & $3.50021$ \\\normalline - $-1\times 10^6$ & $-4.99998$ & $3.50002$ \\\lastline - \end{tabular} - \end{minipage} - \end{table} - - Xiao and Dwayne study \cref{rat:tab:plusinfty,rat:tab:minusinfty} and decide that - the functions $R$ and $S$ never actually touch their horizontal asymptotes, but they - do get infinitely close. They also feel as if they have a better understanding of - what it means to study the behavior of a function as $x\rightarrow\pm\infty$. - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample}[Repeated factors in the numerator] - Consider the functions $f$, $g$, and $h$ that have formulas - \[ - f(x)=\frac{(x-2)^2}{(x-3)(x+1)}, \qquad g(x)=\frac{x-2}{(x-3)(x+1)}, \qquad h(x)=\frac{(x-2)^3}{(x-3)(x+1)} - \] - which are graphed in \cref{rat:fig:repfactn}. We note that each function has vertical - asymptotes at $-1$ and $3$, and so the domain of each function is - \[ - (-\infty,-1)\cup(-1,3)\cup(3,\infty) - \] - We also notice that the numerators of each function are quite similar| indeed, each - function has a zero at $2$, but how does each function behave around their zero? - - Using \cref{rat:fig:repfactn} to guide us, we note that - \begin{itemize} - \item $f$ has a horizontal intercept $(2,0)$, but the curve of - $f$ does not cut the horizontal axis| it bounces off it; - \item $g$ also has a horizontal intercept $(2,0)$, and the curve - of $g$ \emph{does} cut the horizontal axis; - \item $h$ has a horizontal intercept $(2,0)$, and the curve of $h$ - also cuts the axis, but appears flattened as it does so. - \end{itemize} - - We can further enrich our study by discussing the long-run behavior of each function. - Using the tools of \cref{rat:def:longrun}, we can deduce that - \begin{itemize} - \item $f$ has a horizontal asymptote with equation $y=1$; - \item $g$ has a horizontal asymptote with equation $y=0$; - \item $h$ does \emph{not} have a horizontal asymptote| it has an oblique asymptote (we'll - study this more in \cref{rat:sec:oblique}). - \end{itemize} - \end{pccexample} - - \begin{figure}[!htb] - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)^2/((x+1)*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-10,ymax=10, - xtick={-4,-2,...,4}, - ytick={-8,-4,...,8}, - % grid=both, - width=\figurewidth, - ] - \addplot[pccplot] expression[domain=-5:-1.248,samples=50]{f}; - \addplot[pccplot] expression[domain=-0.794:2.976,samples=50]{f}; - \addplot[pccplot] expression[domain=3.026:5,samples=50]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-6:6]({-1},{x}); - % \addplot[asymptote,domain=-6:6]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{(x-2)^2}{(x+1)(x-3)}$} - \label{rat:fig:repfactn1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)/((x+1)*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - ymin=-10,ymax=10, - xtick={-4,-2,...,4}, - ytick={-8,-4,...,8}, - % grid=both, - width=\figurewidth, - ] - \addplot[pccplot] expression[domain=-5:-1.075]{f}; - \addplot[pccplot] expression[domain=-0.925:2.975]{f}; - \addplot[pccplot] expression[domain=3.025:5]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-6:6]({-1},{x}); - % \addplot[asymptote,domain=-6:6]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x-2}{(x+1)(x-3)}$} - \label{rat:fig:repfactn2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x-2)^3/((x+1)*(x-3));}] - \begin{axis}[ - % framed, - xmin=-5,xmax=5, - xtick={-8,-6,...,8}, - % grid=both, - ymin=-30,ymax=30, - width=\figurewidth, - ] - \addplot[pccplot] expression[domain=-5:-1.27]{f}; - \addplot[pccplot] expression[domain=-0.806:2.99185]{f}; - \addplot[pccplot] expression[domain=3.0085:5]{f}; - \addplot[soldot] coordinates{(2,0)}; - % \addplot[asymptote,domain=-30:30]({-1},{x}); - % \addplot[asymptote,domain=-30:30]({3},{x}); - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{(x-2)^3}{(x+1)(x-3)}$} - \label{rat:fig:repfactn3} - \end{subfigure} - \caption{} - \label{rat:fig:repfactn} - \end{figure} - + \label{rat:fig:repfactn} + \end{figure} + \subsection*{Holes} - Rational functions have a vertical asymptote at $a$ if the denominator is $0$ at $a$. - What happens if the numerator is $0$ at the same place? In this case, we say that the rational - function has a \emph{hole} at $a$. - \begin{pccdefinition}[Holes] - The rational function - \[ - r(x)=\frac{p(x)}{q(x)} - \] - has a hole at $a$ if $p(a)=q(a)=0$. Note that holes are different from - a vertical asymptotes. We represent that $r$ has a hole at the point - $(a,r(a))$ on the curve $y=r(x)$ by - using a hollow circle, $\circ$. - \end{pccdefinition} - - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{pccexample} - \pccname{Mohammed} and \pccname{Sue} have graphed the function $r$ that has formula - \[ - r(x)=\frac{x^2+x-6}{(x-2)} - \] - in their calculators, and can not decide if the correct graph - is \cref{rat:fig:hole} or \cref{rat:fig:hole1}. - - Luckily for them, Oscar is nearby, and can help them settle the debate. - Oscar demonstrates that - \begin{align*} - r(x) & =\frac{(x+3)(x-2)}{(x-2)} \\ - & = x+3 - \end{align*} - but only when $x\ne 2$, because the function is undefined at $2$. Oscar - says that this necessarily means that the domain or $r$ is - \[ - (-\infty,2)\cup(2,\infty) - \] - and that $r$ must have a hole at $2$. - - Mohammed and Sue are very grateful for the clarification, and conclude that - the graph of $r$ is shown in \cref{rat:fig:hole1}. - \begin{figure}[!htb] - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-4,...,8}, - ytick={-8,-4,...,8}, - grid=both, - width=\textwidth, - ] - \addplot expression[domain=-10:7]{x+3}; - \addplot[soldot] coordinates{(-3,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:hole} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-4,...,8}, - ytick={-8,-4,...,8}, - grid=both, - width=\textwidth, - ] - \addplot expression[domain=-10:7]{x+3}; - \addplot[holdot] coordinates{(2,5)}; - \addplot[soldot] coordinates{(-3,0)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:hole1} - \end{minipage}% - \end{figure} - \end{pccexample} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{pccexample} - Consider the function $f$ that has formula - \[ - f(x)=\frac{x(x+3)}{x^2-4x} - \] - The domain of $f$ is $(-\infty,0)\cup(0,4)\cup(4,\infty)$ because both $0$ and $4$ - make the denominator equal to $0$. Notice that - \begin{align*} - f(x) & = \frac{x(x+3)}{x(x-4)} \\ - & = \frac{x+3}{x-4} - \end{align*} - provided that $x\ne 0$. Since $0$ makes the numerator - and the denominator 0 at the same time, we say that $f$ has a hole at $(0,-\nicefrac{3}{4})$. - Note that this necessarily means that $f$ does not have a vertical intercept. - - We also note $f$ has a vertical asymptote at $4$; the function is graphed in \cref{rat:fig:holeex}. - \begin{figure}[!htb] - \centering - \begin{tikzpicture}[/pgf/declare function={f=(x+3)/(x-4);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=both, - ] - \addplot[pccplot] expression[domain=-10:3.36364,samples=50]{f}; - \addplot[pccplot] expression[domain=4.77:10]{f}; - \addplot[asymptote,domain=-10:10]({4},{x}); - \addplot[holdot]coordinates{(0,-0.75)}; - \addplot[soldot] coordinates{(-3,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=\dfrac{x(x+3)}{x^2-4x}$} - \label{rat:fig:holeex} - \end{figure} - \end{pccexample} - - - - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{pccexample}[Minimums and maximums] - \pccname{Seamus} and \pccname{Trang} are discussing rational functions. Seamus says that - if a rational function has a vertical asymptote, then it can - not possibly have local minimums and maximums, nor can it have - global minimums and maximums. - - Trang says this statement is not always true. She plots the functions - $f$ and $g$ that have formulas - \[ - f(x)=-\frac{32(x-1)(x+1)}{(x-2)^2(x+2)^2}, \qquad g(x)=\frac{32(x-1)(x+1)}{(x-2)^2(x+2)^2} - \] - in \cref{rat:fig:minmax1,rat:fig:minmax2} and shows them to Seamus. On seeing the graphs, - Seamus quickly corrects himself, and says that $f$ has a local (and global) - maximum of $2$ at $0$, and that $g$ has a local (and global) minimum of $-2$ at $0$. - - \begin{figure}[!htb] - \begin{minipage}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=-32*(x-1)*(x+1)/(( x-2)^2*(x+2)^2);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-3.01]{f}; - \addplot[pccplot] expression[domain=-1.45:1.45]{f}; - \addplot[pccplot] expression[domain=3.01:10]{f}; - \addplot[soldot] coordinates{(-1,0)(1,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=f(x)$} - \label{rat:fig:minmax1} - \end{minipage}% - \hfill - \begin{minipage}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=32*(x-1)*(x+1)/(( x-2)^2*(x+2)^2);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-3.01]{f}; - \addplot[pccplot] expression[domain=-1.45:1.45]{f}; - \addplot[pccplot] expression[domain=3.01:10]{f}; - \addplot[soldot] coordinates{(-1,0)(1,0)}; - \end{axis} - \end{tikzpicture} - \caption{$y=g(x)$} - \label{rat:fig:minmax2} - \end{minipage}% - \end{figure} - - Seamus also notes that (in its domain) the function $f$ is always concave down, and - that (in its domain) the function $g$ is always concave up. Furthermore, Trang - observes that each function behaves like $\frac{1}{x^2}$ around each of its vertical - asymptotes, because each linear factor in the denominator is raised to the power $2$. - - \pccname{Oscar} stops by and reminds both students about the long-run behavior; according - to \cref{rat:def:longrun} since the degree of the denominator is greater than the - degree of the numerator (in both functions), each function has a horizontal asymptote - at $y=0$. - \end{pccexample} - - - \investigation*{} - %=================================== - % Author: Pettit/Hughes - % Date: March 2012 - %=================================== - \begin{problem}[The spaghetti incident] - The same Queen from \vref{exp:prob:queenschessboard} has recovered from - the rice experiments, and has called her loyal jester for another challenge. - - The jester has an $11-$inch piece of uncooked spaghetti that he puts on a table; - he uses a book to cover $\unit[1]{inch}$ of it so that - $\unit[10]{inches}$ hang over the edge. The jester then produces a box of $\unit{mg}$ - weights that can be hung from the spaghetti. - - The jester says it will take $\unit[y]{mg}$ to break the spaghetti when hung - $\unit[x]{inches}$ from the edge, according to the rule $y=\frac{100}{x}$. - \begin{margintable} - \centering - \captionof{table}{} - \label{rat:tab:spaghetti} - \begin{tabular}{cc} - \beforeheading - \heading{$x$} & \heading{$y$} \\ - \afterheading - $1$ & \\\normalline - $2$ & \\\normalline - $3$ & \\\normalline - $4$ & \\\normalline - $5$ & \\\normalline - $6$ & \\\normalline - $7$ & \\\normalline - $8$ & \\\normalline - $9$ & \\\normalline - $10$ & \\\lastline - \end{tabular} - \end{margintable} - \begin{subproblem}\label{rat:prob:spaggt1} - Help the Queen complete \cref{rat:tab:spaghetti}, and use $2$ digits after the decimal - where appropriate. - \begin{shortsolution} - \begin{tabular}[t]{ld{2}} - \beforeheading - \heading{$x$} & \heading{$y$} \\ - \afterheading - $1$ & 100 \\\normalline - $2$ & 50 \\\normalline - $3$ & 33.33 \\\normalline - $4$ & 25 \\\normalline - $5$ & 20 \\\normalline - $6$ & 16.67 \\\normalline - $7$ & 14.29 \\\normalline - $8$ & 12.50 \\\normalline - $9$ & 11.11 \\\normalline - $10$ & 10 \\\lastline - \end{tabular} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - What do you notice about the number of $\unit{mg}$ that it takes to break - the spaghetti as $x$ increases? - \begin{shortsolution} - It seems that the number of $\unit{mg}$ that it takes to break the spaghetti decreases - as $x$ increases. - \end{shortsolution} - \end{subproblem} - \begin{subproblem}\label{rat:prob:spaglt1} - The Queen wonders what happens when $x$ gets very small| help the Queen construct - a table of values for $x$ and $y$ when $x=0.0001, 0.001, 0.01, 0.1, 0.5, 1$. - \begin{shortsolution} - \begin{tabular}[t]{d{2}l} - \beforeheading - \heading{$x$} & \heading{$y$} \\ - \afterheading - 0.0001 & $1000000$ \\\normalline - 0.001 & $100000$ \\\normalline - 0.01 & $10000$ \\\normalline - 0.1 & $1000$ \\\normalline - 0.5 & $200$ \\\normalline - 1 & $100$ \\\lastline - \end{tabular} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - What do you notice about the number of $\unit{mg}$ that it takes to break the spaghetti - as $x\rightarrow 0$? Would it ever make sense to let $x=0$? - \begin{shortsolution} - The number of $\unit{mg}$ required to break the spaghetti increases as $x\rightarrow 0$. - We can not allow $x$ to be $0$, as we can not divide by $0$, and we can not - be $0$ inches from the edge of the table. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Plot your results from \cref{rat:prob:spaggt1,rat:prob:spaglt1} on the same graph, - and join the points using a smooth curve| set the maximum value of $y$ as $200$, and - note that this necessarily means that you will not be able to plot all of the points. - \begin{shortsolution} - The graph of $y=\frac{100}{x}$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-2,xmax=11, - ymin=-20,ymax=200, - xtick={2,4,...,10}, - ytick={20,40,...,180}, - grid=major, - width=\solutionfigurewidth, - ] - \addplot+[-] expression[domain=0.5:10]{100/x}; - \addplot[soldot] coordinates{(0.5,200)(1,100)(2,50)(3,33.33) - (4,25)(5,20)(16.67)(7,14.29)(8,12.50)(9,11.11)(10,10)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Using your graph, observe what happens to $y$ as $x$ increases. If we could somehow - construct a piece of uncooked spaghetti that was $\unit[101]{inches}$ long, how many - $\unit{mg}$ would it take to break the spaghetti? - \begin{shortsolution} - As $x$ increases, $y\rightarrow 0$. If we could construct a piece of spaghetti - $\unit[101]{inches}$ long, it would only take $\unit[1]{mg}$ to break it $\left(\frac{100}{100}=1\right)$. Of course, - the weight of spaghetti would probably cause it to break without the weight. - \end{shortsolution} - \end{subproblem} - The Queen looks forward to more food-related investigations from her jester. - \end{problem} - - - - %=================================== - % Author: Adams (Hughes) - % Date: March 2012 - %=================================== - \begin{problem}[Debt Amortization] - To amortize a debt means to pay it off in a given length of time using - equal periodic payments. The payments include interest on the unpaid - balance. The following formula gives the monthly payment, $M$, in dollars - that is necessary to amortize a debt of $P$ dollars in $n$ months - at a monthly interest rate of $i$ - \[ - M=\frac{P\cdot i}{1-(1+i)^{-n}} - \] - Use this formula in each of the following problems. - \begin{subproblem} - What monthly payments are necessary on a credit card debt of \$2000 at - $\unit[1.5]{\%}$ monthly if you want to pay off the debt in $2$ years? - In one year? How much money will you save by paying off the debt in the - shorter amount of time? - \begin{shortsolution} - Paying off the debt in $2$ years, we use - \begin{align*} - M & = \frac{2000\cdot 0.015}{1-(1+0.015)^{-24}} \\ - & \approx 99.85 - \end{align*} - The monthly payments are \$99.85. - - Paying off the debt in $1$ year, we use - \begin{align*} - M & = \frac{2000\cdot 0.015}{1-(1+0.015)^{-12}} \\ - & \approx 183.36 - \end{align*} - The monthly payments are \$183.36 - - In the $2$-year model we would pay a total of $\$99.85\cdot 12=\$2396.40$. In the - $1$-year model we would pay a total of $\$183.36\cdot 12=\$2200.32$. We would therefore - save $\$196.08$ if we went with the $1$-year model instead of the $2$-year model. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - To purchase a home, a family needs a loan of \$300,000 at $\unit[5.2]{\%}$ - annual interest. Compare a $20$ year loan to a $30$ year loan and make - a recommendation for the family. - (Note: when given an annual interest rate, it is a common business practice to divide by - $12$ to get a monthly rate.) - \begin{shortsolution} - For the $20$-year loan we use + Rational functions have a vertical asymptote at $a$ if the denominator is $0$ at $a$. + What happens if the numerator is $0$ at the same place? In this case, we say that the rational + function has a \emph{hole} at $a$. + \begin{pccdefinition}[Holes] + The rational function + \[ + r(x)=\frac{p(x)}{q(x)} + \] + has a hole at $a$ if $p(a)=q(a)=0$. Note that holes are different from + a vertical asymptotes. We represent that $r$ has a hole at the point + $(a,r(a))$ on the curve $y=r(x)$ by + using a hollow circle, $\circ$. + \end{pccdefinition} + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample} + \pccname{Mohammed} and \pccname{Sue} have graphed the function $r$ that has formula + \[ + r(x)=\frac{x^2+x-6}{(x-2)} + \] + in their calculators, and can not decide if the correct graph + is \cref{rat:fig:hole} or \cref{rat:fig:hole1}. + + Luckily for them, Oscar is nearby, and can help them settle the debate. + Oscar demonstrates that \begin{align*} - M & = \frac{300000\cdot \frac{0.052}{12}}{1-\left( 1+\frac{0.052}{12} \right)^{-12\cdot 20}} \\ - & \approx 2013.16 + r(x) & =\frac{(x+3)(x-2)}{(x-2)} \\ + & = x+3 \end{align*} - The monthly payments are \$2013.16. - - For the $30$-year loan we use + but only when $x\ne 2$, because the function is undefined at $2$. Oscar + says that this necessarily means that the domain or $r$ is + \[ + (-\infty,2)\cup(2,\infty) + \] + and that $r$ must have a hole at $2$. + + Mohammed and Sue are very grateful for the clarification, and conclude that + the graph of $r$ is shown in \cref{rat:fig:hole1}. + \begin{figure}[!htb] + \begin{minipage}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-4,...,8}, + ytick={-8,-4,...,8}, + grid=both, + width=\textwidth, + ] + \addplot expression[domain=-10:7]{x+3}; + \addplot[soldot] coordinates{(-3,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:hole} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-4,...,8}, + ytick={-8,-4,...,8}, + grid=both, + width=\textwidth, + ] + \addplot expression[domain=-10:7]{x+3}; + \addplot[holdot] coordinates{(2,5)}; + \addplot[soldot] coordinates{(-3,0)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:hole1} + \end{minipage}% + \end{figure} + \end{pccexample} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{pccexample} + Consider the function $f$ that has formula + \[ + f(x)=\frac{x(x+3)}{x^2-4x} + \] + The domain of $f$ is $(-\infty,0)\cup(0,4)\cup(4,\infty)$ because both $0$ and $4$ + make the denominator equal to $0$. Notice that \begin{align*} - M & = \frac{300000\cdot \frac{0.052}{12}}{1-\left( 1+\frac{0.052}{12} \right)^{-12\cdot 30}} \\ - & \approx 1647.33 + f(x) & = \frac{x(x+3)}{x(x-4)} \\ + & = \frac{x+3}{x-4} \end{align*} - The monthly payments are \$1647.33. - - The total amount paid during the $20$-year loan is $\$2013.16\cdot 12\cdot 20=\$483,158.40$. - The total amount paid during the $30$-year loan is $\$1647.33\cdot 12\cdot 30=\$593,038.80$. - - Recommendation: if you can afford the payments, choose the $20$-year loan. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - \pccname{Ellen} wants to make monthly payments of \$100 to pay off a debt of \$3000 - at \unit[12]{\%} annual interest. How long will it take her to pay off the - debt? - \begin{shortsolution} - We are given $M=100$, $P=3000$, $i=0.01$, and we need to find $n$ - in the equation + provided that $x\ne 0$. Since $0$ makes the numerator + and the denominator 0 at the same time, we say that $f$ has a hole at $(0,-\nicefrac{3}{4})$. + Note that this necessarily means that $f$ does not have a vertical intercept. + + We also note $f$ has a vertical asymptote at $4$; the function is graphed in \cref{rat:fig:holeex}. + \begin{figure}[!htb] + \centering + \begin{tikzpicture}[/pgf/declare function={f=(x+3)/(x-4);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=both, + ] + \addplot[pccplot] expression[domain=-10:3.36364,samples=50]{f}; + \addplot[pccplot] expression[domain=4.77:10]{f}; + \addplot[asymptote,domain=-10:10]({4},{x}); + \addplot[holdot]coordinates{(0,-0.75)}; + \addplot[soldot] coordinates{(-3,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=\dfrac{x(x+3)}{x^2-4x}$} + \label{rat:fig:holeex} + \end{figure} + \end{pccexample} + + + + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{pccexample}[Minimums and maximums] + \pccname{Seamus} and \pccname{Trang} are discussing rational functions. Seamus says that + if a rational function has a vertical asymptote, then it can + not possibly have local minimums and maximums, nor can it have + global minimums and maximums. + + Trang says this statement is not always true. She plots the functions + $f$ and $g$ that have formulas \[ - 100 = \frac{3000\cdot 0.01}{1-(1+0.01)^{-n}} + f(x)=-\frac{32(x-1)(x+1)}{(x-2)^2(x+2)^2}, \qquad g(x)=\frac{32(x-1)(x+1)}{(x-2)^2(x+2)^2} \] - Using logarithms, we find that $n\approx 36$. It will take - Ellen about $3$ years to pay off the debt. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - \pccname{Jake} is going to buy a new car. He puts \$2000 down and wants to finance the - remaining \$14,000. The dealer will offer him \unit[4]{\%} annual interest for - $5$ years, or a \$2000 - rebate which he can use to reduce the amount of the loan and \unit[8]{\%} - annual interest for 5 years. Which should he choose? - \begin{shortsolution} - \begin{description} - \item[Option 1:] $\unit[4]{\%}$ annual interest for $5$ years on \$14,000. - This means that the monthly payments will be calculated using - \begin{align*} - M & = \frac{14000\cdot \frac{0.04}{12}}{1-\left( 1+\frac{0.04}{12} \right)^{-12\cdot 5}} \\ - & \approx 257.83 - \end{align*} - The monthly payments will be $\$257.83$. The total amount paid will be - $\$257.83\cdot 5\cdot 12=\$15,469.80$, of which $\$1469.80$ is interest. - \item[Option 2:] $\unit[8]{\%}$ annual interest for $5$ years on \$12,000. - This means that the monthly payments will be calculated using - \begin{align*} - M & = \frac{12000\cdot \frac{0.08}{12}}{1-\left( 1+\frac{0.08}{12} \right)^{-12\cdot 5}} \\ - & \approx 243.32 - \end{align*} - The monthly payments will be $\$243.32$. The total amount paid - will be $\$243.32\cdot 5\cdot 12 =\$14,599.20$, of which $\$2599.2$ is - interest. - \end{description} - Jake should choose option 1 to minimize the amount of interest - he has to pay. - \end{shortsolution} - \end{subproblem} - \end{problem} - - \begin{exercises} - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{problem}[Rational or not] - Decide if each of the following functions are rational or not. If - they are rational, state their domain. - \begin{multicols}{3} - \begin{subproblem} - $r(x)=\dfrac{3}{x}$ - \begin{shortsolution} - $r$ is rational; the domain of $r$ is $(-\infty,0)\cup (0,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $s(y)=\dfrac{y}{6}$ - \begin{shortsolution} - $s$ is not rational ($s$ is linear). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $t(z)=\dfrac{4-x}{7-8z}$ - \begin{shortsolution} - $t$ is rational; the domain of $t$ is $\left( -\infty,\dfrac{7}{8} \right)\cup \left( \dfrac{7}{8},\infty \right)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $u(w)=\dfrac{w^2}{(w-3)(w+4)}$ - \begin{shortsolution} - $u$ is rational; the domain of $w$ is $(-\infty,-4)\cup(-4,3)\cup(3,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $v(x)=\dfrac{4}{(x-2)^2}$ - \begin{shortsolution} - $v$ is rational; the domain of $v$ is $(-\infty,2)\cup(2,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $w(x)=\dfrac{9-x}{x+17}$ - \begin{shortsolution} - $w$ is rational; the domain of $w$ is $(-\infty,-17)\cup(-17,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $a(x)=x^2+4$ - \begin{shortsolution} - $a$ is not rational ($a$ is quadratic, or a polynomial of degree $2$). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $b(y)=3^y$ - \begin{shortsolution} - $b$ is not rational ($b$ is exponential). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $c(z)=\dfrac{z^2}{z^3}$ - \begin{shortsolution} - $c$ is rational; the domain of $c$ is $(-\infty,0)\cup (0,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $d(x)=x^2(x+3)(5x-7)$ - \begin{shortsolution} - $d$ is not rational ($d$ is a polynomial). - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $e(\alpha)=\dfrac{\alpha^2}{\alpha^2-1}$ - \begin{shortsolution} - $e$ is rational; the domain of $e$ is $(-\infty,-1)\cup(-1,1)\cup(1,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $f(\beta)=\dfrac{3}{4}$ + in \cref{rat:fig:minmax1,rat:fig:minmax2} and shows them to Seamus. On seeing the graphs, + Seamus quickly corrects himself, and says that $f$ has a local (and global) + maximum of $2$ at $0$, and that $g$ has a local (and global) minimum of $-2$ at $0$. + + \begin{figure}[!htb] + \begin{minipage}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=-32*(x-1)*(x+1)/(( x-2)^2*(x+2)^2);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-3.01]{f}; + \addplot[pccplot] expression[domain=-1.45:1.45]{f}; + \addplot[pccplot] expression[domain=3.01:10]{f}; + \addplot[soldot] coordinates{(-1,0)(1,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=f(x)$} + \label{rat:fig:minmax1} + \end{minipage}% + \hfill + \begin{minipage}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=32*(x-1)*(x+1)/(( x-2)^2*(x+2)^2);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-3.01]{f}; + \addplot[pccplot] expression[domain=-1.45:1.45]{f}; + \addplot[pccplot] expression[domain=3.01:10]{f}; + \addplot[soldot] coordinates{(-1,0)(1,0)}; + \end{axis} + \end{tikzpicture} + \caption{$y=g(x)$} + \label{rat:fig:minmax2} + \end{minipage}% + \end{figure} + + Seamus also notes that (in its domain) the function $f$ is always concave down, and + that (in its domain) the function $g$ is always concave up. Furthermore, Trang + observes that each function behaves like $\frac{1}{x^2}$ around each of its vertical + asymptotes, because each linear factor in the denominator is raised to the power $2$. + + \pccname{Oscar} stops by and reminds both students about the long-run behavior; according + to \cref{rat:def:longrun} since the degree of the denominator is greater than the + degree of the numerator (in both functions), each function has a horizontal asymptote + at $y=0$. + \end{pccexample} + + + \investigation*{} + %=================================== + % Author: Pettit/Hughes + % Date: March 2012 + %=================================== + \begin{problem}[The spaghetti incident] + The same Queen from \vref{exp:prob:queenschessboard} has recovered from + the rice experiments, and has called her loyal jester for another challenge. + + The jester has an $11-$inch piece of uncooked spaghetti that he puts on a table; + he uses a book to cover $\unit[1]{inch}$ of it so that + $\unit[10]{inches}$ hang over the edge. The jester then produces a box of $\unit{mg}$ + weights that can be hung from the spaghetti. + + The jester says it will take $\unit[y]{mg}$ to break the spaghetti when hung + $\unit[x]{inches}$ from the edge, according to the rule $y=\frac{100}{x}$. + \begin{margintable} + \centering + \captionof{table}{} + \label{rat:tab:spaghetti} + \begin{tabular}{cc} + \beforeheading + \heading{$x$} & \heading{$y$} \\ + \afterheading + $1$ & \\\normalline + $2$ & \\\normalline + $3$ & \\\normalline + $4$ & \\\normalline + $5$ & \\\normalline + $6$ & \\\normalline + $7$ & \\\normalline + $8$ & \\\normalline + $9$ & \\\normalline + $10$ & \\\lastline + \end{tabular} + \end{margintable} + \begin{subproblem}\label{rat:prob:spaggt1} + Help the Queen complete \cref{rat:tab:spaghetti}, and use $2$ digits after the decimal + where appropriate. \begin{shortsolution} - $f$ is not rational ($f$ is constant). + \begin{tabular}[t]{ld{2}} + \beforeheading + \heading{$x$} & \heading{$y$} \\ + \afterheading + $1$ & 100 \\\normalline + $2$ & 50 \\\normalline + $3$ & 33.33 \\\normalline + $4$ & 25 \\\normalline + $5$ & 20 \\\normalline + $6$ & 16.67 \\\normalline + $7$ & 14.29 \\\normalline + $8$ & 12.50 \\\normalline + $9$ & 11.11 \\\normalline + $10$ & 10 \\\lastline + \end{tabular} \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{problem}[Function evaluation] - Let $r$ be the function that has formula - \[ - r(x)=\frac{(x-2)(x+3)}{(x+5)(x-7)} - \] - Evaluate each of the following (if possible); if the value is undefined, - then state so. - \begin{multicols}{4} \begin{subproblem} - $r(0)$ + What do you notice about the number of $\unit{mg}$ that it takes to break + the spaghetti as $x$ increases? \begin{shortsolution} - $\begin{aligned}[t] - r(0) & =\frac{(0-2)(0+3)}{(0+5)(0-7)} \\ - & =\frac{-6}{-35} \\ - & =\frac{6}{35} - \end{aligned}$ + It seems that the number of $\unit{mg}$ that it takes to break the spaghetti decreases + as $x$ increases. \end{shortsolution} \end{subproblem} - \begin{subproblem} - $r(1)$ + \begin{subproblem}\label{rat:prob:spaglt1} + The Queen wonders what happens when $x$ gets very small| help the Queen construct + a table of values for $x$ and $y$ when $x=0.0001, 0.001, 0.01, 0.1, 0.5, 1$. \begin{shortsolution} - $\begin{aligned}[t] - r(1) & =\frac{(1-2)(1+3)}{(1+5)(1-7)} \\ - & =\frac{-4}{-36} \\ - & =\frac{1}{9} - \end{aligned}$ + \begin{tabular}[t]{d{2}l} + \beforeheading + \heading{$x$} & \heading{$y$} \\ + \afterheading + 0.0001 & $1000000$ \\\normalline + 0.001 & $100000$ \\\normalline + 0.01 & $10000$ \\\normalline + 0.1 & $1000$ \\\normalline + 0.5 & $200$ \\\normalline + 1 & $100$ \\\lastline + \end{tabular} \end{shortsolution} \end{subproblem} \begin{subproblem} - $r(2)$ + What do you notice about the number of $\unit{mg}$ that it takes to break the spaghetti + as $x\rightarrow 0$? Would it ever make sense to let $x=0$? \begin{shortsolution} - $\begin{aligned}[t] - r(2) & =\frac{(2-2)(2+3)}{(2+5)(2-7)} \\ - & = \frac{0}{-50} \\ - & =0 - \end{aligned}$ + The number of $\unit{mg}$ required to break the spaghetti increases as $x\rightarrow 0$. + We can not allow $x$ to be $0$, as we can not divide by $0$, and we can not + be $0$ inches from the edge of the table. \end{shortsolution} \end{subproblem} \begin{subproblem} - $r(4)$ + Plot your results from \cref{rat:prob:spaggt1,rat:prob:spaglt1} on the same graph, + and join the points using a smooth curve| set the maximum value of $y$ as $200$, and + note that this necessarily means that you will not be able to plot all of the points. \begin{shortsolution} - $\begin{aligned}[t] - r(4) & =\frac{(4-2)(4+3)}{(4+5)(4-7)} \\ - & =\frac{14}{-27} \\ - & =-\frac{14}{27} - \end{aligned}$ + The graph of $y=\frac{100}{x}$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-2,xmax=11, + ymin=-20,ymax=200, + xtick={2,4,...,10}, + ytick={20,40,...,180}, + grid=major, + width=\solutionfigurewidth, + ] + \addplot+[-] expression[domain=0.5:10]{100/x}; + \addplot[soldot] coordinates{(0.5,200)(1,100)(2,50)(3,33.33) + (4,25)(5,20)(16.67)(7,14.29)(8,12.50)(9,11.11)(10,10)}; + \end{axis} + \end{tikzpicture} \end{shortsolution} \end{subproblem} \begin{subproblem} - $r(7)$ + Using your graph, observe what happens to $y$ as $x$ increases. If we could somehow + construct a piece of uncooked spaghetti that was $\unit[101]{inches}$ long, how many + $\unit{mg}$ would it take to break the spaghetti? \begin{shortsolution} - $\begin{aligned}[t] - r(7) & =\frac{(7-2)(7+3)}{(7+5)(7-7)} \\ - & =\frac{50}{0} - \end{aligned}$ - - $r(7)$ is undefined. + As $x$ increases, $y\rightarrow 0$. If we could construct a piece of spaghetti + $\unit[101]{inches}$ long, it would only take $\unit[1]{mg}$ to break it $\left(\frac{100}{100}=1\right)$. Of course, + the weight of spaghetti would probably cause it to break without the weight. \end{shortsolution} \end{subproblem} + The Queen looks forward to more food-related investigations from her jester. + \end{problem} + + + + %=================================== + % Author: Adams (Hughes) + % Date: March 2012 + %=================================== + \begin{problem}[Debt Amortization] + To amortize a debt means to pay it off in a given length of time using + equal periodic payments. The payments include interest on the unpaid + balance. The following formula gives the monthly payment, $M$, in dollars + that is necessary to amortize a debt of $P$ dollars in $n$ months + at a monthly interest rate of $i$ + \[ + M=\frac{P\cdot i}{1-(1+i)^{-n}} + \] + Use this formula in each of the following problems. \begin{subproblem} - $r(-3)$ + What monthly payments are necessary on a credit card debt of \$2000 at + $\unit[1.5]{\%}$ monthly if you want to pay off the debt in $2$ years? + In one year? How much money will you save by paying off the debt in the + shorter amount of time? \begin{shortsolution} - $\begin{aligned}[t] - r(-3) & =\frac{(-3-2)(-3+3)}{(-3+5)(-3-7)} \\ - & =\frac{0}{-20} \\ - & =0 - \end{aligned}$ + Paying off the debt in $2$ years, we use + \begin{align*} + M & = \frac{2000\cdot 0.015}{1-(1+0.015)^{-24}} \\ + & \approx 99.85 + \end{align*} + The monthly payments are \$99.85. + + Paying off the debt in $1$ year, we use + \begin{align*} + M & = \frac{2000\cdot 0.015}{1-(1+0.015)^{-12}} \\ + & \approx 183.36 + \end{align*} + The monthly payments are \$183.36 + + In the $2$-year model we would pay a total of $\$99.85\cdot 12=\$2396.40$. In the + $1$-year model we would pay a total of $\$183.36\cdot 12=\$2200.32$. We would therefore + save $\$196.08$ if we went with the $1$-year model instead of the $2$-year model. \end{shortsolution} \end{subproblem} \begin{subproblem} - $r(-5)$ + To purchase a home, a family needs a loan of \$300,000 at $\unit[5.2]{\%}$ + annual interest. Compare a $20$ year loan to a $30$ year loan and make + a recommendation for the family. + (Note: when given an annual interest rate, it is a common business practice to divide by + $12$ to get a monthly rate.) \begin{shortsolution} - $\begin{aligned}[t] - r(-5) & =\frac{(-5-2)(-5+3)}{(-5+5)(-5-7)} \\ - & =\frac{14}{0} - \end{aligned}$ - - $r(-5)$ is undefined. + For the $20$-year loan we use + \begin{align*} + M & = \frac{300000\cdot \frac{0.052}{12}}{1-\left( 1+\frac{0.052}{12} \right)^{-12\cdot 20}} \\ + & \approx 2013.16 + \end{align*} + The monthly payments are \$2013.16. + + For the $30$-year loan we use + \begin{align*} + M & = \frac{300000\cdot \frac{0.052}{12}}{1-\left( 1+\frac{0.052}{12} \right)^{-12\cdot 30}} \\ + & \approx 1647.33 + \end{align*} + The monthly payments are \$1647.33. + + The total amount paid during the $20$-year loan is $\$2013.16\cdot 12\cdot 20=\$483,158.40$. + The total amount paid during the $30$-year loan is $\$1647.33\cdot 12\cdot 30=\$593,038.80$. + + Recommendation: if you can afford the payments, choose the $20$-year loan. \end{shortsolution} \end{subproblem} \begin{subproblem} - $r\left( \frac{1}{2} \right)$ + \pccname{Ellen} wants to make monthly payments of \$100 to pay off a debt of \$3000 + at \unit[12]{\%} annual interest. How long will it take her to pay off the + debt? \begin{shortsolution} - $\begin{aligned}[t] - r\left( \frac{1}{2} \right) & = \frac{\left( \frac{1}{2}-2 \right)\left( \frac{1}{2}+3 \right)}{\left( \frac{1}{2}+5 \right)\left( \frac{1}{2}-7 \right)} \\ - & =\frac{-\frac{3}{2}\cdot\frac{7}{2}}{\frac{11}{2}\left( -\frac{13}{2} \right)} \\ - & =\frac{-\frac{21}{4}}{-\frac{143}{4}} \\ - & =\frac{37}{143} - \end{aligned}$ + We are given $M=100$, $P=3000$, $i=0.01$, and we need to find $n$ + in the equation + \[ + 100 = \frac{3000\cdot 0.01}{1-(1+0.01)^{-n}} + \] + Using logarithms, we find that $n\approx 36$. It will take + Ellen about $3$ years to pay off the debt. \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - %=================================== - % Author: Hughes - % Date: March 2012 - %=================================== - \begin{problem}[Holes or asymptotes?] - State the domain of each of the following rational functions. Identify - any holes or asymptotes. - \begin{multicols}{3} \begin{subproblem} - $f(x)=\dfrac{12}{x-2}$ + \pccname{Jake} is going to buy a new car. He puts \$2000 down and wants to finance the + remaining \$14,000. The dealer will offer him \unit[4]{\%} annual interest for + $5$ years, or a \$2000 + rebate which he can use to reduce the amount of the loan and \unit[8]{\%} + annual interest for 5 years. Which should he choose? \begin{shortsolution} - $f$ has a vertical asymptote at $2$; the domain of $f$ is $(-\infty,2)\cup (2,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $g(x)=\dfrac{x^2+x}{(x+1)(x-2)}$ - \begin{shortsolution} - $g$ has a vertical asymptote at $2$, and a hole at $-1$; the domain of $g$ is $(-\infty,-1)\cup(-1,2)\cup(2,\infty)$. + \begin{description} + \item[Option 1:] $\unit[4]{\%}$ annual interest for $5$ years on \$14,000. + This means that the monthly payments will be calculated using + \begin{align*} + M & = \frac{14000\cdot \frac{0.04}{12}}{1-\left( 1+\frac{0.04}{12} \right)^{-12\cdot 5}} \\ + & \approx 257.83 + \end{align*} + The monthly payments will be $\$257.83$. The total amount paid will be + $\$257.83\cdot 5\cdot 12=\$15,469.80$, of which $\$1469.80$ is interest. + \item[Option 2:] $\unit[8]{\%}$ annual interest for $5$ years on \$12,000. + This means that the monthly payments will be calculated using + \begin{align*} + M & = \frac{12000\cdot \frac{0.08}{12}}{1-\left( 1+\frac{0.08}{12} \right)^{-12\cdot 5}} \\ + & \approx 243.32 + \end{align*} + The monthly payments will be $\$243.32$. The total amount paid + will be $\$243.32\cdot 5\cdot 12 =\$14,599.20$, of which $\$2599.2$ is + interest. + \end{description} + Jake should choose option 1 to minimize the amount of interest + he has to pay. \end{shortsolution} \end{subproblem} + \end{problem} + + \begin{exercises} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Rational or not] + Decide if each of the following functions are rational or not. If + they are rational, state their domain. + \begin{multicols}{3} + \begin{subproblem} + $r(x)=\dfrac{3}{x}$ + \begin{shortsolution} + $r$ is rational; the domain of $r$ is $(-\infty,0)\cup (0,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $s(y)=\dfrac{y}{6}$ + \begin{shortsolution} + $s$ is not rational ($s$ is linear). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $t(z)=\dfrac{4-x}{7-8z}$ + \begin{shortsolution} + $t$ is rational; the domain of $t$ is $\left( -\infty,\dfrac{7}{8} \right)\cup \left( \dfrac{7}{8},\infty \right)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $u(w)=\dfrac{w^2}{(w-3)(w+4)}$ + \begin{shortsolution} + $u$ is rational; the domain of $w$ is $(-\infty,-4)\cup(-4,3)\cup(3,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $v(x)=\dfrac{4}{(x-2)^2}$ + \begin{shortsolution} + $v$ is rational; the domain of $v$ is $(-\infty,2)\cup(2,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $w(x)=\dfrac{9-x}{x+17}$ + \begin{shortsolution} + $w$ is rational; the domain of $w$ is $(-\infty,-17)\cup(-17,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $a(x)=x^2+4$ + \begin{shortsolution} + $a$ is not rational ($a$ is quadratic, or a polynomial of degree $2$). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $b(y)=3^y$ + \begin{shortsolution} + $b$ is not rational ($b$ is exponential). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $c(z)=\dfrac{z^2}{z^3}$ + \begin{shortsolution} + $c$ is rational; the domain of $c$ is $(-\infty,0)\cup (0,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $d(x)=x^2(x+3)(5x-7)$ + \begin{shortsolution} + $d$ is not rational ($d$ is a polynomial). + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $e(\alpha)=\dfrac{\alpha^2}{\alpha^2-1}$ + \begin{shortsolution} + $e$ is rational; the domain of $e$ is $(-\infty,-1)\cup(-1,1)\cup(1,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $f(\beta)=\dfrac{3}{4}$ + \begin{shortsolution} + $f$ is not rational ($f$ is constant). + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Function evaluation] + Let $r$ be the function that has formula + \[ + r(x)=\frac{(x-2)(x+3)}{(x+5)(x-7)} + \] + Evaluate each of the following (if possible); if the value is undefined, + then state so. + \begin{multicols}{4} + \begin{subproblem} + $r(0)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(0) & =\frac{(0-2)(0+3)}{(0+5)(0-7)} \\ + & =\frac{-6}{-35} \\ + & =\frac{6}{35} + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(1)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(1) & =\frac{(1-2)(1+3)}{(1+5)(1-7)} \\ + & =\frac{-4}{-36} \\ + & =\frac{1}{9} + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(2)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(2) & =\frac{(2-2)(2+3)}{(2+5)(2-7)} \\ + & = \frac{0}{-50} \\ + & =0 + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(4)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(4) & =\frac{(4-2)(4+3)}{(4+5)(4-7)} \\ + & =\frac{14}{-27} \\ + & =-\frac{14}{27} + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(7)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(7) & =\frac{(7-2)(7+3)}{(7+5)(7-7)} \\ + & =\frac{50}{0} + \end{aligned}$ + + $r(7)$ is undefined. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(-3)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(-3) & =\frac{(-3-2)(-3+3)}{(-3+5)(-3-7)} \\ + & =\frac{0}{-20} \\ + & =0 + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r(-5)$ + \begin{shortsolution} + $\begin{aligned}[t] + r(-5) & =\frac{(-5-2)(-5+3)}{(-5+5)(-5-7)} \\ + & =\frac{14}{0} + \end{aligned}$ + + $r(-5)$ is undefined. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $r\left( \frac{1}{2} \right)$ + \begin{shortsolution} + $\begin{aligned}[t] + r\left( \frac{1}{2} \right) & = \frac{\left( \frac{1}{2}-2 \right)\left( \frac{1}{2}+3 \right)}{\left( \frac{1}{2}+5 \right)\left( \frac{1}{2}-7 \right)} \\ + & =\frac{-\frac{3}{2}\cdot\frac{7}{2}}{\frac{11}{2}\left( -\frac{13}{2} \right)} \\ + & =\frac{-\frac{21}{4}}{-\frac{143}{4}} \\ + & =\frac{37}{143} + \end{aligned}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + %=================================== + % Author: Hughes + % Date: March 2012 + %=================================== + \begin{problem}[Holes or asymptotes?] + State the domain of each of the following rational functions. Identify + any holes or asymptotes. + \begin{multicols}{3} + \begin{subproblem} + $f(x)=\dfrac{12}{x-2}$ + \begin{shortsolution} + $f$ has a vertical asymptote at $2$; the domain of $f$ is $(-\infty,2)\cup (2,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $g(x)=\dfrac{x^2+x}{(x+1)(x-2)}$ + \begin{shortsolution} + $g$ has a vertical asymptote at $2$, and a hole at $-1$; the domain of $g$ is $(-\infty,-1)\cup(-1,2)\cup(2,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $h(x)=\dfrac{x^2+5x+4}{x^2+x-12}$ + \begin{shortsolution} + $h$ has a vertical asymptote at $3$, and a whole at $-4$; the domain of $h$ is $(-\infty,-4)\cup(-4,3)\cup(3,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $k(z)=\dfrac{z+2}{2z-3}$ + \begin{shortsolution} + $k$ has a vertical asymptote at $\dfrac{3}{2}$; the domain of $k$ is $\left( -\infty,\dfrac{3}{2} \right)\cup\left( \dfrac{3}{2},\infty \right)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $l(w)=\dfrac{w}{w^2+1}$ + \begin{shortsolution} + $l$ does not have any vertical asymptotes nor holes; the domain of $w$ is $(-\infty,\infty)$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $m(t)=\dfrac{14}{13-t^2}$ + \begin{shortsolution} + $m$ has vertical asymptotes at $\pm\sqrt{13}$; the domain of $m$ is $(-\infty,\sqrt{13})\cup(-\sqrt{13},\sqrt{13})\cup(\sqrt{13},\infty)$. + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a graph] + Consider the rational functions graphed in \cref{rat:fig:findformula}. Find + the vertical asymptotes for each function, together with any zeros, and + give a possible formula for each. + \begin{shortsolution} + \begin{itemize} + \item \Vref{rat:fig:formula1}: possible formula is $r(x)=\dfrac{1}{x+5}$ + \item \Vref{rat:fig:formula2}: possible formula is $r(x)=\dfrac{(x+3)}{(x-5)}$ + \item \Vref{rat:fig:formula3}: possible formula is $r(x)=\dfrac{1}{(x-4)(x+3)}$. + \end{itemize} + \end{shortsolution} + \end{problem} + + \begin{figure}[!htb] + \begin{widepage} + \setlength{\figurewidth}{0.3\textwidth} + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=1/(x+4);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-6,ymax=6, + xtick={-8,-6,...,8}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-4.16667,samples=50]{f}; + \addplot[pccplot] expression[domain=-3.83333:10,samples=50]{f}; + \addplot[asymptote,domain=-6:6]({-4},{x}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:formula1} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=(x+3)/(x-5);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-6,ymax=6, + xtick={-8,-6,...,8}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:3.85714]{f}; + \addplot[pccplot] expression[domain=6.6:10]{f}; + \addplot[soldot] coordinates{(-3,0)}; + \addplot[asymptote,domain=-6:6]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{1}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:formula2} + \end{subfigure} + \hfill + \begin{subfigure}{\figurewidth} + \begin{tikzpicture}[/pgf/declare function={f=1/((x-4)*(x+3));}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-3,ymax=3, + xtick={-8,-6,...,8}, + minor ytick={-4,-3,...,4}, + grid=both, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-3.0473]{f}; + \addplot[pccplot] expression[domain=-2.95205:3.95205]{f}; + \addplot[pccplot] expression[domain=4.0473:10]{f}; + \addplot[asymptote,domain=-3:3]({-3},{x}); + \addplot[asymptote,domain=-3:3]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{0}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:formula3} + \end{subfigure} + \caption{} + \label{rat:fig:findformula} + \end{widepage} + \end{figure} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a description] + In each of the following problems, give a formula of a rational + function that has the listed properties. \begin{subproblem} - $h(x)=\dfrac{x^2+5x+4}{x^2+x-12}$ + Vertical asymptote at $2$. \begin{shortsolution} - $h$ has a vertical asymptote at $3$, and a whole at $-4$; the domain of $h$ is $(-\infty,-4)\cup(-4,3)\cup(3,\infty)$. + Possible option: $r(x)=\dfrac{1}{x-2}$. Note that we could multiply the + numerator or denominator by any real number and still have the desired properties. \end{shortsolution} \end{subproblem} \begin{subproblem} - $k(z)=\dfrac{z+2}{2z-3}$ + Vertical asymptote at $5$. \begin{shortsolution} - $k$ has a vertical asymptote at $\dfrac{3}{2}$; the domain of $k$ is $\left( -\infty,\dfrac{3}{2} \right)\cup\left( \dfrac{3}{2},\infty \right)$. + Possible option: $r(x)=\dfrac{1}{x-5}$. Note that we could multiply the + numerator or denominator by any real number and still have the desired properties. \end{shortsolution} \end{subproblem} \begin{subproblem} - $l(w)=\dfrac{w}{w^2+1}$ + Vertical asymptote at $-2$, and zero at $6$. \begin{shortsolution} - $l$ does not have any vertical asymptotes nor holes; the domain of $w$ is $(-\infty,\infty)$. + Possible option: $r(x)=\dfrac{x-6}{x+2}$. Note that we could multiply the + numerator or denominator by any real number and still have the desired properties. \end{shortsolution} \end{subproblem} \begin{subproblem} - $m(t)=\dfrac{14}{13-t^2}$ + Zeros at $2$ and $-5$ and vertical asymptotes at $1$ and $-7$. \begin{shortsolution} - $m$ has vertical asymptotes at $\pm\sqrt{13}$; the domain of $m$ is $(-\infty,\sqrt{13})\cup(-\sqrt{13},\sqrt{13})\cup(\sqrt{13},\infty)$. + Possible option: $r(x)=\dfrac{(x-2)(x+5)}{(x-1)(x+7)}$. Note that we could multiply the + numerator or denominator by any real number and still have the desired properties. \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Find a formula from a graph] - Consider the rational functions graphed in \cref{rat:fig:findformula}. Find - the vertical asymptotes for each function, together with any zeros, and - give a possible formula for each. - \begin{shortsolution} - \begin{itemize} - \item \Vref{rat:fig:formula1}: possible formula is $r(x)=\dfrac{1}{x+5}$ - \item \Vref{rat:fig:formula2}: possible formula is $r(x)=\dfrac{(x+3)}{(x-5)}$ - \item \Vref{rat:fig:formula3}: possible formula is $r(x)=\dfrac{1}{(x-4)(x+3)}$. - \end{itemize} - \end{shortsolution} - \end{problem} - - \begin{figure}[!htb] - \begin{widepage} - \setlength{\figurewidth}{0.3\textwidth} - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=1/(x+4);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-6,ymax=6, - xtick={-8,-6,...,8}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-4.16667,samples=50]{f}; - \addplot[pccplot] expression[domain=-3.83333:10,samples=50]{f}; - \addplot[asymptote,domain=-6:6]({-4},{x}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:formula1} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=(x+3)/(x-5);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-6,ymax=6, - xtick={-8,-6,...,8}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:3.85714]{f}; - \addplot[pccplot] expression[domain=6.6:10]{f}; - \addplot[soldot] coordinates{(-3,0)}; - \addplot[asymptote,domain=-6:6]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{1}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:formula2} - \end{subfigure} - \hfill - \begin{subfigure}{\figurewidth} - \begin{tikzpicture}[/pgf/declare function={f=1/((x-4)*(x+3));}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-3,ymax=3, - xtick={-8,-6,...,8}, - minor ytick={-4,-3,...,4}, - grid=both, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-3.0473]{f}; - \addplot[pccplot] expression[domain=-2.95205:3.95205]{f}; - \addplot[pccplot] expression[domain=4.0473:10]{f}; - \addplot[asymptote,domain=-3:3]({-3},{x}); - \addplot[asymptote,domain=-3:3]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{0}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:formula3} - \end{subfigure} - \caption{} - \label{rat:fig:findformula} - \end{widepage} - \end{figure} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Find a formula from a description] - In each of the following problems, give a formula of a rational - function that has the listed properties. - \begin{subproblem} - Vertical asymptote at $2$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{1}{x-2}$. Note that we could multiply the - numerator or denominator by any real number and still have the desired properties. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Vertical asymptote at $5$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{1}{x-5}$. Note that we could multiply the - numerator or denominator by any real number and still have the desired properties. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Vertical asymptote at $-2$, and zero at $6$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{x-6}{x+2}$. Note that we could multiply the - numerator or denominator by any real number and still have the desired properties. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Zeros at $2$ and $-5$ and vertical asymptotes at $1$ and $-7$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{(x-2)(x+5)}{(x-1)(x+7)}$. Note that we could multiply the - numerator or denominator by any real number and still have the desired properties. - \end{shortsolution} - \end{subproblem} - \end{problem} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Given formula, find horizontal asymptotes] - Each of the following functions has a horizontal asymptote. Write the equation - of the horizontal asymptote for each function. - \begin{multicols}{3} - \begin{subproblem} - $f(x) = \dfrac{1}{x}$ - \begin{shortsolution} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Given formula, find horizontal asymptotes] + Each of the following functions has a horizontal asymptote. Write the equation + of the horizontal asymptote for each function. + \begin{multicols}{3} + \begin{subproblem} + $f(x) = \dfrac{1}{x}$ + \begin{shortsolution} + $y=0$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $g(x) = \dfrac{2x+3}{x}$ + \begin{shortsolution} + $y=2$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $h(x) = \dfrac{x^2+2x}{x^2+3}$ + \begin{shortsolution} + $y=1$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $k(x) = \dfrac{x^2+7}{x}$ + \begin{shortsolution} + $y=1$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $l(x)=\dfrac{3x-2}{5x+8}$ + \begin{shortsolution} + $y=\dfrac{3}{5}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $m(x)=\dfrac{3x-2}{5x^2+8}$ + \begin{shortsolution} + $y=0$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $n(x)=\dfrac{(6x+1)(x-7)}{(11x-8)(x-5)}$ + \begin{shortsolution} + $y=\dfrac{6}{11}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $p(x)=\dfrac{19x^3}{5-x^4}$ + \begin{shortsolution} + $y=0$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $q(x)=\dfrac{14x^2+x}{1-7x^2}$ + \begin{shortsolution} + $y=-2$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2012 + %=================================== + \begin{problem}[Given horizontal asymptotes, find formula] + In each of the following problems, give a formula for a function that + has the given horizontal asymptote. Note that there may be more than one option. + \begin{multicols}{4} + \begin{subproblem} + $y=7$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{7(x-2)}{x+1}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $7$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=-1$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{5-x^2}{x^2+10}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $10$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=53$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{53x^3}{x^3+4x^2-7}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $53$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=-17$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{34(x+2)}{7-2x}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $-17$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=\dfrac{3}{2}$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{3x+4}{2(x+1)}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $\dfrac{3}{2}$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} $y=0$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $g(x) = \dfrac{2x+3}{x}$ - \begin{shortsolution} + \begin{shortsolution} + Possible option: $f(x)=\dfrac{4}{x}$. Note that there + are other options, provided that the degree of the numerator is less than the degree + of the denominator. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $y=-1$ + \begin{shortsolution} + Possible option: $f(x)=\dfrac{10x}{5-10x}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $-1$. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} $y=2$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $h(x) = \dfrac{x^2+2x}{x^2+3}$ - \begin{shortsolution} - $y=1$ - \end{shortsolution} - \end{subproblem} + \begin{shortsolution} + Possible option: $f(x)=\dfrac{8x-3}{4x+1}$. Note that there + are other options, provided that the degree of the numerator is the same as the degree + of the denominator, and that the ratio of the leading + coefficients is $2$. + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a description] + In each of the following problems, give a formula for a function that + has the prescribed properties. Note that there may be more than one option. \begin{subproblem} - $k(x) = \dfrac{x^2+7}{x}$ + $f(x)\rightarrow 3$ as $x\rightarrow\pm\infty$. \begin{shortsolution} - $y=1$ + Possible option: $f(x)=\dfrac{3(x-2)}{x+7}$. Note that + the zero and asymptote of $f$ could be changed, and $f$ would still have the desired properties. \end{shortsolution} \end{subproblem} \begin{subproblem} - $l(x)=\dfrac{3x-2}{5x+8}$ + $r(x)\rightarrow -4$ as $x\rightarrow\pm\infty$. \begin{shortsolution} - $y=\dfrac{3}{5}$ + Possible option: $r(x)=\dfrac{-4(x-2)}{x+7}$. Note that + the zero and asymptote of $r$ could be changed, and $r$ would still have the desired properties. \end{shortsolution} \end{subproblem} \begin{subproblem} - $m(x)=\dfrac{3x-2}{5x^2+8}$ + $k(x)\rightarrow 2$ as $x\rightarrow\pm\infty$, and $k$ has vertical asymptotes at $-3$ and $5$. \begin{shortsolution} - $y=0$ + Possible option: $k(x)=\dfrac{2x^2}{(x+3)(x-5)}$. Note that the denominator + must have the given factors; the numerator could be any degree $2$ polynomial, provided the + leading coefficient is $2$. \end{shortsolution} \end{subproblem} + \end{problem} + + %=================================== + % Author: Hughes + % Date: Feb 2011 + %=================================== + \begin{problem} + Let $r$ be the rational function that has + \[ + r(x) = \frac{(x+2)(x-1)}{(x+3)(x-4)} + \] + Each of the following questions are in relation to this function. \begin{subproblem} - $n(x)=\dfrac{(6x+1)(x-7)}{(11x-8)(x-5)}$ + What is the vertical intercept of this function? State your answer as an + ordered pair. \index{rational functions!vertical intercept} \begin{shortsolution} - $y=\dfrac{6}{11}$ + $\left(0,\frac{1}{6}\right)$ \end{shortsolution} \end{subproblem} - \begin{subproblem} - $p(x)=\dfrac{19x^3}{5-x^4}$ + \begin{subproblem}\label{rat:prob:rational} + What values of $x$ make the denominator equal to $0$? \begin{shortsolution} - $y=0$ + $-3,4$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $q(x)=\dfrac{14x^2+x}{1-7x^2}$ + Use your answer to \cref{rat:prob:rational} to write the domain of the function in + both interval, and set builder notation. %\index{rational functions!domain}\index{domain!rational functions} \begin{shortsolution} - $y=-2$ + Interval notation: $(-\infty,-3)\cup (-3,4)\cup (4,\infty)$. + Set builder: $\{x|x\ne -3, \mathrm{and}\, x\ne 4\}$ \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - - %=================================== - % Author: Hughes - % Date: May 2012 - %=================================== - \begin{problem}[Given horizontal asymptotes, find formula] - In each of the following problems, give a formula for a function that - has the given horizontal asymptote. Note that there may be more than one option. - \begin{multicols}{4} \begin{subproblem} - $y=7$ + What are the vertical asymptotes of the function? State your answers in + the form $x=$ \begin{shortsolution} - Possible option: $f(x)=\dfrac{7(x-2)}{x+1}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $7$. + $x=-3$ and $x=4$ \end{shortsolution} \end{subproblem} - \begin{subproblem} - $y=-1$ + \begin{subproblem}\label{rat:prob:zeroes} + What values of $x$ make the numerator equal to $0$? \begin{shortsolution} - Possible option: $f(x)=\dfrac{5-x^2}{x^2+10}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $10$. + $-2,1$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=53$ + Use your answer to \cref{rat:prob:zeroes} to write the horizontal intercepts of + $r$ as ordered pairs. \begin{shortsolution} - Possible option: $f(x)=\dfrac{53x^3}{x^3+4x^2-7}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $53$. + $(-2,0)$ and $(1,0)$ \end{shortsolution} \end{subproblem} + \end{problem} + + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Holes] + \pccname{Josh} and \pccname{Pedro} are discussing the function + \[ + r(x)=\frac{x^2-1}{(x+3)(x-1)} + \] \begin{subproblem} - $y=-17$ + What is the domain of $r$? \begin{shortsolution} - Possible option: $f(x)=\dfrac{34(x+2)}{7-2x}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $-17$. + The domain of $r$ is $(-\infty,-3)\cup(-3,1)\cup(1,\infty)$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=\dfrac{3}{2}$ + Josh notices that the numerator can be factored- can you see how? \begin{shortsolution} - Possible option: $f(x)=\dfrac{3x+4}{2(x+1)}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $\dfrac{3}{2}$. + $(x^2-1)=(x-1)(x+1)$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=0$ + Pedro asks, `Doesn't that just mean that + \[ + r(x)=\frac{x+1}{x+3} + \] + for all values of $x$?' Josh says, `Nearly\ldots but not for all values of $x$'. + What does Josh mean? \begin{shortsolution} - Possible option: $f(x)=\dfrac{4}{x}$. Note that there - are other options, provided that the degree of the numerator is less than the degree - of the denominator. + $r(x)=\dfrac{x+1}{x+3}$ provided that $x\ne -1$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=-1$ + Where does $r$ have vertical asymptotes, and where does it have holes? \begin{shortsolution} - Possible option: $f(x)=\dfrac{10x}{5-10x}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $-1$. + The function $r$ has a vertical asymptote at $-3$, and a hole at $1$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=2$ + Sketch a graph of $r$. \begin{shortsolution} - Possible option: $f(x)=\dfrac{8x-3}{4x+1}$. Note that there - are other options, provided that the degree of the numerator is the same as the degree - of the denominator, and that the ratio of the leading - coefficients is $2$. + A graph of $r$ is shown below. + + \begin{tikzpicture} + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-8,-6,...,8}, + ytick={-8,-6,...,8}, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot] expression[domain=-10:-3.25]{(x+1)/(x+3)}; + \addplot[pccplot] expression[domain=-2.75:10]{(x+1)/(x+3)}; + \addplot[asymptote,domain=-10:10]({-3},{x}); + \addplot[holdot]coordinates{(1,0.5)}; + \end{axis} + \end{tikzpicture} \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Find a formula from a description] - In each of the following problems, give a formula for a function that - has the prescribed properties. Note that there may be more than one option. - \begin{subproblem} - $f(x)\rightarrow 3$ as $x\rightarrow\pm\infty$. - \begin{shortsolution} - Possible option: $f(x)=\dfrac{3(x-2)}{x+7}$. Note that - the zero and asymptote of $f$ could be changed, and $f$ would still have the desired properties. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $r(x)\rightarrow -4$ as $x\rightarrow\pm\infty$. - \begin{shortsolution} - Possible option: $r(x)=\dfrac{-4(x-2)}{x+7}$. Note that - the zero and asymptote of $r$ could be changed, and $r$ would still have the desired properties. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $k(x)\rightarrow 2$ as $x\rightarrow\pm\infty$, and $k$ has vertical asymptotes at $-3$ and $5$. - \begin{shortsolution} - Possible option: $k(x)=\dfrac{2x^2}{(x+3)(x-5)}$. Note that the denominator - must have the given factors; the numerator could be any degree $2$ polynomial, provided the - leading coefficient is $2$. - \end{shortsolution} - \end{subproblem} - \end{problem} - - %=================================== - % Author: Hughes - % Date: Feb 2011 - %=================================== - \begin{problem} - Let $r$ be the rational function that has - \[ - r(x) = \frac{(x+2)(x-1)}{(x+3)(x-4)} - \] - Each of the following questions are in relation to this function. - \begin{subproblem} - What is the vertical intercept of this function? State your answer as an - ordered pair. \index{rational functions!vertical intercept} - \begin{shortsolution} - $\left(0,\frac{1}{6}\right)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem}\label{rat:prob:rational} - What values of $x$ make the denominator equal to $0$? - \begin{shortsolution} - $-3,4$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Use your answer to \cref{rat:prob:rational} to write the domain of the function in - both interval, and set builder notation. %\index{rational functions!domain}\index{domain!rational functions} - \begin{shortsolution} - Interval notation: $(-\infty,-3)\cup (-3,4)\cup (4,\infty)$. - Set builder: $\{x|x\ne -3, \mathrm{and}\, x\ne 4\}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - What are the vertical asymptotes of the function? State your answers in - the form $x=$ - \begin{shortsolution} - $x=-3$ and $x=4$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem}\label{rat:prob:zeroes} - What values of $x$ make the numerator equal to $0$? - \begin{shortsolution} - $-2,1$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Use your answer to \cref{rat:prob:zeroes} to write the horizontal intercepts of - $r$ as ordered pairs. - \begin{shortsolution} - $(-2,0)$ and $(1,0)$ - \end{shortsolution} - \end{subproblem} - \end{problem} - - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Holes] - \pccname{Josh} and \pccname{Pedro} are discussing the function - \[ - r(x)=\frac{x^2-1}{(x+3)(x-1)} - \] - \begin{subproblem} - What is the domain of $r$? - \begin{shortsolution} - The domain of $r$ is $(-\infty,-3)\cup(-3,1)\cup(1,\infty)$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Josh notices that the numerator can be factored- can you see how? - \begin{shortsolution} - $(x^2-1)=(x-1)(x+1)$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Pedro asks, `Doesn't that just mean that + \end{problem} + + %=================================== + % Author: Hughes + % Date: July 2012 + %=================================== + \begin{problem}[Function algebra] + Let $r$ and $s$ be the rational functions that have formulas \[ - r(x)=\frac{x+1}{x+3} + r(x)=\frac{2-x}{x+3}, \qquad s(x)=\frac{x^2}{x-4} \] - for all values of $x$?' Josh says, `Nearly\ldots but not for all values of $x$'. - What does Josh mean? - \begin{shortsolution} - $r(x)=\dfrac{x+1}{x+3}$ provided that $x\ne -1$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Where does $r$ have vertical asymptotes, and where does it have holes? - \begin{shortsolution} - The function $r$ has a vertical asymptote at $-3$, and a hole at $1$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Sketch a graph of $r$. - \begin{shortsolution} - A graph of $r$ is shown below. - - \begin{tikzpicture} - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-8,-6,...,8}, - ytick={-8,-6,...,8}, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot] expression[domain=-10:-3.25]{(x+1)/(x+3)}; - \addplot[pccplot] expression[domain=-2.75:10]{(x+1)/(x+3)}; - \addplot[asymptote,domain=-10:10]({-3},{x}); - \addplot[holdot]coordinates{(1,0.5)}; - \end{axis} - \end{tikzpicture} - \end{shortsolution} - \end{subproblem} - \end{problem} - - %=================================== - % Author: Hughes - % Date: July 2012 - %=================================== - \begin{problem}[Function algebra] - Let $r$ and $s$ be the rational functions that have formulas - \[ - r(x)=\frac{2-x}{x+3}, \qquad s(x)=\frac{x^2}{x-4} - \] - Evaluate each of the following (if possible). - \begin{multicols}{4} - \begin{subproblem} - $(r+s)(5)$ - \begin{shortsolution} - $\frac{197}{8}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(r-s)(3)$ - \begin{shortsolution} - $\frac{53}{6}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $(r\cdot s)(4)$ - \begin{shortsolution} - Undefined. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - $\left( \frac{r}{s} \right)(1)$ - \begin{shortsolution} - $-\frac{3}{4}$ - \end{shortsolution} - \end{subproblem} - \end{multicols} - \end{problem} - - - %=================================== - % Author: Hughes - % Date: July 2012 - %=================================== - \begin{problem}[Transformations: given the transformation, find the formula] - Let $r$ be the rational function that has formula. - \[ - r(x)=\frac{x+5}{2x-3} - \] - In each of the following problems apply the given transformation to the function $r$ and - write a formula for the transformed version of $r$. - \begin{multicols}{2} + Evaluate each of the following (if possible). + \begin{multicols}{4} + \begin{subproblem} + $(r+s)(5)$ + \begin{shortsolution} + $\frac{197}{8}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(r-s)(3)$ + \begin{shortsolution} + $\frac{53}{6}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $(r\cdot s)(4)$ + \begin{shortsolution} + Undefined. + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + $\left( \frac{r}{s} \right)(1)$ + \begin{shortsolution} + $-\frac{3}{4}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + + %=================================== + % Author: Hughes + % Date: July 2012 + %=================================== + \begin{problem}[Transformations: given the transformation, find the formula] + Let $r$ be the rational function that has formula. + \[ + r(x)=\frac{x+5}{2x-3} + \] + In each of the following problems apply the given transformation to the function $r$ and + write a formula for the transformed version of $r$. + \begin{multicols}{2} + \begin{subproblem} + Shift $r$ to the right by $3$ units. + \begin{shortsolution} + $r(x-3)=\frac{x+2}{2x-9}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $r$ to the left by $4$ units. + \begin{shortsolution} + $r(x+4)=\frac{x+9}{2x+5}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $r$ up by $\pi$ units. + \begin{shortsolution} + $r(x)+\pi=\frac{x+5}{2x-3}+\pi$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Shift $r$ down by $17$ units. + \begin{shortsolution} + $r(x)-17=\frac{x+5}{2x-3}-17$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Reflect $r$ over the horizontal axis. + \begin{shortsolution} + $-r(x)=-\frac{x+5}{2x-3}$ + \end{shortsolution} + \end{subproblem} + \begin{subproblem} + Reflect $r$ over the vertical axis. + \begin{shortsolution} + $r(-x)=\frac{x-5}{2x+3}$ + \end{shortsolution} + \end{subproblem} + \end{multicols} + \end{problem} + + + %=================================== + % Author: Hughes + % Date: May 2011 + %=================================== + \begin{problem}[Find a formula from a table]\label{rat:prob:findformula} + \Crefrange{rat:tab:findformular}{rat:tab:findformulau} show values of rational functions $r$, $q$, $s$, + and $t$. Assume that any values marked with an X are undefined. + + \begin{table}[!htb] + \begin{widepage} + \centering + \caption{Tables for \cref{rat:prob:findformula}} + \label{rat:tab:findformula} + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=r(x)$} + \label{rat:tab:findformular} + \begin{tabular}{rr} + \beforeheading + $x$ & $y$ \\ \afterheading + $-4$ & $\nicefrac{7}{2}$ \\\normalline + $-3$ & $-18$ \\\normalline + $-2$ & X \\\normalline + $-1$ & $-4$ \\\normalline + $0$ & $\nicefrac{-3}{2}$ \\\normalline + $1$ & $\nicefrac{-2}{3}$ \\\normalline + $2$ & $\nicefrac{-1}{4}$ \\\normalline + $3$ & $0$ \\\normalline + $4$ & $\nicefrac{1}{6}$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=s(x)$} + \label{rat:tab:findformulas} + \begin{tabular}{rr} + \beforeheading + $x$ & $y$ \\ \afterheading + $-4$ & $\nicefrac{-2}{21}$ \\\normalline + $-3$ & $\nicefrac{-1}{12}$ \\\normalline + $-2$ & $0$ \\\normalline + $-1$ & X \\\normalline + $0$ & $\nicefrac{-2}{3}$ \\\normalline + $1$ & $\nicefrac{-3}{4}$ \\\normalline + $2$ & $\nicefrac{-4}{3}$ \\\normalline + $3$ & X \\\normalline + $4$ & $\nicefrac{6}{5}$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=t(x)$} + \label{rat:tab:findformulat} + \begin{tabular}{rr} + \beforeheading + $x$ & $y$ \\ \afterheading + $-4$ & $\nicefrac{3}{5}$ \\\normalline + $-3$ & $0$ \\\normalline + $-2$ & X \\\normalline + $-1$ & $3$ \\\normalline + $0$ & $3$ \\\normalline + $1$ & X \\\normalline + $2$ & $0$ \\\normalline + $3$ & $\nicefrac{3}{5}$ \\\normalline + $4$ & $\nicefrac{7}{9}$ \\\lastline + \end{tabular} + \end{subtable} + \hfill + \begin{subtable}{.2\textwidth} + \centering + \caption{$y=u(x)$} + \label{rat:tab:findformulau} + \begin{tabular}{rr} + \beforeheading + $x$ & $y$ \\ \afterheading + $-4$ & $\nicefrac{16}{7}$ \\\normalline + $-3$ & X \\\normalline + $-2$ & $-\nicefrac{4}{5}$ \\\normalline + $-1$ & $-\nicefrac{1}{8}$ \\\normalline + $0$ & $0$ \\\normalline + $1$ & $-\nicefrac{1}{8}$ \\\normalline + $2$ & $-\nicefrac{4}{5}$ \\\normalline + $3$ & X \\\normalline + $4$ & $\nicefrac{16}{7}$ \\\lastline + \end{tabular} + \end{subtable} + \end{widepage} + \end{table} \begin{subproblem} - Shift $r$ to the right by $3$ units. + Given that the formula for $r(x)$ has the form $r(x)=\dfrac{x-A}{x-B}$, use \cref{rat:tab:findformular} + to find values of $A$ and $B$. \begin{shortsolution} - $r(x-3)=\frac{x+2}{2x-9}$ + $A=3$ and $B=-2$, so $r(x)=\dfrac{x-3}{x+2}$. \end{shortsolution} \end{subproblem} \begin{subproblem} - Shift $r$ to the left by $4$ units. + Check your formula by computing $r(x)$ at the values specified in the table. \begin{shortsolution} - $r(x+4)=\frac{x+9}{2x+5}$ + $\begin{aligned}[t] + r(-4) & = \frac{-4-3}{-4+2} \\ + & = \frac{7}{2} \\ + \end{aligned}$ + + $r(-3)=\ldots$ etc \end{shortsolution} \end{subproblem} \begin{subproblem} - Shift $r$ up by $\pi$ units. + The function $s$ in \cref{rat:tab:findformulas} has two vertical asymptotes and one zero. + Can you find a formula for $s(x)$? \begin{shortsolution} - $r(x)+\pi=\frac{x+5}{2x-3}+\pi$ + $s(x)=\dfrac{x+2}{(x-3)(x+1)}$ \end{shortsolution} \end{subproblem} \begin{subproblem} - Shift $r$ down by $17$ units. + Check your formula by computing $s(x)$ at the values specified in the table. \begin{shortsolution} - $r(x)-17=\frac{x+5}{2x-3}-17$ + $\begin{aligned}[t] + s(-4) & =\frac{-4+2}{(-4-3)(-4+1)} \\ + & =-\frac{2}{21} + \end{aligned}$ + + $s(-3)=\ldots$ etc \end{shortsolution} \end{subproblem} \begin{subproblem} - Reflect $r$ over the horizontal axis. + Given that the formula for $t(x)$ has the form $t(x)=\dfrac{(x-A)(x-B)}{(x-C)(x-D)}$, use \cref{rat:tab:findformulat} to find the + values of $A$, $B$, $C$, and $D$; hence write a formula for $t(x)$. \begin{shortsolution} - $-r(x)=-\frac{x+5}{2x-3}$ + $t(x)=\dfrac{(x+3)(x-2)}{(x+2)(x+1)}$ \end{shortsolution} \end{subproblem} \begin{subproblem} - Reflect $r$ over the vertical axis. + Given that the formula for $u(x)$ has the form $u(x)=\dfrac{(x-A)^2}{(x-B)(x-C)}$, use \cref{rat:tab:findformulau} to find the + values of $A$, $B$, and $C$; hence write a formula for $u(x)$. \begin{shortsolution} - $r(-x)=\frac{x-5}{2x+3}$ + $u(x)=\dfrac{x^2}{(x+3)(x-3)}$ \end{shortsolution} \end{subproblem} - \end{multicols} - \end{problem} - - - %=================================== - % Author: Hughes - % Date: May 2011 - %=================================== - \begin{problem}[Find a formula from a table]\label{rat:prob:findformula} - \Crefrange{rat:tab:findformular}{rat:tab:findformulau} show values of rational functions $r$, $q$, $s$, - and $t$. Assume that any values marked with an X are undefined. - - \begin{table}[!htb] - \begin{widepage} - \centering - \caption{Tables for \cref{rat:prob:findformula}} - \label{rat:tab:findformula} - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=r(x)$} - \label{rat:tab:findformular} - \begin{tabular}{rr} - \beforeheading - $x$ & $y$ \\ \afterheading - $-4$ & $\nicefrac{7}{2}$ \\\normalline - $-3$ & $-18$ \\\normalline - $-2$ & X \\\normalline - $-1$ & $-4$ \\\normalline - $0$ & $\nicefrac{-3}{2}$ \\\normalline - $1$ & $\nicefrac{-2}{3}$ \\\normalline - $2$ & $\nicefrac{-1}{4}$ \\\normalline - $3$ & $0$ \\\normalline - $4$ & $\nicefrac{1}{6}$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=s(x)$} - \label{rat:tab:findformulas} - \begin{tabular}{rr} - \beforeheading - $x$ & $y$ \\ \afterheading - $-4$ & $\nicefrac{-2}{21}$ \\\normalline - $-3$ & $\nicefrac{-1}{12}$ \\\normalline - $-2$ & $0$ \\\normalline - $-1$ & X \\\normalline - $0$ & $\nicefrac{-2}{3}$ \\\normalline - $1$ & $\nicefrac{-3}{4}$ \\\normalline - $2$ & $\nicefrac{-4}{3}$ \\\normalline - $3$ & X \\\normalline - $4$ & $\nicefrac{6}{5}$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=t(x)$} - \label{rat:tab:findformulat} - \begin{tabular}{rr} - \beforeheading - $x$ & $y$ \\ \afterheading - $-4$ & $\nicefrac{3}{5}$ \\\normalline - $-3$ & $0$ \\\normalline - $-2$ & X \\\normalline - $-1$ & $3$ \\\normalline - $0$ & $3$ \\\normalline - $1$ & X \\\normalline - $2$ & $0$ \\\normalline - $3$ & $\nicefrac{3}{5}$ \\\normalline - $4$ & $\nicefrac{7}{9}$ \\\lastline - \end{tabular} - \end{subtable} - \hfill - \begin{subtable}{.2\textwidth} - \centering - \caption{$y=u(x)$} - \label{rat:tab:findformulau} - \begin{tabular}{rr} - \beforeheading - $x$ & $y$ \\ \afterheading - $-4$ & $\nicefrac{16}{7}$ \\\normalline - $-3$ & X \\\normalline - $-2$ & $-\nicefrac{4}{5}$ \\\normalline - $-1$ & $-\nicefrac{1}{8}$ \\\normalline - $0$ & $0$ \\\normalline - $1$ & $-\nicefrac{1}{8}$ \\\normalline - $2$ & $-\nicefrac{4}{5}$ \\\normalline - $3$ & X \\\normalline - $4$ & $\nicefrac{16}{7}$ \\\lastline - \end{tabular} - \end{subtable} - \end{widepage} - \end{table} - \begin{subproblem} - Given that the formula for $r(x)$ has the form $r(x)=\dfrac{x-A}{x-B}$, use \cref{rat:tab:findformular} - to find values of $A$ and $B$. - \begin{shortsolution} - $A=3$ and $B=-2$, so $r(x)=\dfrac{x-3}{x+2}$. - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Check your formula by computing $r(x)$ at the values specified in the table. - \begin{shortsolution} - $\begin{aligned}[t] - r(-4) & = \frac{-4-3}{-4+2} \\ - & = \frac{7}{2} \\ - \end{aligned}$ - - $r(-3)=\ldots$ etc - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - The function $s$ in \cref{rat:tab:findformulas} has two vertical asymptotes and one zero. - Can you find a formula for $s(x)$? - \begin{shortsolution} - $s(x)=\dfrac{x+2}{(x-3)(x+1)}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Check your formula by computing $s(x)$ at the values specified in the table. - \begin{shortsolution} - $\begin{aligned}[t] - s(-4) & =\frac{-4+2}{(-4-3)(-4+1)} \\ - & =-\frac{2}{21} - \end{aligned}$ - - $s(-3)=\ldots$ etc - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Given that the formula for $t(x)$ has the form $t(x)=\dfrac{(x-A)(x-B)}{(x-C)(x-D)}$, use \cref{rat:tab:findformulat} to find the - values of $A$, $B$, $C$, and $D$; hence write a formula for $t(x)$. - \begin{shortsolution} - $t(x)=\dfrac{(x+3)(x-2)}{(x+2)(x+1)}$ - \end{shortsolution} - \end{subproblem} - \begin{subproblem} - Given that the formula for $u(x)$ has the form $u(x)=\dfrac{(x-A)^2}{(x-B)(x-C)}$, use \cref{rat:tab:findformulau} to find the - values of $A$, $B$, and $C$; hence write a formula for $u(x)$. - \begin{shortsolution} - $u(x)=\dfrac{x^2}{(x+3)(x-3)}$ - \end{shortsolution} - \end{subproblem} - \end{problem} - \end{exercises} - + \end{problem} + \end{exercises} + \section{Graphing rational functions (horizontal asymptotes)} \reformatstepslist{R} % the steps list should be R1, R2, \ldots - We studied rational functions in the previous section, but were - not asked to graph them; in this section we will demonstrate the - steps to be followed in order to sketch graphs of the functions. - - Remember from \vref{rat:def:function} that rational functions have + We studied rational functions in the previous section, but were + not asked to graph them; in this section we will demonstrate the + steps to be followed in order to sketch graphs of the functions. + + Remember from \vref{rat:def:function} that rational functions have the form \[ r(x)=\frac{p(x)}{q(x)} \] - In this section we will restrict attention to the case when + In this section we will restrict attention to the case when \[ \text{degree of }p\leq \text{degree of }q \] Note that this necessarily means that each function that we consider in this section \emph{will have a horizontal asymptote} (see \vref{rat:def:longrun}). - The cases in which the degree of $p$ is greater than the degree of $q$ + The cases in which the degree of $p$ is greater than the degree of $q$ is covered in the next section. - + Before we begin, it is important to remember the following: \begin{itemize} - \item Our sketches will give a good representation of the overall - shape of the graph, but until we have the tools of calculus (from MTH 251) - we can not find local minimums, local maximums, and inflection points algebraically. This - means that we will make our best guess as to where these points are. - \item We will not concern ourselves too much with the vertical scale (because of - our previous point)| we will, however, mark the vertical intercept (assuming there is one), - and any horizontal asymptotes. + \item Our sketches will give a good representation of the overall + shape of the graph, but until we have the tools of calculus (from MTH 251) + we can not find local minimums, local maximums, and inflection points algebraically. This + means that we will make our best guess as to where these points are. + \item We will not concern ourselves too much with the vertical scale (because of + our previous point)| we will, however, mark the vertical intercept (assuming there is one), + and any horizontal asymptotes. \end{itemize} \begin{pccspecialcomment}[Steps to follow when sketching rational functions]\label{rat:def:stepsforsketch} \begin{steps} - \item \label{rat:step:first} Find all vertical asymptotes and holes, and mark them on the + \item \label{rat:step:first} Find all vertical asymptotes and holes, and mark them on the graph using dashed vertical lines and open circles $\circ$ respectively. \item Find any intercepts, and mark them using solid circles $\bullet$; determine if the curve cuts the axis, or bounces off it at each zero. \item Determine the behavior of the function around each asymptote| does it behave like $\frac{1}{x}$ or $\frac{1}{x^2}$? - \item \label{rat:step:penultimate} Determine the long-run behavior of the function, and mark the horizontal + \item \label{rat:step:penultimate} Determine the long-run behavior of the function, and mark the horizontal asymptote using a dashed horizontal line. \item \label{rat:step:last} Deduce the overall shape of the curve, and sketch it. If there isn't enough information from the previous steps, then construct a table of values including sample points from each branch. \end{steps} - Remember that until we have the tools of calculus, we won't be able to + Remember that until we have the tools of calculus, we won't be able to find the exact coordinates of local minimums, local maximums, and points of inflection. \end{pccspecialcomment} - + The examples that follow show how \crefrange{rat:step:first}{rat:step:last} can be applied to a variety of different rational functions. - + %=================================== % Author: Hughes % Date: May 2012 %=================================== \begin{pccexample}\label{rat:ex:1overxminus2p2} - Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $r$ - that has formula - \[ - r(x)=\frac{1}{x-2} - \] - \begin{pccsolution} - \begin{steps} - \item $r$ has a vertical asymptote at $2$; $r$ does not have any holes. The curve of - $r$ will have $2$ branches. - \item $r$ does not have any zeros since the numerator is never equal to $0$. The - vertical intercept of $r$ is $\left( 0,-\frac{1}{2} \right)$. - \item $r$ behaves like $\frac{1}{x}$ around its vertical asymptote since $(x-2)$ - is raised to the power $1$. - \item Since the degree of the numerator is less than the degree of the denominator, - according to \vref{rat:def:longrun} the horizontal asymptote of $r$ has equation $y=0$. - \item We put the details we have obtained so far on \cref{rat:fig:1overxminus2p1}. Notice - that there is only one way to complete the graph, which we have done in \cref{rat:fig:1overxminus2p2}. - \end{steps} - \end{pccsolution} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $r$ + that has formula + \[ + r(x)=\frac{1}{x-2} + \] + \begin{pccsolution} + \begin{steps} + \item $r$ has a vertical asymptote at $2$; $r$ does not have any holes. The curve of + $r$ will have $2$ branches. + \item $r$ does not have any zeros since the numerator is never equal to $0$. The + vertical intercept of $r$ is $\left( 0,-\frac{1}{2} \right)$. + \item $r$ behaves like $\frac{1}{x}$ around its vertical asymptote since $(x-2)$ + is raised to the power $1$. + \item Since the degree of the numerator is less than the degree of the denominator, + according to \vref{rat:def:longrun} the horizontal asymptote of $r$ has equation $y=0$. + \item We put the details we have obtained so far on \cref{rat:fig:1overxminus2p1}. Notice + that there is only one way to complete the graph, which we have done in \cref{rat:fig:1overxminus2p2}. + \end{steps} + \end{pccsolution} \end{pccexample} - + \begin{figure}[!htbp] \begin{subfigure}{.45\textwidth} \begin{tikzpicture} @@ -4678,204 +4678,204 @@ $r$, and $s$. \end{subfigure}% \caption{$y=\dfrac{1}{x-2}$} \end{figure} - + The function $r$ in \cref{rat:ex:1overxminus2p2} has a horizontal asymptote which has equation $y=0$. - This asymptote lies on the horizontal axis, and you might (understandably) find it hard + This asymptote lies on the horizontal axis, and you might (understandably) find it hard to distinguish between the two lines (\cref{rat:fig:1overxminus2p2}). When faced - with such a situation, it is perfectly acceptable to draw the horizontal axis - as a dashed line| just make sure to label it correctly. We will demonstrate this + with such a situation, it is perfectly acceptable to draw the horizontal axis + as a dashed line| just make sure to label it correctly. We will demonstrate this in the next example. - + %=================================== % Author: Hughes % Date: May 2012 %=================================== \begin{pccexample}\label{rat:ex:1overxp1} - Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $v$ - that has formula - \[ - v(x)=\frac{10}{x} - \] - \begin{pccsolution} - \begin{steps} - \item $v$ has a vertical asymptote at $0$. $v$ does not have - any holes. The curve of $v$ will have $2$ branches. - \item $v$ does not have any zeros (since $10\ne 0$). Furthermore, $v$ - does not have a vertical intercept since $v(0)$ is undefined. - \item $v$ behaves like $\frac{1}{x}$ around its vertical asymptote. - \item $v$ has a horizontal asymptote with equation $y=0$. - \item We put the details we have obtained so far in \cref{rat:fig:1overxp1}. - We do not have enough information to sketch $v$ yet (because $v$ does - not have any intercepts), so let's pick a sample - point in either of the $2$ branches| it doesn't matter where our sample point - is, because we know what the overall shape will be. Let's compute $v(2)$ - \begin{align*} - v(2) & =\dfrac{10}{2} \\ - & = 5 - \end{align*} - We therefore mark the point $(2,5)$ on \cref{rat:fig:1overxp2}, and then complete the sketch using - the details we found in the previous steps. - \end{steps} - - \begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-5,5}, - ytick={-5,5}, - axis line style={color=white}, - width=\textwidth, - ] - \addplot[asymptote,<->,domain=-10:10]({0},{x}); - \addplot[asymptote,<->,domain=-10:10]({x},{0}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:1overxp1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=10/x;}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-10,ymax=10, - xtick={-5,5}, - ytick={-5,5}, - axis line style={color=white}, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:-1]{f}; - \addplot[pccplot] expression[domain=1:10]{f}; - \addplot[soldot] coordinates{(2,5)}node[axisnode,anchor=south west]{$(2,5)$}; - \addplot[asymptote,<->,domain=-10:10]({0},{x}); - \addplot[asymptote,<->,domain=-10:10]({x},{0}); - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:1overxp2} - \end{subfigure}% - \caption{$y=\dfrac{10}{x}$} - \end{figure} - \end{pccsolution} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $v$ + that has formula + \[ + v(x)=\frac{10}{x} + \] + \begin{pccsolution} + \begin{steps} + \item $v$ has a vertical asymptote at $0$. $v$ does not have + any holes. The curve of $v$ will have $2$ branches. + \item $v$ does not have any zeros (since $10\ne 0$). Furthermore, $v$ + does not have a vertical intercept since $v(0)$ is undefined. + \item $v$ behaves like $\frac{1}{x}$ around its vertical asymptote. + \item $v$ has a horizontal asymptote with equation $y=0$. + \item We put the details we have obtained so far in \cref{rat:fig:1overxp1}. + We do not have enough information to sketch $v$ yet (because $v$ does + not have any intercepts), so let's pick a sample + point in either of the $2$ branches| it doesn't matter where our sample point + is, because we know what the overall shape will be. Let's compute $v(2)$ + \begin{align*} + v(2) & =\dfrac{10}{2} \\ + & = 5 + \end{align*} + We therefore mark the point $(2,5)$ on \cref{rat:fig:1overxp2}, and then complete the sketch using + the details we found in the previous steps. + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-5,5}, + ytick={-5,5}, + axis line style={color=white}, + width=\textwidth, + ] + \addplot[asymptote,<->,domain=-10:10]({0},{x}); + \addplot[asymptote,<->,domain=-10:10]({x},{0}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:1overxp1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=10/x;}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-10,ymax=10, + xtick={-5,5}, + ytick={-5,5}, + axis line style={color=white}, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:-1]{f}; + \addplot[pccplot] expression[domain=1:10]{f}; + \addplot[soldot] coordinates{(2,5)}node[axisnode,anchor=south west]{$(2,5)$}; + \addplot[asymptote,<->,domain=-10:10]({0},{x}); + \addplot[asymptote,<->,domain=-10:10]({x},{0}); + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:1overxp2} + \end{subfigure}% + \caption{$y=\dfrac{10}{x}$} + \end{figure} + \end{pccsolution} \end{pccexample} - + %=================================== % Author: Hughes % Date: May 2012 %=================================== \begin{pccexample}\label{rat:ex:asympandholep1} - Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $u$ - that has formula - \[ - u(x)=\frac{-4(x^2-9)}{x^2-8x+15} - \] - \begin{pccsolution} - \begin{steps} - \item We begin by factoring both the numerator and denominator of $u$ to help - us find any vertical asymptotes or holes - \begin{align*} - u(x) & =\frac{-4(x^2-9)}{x^2-8x+15} \\ - & =\frac{-4(x+3)(x-3)}{(x-5)(x-3)} \\ - & =\frac{-4(x+3)}{x-5} - \end{align*} - provided that $x\ne 3$. Therefore $u$ has a vertical asymptote at $5$ and - a hole at $3$. The curve of $u$ has $2$ branches. - \item $u$ has a simple zero at $-3$. The vertical intercept of $u$ is $\left( 0,\frac{12}{5} \right)$. - \item $u$ behaves like $\frac{1}{x}$ around its vertical asymptote at $4$. - \item Using \vref{rat:def:longrun} the equation of the horizontal asymptote of $u$ is $y=-4$. - \item We put the details we have obtained so far on \cref{rat:fig:1overxminus2p1}. Notice - that there is only one way to complete the graph, which we have done in \cref{rat:fig:1overxminus2p2}. - \end{steps} - - \begin{figure}[!htbp] - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture} - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-20,ymax=20, - xtick={-8,-6,...,8}, - ytick={-10,10}, - width=\textwidth, - ] - \addplot[asymptote,domain=-20:20]({4},{x}); - \addplot[asymptote,domain=-10:10]({x},{-4}); - \addplot[soldot] coordinates{(-3,0)(0,2.4)}node[axisnode,anchor=south east]{$\left( 0,\frac{12}{5} \right)$}; - \addplot[holdot] coordinates{(3,12)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:asympandholep1} - \end{subfigure}% - \hfill - \begin{subfigure}{.45\textwidth} - \begin{tikzpicture}[/pgf/declare function={f=-4*(x+3)/(x-5);}] - \begin{axis}[ - xmin=-10,xmax=10, - ymin=-20,ymax=20, - xtick={-8,-6,...,8}, - ytick={-10,10}, - width=\textwidth, - ] - \addplot[pccplot] expression[domain=-10:3.6666,samples=50]{f}; - \addplot[pccplot] expression[domain=7:10]{f}; - \addplot[asymptote,domain=-20:20]({5},{x}); - \addplot[asymptote,domain=-10:10]({x},{-4}); - \addplot[soldot] coordinates{(-3,0)(0,2.4)}node[axisnode,anchor=south east]{$\left( 0,\frac{12}{5} \right)$}; - \addplot[holdot] coordinates{(3,12)}; - \end{axis} - \end{tikzpicture} - \caption{} - \label{rat:fig:asympandholep2} - \end{subfigure}% - \caption{$y=\dfrac{-4(x+3)}{x-5}$} - \end{figure} - \end{pccsolution} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $u$ + that has formula + \[ + u(x)=\frac{-4(x^2-9)}{x^2-8x+15} + \] + \begin{pccsolution} + \begin{steps} + \item We begin by factoring both the numerator and denominator of $u$ to help + us find any vertical asymptotes or holes + \begin{align*} + u(x) & =\frac{-4(x^2-9)}{x^2-8x+15} \\ + & =\frac{-4(x+3)(x-3)}{(x-5)(x-3)} \\ + & =\frac{-4(x+3)}{x-5} + \end{align*} + provided that $x\ne 3$. Therefore $u$ has a vertical asymptote at $5$ and + a hole at $3$. The curve of $u$ has $2$ branches. + \item $u$ has a simple zero at $-3$. The vertical intercept of $u$ is $\left( 0,\frac{12}{5} \right)$. + \item $u$ behaves like $\frac{1}{x}$ around its vertical asymptote at $4$. + \item Using \vref{rat:def:longrun} the equation of the horizontal asymptote of $u$ is $y=-4$. + \item We put the details we have obtained so far on \cref{rat:fig:1overxminus2p1}. Notice + that there is only one way to complete the graph, which we have done in \cref{rat:fig:1overxminus2p2}. + \end{steps} + + \begin{figure}[!htbp] + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture} + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-20,ymax=20, + xtick={-8,-6,...,8}, + ytick={-10,10}, + width=\textwidth, + ] + \addplot[asymptote,domain=-20:20]({4},{x}); + \addplot[asymptote,domain=-10:10]({x},{-4}); + \addplot[soldot] coordinates{(-3,0)(0,2.4)}node[axisnode,anchor=south east]{$\left( 0,\frac{12}{5} \right)$}; + \addplot[holdot] coordinates{(3,12)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:asympandholep1} + \end{subfigure}% + \hfill + \begin{subfigure}{.45\textwidth} + \begin{tikzpicture}[/pgf/declare function={f=-4*(x+3)/(x-5);}] + \begin{axis}[ + xmin=-10,xmax=10, + ymin=-20,ymax=20, + xtick={-8,-6,...,8}, + ytick={-10,10}, + width=\textwidth, + ] + \addplot[pccplot] expression[domain=-10:3.6666,samples=50]{f}; + \addplot[pccplot] expression[domain=7:10]{f}; + \addplot[asymptote,domain=-20:20]({5},{x}); + \addplot[asymptote,domain=-10:10]({x},{-4}); + \addplot[soldot] coordinates{(-3,0)(0,2.4)}node[axisnode,anchor=south east]{$\left( 0,\frac{12}{5} \right)$}; + \addplot[holdot] coordinates{(3,12)}; + \end{axis} + \end{tikzpicture} + \caption{} + \label{rat:fig:asympandholep2} + \end{subfigure}% + \caption{$y=\dfrac{-4(x+3)}{x-5}$} + \end{figure} + \end{pccsolution} \end{pccexample} - + \Cref{rat:ex:1overxminus2p2,rat:ex:1overxp1,rat:ex:asympandholep1} have focused on functions that only have one vertical asymptote; the remaining examples in this section concern functions that have more than one vertical asymptote. We will demonstrate that \crefrange{rat:step:first}{rat:step:last} still apply. - + %=================================== % Author: Hughes % Date: May 2012 %=================================== \begin{pccexample}\label{rat:ex:sketchtwoasymp} - Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $w$ - that has formula - \[ - w(x)=\frac{2(x+3)(x-5)}{(x+5)(x-4)} - \] - \begin{pccsolution} - \begin{steps} - \item $w$ has vertical asymptotes at $-5$ and $4$. $w$ does not have - any holes. The curve of $w$ will have $3$ branches. - \item $w$ has simple zeros at $-3$ and $5$. The vertical intercept of $w$ - is $\left( 0,\frac{3}{2} \right)$. - \item $w$ behaves like $\frac{1}{x}$ around both of its vertical - asymptotes. - \item The degree of the numerator of $w$ is $2$ and the degree of the - denominator of $w$ is also $2$. Using the ratio of the leading coefficients - of the numerator and denominator, we say that $w$ has a horizontal - asymptote with equation $y=\frac{2}{1}=2$. - \item We put the details we have obtained so far on \cref{rat:fig:sketchtwoasymptp1}. - - The function $w$ is a little more complicated than the functions that - we have considered in the previous examples because the curve has $3$ - branches. When graphing such functions, it is generally a good idea to start with the branch - for which you have the most information| in this case, that is the \emph{middle} branch - on the interval $(-5,4)$. - - Once we have drawn the middle branch, there is only one way to complete the graph - (because of our observations about the behavior of $w$ around its vertical asymptotes), - which we have done in \cref{rat:fig:sketchtwoasymptp2}. - \end{steps} - \end{pccsolution} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $w$ + that has formula + \[ + w(x)=\frac{2(x+3)(x-5)}{(x+5)(x-4)} + \] + \begin{pccsolution} + \begin{steps} + \item $w$ has vertical asymptotes at $-5$ and $4$. $w$ does not have + any holes. The curve of $w$ will have $3$ branches. + \item $w$ has simple zeros at $-3$ and $5$. The vertical intercept of $w$ + is $\left( 0,\frac{3}{2} \right)$. + \item $w$ behaves like $\frac{1}{x}$ around both of its vertical + asymptotes. + \item The degree of the numerator of $w$ is $2$ and the degree of the + denominator of $w$ is also $2$. Using the ratio of the leading coefficients + of the numerator and denominator, we say that $w$ has a horizontal + asymptote with equation $y=\frac{2}{1}=2$. + \item We put the details we have obtained so far on \cref{rat:fig:sketchtwoasymptp1}. + + The function $w$ is a little more complicated than the functions that + we have considered in the previous examples because the curve has $3$ + branches. When graphing such functions, it is generally a good idea to start with the branch + for which you have the most information| in this case, that is the \emph{middle} branch + on the interval $(-5,4)$. + + Once we have drawn the middle branch, there is only one way to complete the graph + (because of our observations about the behavior of $w$ around its vertical asymptotes), + which we have done in \cref{rat:fig:sketchtwoasymptp2}. + \end{steps} + \end{pccsolution} \end{pccexample} - + \begin{figure}[!htbp] \begin{subfigure}{.45\textwidth} \begin{tikzpicture} @@ -4921,53 +4921,53 @@ $r$, and $s$. \end{subfigure}% \caption{$y=\dfrac{2(x+3)(x-5)}{(x+5)(x-4)}$} \end{figure} - + The rational functions that we have considered so far have had simple - factors in the denominator; each function has behaved like $\frac{1}{x}$ + factors in the denominator; each function has behaved like $\frac{1}{x}$ around each of its vertical asymptotes. \Cref{rat:ex:2asympnozeros,rat:ex:2squaredasymp} consider functions that have a repeated factor in the denominator. - + %=================================== % Author: Hughes % Date: May 2012 %=================================== \begin{pccexample}\label{rat:ex:2asympnozeros} - Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $f$ - that has formula - \[ - f(x)=\frac{100}{(x+5)(x-4)^2} - \] - \begin{pccsolution} - \begin{steps} - \item $f$ has vertical asymptotes at $-5$ and $4$. $f$ does not have - any holes. The curve of $f$ will have $3$ branches. - \item $f$ does not have any zeros (since $100\ne 0$). The vertical intercept of $f$ - is $\left( 0,\frac{5}{4} \right)$. - \item $f$ behaves like $\frac{1}{x}$ around $-5$ and behaves like $\frac{1}{x^2}$ - around $4$. - \item The degree of the numerator of $f$ is $0$ and the degree of the - denominator of $f$ is $2$. $f$ has a horizontal asymptote with - equation $y=0$. - \item We put the details we have obtained so far on \cref{rat:fig:2asympnozerosp1}. - - The function $f$ is similar to the function $w$ that we considered in \cref{rat:ex:sketchtwoasymp}| - it has two vertical asymptotes and $3$ branches, but in contrast to $w$ it does not have any zeros. - - We sketch $f$ in \cref{rat:fig:2asympnozerosp2}, using the middle branch as our guide - because we have the most information about the function on the interval $(-5,4)$. - - Once we have drawn the middle branch, there is only one way to complete the graph - because of our observations about the behavior of $f$ around its vertical asymptotes (it behaves like $\frac{1}{x}$), - which we have done in \cref{rat:fig:2asympnozerosp2}. - - Note that we are not yet able to find the local minimum of $f$ algebraically on the interval $(-5,4)$, - so we make a reasonable guess as to where it is| we can be confident that it is above the horizontal axis - since $f$ has no zeros. You may think that this is unsatisfactory, but once we have the tools of calculus, we will - be able to find local minimums more precisely. - \end{steps} - \end{pccsolution} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $f$ + that has formula + \[ + f(x)=\frac{100}{(x+5)(x-4)^2} + \] + \begin{pccsolution} + \begin{steps} + \item $f$ has vertical asymptotes at $-5$ and $4$. $f$ does not have + any holes. The curve of $f$ will have $3$ branches. + \item $f$ does not have any zeros (since $100\ne 0$). The vertical intercept of $f$ + is $\left( 0,\frac{5}{4} \right)$. + \item $f$ behaves like $\frac{1}{x}$ around $-5$ and behaves like $\frac{1}{x^2}$ + around $4$. + \item The degree of the numerator of $f$ is $0$ and the degree of the + denominator of $f$ is $2$. $f$ has a horizontal asymptote with + equation $y=0$. + \item We put the details we have obtained so far on \cref{rat:fig:2asympnozerosp1}. + + The function $f$ is similar to the function $w$ that we considered in \cref{rat:ex:sketchtwoasymp}| + it has two vertical asymptotes and $3$ branches, but in contrast to $w$ it does not have any zeros. + + We sketch $f$ in \cref{rat:fig:2asympnozerosp2}, using the middle branch as our guide + because we have the most information about the function on the interval $(-5,4)$. + + Once we have drawn the middle branch, there is only one way to complete the graph + because of our observations about the behavior of $f$ around its vertical asymptotes (it behaves like $\frac{1}{x}$), + which we have done in \cref{rat:fig:2asympnozerosp2}. + + Note that we are not yet able to find the local minimum of $f$ algebraically on the interval $(-5,4)$, + so we make a reasonable guess as to where it is| we can be confident that it is above the horizontal axis + since $f$ has no zeros. You may think that this is unsatisfactory, but once we have the tools of calculus, we will + be able to find local minimums more precisely. + \end{steps} + \end{pccsolution} \end{pccexample} - + \begin{figure}[!htbp] \begin{subfigure}{.45\textwidth} \begin{tikzpicture} @@ -5011,45 +5011,45 @@ $r$, and $s$. \end{subfigure}% \caption{$y=\dfrac{100}{(x+5)(x-4)^2}$} \end{figure} - + %=================================== % Author: Hughes % Date: May 2012 %=================================== \begin{pccexample}\label{rat:ex:2squaredasymp} - Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $g$ - that has formula - \[ - g(x)=\frac{50(2-x)}{(x+3)^2(x-5)^2} - \] - \begin{pccsolution} - \begin{steps} - \item $g$ has vertical asymptotes at $-3$ and $5$. $g$ does - not have any holes. The curve of $g$ will have $3$ branches. - \item $g$ has a simple zero at $2$. The vertical intercept of $g$ is - $\left( 0,\frac{4}{9} \right)$. - \item $g$ behaves like $\frac{1}{x^2}$ around both of its - vertical asymptotes. - \item The degree of the numerator of $g$ is $1$ and the degree of the denominator - of $g$ is $4$. Using \vref{rat:def:longrun}, we calculate that - the horizontal asymptote of $g$ has equation $y=0$. - \item The details that we have found so far have been drawn in - \cref{rat:fig:2squaredasymp1}. The function $g$ is similar to the functions - we considered in \cref{rat:ex:sketchtwoasymp,rat:ex:2asympnozeros} because - it has $2$ vertical asymptotes and $3$ branches. - - We sketch $g$ using the middle branch as our guide because we have the most information - about $g$ on the interval $(-3,5)$. Note that there is no other way to draw this branch - without introducing other zeros which $g$ does not have. - - Once we have drawn the middle branch, there is only one way to complete the graph - because of our observations about the behavior of $g$ around its vertical asymptotes| it - behaves like $\frac{1}{x^2}$. - - \end{steps} - \end{pccsolution} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $g$ + that has formula + \[ + g(x)=\frac{50(2-x)}{(x+3)^2(x-5)^2} + \] + \begin{pccsolution} + \begin{steps} + \item $g$ has vertical asymptotes at $-3$ and $5$. $g$ does + not have any holes. The curve of $g$ will have $3$ branches. + \item $g$ has a simple zero at $2$. The vertical intercept of $g$ is + $\left( 0,\frac{4}{9} \right)$. + \item $g$ behaves like $\frac{1}{x^2}$ around both of its + vertical asymptotes. + \item The degree of the numerator of $g$ is $1$ and the degree of the denominator + of $g$ is $4$. Using \vref{rat:def:longrun}, we calculate that + the horizontal asymptote of $g$ has equation $y=0$. + \item The details that we have found so far have been drawn in + \cref{rat:fig:2squaredasymp1}. The function $g$ is similar to the functions + we considered in \cref{rat:ex:sketchtwoasymp,rat:ex:2asympnozeros} because + it has $2$ vertical asymptotes and $3$ branches. + + We sketch $g$ using the middle branch as our guide because we have the most information + about $g$ on the interval $(-3,5)$. Note that there is no other way to draw this branch + without introducing other zeros which $g$ does not have. + + Once we have drawn the middle branch, there is only one way to complete the graph + because of our observations about the behavior of $g$ around its vertical asymptotes| it + behaves like $\frac{1}{x^2}$. + + \end{steps} + \end{pccsolution} \end{pccexample} - + \begin{figure}[!htbp] \begin{subfigure}{.45\textwidth} \begin{tikzpicture} @@ -5093,54 +5093,54 @@ $r$, and $s$. \end{subfigure}% \caption{$y=\dfrac{50(2-x)}{(x+3)^2(x-5)^2}$} \end{figure} - - Each of the rational functions that we have considered so far has had either - a \emph{simple} zero, or no zeros at all. Remember from our work on polynomial + + Each of the rational functions that we have considered so far has had either + a \emph{simple} zero, or no zeros at all. Remember from our work on polynomial functions, and particularly \vref{poly:def:multzero}, that a \emph{repeated} zero corresponds to the curve of the function behaving differently at the zero - when compared to how the curve behaves at a simple zero. \Cref{rat:ex:doublezero} details a + when compared to how the curve behaves at a simple zero. \Cref{rat:ex:doublezero} details a function that has a non-simple zero. - + %=================================== % Author: Hughes % Date: June 2012 %=================================== \begin{pccexample}\label{rat:ex:doublezero} - Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $g$ - that has formula - \[ - h(x)=\frac{(x-3)^2}{(x+4)(x-6)} - \] - \begin{pccsolution} - \begin{steps} - \item $h$ has vertical asymptotes at $-4$ and $6$. $h$ does - not have any holes. The curve of $h$ will have $3$ branches. - \item $h$ has a zero at $3$ that has \emph{multiplicity $2$}. - The vertical intercept of $h$ is - $\left( 0,-\frac{3}{8} \right)$. - \item $h$ behaves like $\frac{1}{x}$ around both of its - vertical asymptotes. - \item The degree of the numerator of $h$ is $2$ and the degree of the denominator - of $h$ is $2$. Using \vref{rat:def:longrun}, we calculate that - the horizontal asymptote of $h$ has equation $y=1$. - \item The details that we have found so far have been drawn in - \cref{rat:fig:doublezerop1}. The function $h$ is different - from the functions that we have considered in previous examples because - of the multiplicity of the zero at $3$. - - We sketch $h$ using the middle branch as our guide because we have the most information - about $h$ on the interval $(-4,6)$. Note that there is no other way to draw this branch - without introducing other zeros which $h$ does not have| also note how - the curve bounces off the horizontal axis at $3$. - - Once we have drawn the middle branch, there is only one way to complete the graph - because of our observations about the behavior of $h$ around its vertical asymptotes| it - behaves like $\frac{1}{x}$. - - \end{steps} - \end{pccsolution} + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of the function $g$ + that has formula + \[ + h(x)=\frac{(x-3)^2}{(x+4)(x-6)} + \] + \begin{pccsolution} + \begin{steps} + \item $h$ has vertical asymptotes at $-4$ and $6$. $h$ does + not have any holes. The curve of $h$ will have $3$ branches. + \item $h$ has a zero at $3$ that has \emph{multiplicity $2$}. + The vertical intercept of $h$ is + $\left( 0,-\frac{3}{8} \right)$. + \item $h$ behaves like $\frac{1}{x}$ around both of its + vertical asymptotes. + \item The degree of the numerator of $h$ is $2$ and the degree of the denominator + of $h$ is $2$. Using \vref{rat:def:longrun}, we calculate that + the horizontal asymptote of $h$ has equation $y=1$. + \item The details that we have found so far have been drawn in + \cref{rat:fig:doublezerop1}. The function $h$ is different + from the functions that we have considered in previous examples because + of the multiplicity of the zero at $3$. + + We sketch $h$ using the middle branch as our guide because we have the most information + about $h$ on the interval $(-4,6)$. Note that there is no other way to draw this branch + without introducing other zeros which $h$ does not have| also note how + the curve bounces off the horizontal axis at $3$. + + Once we have drawn the middle branch, there is only one way to complete the graph + because of our observations about the behavior of $h$ around its vertical asymptotes| it + behaves like $\frac{1}{x}$. + + \end{steps} + \end{pccsolution} \end{pccexample} - + \begin{figure}[!htbp] \begin{subfigure}{.45\textwidth} \begin{tikzpicture} @@ -5190,24 +5190,24 @@ $r$, and $s$. % Date: June 2012 %=================================== \begin{problem}[\Cref{rat:step:last}]\label{rat:prob:deduce} - \pccname{Katie} is working on graphing rational functions. She + \pccname{Katie} is working on graphing rational functions. She has been concentrating on functions that have the form \begin{equation}\label{rat:eq:deducecurve} f(x)=\frac{a(x-b)}{x-c} \end{equation} Katie notes that functions with this type of formula have a zero at $b$, and a vertical asymptote at $c$. Furthermore, these functions - behave like $\frac{1}{x}$ around their vertical asymptote, and the + behave like $\frac{1}{x}$ around their vertical asymptote, and the curve of each function will have $2$ branches. - - Katie has been working with $3$ functions that have the form given + + Katie has been working with $3$ functions that have the form given in \cref{rat:eq:deducecurve}, and has followed \crefrange{rat:step:first}{rat:step:penultimate}; her results are shown in \cref{rat:fig:deducecurve}. There is just one more thing to do to complete the graphs| follow \cref{rat:step:last}. Help Katie finish each graph by deducing the curve of each function. \begin{shortsolution} \Vref{rat:fig:deducecurve1} - + \begin{tikzpicture}[/pgf/declare function={f=3*(x+4)/(x+5);}] \begin{axis}[ xmin=-10,xmax=10, @@ -5222,9 +5222,9 @@ $r$, and $s$. \addplot[pccplot] expression[domain=-4.76923:10,samples=50]{f}; \end{axis} \end{tikzpicture} - + \Vref{rat:fig:deducecurve2} - + \begin{tikzpicture}[/pgf/declare function={f=-3*(x-2)/(x-4);}] \begin{axis}[ xmin=-10,xmax=10, @@ -5239,9 +5239,9 @@ $r$, and $s$. \addplot[pccplot] expression[domain=4.85714:10]{f}; \end{axis} \end{tikzpicture} - + \Vref{rat:fig:deducecurve4} - + \begin{tikzpicture}[/pgf/declare function={f=2*(x-6)/(x-4);}] \begin{axis}[ xmin=-10,xmax=10, @@ -5258,7 +5258,7 @@ $r$, and $s$. \end{tikzpicture} \end{shortsolution} \end{problem} - + \begin{figure}[!htb] \begin{widepage} \setlength{\figurewidth}{0.3\textwidth} @@ -5316,28 +5316,28 @@ $r$, and $s$. \label{rat:fig:deducecurve} \end{widepage} \end{figure} - + %=================================== % Author: Hughes % Date: June 2012 %=================================== \begin{problem}[\Cref{rat:step:last} for more complicated rational functions]\label{rat:prob:deducehard} - \pccname{David} is also working on graphing rational functions, and + \pccname{David} is also working on graphing rational functions, and has been concentrating on functions that have the form \[ r(x)=\frac{a(x-b)(x-c)}{(x-d)(x-e)} \] - David notices that functions with this type of formula have simple zeros - at $b$ and $c$, and vertical asymptotes at $d$ and $e$. Furthermore, + David notices that functions with this type of formula have simple zeros + at $b$ and $c$, and vertical asymptotes at $d$ and $e$. Furthermore, these functions behave like $\frac{1}{x}$ around both vertical asymptotes, - and the curve of the function will have $3$ branches. - - David has followed \crefrange{rat:step:first}{rat:step:penultimate} for + and the curve of the function will have $3$ branches. + + David has followed \crefrange{rat:step:first}{rat:step:penultimate} for $3$ separate functions, and drawn the results in \cref{rat:fig:deducehard}. Help David finish each graph by deducing the curve of each function. \begin{shortsolution} \Vref{rat:fig:deducehard1} - + \begin{tikzpicture}[/pgf/declare function={f=(x-6)*(x+3)/( (x-4)*(x+1));}] \begin{axis}[ xmin=-10,xmax=10, @@ -5354,9 +5354,9 @@ $r$, and $s$. \addplot[pccplot] expression[domain=4.24276:10]{f}; \end{axis} \end{tikzpicture} - + \Vref{rat:fig:deducehard2} - + \begin{tikzpicture}[/pgf/declare function={f=3*(x-2)*(x+3)/( (x-6)*(x+5));}] \begin{axis}[ xmin=-10,xmax=10, @@ -5373,9 +5373,9 @@ $r$, and $s$. \addplot[pccplot] expression[domain=7.34324:10]{f}; \end{axis} \end{tikzpicture} - + \Vref{rat:fig:deducehard3} - + \begin{tikzpicture}[/pgf/declare function={f=2*(x-7)*(x+3)/( (x+6)*(x-5));}] \begin{axis}[ xmin=-10,xmax=10, @@ -5392,10 +5392,10 @@ $r$, and $s$. \addplot[pccplot] expression[domain=5.25586:10]{f}; \end{axis} \end{tikzpicture} - + \end{shortsolution} \end{problem} - + \begin{figure}[!htb] \begin{widepage} \setlength{\figurewidth}{0.3\textwidth} @@ -5462,15 +5462,15 @@ $r$, and $s$. % Date: March 2012 %=================================== \begin{problem}[\Crefrange{rat:step:first}{rat:step:last}] - Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of + Use \crefrange{rat:step:first}{rat:step:last} to sketch a graph of each of the following functions \fixthis{need 2 more subproblems here} \begin{multicols}{4} \begin{subproblem} - $y=\dfrac{4}{x+2}$ + $y=\dfrac{4}{x+2}$ \begin{shortsolution} Vertical intercept: $(0,2)$; vertical asymptote: $x=-2$, horizontal asymptote: $y=0$. - + \begin{tikzpicture} \begin{axis}[ framed, @@ -5489,12 +5489,12 @@ $r$, and $s$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=\dfrac{2x-1}{x^2-9}$ + $y=\dfrac{2x-1}{x^2-9}$ \begin{shortsolution} - Vertical intercept:$\left( 0,\frac{1}{9} \right)$; + Vertical intercept:$\left( 0,\frac{1}{9} \right)$; horizontal intercept: $\left( \frac{1}{2},0 \right)$; vertical asymptotes: $x=-3$, $x=3$, horizontal asymptote: $y=0$. - + \begin{tikzpicture} \begin{axis}[ framed, @@ -5515,11 +5515,11 @@ $r$, and $s$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=\dfrac{x+3}{x-5}$ + $y=\dfrac{x+3}{x-5}$ \begin{shortsolution} Vertical intercept $\left( 0,-\frac{3}{5} \right)$; horizontal intercept: $(-3,0)$; vertical asymptote: $x=5$; horizontal asymptote: $y=1$. - + \begin{tikzpicture} \begin{axis}[ framed, @@ -5540,11 +5540,11 @@ $r$, and $s$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=\dfrac{2x+3}{3x-1}$ + $y=\dfrac{2x+3}{3x-1}$ \begin{shortsolution} Vertical intercept: $(0,-3)$; horizontal intercept: $\left( -\frac{3}{2},0 \right)$; vertical asymptote: $x=\frac{1}{3}$, horizontal asymptote: $y=\frac{2}{3}$. - + \begin{tikzpicture}[/pgf/declare function={f=(2*x+3)/(3*x-1);}] \begin{axis}[ framed, @@ -5563,12 +5563,12 @@ $r$, and $s$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=\dfrac{4-x^2}{x^2-9}$ + $y=\dfrac{4-x^2}{x^2-9}$ \begin{shortsolution} Vertical intercept: $\left( 0,-\frac{4}{9} \right)$; - horizontal intercepts: $(2,0)$, $(-2,0)$; + horizontal intercepts: $(2,0)$, $(-2,0)$; vertical asymptotes: $x=-3$, $x=3$; horizontal asymptote: $y=-1$. - + \begin{tikzpicture}[/pgf/declare function={f=(4-x^2)/(x^2-9);}] \begin{axis}[ framed, @@ -5589,12 +5589,12 @@ $r$, and $s$. \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=\dfrac{(4x+5)(3x-4)}{(2x+5)(x-5)}$ + $y=\dfrac{(4x+5)(3x-4)}{(2x+5)(x-5)}$ \begin{shortsolution} - Vertical intercept: $\left( 0,\frac{4}{5} \right)$; - horizontal intercepts: $\left( -\frac{5}{4},0 \right)$, $\left( \frac{4}{3},0 \right)$; + Vertical intercept: $\left( 0,\frac{4}{5} \right)$; + horizontal intercepts: $\left( -\frac{5}{4},0 \right)$, $\left( \frac{4}{3},0 \right)$; vertical asymptotes: $x=-\frac{5}{2}$, $x=5$; horizontal asymptote: $y=6$. - + \begin{tikzpicture}[/pgf/declare function={f=(4*x+5)*(3*x-4)/((2*x+5)*(x-5));}] \begin{axis}[ framed, @@ -5624,12 +5624,12 @@ $r$, and $s$. % Date: March 2012 %=================================== \begin{problem}[Inverse functions] - Each of the following rational functions are invertible + Each of the following rational functions are invertible \[ F(x)=\frac{2x+1}{x-3}, \qquad G(x)= \frac{1-4x}{x+3} \] \begin{subproblem} - State the domain of each function. + State the domain of each function. \begin{shortsolution} \begin{itemize} \item The domain of $F$ is $(-\infty,3)\cup(3,\infty)$. @@ -5656,7 +5656,7 @@ $r$, and $s$. \end{shortsolution} \end{subproblem} \begin{subproblem} - State the range of each inverse function. + State the range of each inverse function. \begin{shortsolution} \begin{itemize} \item The range of $F^{-1}$ is the domain of $F$, which is $(-\infty,3)\cup(3,\infty)$. @@ -5679,35 +5679,35 @@ $r$, and $s$. \begin{subproblem} $(r\circ s)(0)$ \begin{shortsolution} - $\frac{75}{16}$ + $\frac{75}{16}$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $(s\circ r)(0)$ + $(s\circ r)(0)$ \begin{shortsolution} $(s\circ r)(0)$ is undefined. \end{shortsolution} \end{subproblem} \begin{subproblem} - $(r\circ s)(2)$ + $(r\circ s)(2)$ \begin{shortsolution} - $\frac{147}{4}$ + $\frac{147}{4}$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $(s\circ r)(3)$ + $(s\circ r)(3)$ \begin{shortsolution} - $192$ + $192$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $(s\circ r)(4)$ + $(s\circ r)(4)$ \begin{shortsolution} $(s\circ r)(4)$ is undefined. \end{shortsolution} \end{subproblem} \begin{subproblem} - $(s\circ r)(x)$ + $(s\circ r)(x)$ \begin{shortsolution} $\dfrac{4x^2-3}{1+5x^2}$ \end{shortsolution} @@ -5724,96 +5724,96 @@ $r$, and $s$. R(x)= \begin{dcases} \frac{2}{x+3}, & x<-5 \\ - \frac{x-4}{x-10}, & x\geq -5 + \frac{x-4}{x-10}, & x\geq -5 \end{dcases} \] Evaluate each of the following. \begin{multicols}{4} \begin{subproblem} - $R(-6)$ + $R(-6)$ \begin{shortsolution} - $-\frac{2}{3}$ + $-\frac{2}{3}$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $R(-5)$ + $R(-5)$ \begin{shortsolution} - $\frac{3}{5}$ + $\frac{3}{5}$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $R(-3)$ + $R(-3)$ \begin{shortsolution} - $\frac{7}{13}$ + $\frac{7}{13}$ \end{shortsolution} \end{subproblem} \begin{subproblem} - $R(5)$ + $R(5)$ \begin{shortsolution} - $-\frac{1}{5}$ + $-\frac{1}{5}$ \end{shortsolution} \end{subproblem} \end{multicols} \begin{subproblem} - What is the domain of $R$? + What is the domain of $R$? \begin{shortsolution} - $(-\infty,10)\cup(10,\infty)$ + $(-\infty,10)\cup(10,\infty)$ \end{shortsolution} \end{subproblem} \end{problem} \end{exercises} - + \section{Graphing rational functions (oblique asymptotes)}\label{rat:sec:oblique} \begin{subproblem} - $y=\dfrac{x^2+1}{x-4}$ + $y=\dfrac{x^2+1}{x-4}$ \begin{shortsolution} \begin{enumerate} \item $\left( 0,-\frac{1}{4} \right)$ \item Vertical asymptote: $x=4$. \item A graph of the function is shown below - - \begin{tikzpicture}[/pgf/declare function={f=(x^2+1)/(x-4);}] - \begin{axis}[ - framed, - xmin=-20,xmax=20, - ymin=-30,ymax=30, - xtick={-10,10}, - minor xtick={-15,-5,...,15}, - minor ytick={-10,10}, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot,samples=50] expression[domain=-20:3.54724]{f}; - \addplot[pccplot,samples=50] expression[domain=4.80196:20]{f}; - \addplot[asymptote,domain=-30:30]({4},{x}); - \end{axis} - \end{tikzpicture} + + \begin{tikzpicture}[/pgf/declare function={f=(x^2+1)/(x-4);}] + \begin{axis}[ + framed, + xmin=-20,xmax=20, + ymin=-30,ymax=30, + xtick={-10,10}, + minor xtick={-15,-5,...,15}, + minor ytick={-10,10}, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot,samples=50] expression[domain=-20:3.54724]{f}; + \addplot[pccplot,samples=50] expression[domain=4.80196:20]{f}; + \addplot[asymptote,domain=-30:30]({4},{x}); + \end{axis} + \end{tikzpicture} \end{enumerate} \end{shortsolution} \end{subproblem} \begin{subproblem} - $y=\dfrac{x^3(x+3)}{x-5}$ + $y=\dfrac{x^3(x+3)}{x-5}$ \begin{shortsolution} \begin{enumerate} \item $(0,0)$, $(-3,0)$ \item Vertical asymptote: $x=5$, horizontal asymptote: none. \item A graph of the function is shown below - - \begin{tikzpicture}[/pgf/declare function={f=x^3*(x+3)/(x-5);}] - \begin{axis}[ - framed, - xmin=-10,xmax=10, - ymin=-500,ymax=2500, - xtick={-8,-6,...,8}, - ytick={500,1000,1500,2000}, - grid=both, - width=\solutionfigurewidth, - ] - \addplot[pccplot,samples=50] expression[domain=-10:4]{f}; - \addplot[pccplot] expression[domain=5.6068:9.777]{f}; - \addplot[asymptote,domain=-500:2500]({5},{x}); - \end{axis} - \end{tikzpicture} + + \begin{tikzpicture}[/pgf/declare function={f=x^3*(x+3)/(x-5);}] + \begin{axis}[ + framed, + xmin=-10,xmax=10, + ymin=-500,ymax=2500, + xtick={-8,-6,...,8}, + ytick={500,1000,1500,2000}, + grid=both, + width=\solutionfigurewidth, + ] + \addplot[pccplot,samples=50] expression[domain=-10:4]{f}; + \addplot[pccplot] expression[domain=5.6068:9.777]{f}; + \addplot[asymptote,domain=-500:2500]({5},{x}); + \end{axis} + \end{tikzpicture} \end{enumerate} \end{shortsolution} \end{subproblem} diff --git a/Master/texmf-dist/doc/support/latexindent/success/stylefile.tex b/Master/texmf-dist/doc/support/latexindent/success/stylefile.tex index fb1154d3420..1fd497c1e2f 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/stylefile.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/stylefile.tex @@ -1,5 +1,6 @@ +% arara: indent: {overwrite: yes} % http://tex.stackexchange.com/questions/106244/using-a-lot-of-marginpars -\ProvidesPackage{tabto}[2013/03/25 \space v 1.3 \space +\ProvidesPackage{tabto}[2013/03/25 \space v 1.3 \space Another tabbing mechanism]\relax \newdimen\CurrentLineWidth @@ -9,124 +10,124 @@ Another tabbing mechanism]\relax \leavevmode \begingroup \def\@tempa{*}\def\@tempb{#1}% - \ifx\@tempa\@tempb % \tab* - \endgroup - \TTo@overlaptrue % ... set a flag and re-issue \tabto to get argument - \expandafter\tabto + \ifx\@tempa\@tempb % \tab* + \endgroup + \TTo@overlaptrue % ... set a flag and re-issue \tabto to get argument + \expandafter\tabto \else - \ifinner % in a \hbox, so ignore - \else % unrestricted horizontal mode - \null% \predisplaysize will tell the position of this box (must be box) - \parfillskip\fill - \everydisplay{}\everymath{}% - \predisplaypenalty\@M \postdisplaypenalty\@M - $$% math display so we can test \predisplaysize - \lineskiplimit=-999pt % so we get pure \baselineskip - \abovedisplayskip=-\baselineskip \abovedisplayshortskip=-\baselineskip - \belowdisplayskip\z@skip \belowdisplayshortskip\z@skip - \halign{##\cr\noalign{% - % get the width of the line above - %\message{>>> Line \the\inputlineno\space -- \predisplaydirection\the\predisplaydirection, \predisplaysize\the\predisplaysize, \displayindent\the\displayindent, \leftskip\the\leftskip, \linewidth\the\linewidth. }% - \ifdim\predisplaysize=\maxdimen % mixed R and L; call the line full - \message{Mixed R and L, so line is full. }% - \CurrentLineWidth\linewidth - \else - \ifdim\predisplaysize=-\maxdimen % impossible, in vmode; call the line empty - \message{Not in paragraph, so line is empty. }% - \CurrentLineWidth\z@ - \else - \ifnum\TTo@Direction<\z@ - \CurrentLineWidth\linewidth \advance\CurrentLineWidth\predisplaysize - \else - \CurrentLineWidth\predisplaysize - \fi - % Correct the 2em offset - \advance\CurrentLineWidth -2em - \advance\CurrentLineWidth -\displayindent - \advance\CurrentLineWidth -\leftskip - \fi\fi - \ifdim\CurrentLineWidth<\z@ \CurrentLineWidth\z@\fi - % Enshrine the tab-to position; #1 might reference \CurrentLineWidth - \@tempdimb=#1\relax - \message{*** Tab to \the\@tempdimb, previous width is \the\CurrentLineWidth. ***}% - % Save width for possible return use - \xdef\TabPrevPos{\the\CurrentLineWidth}% - % Build the action to perform - \protected@xdef\TTo@action{% - \vrule\@width\z@\@depth\the\prevdepth - \ifdim\CurrentLineWidth>\@tempdimb - \ifTTo@overlap\else - \protect\newline \protect\null - \fi\fi - \protect\nobreak - \protect\hskip\the\@tempdimb\relax - }% - %\message{\string\TTo@action: \meaning \TTo@action. }% - % get back to the baseline, regardless of its depth. - \vskip-\prevdepth - \prevdepth-99\p@ - \vskip\prevdepth - }}% - $$ - % Don't count the display as lines in the paragraph - \count@\prevgraf \advance\count@-4 \prevgraf\count@ - \TTo@action - %% \penalty\@m % to allow a penalized line break - \fi - \endgroup - \TTo@overlapfalse - \ignorespaces - \fi -} + \ifinner % in a \hbox, so ignore + \else % unrestricted horizontal mode + \null% \predisplaysize will tell the position of this box (must be box) + \parfillskip\fill + \everydisplay{}\everymath{}% + \predisplaypenalty\@M \postdisplaypenalty\@M + $$% math display so we can test \predisplaysize + \lineskiplimit=-999pt % so we get pure \baselineskip + \abovedisplayskip=-\baselineskip \abovedisplayshortskip=-\baselineskip + \belowdisplayskip\z@skip \belowdisplayshortskip\z@skip + \halign{##\cr\noalign{% + % get the width of the line above + %\message{>>> Line \the\inputlineno\space -- \predisplaydirection\the\predisplaydirection, \predisplaysize\the\predisplaysize, \displayindent\the\displayindent, \leftskip\the\leftskip, \linewidth\the\linewidth. }% + \ifdim\predisplaysize=\maxdimen % mixed R and L; call the line full + \message{Mixed R and L, so line is full. }% + \CurrentLineWidth\linewidth + \else + \ifdim\predisplaysize=-\maxdimen % impossible, in vmode; call the line empty + \message{Not in paragraph, so line is empty. }% + \CurrentLineWidth\z@ + \else + \ifnum\TTo@Direction<\z@ + \CurrentLineWidth\linewidth \advance\CurrentLineWidth\predisplaysize + \else + \CurrentLineWidth\predisplaysize + \fi + % Correct the 2em offset + \advance\CurrentLineWidth -2em + \advance\CurrentLineWidth -\displayindent + \advance\CurrentLineWidth -\leftskip + \fi\fi + \ifdim\CurrentLineWidth<\z@ \CurrentLineWidth\z@\fi + % Enshrine the tab-to position; #1 might reference \CurrentLineWidth + \@tempdimb=#1\relax + \message{*** Tab to \the\@tempdimb, previous width is \the\CurrentLineWidth. ***}% + % Save width for possible return use + \xdef\TabPrevPos{\the\CurrentLineWidth}% + % Build the action to perform + \protected@xdef\TTo@action{% + \vrule\@width\z@\@depth\the\prevdepth + \ifdim\CurrentLineWidth>\@tempdimb + \ifTTo@overlap\else + \protect\newline \protect\null + \fi\fi + \protect\nobreak + \protect\hskip\the\@tempdimb\relax + }% + %\message{\string\TTo@action: \meaning \TTo@action. }% + % get back to the baseline, regardless of its depth. + \vskip-\prevdepth + \prevdepth-99\p@ + \vskip\prevdepth + }}% + $$ + % Don't count the display as lines in the paragraph + \count@\prevgraf \advance\count@-4 \prevgraf\count@ + \TTo@action + %% \penalty\@m % to allow a penalized line break + \fi + \endgroup + \TTo@overlapfalse + \ignorespaces + \fi + } -% \tab -- to the next position -% \hskip so \tab\tab moves two positions -% Allow a (penalized but flexible) line-break right after the tab. -% -\newcommand\tab{\leavevmode\hskip2sp\tabto{\NextTabStop}% - \nobreak\hskip\z@\@plus 30\p@\penalty4000\hskip\z@\@plus-30\p@\relax} + % \tab -- to the next position + % \hskip so \tab\tab moves two positions + % Allow a (penalized but flexible) line-break right after the tab. + % + \newcommand\tab{\leavevmode\hskip2sp\tabto{\NextTabStop}% + \nobreak\hskip\z@\@plus 30\p@\penalty4000\hskip\z@\@plus-30\p@\relax} -% Expandable macro to select the next tab position from the list + % Expandable macro to select the next tab position from the list -\newcommand\NextTabStop{% - \expandafter \TTo@nexttabstop \TabStopList,\maxdimen,>% -} + \newcommand\NextTabStop{% + \expandafter \TTo@nexttabstop \TabStopList,\maxdimen,>% + } -\def\TTo@nexttabstop #1,{% - \ifdim#1<\CurrentLineWidth - \expandafter\TTo@nexttabstop - \else - \ifdim#1<0.9999\linewidth#1\else\z@\fi - \expandafter\strip@prefix - \fi -} -\def\TTo@foundtabstop#1>{} + \def\TTo@nexttabstop #1,{% + \ifdim#1<\CurrentLineWidth + \expandafter\TTo@nexttabstop + \else + \ifdim#1<0.9999\linewidth#1\else\z@\fi + \expandafter\strip@prefix + \fi + } + \def\TTo@foundtabstop#1>{} -\newcommand\TabPositions[1]{\def\TabStopList{\z@,#1}} + \newcommand\TabPositions[1]{\def\TabStopList{\z@,#1}} -\newcommand\NumTabs[1]{% - \def\TabStopList{}% - \@tempdimb\linewidth - \divide\@tempdimb by#1\relax - \advance\@tempdimb 1sp % counteract rounding-down by \divide - \CurrentLineWidth\z@ - \@whiledim\CurrentLineWidth<\linewidth\do {% - \edef\TabStopList{\TabStopList\the\CurrentLineWidth,}% - \advance\CurrentLineWidth\@tempdimb - }% - \edef\TabStopList{\TabStopList\linewidth}% -} + \newcommand\NumTabs[1]{% + \def\TabStopList{}% + \@tempdimb\linewidth + \divide\@tempdimb by#1\relax + \advance\@tempdimb 1sp % counteract rounding-down by \divide + \CurrentLineWidth\z@ + \@whiledim\CurrentLineWidth<\linewidth\do {% + \edef\TabStopList{\TabStopList\the\CurrentLineWidth,}% + \advance\CurrentLineWidth\@tempdimb + }% + \edef\TabStopList{\TabStopList\linewidth}% + } -% default setting of tab positions: -\TabPositions{\parindent,.5\linewidth} + % default setting of tab positions: + \TabPositions{\parindent,.5\linewidth} -\newif\ifTTo@overlap \TTo@overlapfalse + \newif\ifTTo@overlap \TTo@overlapfalse -\@ifundefined{predisplaydirection}{ - \let\TTo@Direction\predisplaysize - \let\predisplaydirection\@undefined -} -{ - \let\TTo@Direction\predisplaydirection -} + \@ifundefined{predisplaydirection}{ + \let\TTo@Direction\predisplaysize + \let\predisplaydirection\@undefined + } + { + \let\TTo@Direction\predisplaydirection + } diff --git a/Master/texmf-dist/doc/support/latexindent/success/table3.tex b/Master/texmf-dist/doc/support/latexindent/success/table3.tex index e4e0940fb80..19007908e01 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/table3.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/table3.tex @@ -1,5 +1,5 @@ -% arara: pdflatex -% !arara: indent: {overwrite: yes, trace: on} +% !arara: pdflatex +% arara: indent: {overwrite: yes, trace: on} \documentclass{article} \usepackage{multirow} @@ -20,7 +20,7 @@ & 12 & 8 & 14 & 5 & 2 \\ \hline \end{tabular} - \caption{Multirow in multirow} - \label{ta.Multirow} + \caption{Multirow in multirow} + \label{ta.Multirow} \end{figure*} \end{document} diff --git a/Master/texmf-dist/doc/support/latexindent/success/testHeadings.tex b/Master/texmf-dist/doc/support/latexindent/success/testHeadings.tex index 3c766b3e77f..2a8fa072e4e 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/testHeadings.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/testHeadings.tex @@ -1,59 +1,59 @@ % arara: indent: {onlyDefault: no, overwrite: true, trace: on, silent: yes, localSettings: true} \part{part} - part text - part text - \chapter{chapter long title} - chapter text - chapter text - \[ - f(x)=x^2 - \] - \section[for the toc]{section} - section text - section text - \section[for the toc]{section} - section text - section text - \subsection[for the toc]{subsection} - subsection text - subsection text - \subsection[for the toc]{subsection} - subsection text - subsection text - \section[for the toc]{section} - section text - section text - \chapter{chapter} - chapter text - chapter text + part text + part text + \chapter{chapter long title} + chapter text + chapter text + \[ + f(x)=x^2 + \] + \section[for the toc]{section} + section text + section text + \section[for the toc]{section} + section text + section text + \subsection[for the toc]{subsection} + subsection text + subsection text + \subsection[for the toc]{subsection} + subsection text + subsection text + \section[for the toc]{section} + section text + section text + \chapter{chapter} + chapter text + chapter text \part{part} - part text - part text - \chapter[toc]{chapter title} - chapter text - chapter text - \section[for the toc]{section} - section text - section text - \subsubsection[for the toc]{subsubsection} - subsubsection text - subsubsection text - \paragraph{paragraph} - paragraph text - paragraph text - \subparagraph{subparagraph} - subparagraph text - subparagraph text - \section[for the toc]{section} - section text - section text - \subsubsection[for the toc]{subsubsection} - subsubsection text - subsubsection text - \paragraph{paragraph} - paragraph text - paragraph text - \subparagraph{subparagraph} - subparagraph text - subparagraph text - \chapter[somethingelse]{goes here} + part text + part text + \chapter[toc]{chapter title} + chapter text + chapter text + \section[for the toc]{section} + section text + section text + \subsubsection[for the toc]{subsubsection} + subsubsection text + subsubsection text + \paragraph{paragraph} + paragraph text + paragraph text + \subparagraph{subparagraph} + subparagraph text + subparagraph text + \section[for the toc]{section} + section text + section text + \subsubsection[for the toc]{subsubsection} + subsubsection text + subsubsection text + \paragraph{paragraph} + paragraph text + paragraph text + \subparagraph{subparagraph} + subparagraph text + subparagraph text + \chapter[somethingelse]{goes here} diff --git a/Master/texmf-dist/doc/support/latexindent/success/testHeadings1.tex b/Master/texmf-dist/doc/support/latexindent/success/testHeadings1.tex index de90829fb5f..164fcbe1057 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/testHeadings1.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/testHeadings1.tex @@ -8,12 +8,12 @@ \end{filecontents} \begin{document} \section{} - \subsection{} - \subsubsection{} - some text goes here - some text goes here - some text goes here - \begin{verbatim} +\subsection{} + \subsubsection{} + some text goes here + some text goes here + some text goes here + \begin{verbatim} \documentclass[<+options+>]{<+class+>} \begin{document} @@ -21,5 +21,5 @@ \end{document} \end{document} more text here - \end{verbatim} + \end{verbatim} \end{document} diff --git a/Master/texmf-dist/doc/support/latexindent/success/testItems.tex b/Master/texmf-dist/doc/support/latexindent/success/testItems.tex new file mode 100644 index 00000000000..32e153eb19a --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/success/testItems.tex @@ -0,0 +1,94 @@ +% arara: indent: {overwrite: yes, silent: off, trace: yes, localSettings: yes} + +\begin{itemize} + \item some text here + some more text here + some more text here + \item another item more text + more text more text more text + more text more text more text + \item + more text more text more text + more text more text more text +\end{itemize} + +regular text +regular text +regular text +\begin{itemize} + \item some other stuff + \item[1] some other stuff + \myitem another item + \myitem[2] another item + \item some other stuff + \item some other stuff + \item some other stuff + \item some text some text + some text some text + some text some text + % here's a comment + \item some text some text + some text some text + some text some text + \[ + x^2 + \] + \item some text some text + some text some text + some text some text + \begin{list} + \item some other stuff + some other stuff + some other stuff + % here's a comment + \end{list} + \item some text some text + some text some text + some text some text + \begin{myenv} + some other stuff + some other stuff + some other stuff + \end{myenv} + \begin{itemize} + \item some text some text + some text some text + some text some text + % here's a comment + \item some text some text + some text some text + some text some text + \[ + x^2 + \] + \item some text some text + some text some text + some text some text + \begin{list} + \item some other stuff + some other stuff + some other stuff + % here's a comment + \end{list} + + \item some text some text + some text some text + some text some text + \begin{myenv} + some other stuff + some other stuff + some other stuff + \end{myenv} + \item just one line + some more text + \item something here + \end{itemize} + \item this one belongs here + more text more text more text +\end{itemize} + +\begin{myenv} + some other stuff + some other stuff + some other stuff +\end{myenv} diff --git a/Master/texmf-dist/doc/support/latexindent/success/testcls.cls b/Master/texmf-dist/doc/support/latexindent/success/testcls.cls new file mode 100644 index 00000000000..8b0d1a0e73a --- /dev/null +++ b/Master/texmf-dist/doc/support/latexindent/success/testcls.cls @@ -0,0 +1,369 @@ +% arara: indent: {overwrite: yes} +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{rpisudiss}[2014/07/06 Ryan Pavlik's ISU Thesis] + +\newcommand{\@isu@classname}{rpisudiss} +\RequirePackage{setspace} + +% option doublespacing: Double-space where we would have 1.5 spaced. +\newcommand\isu@spacing{\onehalfspacing} +\newcommand\isu@space{onehalfspace} +\DeclareOption{doublespacing}{% + \renewcommand\isu@spacing{\doublespacing} + \renewcommand\isu@space{doublespace} +} + +% option capstoc: Capitalize chapters in the table of contents +% Technically required if you go by the text of the grad college site, +% but rule inconsistently applied and results painful to read. +\newif\if@isu@capstoc \@isu@capstocfalse +\DeclareOption{capstoc}{\@isu@capstoctrue} + +% option capschap: Capitalize chapters everywhere else +% Technically required if you go by the text of the grad college site, +% but rule inconsistently applied and results painful to read. +\newif\if@isu@capschap \@isu@capschapfalse +\DeclareOption{capschap}{\@isu@capschaptrue} + +% option print: Optimize for print rather than on-screen (hide links, etc.) +% Apparently doesn't work right now. Sad. +\newif\if@isu@print \@isu@printfalse +\DeclareOption{print}{\@isu@printtrue} + +% option tocnumbersections: Number sections in the ToC. +\newif\if@isu@tocnumbersections@ \@isu@tocnumbersections@false +\DeclareOption{tocnumbersections}{\@isu@tocnumbersections@true} + +% option tocnumbersubsections: Number subsections in the ToC. Implies tocnumbersections. +\newif\if@isu@tocnumbersubsections@ \@isu@tocnumbersubsections@false +\DeclareOption{tocnumbersubsections}{ \@isu@tocnumbersubsections@true\@isu@tocnumbersections@true} + +% option ignoremissingmainmatter: Don't error if we've seen a titlepage but no \mainmatter by the end of the document. +\newif\if@isu@errormissingmainmatter@ \@isu@errormissingmainmatter@true +\DeclareOption{ignoremissingmainmatter}{\@isu@errormissingmainmatter@false} + +% option draftcls: adds "DRAFT" and a date/time stamp on the footer. +\newif\if@isu@draftcls@ \@isu@draftcls@false +\DeclareOption{draftcls}{\@isu@draftcls@true} + +% option draft: draftcls plus whatever anyone else thinks about draft. +\DeclareOption{draft}{ + \@isu@draftcls@true + \PassOptionsToClass{draft}{report} +} + +% Forward everything not recognized +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}} + +% Process options +\ProcessOptions\relax + +% Based on report +\LoadClass[12pt]{report} + +% had to choose to put this here for tocloft +\RequirePackage{subfig} + +% Put lot, lof, and bibliography (but not the contents itself) in the ToC +\RequirePackage[nottoc]{tocbibind} + +% Basic hyperref - note that backreferences are incompatible with bibtopic (for per-chapter bibliographies) +\RequirePackage[pdftex,pdfusetitle,hypertexnames=false,linktocpage=true]{hyperref} +\hypersetup{bookmarksnumbered=true,bookmarksopen=true,pdfpagemode=UseOutlines,pdfview=FitB} + +\if@isu@print +% Hide links for print +% Apparently doesn't work right now. Sad. +\hypersetup{hidelinks} +\else +% Nice blue links. +\hypersetup{colorlinks=true,linkcolor=blue,anchorcolor=blue,citecolor=blue,filecolor=blue,urlcolor=blue} +\fi + +% Indent first paragraph after sectioning things. +\RequirePackage{indentfirst} + +% Setup page layout +\RequirePackage{geometry} +\geometry{left=1in, top=1in, headheight=0.25in, headsep=0.5in, right=1in, bottom=1in, includehead=false} + +% Handle draftcls option placing timestamp in footer and watermarking first page. +\if@isu@draftcls@ + \RequirePackage[firstpage]{draftwatermark} + \RequirePackage{datetime} + \newcommand{\isu@draftfooter}{DRAFT --- rendered \today\ at \currenttime} +\else + \newcommand{\isu@draftfooter}{} +\fi + +% Setup headers/footers - override the plain page style. +\RequirePackage{fancyhdr} +\fancypagestyle{plain}{% + \fancyhf{} % clear all header and footer fields + \fancyhead[C]{\thepage} % Always put the page in the center header + \fancyfoot[C]{\isu@draftfooter} % In draft mode, put stuff in the center footer. + \renewcommand{\headrulewidth}{0pt} + \renewcommand{\footrulewidth}{0pt}} + +\AtBeginDocument{\pagestyle{plain}} + +% Set up a bool for mainmatter or not. +\newif\if@mainmatter \@mainmatterfalse + +% Title page: +% - empty style (no numbering shown) +% - starts the preface/roman numerals +% - gets a PDF bookmark, just because we can. +\renewcommand{\titlepage}{ + \thispagestyle{empty} + \pagenumbering{roman} + \pdfbookmark[0]{\@title}{toc} + % backup and set secnumdepth + \newcounter{isu@secnumdepth} + \setcounter{isu@secnumdepth}{\value{secnumdepth}} + \setcounter{secnumdepth}{-1} + \@mainmatterfalse +} +\renewcommand{\endtitlepage}{\newpage\pagestyle{plain}} + +%%% +% Set up sectioning +\RequirePackage{titlesec} +% \titleformat{command}[shape]{format}{label}{sep}{before}[after] + +% Chapter titles: +% - Caps (optional) +% - large +% - bold +% - center +\titleformat{\chapter}[block] +{\normalfont\large\bfseries\centering} +{\if@mainmatter% + \if@isu@capschap\MakeUppercase{\chaptertitlename}% + \else\chaptertitlename\fi + \thechapter.\quad\fi} +{0pt} +{\if@isu@capschap\MakeUppercase\fi}{} + +% Section: +% - bold +% - center +\titleformat{\section}[block] +{\normalfont\normalsize\bfseries\centering} +{\thesection.}{1em}{}{} + +% Subsection: +% - bold +% - left-justified +\titleformat{\subsection}[block] +{\normalfont\normalsize\bfseries} +{\thesubsection.}{1em}{}{} + +% Subsubsection: +% - bold +% - left-justified with indent +\titleformat{\subsubsection}[block] +{\normalfont\normalsize\bfseries} +{\quad\thesubsubsection.}{1em}{}{} + +% Apply default spacing +\isu@spacing + + +% Needed for toc/lof/lot spacing and headfoot tweaking +\RequirePackage{xpatch} + +%%% +% ToC: + +% Rename the ToC +\RequirePackage[subfigure,titles]{tocloft} +\renewcommand{\contentsname}{Table of Contents} + +% - Remove parskips from toc (and lof/lot) +\setlength{\cftparskip}{0pt} + +% - Single space +% - Page break after +% - TODO: couldn't get pdfbookmark to point to this page instead of the +% first page so it was removed. +\xpretocmd{\tableofcontents}{% + \begin{singlespace}}{}{} + \xapptocmd{\tableofcontents}{% + \end{singlespace}% + \pagestyle{plain}% + \clearpage}{}{} + +% - Add dot leader for chapter levels +\renewcommand\cftchapdotsep{\cftdotsep} + +% - Prefix "Chapter " to chapter number +% - Adjust indentation of levels +% - Capitalize title entries, if requested +\if@isu@capstoc +\renewcommand\cftchappresnum{\MakeUppercase{\chaptertitlename} } +\cftsetindents{chapter}{0em}{8em} +\cftsetindents{section}{2em}{0em} +\cftsetindents{subsection}{3em}{0em} +\renewcommand{\cftchapfont}{\MakeUppercase} +\else +\renewcommand\cftchappresnum{\chaptertitlename\ } +\cftsetindents{chapter}{0em}{6em} +\cftsetindents{section}{1em}{0em} +\cftsetindents{subsection}{2em}{0em} +\fi + +% - Remove section/subsection numbers from ToC by capturing +% see idea at http://tex.stackexchange.com/questions/71123/remove-section-number-toc-entries-with-tocloft +\if@isu@tocnumbersections@\else +\renewcommand{\cftsecpresnum}{\begin{lrbox}{\@tempboxa}} +\renewcommand{\cftsecaftersnum}{\end{lrbox}} +\fi + +\if@isu@tocnumbersubsections@\else +\renewcommand{\cftsubsecpresnum}{\begin{lrbox}{\@tempboxa}} +\renewcommand{\cftsubsecaftersnum}{\end{lrbox}} +\fi + +%%% +% List of Figures: +% - Single space +% - Page break after +\xpretocmd{\listoffigures}{% + \begin{singlespace}}{}{} + \xapptocmd{\listoffigures}{% + \end{singlespace}\clearpage}{}{} + +% - Prepend the word "Figure" to the number +\renewcommand\cftfigpresnum{Figure } +\cftsetindents{figure}{0em}{6em} + +%%% +% List of Tables: +% - Single space +% - Page break after +\xpretocmd{\listoftables}{% + \begin{singlespace}}{}{} + \xapptocmd{\listoftables}{% + \end{singlespace}\clearpage}{}{} + +% - Prepend the word "Table" to the number +\renewcommand\cfttabpresnum{Table } +\cftsetindents{table}{0em}{6em} + +%%% +% Document division commands + +% Command to indicate when we're done +% with preface content - must be called! +% (If we're actually typesetting a full thesis...) +\newcommand{\mainmatter}{% + \clearpage + \pagenumbering{arabic} + \pagestyle{plain} + \@mainmattertrue + \newcommand{\@isu@gotmainmatter@}{} + \setcounter{chapter}{0} + % restore secnumdepth + \setcounter{secnumdepth}{\value{isu@secnumdepth}} +} + +% Command to indicate we're done with main content +\newcommand{\backmatter}{ + \setcounter{isu@secnumdepth}{\value{secnumdepth}} + \setcounter{secnumdepth}{-1} + \@mainmatterfalse +} + +\RequirePackage{etoolbox} +% Verify that we actually got some main matter +\AfterEndDocument{ + \if@isu@errormissingmainmatter@ + \ifdefined\@isu@gottitle + \ClassInfo{\@isu@classname}{Full dissertation mode} + \unless\ifdefined\@isu@gotmainmatter@ + \ClassError{\@isu@classname}{Missing \protect\mainmatter\space before your first real chapter!}{Missing mainmatter} + % \ClassError{\@isu@classname}{% + % \protect\mainmatter\space not called in your document expected before your first real chapter}{% + % You need to put \protect\mainmatter\space before your first real numbered chapter, typically your introduction.} + \fi + \fi + \fi +} + +%%% +% Title Page + +% Temporary: hardcode these values in. +\newcommand\isu@degree{Doctor of Philosophy} +\newcommand\isu@gradyear{2014} +\newcommand\isu@submissiontype{dissertation} +\newcommand\isu@majorline{Co-majors: Human-Computer Interaction; Computer Science} +\newcommand\isu@committee{% + Judy M. Vance, Co-major Professor\\% + Leslie Miller, Co-major Professor\\% + Debra Satterfield \\ Jonathan Kelly \\ David Weiss \\ Horea Ilies} +\newcommand\isu@copyrightnotice{\\ % Unclear what the spacing between notice and the text above should be. + Copyright \copyright\ \@author, \isu@gradyear. +All rights reserved.} + +% Spacing tools +% - used for what the thesis office calls "two blank lines" +\newcommand{\@isu@twoblanklines}{20pt} +\newcommand{\@isu@maketwoblanklines}{\vspace{\@isu@twoblanklines}} + +% The actual title page layout. +% Note that portions that appear double-spaced in the sample/annotated PDF +% are given the same spacing as the body of the document (1.5 or 2) +\renewcommand{\maketitle}{ + \newcommand{\@isu@gottitle}{} % Assume that \maketitle implies typesetting a full thesis, not just a chapter. + \ClassInfo{\@isu@classname}{Generating title page -- assuming we are typesetting a full dissertation.} + + \begin{titlepage} + \setlength{\parindent}{0pt} % Don't you dare try to indent! + \vbox to \textheight{ % Full-page box to contain everything and stretch everything. + \begin{center} % Center this whole page + \vspace*{12pt} % Designated blank line at the top of the page. + + \begin{singlespace} % Single-space this section, we manually add spacing. + \textbf{\@title}\\ % Title in bold + \@isu@maketwoblanklines % "two blank lines" + by\\ % the word 'by', not in bold + \@isu@maketwoblanklines % "two blank lines" + \textbf{\@author} % Author in bold + \end{singlespace} + + \vfill{} % let LaTeX decide what "4-6 blank lines" should be. + + \begin{\isu@space} % Normal document spacing here. + A \isu@submissiontype\ submitted to the graduate faculty\\ + in partial fulfillment of the requirements of the degree of\\ + \MakeUppercase{\isu@degree} % Doctor of Philosophy, etc. We enforce caps so they don't have to. + \end{\isu@space} + + \@isu@maketwoblanklines % "two blank lines" + + \begin{singlespace} % Committee is single-spaced, looks like really long majors would be too. + \isu@majorline\\ % "Major: MAJ (CONC)" or "Co-majors: MAJ; MAJ; + \medskip % Unspecified space here, looks like just "one blank line" on sample + Program of Study Committee:\\ + \isu@committee % Committee, user-delimited with \\ and user-annoted with ", Major Professor" or "Co-major Professor" + \end{singlespace} + + \vfill{} % let LaTeX decide what "7-8 blank lines" should be. + \@isu@maketwoblanklines % Suggest it's a little longer than the other vfill. + + \begin{\isu@space} % Normal document spacing here + Iowa State University\\ + Ames, Iowa\\ + \isu@gradyear % Newline after here, if needed, is in the copyright notice macro. + \isu@copyrightnotice % Copyright line optional if copyright not formally filed. + \end{\isu@space} + + \end{center} + } + \end{titlepage} +} + +\endinput + diff --git a/Master/texmf-dist/doc/support/latexindent/success/theorem.tex b/Master/texmf-dist/doc/support/latexindent/success/theorem.tex index 524b9dfc6f1..dcf9fe05a23 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/theorem.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/theorem.tex @@ -1,6 +1,6 @@ % arara: indent: {overwrite: on} \documentclass[12pt,twoside]{report} -\usepackage[margin=2cm]{geometry} +\usepackage[margin=2cm]{geometry} \usepackage{amsmath,amsthm,amssymb} \usepackage{thmtools} \usepackage{tikz} @@ -31,17 +31,17 @@ \begin{document} \section{Introduction} -Lorem ipsum sed nulla id risus adipiscing vulputate. + Lorem ipsum sed nulla id risus adipiscing vulputate. -\begin{example} - Um consumidor financiou a compra de um veÃculo pagando 48 parcelas de \$800,00 mensais e a taxa de juros cobrada pela concessionária foi de 1,2\% a.m.. Qual era o valor à vista do automóvel adquirido? - \newline - \textbf{Solução:} - \newline - $PV = 800 \times \left[ \dfrac{1,012^{48}-1}{1,012^{48}\times 0,012} \right] \newline - PV = 800 \times \left[ \dfrac{0,772820}{0,021274} \right] \newline - PV = \$29.061,79$ -\end{example} + \begin{example} + Um consumidor financiou a compra de um veÃculo pagando 48 parcelas de \$800,00 mensais e a taxa de juros cobrada pela concessionária foi de 1,2\% a.m.. Qual era o valor à vista do automóvel adquirido? + \newline + \textbf{Solução:} + \newline + $PV = 800 \times \left[ \dfrac{1,012^{48}-1}{1,012^{48}\times 0,012} \right] \newline + PV = 800 \times \left[ \dfrac{0,772820}{0,021274} \right] \newline + PV = \$29.061,79$ + \end{example} -Lorem ipsum sed nulla id risus adipiscing vulputate. + Lorem ipsum sed nulla id risus adipiscing vulputate. \end{document} diff --git a/Master/texmf-dist/doc/support/latexindent/success/tikz1.tex b/Master/texmf-dist/doc/support/latexindent/success/tikz1.tex index 36624b91bcb..ccef3d047f2 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/tikz1.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/tikz1.tex @@ -28,21 +28,21 @@ \foreach \samples[count=\xi from 1] in {#1}{% \StrCut{\samples}{|}{\vertdir}{\hordir} \ifnum\xi=1 - \draw[\samplelinewidth,\samplecol](start) - --++(\hordir,0) coordinate (start); + \draw[\samplelinewidth,\samplecol](start) + --++(\hordir,0) coordinate (start); \else - \IfStrEq{\vertdir}{+}{%true - \draw[\samplelinewidth,\samplecol]($(start)+(0,\vertfactor)$) - --++(\hordir,0)coordinate(start); - }{%false - \relax - } - \IfStrEq{\vertdir}{-}{%true - \draw[\samplelinewidth,\samplecol]($(start)+(0,-\vertfactor)$) - --++(\hordir,0)coordinate(start); - }{%false - \relax - } + \IfStrEq{\vertdir}{+}{%true + \draw[\samplelinewidth,\samplecol]($(start)+(0,\vertfactor)$) + --++(\hordir,0)coordinate(start); + }{%false + \relax + } + \IfStrEq{\vertdir}{-}{%true + \draw[\samplelinewidth,\samplecol]($(start)+(0,-\vertfactor)$) + --++(\hordir,0)coordinate(start); + }{%false + \relax + } \fi } } @@ -59,21 +59,21 @@ \foreach \samples[count=\xi from 1] in {#1}{% \StrCut{\samples}{|}{\vertdir}{\hordir} \ifnum\xi=1 - \path(start)node[sample]{} - --++(\hordir,0) coordinate (start); + \path(start)node[sample]{} + --++(\hordir,0) coordinate (start); \else - \IfStrEq{\vertdir}{+}{%true - \path($(start)+(0,\vertfactor)$)node[sample]{} - --++(\hordir,0)coordinate(start); - }{%false - \relax - } - \IfStrEq{\vertdir}{-}{%true - \path($(start)+(0,-\vertfactor)$)node[sample]{} - --++(\hordir,0)coordinate(start); - }{%false - \relax - } + \IfStrEq{\vertdir}{+}{%true + \path($(start)+(0,\vertfactor)$)node[sample]{} + --++(\hordir,0)coordinate(start); + }{%false + \relax + } + \IfStrEq{\vertdir}{-}{%true + \path($(start)+(0,-\vertfactor)$)node[sample]{} + --++(\hordir,0)coordinate(start); + }{%false + \relax + } \fi } } diff --git a/Master/texmf-dist/doc/support/latexindent/success/torusPGF.tex b/Master/texmf-dist/doc/support/latexindent/success/torusPGF.tex index 2f8ac9b7d5f..0edf21a5e29 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/torusPGF.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/torusPGF.tex @@ -11,8 +11,8 @@ samples=20, domain=0:2*pi,y domain=0:2*pi, z buffer=sort] - ({(2+cos(deg(x)))*cos(deg(y+pi/2))}, - {(2+cos(deg(x)))*sin(deg(y+pi/2))}, + ({(2+cos(deg(x)))*cos(deg(y+pi/2))}, + {(2+cos(deg(x)))*sin(deg(y+pi/2))}, {sin(deg(x))}); \end{axis} \end{tikzpicture} diff --git a/Master/texmf-dist/doc/support/latexindent/success/torusPSTricks.tex b/Master/texmf-dist/doc/support/latexindent/success/torusPSTricks.tex index 7e3fc4bd501..cd8cc0db4ad 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/torusPSTricks.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/torusPSTricks.tex @@ -8,7 +8,7 @@ \defFunction[algebraic]{torus}(u,v) {(2+cos(u))*cos(v+\Pi)} {(2+cos(u))*sin(v+\Pi)} - {sin(u)} + {sin(u)} \psSolid[object=surfaceparametree, base=-10 10 0 6.28,fillcolor=black!70,incolor=orange, function=torus,ngrid=60 0.4, diff --git a/Master/texmf-dist/doc/support/latexindent/success/trailingComments.tex b/Master/texmf-dist/doc/support/latexindent/success/trailingComments.tex index bc0d613c717..060e1888df7 100644 --- a/Master/texmf-dist/doc/support/latexindent/success/trailingComments.tex +++ b/Master/texmf-dist/doc/support/latexindent/success/trailingComments.tex @@ -1,6 +1,6 @@ % arara: indent: {overwrite: yes, trace: true} \parbox{% more comments here - some stuff% comments go here + some stuff% comments go here }}}} some \% stuff this is not a comment } some stuff diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml index 457629ce863..799c081f4dc 100755 --- a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml +++ b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml @@ -34,6 +34,18 @@ onlyOneBackUp: 0 # many backups are possible, unless onlyOneBackUp is switched on maxNumberOfBackUps: 0 +# some users may wish to cycle through back up files, for example, +# with maxNumberOfBackUps: 4, they may wish to delete the oldest +# back up file, and keep only the most recent. +# +# copy myfile.bak1 to myfile.bak0 +# copy myfile.bak2 to myfile.bak1 +# copy myfile.bak3 to myfile.bak2 +# copy myfile.bak4 to myfile.bak3 +# +# the back up will be written to myfile.bak4 +cycleThroughBackUps: 0 + # indent preamble indentPreamble: 0 @@ -53,6 +65,7 @@ removeTrailingWhitespace: 0 lookForAlignDelims: tabular: 1 tabularx: 1 + longtable: 1 array: 1 matrix: 1 bmatrix: 1 @@ -64,7 +77,6 @@ lookForAlignDelims: aligned: 1 cases: 1 dcases: 1 - pmatrix: 1 listabla: 1 # if you have indent rules for particular environments @@ -75,6 +87,7 @@ indentRules: anotherenvironment: "\t\t\t\t" chapter: " " section: " " + item: " " # verbatim environments- environments specified # in this hash table will not be changed at all! @@ -143,6 +156,53 @@ indentAfterHeadings: indent: 0 level: 7 +# if you want the script to look for \item commands +# and format it, as follows (for example), +# \begin{itemize} +# \item content here +# next line is indented +# next line is indented +# \item another item +# \end{itemize} +# then populate indentAfterItems. See also itemNames +indentAfterItems: + itemize: 1 + enumerate: 1 + list: 1 + +# if you want to use other names for your items (such as, for example, part) +# then populate them here- note that you can trick latexindent.pl +# into indenting all kinds of commands (within environments specified in +# indentAfterItems) using this technique. +itemNames: + item: 1 + myitem: 1 + +# if you want to indent if, else, fi constructs such as, for example, +# +# \ifnum#1=2 +# something +# \else +# something else +# \fi +# +# then populate them in constructIfElseFi +constructIfElseFi: + ifnum: 1 + ifdim: 1 + ifodd: 1 + ifvmode: 1 + ifhmode: 1 + ifmmode: 1 + ifinner: 1 + if: 1 + ifcat: 1 + ifx: 1 + ifvoid: 1 + ifeof: 1 + iftrue: 1 + ifcase: 1 + # *** NOTE *** # If you have specified alwaysLookforSplitBraces: 1 # and alwaysLookforSplitBrackets: 1 then you don't need diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl index 9376117c324..d023ef014d0 100755 --- a/Master/texmf-dist/scripts/latexindent/latexindent.pl +++ b/Master/texmf-dist/scripts/latexindent/latexindent.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -13,14 +13,29 @@ # # For details of how to use this file, please see readme.txt -# load packages/modules +# load packages/modules: assume strict and warnings are part of every perl distribution use strict; -use warnings; -use FindBin; # help find defaultSettings.yaml -use YAML::Tiny; # interpret defaultSettings.yaml +use warnings; + +# check the other modules are available +foreach my $moduleName ('FindBin','YAML::Tiny','File::Copy','File::Basename','Getopt::Long','File::HomeDir') +{ + # references: + # http://stackoverflow.com/questions/251694/how-can-i-check-if-i-have-a-perl-module-before-using-it + # http://stackoverflow.com/questions/1917261/how-can-i-dynamically-include-perl-modules-without-using-eval + eval { + (my $file = $moduleName) =~ s|::|/|g; + require $file . '.pm'; + $moduleName->import(); + 1; + } or die "$moduleName Perl Module not currently installed; please install the module, and then try running latexindent.pl again; exiting"; +} + +# now that we have confirmed the modules are available, load them +use FindBin; # help find defaultSettings.yaml +use YAML::Tiny; # interpret defaultSettings.yaml and other potential settings files use File::Copy; # to copy the original file to backup (if overwrite option set) use File::Basename; # to get the filename and directory path -#use Getopt::Std; use Getopt::Long; # to get the switches/options/flags use File::HomeDir; # to get users home directory, regardless of OS @@ -32,7 +47,7 @@ my $tracingMode; my $readLocalSettings; my $onlyDefault; my $showhelp; -my $cruftDirectory='./'; +my $cruftDirectory; GetOptions ("w"=>\$overwrite, "o"=>\$outputToFile, @@ -44,12 +59,10 @@ GetOptions ("w"=>\$overwrite, "c=s"=>\$cruftDirectory, ); -die "Could not find directory $cruftDirectory\nExiting, no indentation done." if(!(-d $cruftDirectory)); - # version number -my $versionNumber = "1.11R"; +my $versionNumber = "2.0R"; -# Check the number of input arguments- if it is 0 then simply +# Check the number of input arguments- if it is 0 then simply # display the list of options (like a manual) if(scalar(@ARGV) < 1 or $showhelp) { @@ -70,6 +83,11 @@ ENDQUOTE exit(2); } +# set up default for cruftDirectory using the one from the input file, +# unless it has been specified using -c="/some/directory" +$cruftDirectory=dirname $ARGV[0] unless(defined($cruftDirectory)); + +die "Could not find directory $cruftDirectory\nExiting, no indentation done." if(!(-d $cruftDirectory)); # we'll be outputting to the logfile and to standard output my $logfile; @@ -97,12 +115,12 @@ ENDQUOTE # a quick options check if($outputToFile and $overwrite) { - print $logfile <<ENDQUOTE + print $logfile <<ENDQUOTE -WARNING: +WARNING: \t You have called latexindent.pl with both -o and -w \t -o (output to file) will take priority, and -w (over write) will be ignored - + ENDQUOTE ; $overwrite = 0; @@ -115,7 +133,7 @@ if(scalar(@ARGV)>2) ERROR: \t You're calling latexindent.pl with more than two file names -\t The script can take at MOST two file names, but you +\t The script can take at MOST two file names, but you \t need to call it with the -o switch; for example \t latexindent.pl -o originalfile.tex outputfile.tex @@ -144,7 +162,7 @@ ENDQUOTE exit(2); } -# if the script is called with the -o switch, then check that +# if the script is called with the -o switch, then check that # a second file is present in the call, e.g # latexindent.pl -o myfile.tex output.tex if($outputToFile and scalar(@ARGV)==1) @@ -173,9 +191,9 @@ $defaultSettings = YAML::Tiny->read( "$FindBin::RealBin/defaultSettings.yaml" ); if(!$defaultSettings) { for my $fh ($out,$logfile) { - print $fh <<ENDQUOTE + print $fh <<ENDQUOTE ERROR There seems to be a yaml formatting error in defaultSettings.yaml - Please check it for mistakes- you can find a working version at https://github.com/cmhughes/latexindent.plx + Please check it for mistakes- you can find a working version at https://github.com/cmhughes/latexindent.pl if you would like to overwrite your current version Exiting, no indendation done. @@ -195,6 +213,7 @@ my $indentPreamble = $defaultSettings->[0]->{indentPreamble}; my $onlyOneBackUp = $defaultSettings->[0]->{onlyOneBackUp}; my $maxNumberOfBackUps = $defaultSettings->[0]->{maxNumberOfBackUps}; my $removeTrailingWhitespace = $defaultSettings->[0]->{removeTrailingWhitespace}; +my $cycleThroughBackUps = $defaultSettings->[0]->{cycleThroughBackUps}; # hash variables my %lookForAlignDelims= %{$defaultSettings->[0]->{lookForAlignDelims}}; @@ -206,6 +225,9 @@ my %checkunmatchedELSE= %{$defaultSettings->[0]->{checkunmatchedELSE}}; my %checkunmatchedbracket= %{$defaultSettings->[0]->{checkunmatchedbracket}}; my %noAdditionalIndent= %{$defaultSettings->[0]->{noAdditionalIndent}}; my %indentAfterHeadings= %{$defaultSettings->[0]->{indentAfterHeadings}}; +my %indentAfterItems= %{$defaultSettings->[0]->{indentAfterItems}}; +my %itemNames= %{$defaultSettings->[0]->{itemNames}}; +my %constructIfElseFi= %{$defaultSettings->[0]->{constructIfElseFi}}; # need new hashes to store the user and local data before # overwriting the default @@ -218,6 +240,9 @@ my %checkunmatchedELSEUSER; my %checkunmatchedbracketUSER; my %noAdditionalIndentUSER; my %indentAfterHeadingsUSER; +my %indentAfterItemsUSER; +my %itemNamesUSER; +my %constructIfElseFiUSER; # for printing the user and local settings to the log file my %dataDump; @@ -230,7 +255,7 @@ my $userSettings; # get information about user settings- first check if indentconfig.yaml exists my $indentconfig = File::HomeDir->my_home . "/indentconfig.yaml"; -if ( -e $indentconfig and !$onlyDefault ) +if ( -e $indentconfig and !$onlyDefault ) { print $logfile "Reading path information from ",File::HomeDir->my_home,"/indentconfig.yaml\n"; @@ -248,13 +273,13 @@ if ( -e $indentconfig and !$onlyDefault ) else { print $logfile <<ENDQUOTE -WARNING: $indentconfig +WARNING: $indentconfig contains some invalid .yaml formatting- unable to read from it. - No user settings loaded. + No user settings loaded. ENDQUOTE ; } -} +} else { if($onlyDefault) @@ -275,16 +300,16 @@ else my $directoryName = dirname $ARGV[0]; # add local settings to the paths, if appropriate -if ( (-e "$directoryName/localSettings.yaml") and $readLocalSettings and !(-z "$directoryName/localSettings.yaml")) +if ( (-e "$directoryName/localSettings.yaml") and $readLocalSettings and !(-z "$directoryName/localSettings.yaml")) { - print $logfile "\nAdding ./localSettings.yaml to paths\n\n"; + print $logfile "\nAdding $directoryName/localSettings.yaml to paths\n\n"; push(@absPaths,"$directoryName/localSettings.yaml"); } -elsif ( !(-e "$directoryName/localSettings.yaml") and $readLocalSettings) +elsif ( !(-e "$directoryName/localSettings.yaml") and $readLocalSettings) { print $logfile "WARNING\n\t$directoryName/localSettings.yaml not found\n"; print $logfile "\tcarrying on without it.\n"; -} +} # read in the settings from each file foreach my $settings (@absPaths) @@ -312,8 +337,9 @@ foreach my $settings (@absPaths) $onlyOneBackUp = $userSettings->[0]->{onlyOneBackUp} if defined($userSettings->[0]->{onlyOneBackUp}); $maxNumberOfBackUps = $userSettings->[0]->{maxNumberOfBackUps} if defined($userSettings->[0]->{maxNumberOfBackUps}); $removeTrailingWhitespace = $userSettings->[0]->{removeTrailingWhitespace} if defined($userSettings->[0]->{removeTrailingWhitespace}); + $cycleThroughBackUps = $userSettings->[0]->{cycleThroughBackUps} if defined($userSettings->[0]->{cycleThroughBackUps}); - # hash variables - note that each one requires two lines, + # hash variables - note that each one requires two lines, # one to read in the data, one to put the keys&values in correctly %lookForAlignDelimsUSER= %{$userSettings->[0]->{lookForAlignDelims}} if defined($userSettings->[0]->{lookForAlignDelims}); @@ -340,6 +366,14 @@ foreach my $settings (@absPaths) %indentAfterHeadingsUSER= %{$userSettings->[0]->{indentAfterHeadings}} if defined($userSettings->[0]->{indentAfterHeadings}); @indentAfterHeadings{ keys %indentAfterHeadingsUSER } = values %indentAfterHeadingsUSER if (%indentAfterHeadingsUSER); + %indentAfterItemsUSER= %{$userSettings->[0]->{indentAfterItems}} if defined($userSettings->[0]->{indentAfterItems}); + @indentAfterItems{ keys %indentAfterItemsUSER } = values %indentAfterItemsUSER if (%indentAfterItemsUSER); + + %itemNamesUSER= %{$userSettings->[0]->{itemNames}} if defined($userSettings->[0]->{itemNames}); + @itemNames{ keys %itemNamesUSER } = values %itemNamesUSER if (%itemNamesUSER); + + %constructIfElseFiUSER= %{$userSettings->[0]->{constructIfElseFi}} if defined($userSettings->[0]->{constructIfElseFi}); + @constructIfElseFi{ keys %constructIfElseFiUSER } = values %constructIfElseFiUSER if (%constructIfElseFiUSER); } else { @@ -371,13 +405,14 @@ if ($overwrite) print $logfile "\nBackup procedure:\n"; # original name of file my $filename = $ARGV[0]; - # copy it - my $backupFile = $filename; + + # get the base file name, allowing for different extensions + my $backupFile = basename($filename,(".tex",".sty",".cls")); # add the user's backup directory to the backup path $backupFile = "$cruftDirectory/$backupFile"; - # if both ($onlyOneBackUp and $maxNumberOfBackUps) then we have + # if both ($onlyOneBackUp and $maxNumberOfBackUps) then we have # a conflict- er on the side of caution and turn off onlyOneBackUp if($onlyOneBackUp and $maxNumberOfBackUps>1) { @@ -386,7 +421,7 @@ if ($overwrite) $onlyOneBackUp = 0; } - # if the user has specified that $maxNumberOfBackUps = 1 then + # if the user has specified that $maxNumberOfBackUps = 1 then # they only want one backup if($maxNumberOfBackUps==1) { @@ -407,7 +442,7 @@ if ($overwrite) # be overwritten each time if($onlyOneBackUp) { - $backupFile =~ s/\.tex/$backupExtension/; + $backupFile .= $backupExtension; print $logfile "\t copying $filename to $backupFile\n"; print $logfile "\t $backupFile was overwritten\n\n" if (-e $backupFile); } @@ -415,7 +450,7 @@ if ($overwrite) { # start with a backup file .bak0 (or whatever $backupExtension is present) my $backupCounter = 0; - $backupFile =~ s/\.tex$/$backupExtension$backupCounter/; + $backupFile .= $backupExtension.$backupCounter; # if it exists, then keep going: .bak0, .bak1, ... while (-e $backupFile or $maxNumberOfBackUps>1) @@ -423,6 +458,36 @@ if ($overwrite) if($backupCounter==$maxNumberOfBackUps) { print $logfile "\t maxNumberOfBackUps reached ($maxNumberOfBackUps)\n"; + + # some users may wish to cycle through back up files, e.g: + # copy myfile.bak1 to myfile.bak0 + # copy myfile.bak2 to myfile.bak1 + # copy myfile.bak3 to myfile.bak2 + # + # current back up is stored in myfile.bak4 + if($cycleThroughBackUps) + { + print $logfile "\t cycleThroughBackUps detected (see cycleThroughBackUps) \n"; + for(my $i=1;$i<=$maxNumberOfBackUps;$i++) + { + # remove number from backUpFile + my $oldBackupFile = $backupFile; + $oldBackupFile =~ s/$backupExtension.*/$backupExtension/; + my $newBackupFile = $oldBackupFile; + + # add numbers back on + $oldBackupFile .= $i; + $newBackupFile .= $i-1; + + # check that the oldBackupFile exists + if(-e $oldBackupFile){ + print $logfile "\t\t copying $oldBackupFile to $newBackupFile \n"; + copy($oldBackupFile,$newBackupFile) or die "Could not write to backup file $backupFile. Please check permissions. Exiting.\n"; + } + } + } + + # rest maxNumberOfBackUps $maxNumberOfBackUps=1 ; last; # break out of the loop } @@ -444,7 +509,7 @@ if ($overwrite) copy($filename,$backupFile) or die "Could not write to backup file $backupFile. Please check permissions. Exiting.\n"; } -if(!($outputToFile or $overwrite)) +if(!($outputToFile or $overwrite)) { print $logfile "Just out put to the terminal :)\n\n" if !$silentMode ; } @@ -460,28 +525,28 @@ my $inverbatim=0; # $inverbatim: switch to determine if in my $delimiters=0; # $delimiters: switch that governs if # we need to check for & or not my $matchedbraces=0; # $matchedbraces: counter to see if { } - # are matched; it will be - # positive if too many { + # are matched; it will be + # positive if too many { # negative if too many } # 0 if matched my $matchedBRACKETS=0; # $matchedBRACKETS: counter to see if [ ] - # are matched; it will be - # positive if too many { + # are matched; it will be + # positive if too many { # negative if too many } # 0 if matched my $commandname; # $commandname: either \parbox, \marginpar, # or anything else from %checkunmatched my $commanddetails; # $command details: a scalar that stores - # details about the command + # details about the command # that splits {} across lines -my $countzeros; # $countzeros: a counter that helps +my $countzeros; # $countzeros: a counter that helps # when determining if we're in # an else construct -my $lookforelse=0; # $lookforelse: a boolean to help determine - # if we need to look for an +my $lookforelse=0; # $lookforelse: a boolean to help determine + # if we need to look for an # else construct -my $trailingcomments; # $trailingcomments stores the comments at the end of - # a line +my $trailingcomments; # $trailingcomments stores the comments at the end of + # a line my $lineCounter=0; # $lineCounter keeps track of the line number my $inIndentBlock=0; # $inindentblock: switch to determine if in # a inindentblock or not @@ -492,26 +557,26 @@ my $headingLevel=0; # $headingLevel: scalar that stores which heading my @indent; # @indent: stores current level of indentation my @lines; # @lines: stores the newly indented lines my @block; # @block: stores blocks that have & delimiters -my @commandstore; # @commandstore: stores commands that +my @commandstore; # @commandstore: stores commands that # have split {} across lines -my @commandstorebrackets; # @commandstorebrackets: stores commands that +my @commandstorebrackets; # @commandstorebrackets: stores commands that # have split [] across lines -my @mainfile; # @mainfile: stores input file; used to +my @mainfile; # @mainfile: stores input file; used to # grep for \documentclass my @headingStore; # @headingStore: stores headings: chapter, section, etc -my @indentNames; # @indentNames: keeps names of commands and +my @indentNames; # @indentNames: keeps names of commands and # environments that have caused # indentation to increase -my @environmentStack; # @environmentStack: stores the (nested) names +my @environmentStack; # @environmentStack: stores the (nested) names # of environments -# check to see if the current file has \documentclass, if so, then +# check to see if the current file has \documentclass, if so, then # it's the main file, if not, then it doesn't have preamble open(MAINFILE, $ARGV[0]) or die "Could not open input file"; @mainfile=<MAINFILE>; close(MAINFILE); -# if the MAINFILE doesn't have a \documentclass statement, then +# if the MAINFILE doesn't have a \documentclass statement, then # it shouldn't have preamble if(scalar(@{[grep(m/^\s*\\documentclass/, @mainfile)]})==0) { @@ -532,7 +597,7 @@ while(<MAINFILE>) { # increment the line counter $lineCounter++; - + # tracing mode print $logfile "\n" if($tracingMode and !($inpreamble or $inverbatim or $inIndentBlock)); @@ -542,10 +607,10 @@ while(<MAINFILE>) { # if not, remove all leading spaces and tabs # from the current line, assuming it isn't empty - #s/^\ *//; - #s/^\s+//; - #s/^\t+//; - s/^\t*// if($_ !~ /^((\s*)|(\t*))*$/); + #s/^\ *//; + #s/^\s+//; + #s/^\t+//; + s/^\t*// if($_ !~ /^((\s*)|(\t*))*$/); s/^\s*// if($_ !~ /^((\s*)|(\t*))*$/); # tracing mode @@ -580,19 +645,28 @@ while(<MAINFILE>) } } + # \END{ENVIRONMENTS}, or CLOSING } or CLOSING ] + # \END{ENVIRONMENTS}, or CLOSING } or CLOSING ] + # \END{ENVIRONMENTS}, or CLOSING } or CLOSING ] + + print $logfile "Line $lineCounter\t << PHASE 1: looking for reasons to DECREASE indentation of CURRENT line \n" if($tracingMode); # check to see if we have \end{something} or \] &at_end_of_env_or_eq() unless ($inpreamble or $inIndentBlock); - # check to see if we're at the end of a noindent + # check to see if we have %* \end{something} for alignment blocks + # outside of environments + &end_command_with_alignment(); + + # check to see if we're at the end of a noindent # block %\end{noindent} &at_end_noindent(); # only check for unmatched braces if we're not in # a verbatim-like environment or in the preamble or in a - # noIndentBlock - if(!($inverbatim or $inpreamble or $inIndentBlock)) + # noIndentBlock or in a delimiter block + if(!($inverbatim or $inpreamble or $inIndentBlock or $delimiters)) { - # The check for closing } and ] relies on counting, so + # The check for closing } and ] relies on counting, so # we have to remove trailing comments so that any {, }, [, ] # that are found after % are not counted # @@ -615,13 +689,19 @@ while(<MAINFILE>) # we're not starting another command that has split braces (nesting) &end_command_or_key_unmatched_braces(); - # check to see if we're at the end of a command that splits + # check to see if we're at the end of a command that splits # [ ] across lines &end_command_or_key_unmatched_brackets(); - # check for a heading + # check for a heading such as \chapter, \section, etc &indent_heading(); + # check for \item + &indent_item(); + + # check for \else or \fi + &indent_if_else_fi(); + # add the trailing comments back to the end of the line if(scalar($trailingcomments)) { @@ -630,21 +710,23 @@ while(<MAINFILE>) $_ = $_ . $trailingcomments."\n" ; # tracing mode - print $logfile "Line $lineCounter\t counting braces/brackets complete: added trailing comments back on $trailingcomments\n" if($tracingMode); + print $logfile "Line $lineCounter\t counting braces/brackets complete\n" if($tracingMode); + print $logfile "Line $lineCounter\t Adding trailing comments back on: $trailingcomments\n" if($tracingMode); # empty the trailingcomments $trailingcomments=''; } + # remove trailing whitespace + if ($removeTrailingWhitespace) + { + print $logfile "Line $lineCounter\t removing trailing whitespace (see removeTrailingWhitespace)\n" if ($tracingMode); + s/\s+$/\n/; + } } - # remove trailing whitespace - if ($removeTrailingWhitespace) - { - print $logfile "Line $lineCounter\t removing trailing whitespace\n" if ($tracingMode); - s/\s+$/\n/; - } - + # ADD CURRENT LEVEL OF INDENTATION + # ADD CURRENT LEVEL OF INDENTATION # ADD CURRENT LEVEL OF INDENTATION # (unless we're in a delimiter-aligned block) if(!$delimiters) @@ -666,7 +748,7 @@ while(<MAINFILE>) } push(@lines,$_); # tracing mode - print $logfile "Line $lineCounter\t Adding current level of indentation: ",join(", ",@indentNames),"\n" if($tracingMode); + print $logfile "Line $lineCounter\t || PHASE 2: Adding current level of indentation: ",join(", ",@indentNames),"\n" if($tracingMode); } } else @@ -678,21 +760,39 @@ while(<MAINFILE>) print $logfile "Line $lineCounter\t In delimeter block, waiting for block formatting\n" if($tracingMode); } - # only check for new environments or commands if we're + # \BEGIN{ENVIRONMENT} or OPEN { or OPEN [ + # \BEGIN{ENVIRONMENT} or OPEN { or OPEN [ + # \BEGIN{ENVIRONMENT} or OPEN { or OPEN [ + + # only check for new environments or commands if we're # not in a verbatim-like environment or in the preamble # or in a noIndentBlock, or delimiter block if(!($inverbatim or $inpreamble or $inIndentBlock or $delimiters)) { - # check if we are in a + print $logfile "Line $lineCounter\t >> PHASE 3: looking for reasons to INCREASE indentation of SUBSEQUENT lines \n" if($tracingMode); + + # check if we are in a # % \begin{noindent} # block; this is similar to a verbatim block, the user - # may not want some blocks of code to be touched + # may not want some blocks of code to be touched # # IMPORTANT: this needs to go before the trailing comments # are removed! &at_beg_noindent(); + # check for + # %* \begin{tabular} + # which might be used to align blocks that contain delimeters that + # are NOT contained in an alignment block in the usual way, e.g + # \matrix{ + # %* \begin{tabular} + # 1 & 2 \\ + # 3 & 4 \\ + # %* \end{tabular} + # } + &begin_command_with_alignment(); + # remove trailing comments so that any {, }, [, ] # that are found after % are not counted # @@ -706,7 +806,7 @@ while(<MAINFILE>) # tracing mode print $logfile "Line $lineCounter\t Removing trailing comments for brace count (line is already stored)\n" if($tracingMode); - # check to see if we have \begin{something} or \[ + # check to see if we have \begin{something} or \[ &at_beg_of_env_or_eq(); # check to see if we have \parbox, \marginpar, or @@ -714,7 +814,7 @@ while(<MAINFILE>) # specified in %checkunmatched hash table &start_command_or_key_unmatched_braces(); - # check for an else statement + # check for an else statement (braces, not \else) &check_for_else(); # check for a command that splits [] across lines @@ -723,6 +823,12 @@ while(<MAINFILE>) # check for a heading &indent_after_heading(); + # check for \item + &indent_after_item(); + + # check for \if or \else command + &indent_after_if_else_fi(); + # tracing mode print $logfile "Line $lineCounter\t Environments: ",join(", ",@environmentStack),"\n" if($tracingMode and scalar(@environmentStack)); } @@ -737,7 +843,7 @@ print $logfile "Line Count of indented $ARGV[0]: ",scalar(@lines); if(scalar(@mainfile) != scalar(@lines)) { print $logfile <<ENDQUOTE -WARNING: \t line count of original file and indented file does +WARNING: \t line count of original file and indented file does \t not match- consider reverting to a back up, see $backupExtension; ENDQUOTE ; @@ -771,6 +877,162 @@ close($logfile); exit; +sub indent_if_else_fi{ + # PURPOSE: set indentation of line that contains \else, \fi command + # + # + + # @indentNames could be empty -- if so, exit + return 0 unless(@indentNames); + + # look for \fi + if( $_ =~ m/^\s*\\fi/ and $constructIfElseFi{$indentNames[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t \\fi command found, matching: \\",$indentNames[-1], "\n" if($tracingMode); + &decrease_indent($indentNames[-1]); + } + elsif( ($_ =~ m/^\s*\\else/ or $_ =~ m/^\s*\\or/) and $constructIfElseFi{$indentNames[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t \\else command found, matching: \\",$indentNames[-1], "\n" if($tracingMode); + print $logfile "Line $lineCounter\t decreasing indent, but indentNames is still \\",join(", ",@indentNames), "\n" if($tracingMode); + pop(@indent); + } +} + +sub indent_after_if_else_fi{ + # PURPOSE: set indentation *after* \if construct such as + # + # \ifnum\x=2 + # <stuff> + # <stuff> + # \else + # <stuff> + # <stuff> + # \fi + # + # How to read /^\s*\\(if.*?)(\s|\\|\#) + # + # ^\s* begins with multiple spaces (possibly none) + # \\(if.*?)(\s|\\|\#) matches \if... up to either a + # space, a \, or a # + if( $_ =~ m/^\s*\\(if.*?)(\s|\\|\#)/ and $constructIfElseFi{$1}) + { + # tracing mode + print $logfile "Line $lineCounter\t ifelsefi construct found: $1 \n" if($tracingMode); + &increase_indent($1); + } + elsif(@indentNames) + { + if( ($_ =~ m/^\s*\\else/ or $_ =~ m/^\s*\\or/ ) and $constructIfElseFi{$indentNames[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t setting indent *after* \\else or \\or command found for $indentNames[-1] \n" if($tracingMode); + &increase_indent($indentNames[-1]); + # don't want to store the name of the \if construct twice + # so remove the second copy + pop(@indentNames); + } + } + } + +sub indent_item{ + # PURPOSE: this subroutine sets the indentation for the item *itself* + + if( $_ =~ m/^\s*\\(.*?)(\[|\s)/ and $itemNames{$1} and $indentAfterItems{$environmentStack[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t $1 found within ",$environmentStack[-1]," environment (see indentAfterItems and itemNames)\n" if($tracingMode); + if($itemNames{$indentNames[-1]}) + { + print $logfile "Line $lineCounter\t $1 found- neutralizing indentation from previous ",$indentNames[-1],"\n" if($tracingMode); + &decrease_indent($1); + } + } + +} + +sub indent_after_item{ + # PURPOSE: Set the indentation *after* the item + # This matches a line that begins with + # + # \item + # \item[ + # \myitem + # \myitem[ + # + # or anything else specified in itemNames + # + if( $_ =~ m/^\s*\\(.*?)(\[|\s)/ + and $itemNames{$1} + and $indentAfterItems{$environmentStack[-1]}) + { + # tracing mode + print $logfile "Line $lineCounter\t $1 found within ",$environmentStack[-1]," environment (see indentAfterItems and itemNames)\n" if($tracingMode); + &increase_indent($1); + } +} +sub begin_command_with_alignment{ + # PURPOSE: This matches + # %* \begin{tabular} + # with any number of spaces (possibly none) between + # the * and \begin{noindent}. + # + # the comment symbol IS indended! + # + # This is to align blocks that contain delimeters that + # are NOT contained in an alignment block in the usual way, e.g + # \matrix{ + # %* \begin{tabular} + # 1 & 2 \\ + # 3 & 4 \\ + # %* \end{tabular} + # } + + if( $_ =~ m/^\s*%\*\s*\\begin{(.*?)}/ and $lookForAlignDelims{$1}) + { + $delimiters=1; + # tracing mode + print $logfile "Line $lineCounter\t Delimiter environment started: $1 (see lookForAlignDelims)\n" if($tracingMode); + } +} + +sub end_command_with_alignment{ + # PURPOSE: This matches + # %* \end{tabular} + # with any number of spaces (possibly none) between + # the * and \end{tabular} (or any other name used from + # lookFroAlignDelims) + # + # Note: the comment symbol IS indended! + # + # This is to align blocks that contain delimeters that + # are NOT contained in an alignment block in the usual way, e.g + # \matrix{ + # %* \begin{tabular} + # 1 & 2 \\ + # 3 & 4 \\ + # %* \end{tabular} + # } + + if( $_ =~ m/^\s*%\*\s*\\end{(.*?)}/ and $lookForAlignDelims{$1}) + { + # same subroutine used at the end of regular tabular, align, etc + # environments + if($delimiters) + { + &print_aligned_block(); + } + else + { + # tracing mode + print $logfile "Line $lineCounter\t FYI: did you mean to start a delimiter block on a previous line? \n" if($tracingMode); + print $logfile "Line $lineCounter\t perhaps using %* \\begin{$1}\n" if($tracingMode); + } + } +} + sub indent_heading{ # PURPOSE: This matches # \part @@ -783,7 +1045,7 @@ sub indent_heading{ # # and anything else listed in indentAfterHeadings # - # This subroutine specifies the indentation for the + # This subroutine specifies the indentation for the # heading itself, i.e the line that has \chapter, \section etc if( $_ =~ m/^\s*\\(.*?)(\[|{)/ and $indentAfterHeadings{$1}) { @@ -796,15 +1058,15 @@ sub indent_heading{ # local scalar my $previousHeadingLevel = $headingLevel; - # if current heading level < old heading level, + # if current heading level < old heading level, if($currentHeading{level}<$previousHeadingLevel) { - # decrease indentation, but only if - # specified in indentHeadings. Note that this check - # needs to be done here- decrease_indent won't + # decrease indentation, but only if + # specified in indentHeadings. Note that this check + # needs to be done here- decrease_indent won't # check a nested hash - - if(scalar(@headingStore)) + + if(scalar(@headingStore)) { while($currentHeading{level}<$previousHeadingLevel and scalar(@headingStore)) { @@ -823,7 +1085,7 @@ sub indent_heading{ } elsif($currentHeading{level}==$previousHeadingLevel) { - if(scalar(@headingStore)) + if(scalar(@headingStore)) { my $higherHeadingName = pop(@headingStore); my %higherLevelHeading = %{$indentAfterHeadings{$higherHeadingName}}; @@ -852,7 +1114,7 @@ sub indent_after_heading{ # # and anything else listed in indentAfterHeadings # - # This subroutine is specifies the indentation for + # This subroutine is specifies the indentation for # the text AFTER the heading, i.e the body of conent # in each \chapter, \section, etc if( $_ =~ m/^\s*\\(.*?)(\[|{)/ and $indentAfterHeadings{$1}) @@ -880,7 +1142,7 @@ sub at_end_noindent{ # This is for blocks of code that the user wants # to leave untouched- similar to verbatim blocks - if( $_ =~ m/^%\s*\\end{(.*?)}/ and $noIndentBlock{$1}) + if( $_ =~ m/^%\s*\\end{(.*?)}/ and $noIndentBlock{$1}) { $inIndentBlock=0; # tracing mode @@ -888,6 +1150,8 @@ sub at_end_noindent{ } } + + sub at_beg_noindent{ # PURPOSE: This matches # % \begin{noindent} @@ -899,7 +1163,7 @@ sub at_beg_noindent{ # This is for blocks of code that the user wants # to leave untouched- similar to verbatim blocks - if( $_ =~ m/^%\s*\\begin{(.*?)}/ and $noIndentBlock{$1}) + if( $_ =~ m/^%\s*\\begin{(.*?)}/ and $noIndentBlock{$1}) { $inIndentBlock = 1; # tracing mode @@ -908,11 +1172,11 @@ sub at_beg_noindent{ } sub start_command_or_key_unmatched_brackets{ - # PURPOSE: This matches + # PURPOSE: This matches # \pgfplotstablecreatecol[... # - # or any other command/key that has brackets [ ] - # split across lines specified in the + # or any other command/key that has brackets [ ] + # split across lines specified in the # hash tables, %checkunmatchedbracket # # How to read: ^\s*(\\)?(.*?)(\[\s*) @@ -924,7 +1188,7 @@ sub start_command_or_key_unmatched_brackets{ # ((?<!\\)\[\s*) match [ possibly leading with spaces # but it WON'T match \[ - if ($_ =~ m/^\s*(\\)?(.*?)(\s*(?<!\\)\[)/ + if ($_ =~ m/^\s*(\\)?(.*?)(\s*(?<!\\)\[)/ and (scalar($checkunmatchedbracket{$2}) or $alwaysLookforSplitBrackets) ) @@ -957,13 +1221,13 @@ sub start_command_or_key_unmatched_brackets{ } sub end_command_or_key_unmatched_brackets{ - # PURPOSE: Check for the closing BRACKET of a command that + # PURPOSE: Check for the closing BRACKET of a command that # splits its BRACKETS across lines, such as # # \pgfplotstablecreatecol[ ... # # It works by checking if we have any entries - # in the array @commandstorebrackets, and making + # in the array @commandstorebrackets, and making # sure that we're not starting another command/key # that has split BRACKETS (nesting). # @@ -971,8 +1235,8 @@ sub end_command_or_key_unmatched_brackets{ # # We count the number of [ and ADD to the counter # ] and SUBTRACT to the counter - if(scalar(@commandstorebrackets) - and !($_ =~ m/^\s*(\\)?(.*?)(\s*\[)/ + if(scalar(@commandstorebrackets) + and !($_ =~ m/^\s*(\\)?(.*?)(\s*\[)/ and (scalar($checkunmatchedbracket{$2}) or $alwaysLookforSplitBrackets)) and $_ !~ m/^\s*%/ @@ -1013,7 +1277,7 @@ sub end_command_or_key_unmatched_brackets{ } sub start_command_or_key_unmatched_braces{ - # PURPOSE: This matches + # PURPOSE: This matches # \parbox{... # \parbox[..]..{ # empty header/.style={ @@ -1021,7 +1285,7 @@ sub start_command_or_key_unmatched_braces{ # etc # # or any other command/key that has BRACES - # split across lines specified in the + # split across lines specified in the # hash tables, %checkunmatched, %checkunmatchedELSE # # How to read: ^\s*(\\)?(.*?)(\[|{|\s) @@ -1032,8 +1296,8 @@ sub start_command_or_key_unmatched_braces{ # (.*?) non-greedy character match and store the result # (\[|}|=|(\s*\\)) either [ or { or = or space \ - if ($_ =~ m/^\s*(\\)?(.*?)(\[|{|=|(\s*\\))/ - and (scalar($checkunmatched{$2}) + if ($_ =~ m/^\s*(\\)?(.*?)(\[|{|=|(\s*\\))/ + and (scalar($checkunmatched{$2}) or scalar($checkunmatchedELSE{$2}) or $alwaysLookforSplitBraces) ) @@ -1079,7 +1343,7 @@ sub start_command_or_key_unmatched_braces{ { # if $matchedbraces < 0 then we must be matching # braces from a previous split-braces command - + # keep matching { OR }, and don't match \{ or \} while ($_ =~ m/(((?<!\\){)|((?<!\\)}))/g) { @@ -1087,6 +1351,9 @@ sub start_command_or_key_unmatched_braces{ # store the match, either { or } my $braceType = $1; + # exit the loop if @commandstore is empty + last if(!@commandstore); + # get the details of the most recent command name $commanddetails = pop(@commandstore); $commandname = $commanddetails->{'commandname'}; @@ -1119,7 +1386,7 @@ sub start_command_or_key_unmatched_braces{ } else { - # otherwise we need to put the command back for the + # otherwise we need to put the command back for the # next brace count push(@commandstore,{commandname=>$commandname, matchedbraces=>$matchedbraces, @@ -1132,17 +1399,17 @@ sub start_command_or_key_unmatched_braces{ } sub end_command_or_key_unmatched_braces{ - # PURPOSE: Check for the closing BRACE of a command that + # PURPOSE: Check for the closing BRACE of a command that # splits its BRACES across lines, such as # # \parbox{ ... # # or one of the tikz keys, such as - # + # # empty header/.style={ # # It works by checking if we have any entries - # in the array @commandstore, and making + # in the array @commandstore, and making # sure that we're not starting another command/key # that has split BRACES (nesting). # @@ -1150,9 +1417,9 @@ sub end_command_or_key_unmatched_braces{ # # We count the number of { and ADD to the counter # } and SUBTRACT to the counter - if(scalar(@commandstore) - and !($_ =~ m/^\s*(\\)?(.*?)(\[|{|=|(\s*\\))/ - and (scalar($checkunmatched{$2}) + if(scalar(@commandstore) + and !($_ =~ m/^\s*(\\)?(.*?)(\[|{|=|(\s*\\))/ + and (scalar($checkunmatched{$2}) or scalar($checkunmatchedELSE{$2}) or $alwaysLookforSplitBraces)) and $_ !~ m/^\s*%/ @@ -1164,6 +1431,9 @@ sub end_command_or_key_unmatched_braces{ # store the match, either { or } my $braceType = $1; + # exit the loop if @commandstore is empty + last if(!@commandstore); + # get the details of the most recent command name $commanddetails = pop(@commandstore); $commandname = $commanddetails->{'commandname'}; @@ -1223,17 +1493,17 @@ sub check_for_else{ # else this # } # - # so we need to look for the else bit, and set + # so we need to look for the else bit, and set # the indentation appropriately. # # We only perform this check if there's something - # in the array @commandstore, and if - # the line itself is not a command, or comment, + # in the array @commandstore, and if + # the line itself is not a command, or comment, # and if it begins with { - if(scalar(@commandstore) - and !($_ =~ m/^\s*(\\)?(.*?)(\[|{|=)/ - and (scalar($checkunmatched{$2}) + if(scalar(@commandstore) + and !($_ =~ m/^\s*(\\)?(.*?)(\[|{|=)/ + and (scalar($checkunmatched{$2}) or scalar($checkunmatchedELSE{$2}) or $alwaysLookforSplitBraces)) and $_ =~ m/^\s*{/ @@ -1272,11 +1542,11 @@ sub at_beg_of_env_or_eq{ # \[ # # It also checks to see if the current environment - # should have alignment delimiters; if so, we need to turn - # ON the $delimiter switch + # should have alignment delimiters; if so, we need to turn + # ON the $delimiter switch # How to read - # m/^\s*(\$)?\\begin{(.*?)}/ + # m/^\s*(\$)?\\begin{(.*?)}/ # # ^ beginning of a line # \s* any white spaces (possibly none) @@ -1289,16 +1559,19 @@ sub at_beg_of_env_or_eq{ # ^ beginning of a line # \s* any white spaces (possibly none) # () empty just so that $1 and $2 are defined - # (\\\[) \[ there are lots of \ because both \ and [ need escaping + # (\\\[) \[ there are lots of \ because both \ and [ need escaping + # \\begin{\\?(.*?)} \begin{something} where something could start + # with a backslash, e.g \my@env@ which can happen + # in a style or class file, for example - if( ( ( $_ =~ m/^\s*(\$)?\\begin{(.*?)}/ and $_ !~ m/\\end{$2}/) + if( ( ( $_ =~ m/^\s*(\$)?\\begin{\\?(.*?)}/ and $_ !~ m/\\end{$2}/) or ($_=~ m/^\s*()(\\\[)/ and $_ !~ m/\\\]/) ) and $_ !~ m/^\s*%/ ) { # tracing mode print $logfile "Line $lineCounter\t \\begin{environment} found: $2 \n" if($tracingMode); - # increase the indentation + # increase the indentation &increase_indent($2); # check for verbatim-like environments @@ -1345,12 +1618,14 @@ sub at_end_of_env_or_eq{ # or # \] # + # Note: environmentname can begin with a backslash + # which might happen in a sty or cls file. + # # It also checks to see if the current environment - # had alignment delimiters; if so, we need to turn - # OFF the $delimiter switch - - if( ($_ =~ m/^\s*\\end{(.*?)}/ or $_=~ m/^(\\\])/) - and $_ !~ m/\s*^%/) + # had alignment delimiters; if so, we need to turn + # OFF the $delimiter switch + + if( ($_ =~ m/^\s*\\end{\\?(.*?)}/ or $_=~ m/^(\\\])/) and $_ !~ m/\s*^%/) { # check if we're at the end of a verbatim-like environment @@ -1361,79 +1636,110 @@ sub at_end_of_env_or_eq{ print $logfile "Line $lineCounter\t \\end{verbatim-like} found: $1, switching off verbatim \n" if($tracingMode); print $logfile "Line $lineCounter\t removing leading spaces \n" if($tracingMode); - #s/^\ *//; - s/^\t+// if($_ ne ""); - s/^\s+// if($_ ne ""); + #s/^\ *//; + s/^\t+// if($_ ne ""); + s/^\s+// if($_ ne ""); } - # check to see if \end{environment} fits with most recent \begin{...} - my $previousEnvironment = pop(@environmentStack); - - # check to see if we need to turn off alignment - # delimiters and output the current block - if($lookForAlignDelims{$1} and ($previousEnvironment eq $1)) + # check if we're in an environment that is looking + # to indent after each \item + if(scalar(@indentNames) and $itemNames{$indentNames[-1]}) { - $delimiters=0; + &decrease_indent($indentNames[-1]); + } - # tracing mode - print $logfile "Line $lineCounter\t Delimiter body FINISHED: $1\n" if($tracingMode); + # some commands contain \end{environmentname}, which + # can cause a problem if \begin{environmentname} was not + # started previously; if @environmentStack is empty, + # then we don't need to check for \end{environmentname} + if(@environmentStack) + { + # check to see if \end{environment} fits with most recent \begin{...} + my $previousEnvironment = pop(@environmentStack); - # print the current FORMATTED block - @block = &format_block(@block); - foreach $line (@block) - { - # add the indentation and add the - # each line of the formatted block - # to the output - # unless this would only create trailing whitespace and the - # corresponding option is set - unless ($line =~ m/^$/ and $removeTrailingWhitespace) - { - $line = join("",@indent).$line; - } - push(@lines,$line); - } - # empty the @block, very important! - @block=(); - } + # check to see if we need to turn off alignment + # delimiters and output the current block + if($lookForAlignDelims{$1} and ($previousEnvironment eq $1)) + { + &print_aligned_block(); + } - # tracing mode - print $logfile "Line $lineCounter\t \\end{envrionment} found: $1 \n" if($tracingMode and !$verbatimEnvironments{$1}); + # tracing mode + print $logfile "Line $lineCounter\t \\end{envrionment} found: $1 \n" if($tracingMode and !$verbatimEnvironments{$1}); - # check to see if \end{environment} fits with most recent \begin{...} - if($previousEnvironment eq $1) - { - # decrease the indentation (if appropriate) - &decrease_indent($1); - } - else - { - # otherwise put the environment name back on the stack - push(@environmentStack,$previousEnvironment); - print $logfile "Line $lineCounter\t WARNING: \\end{$1} found on its own line, not matched to \\begin{$previousEnvironment}\n" unless ($delimiters or $inverbatim or $inIndentBlock or $1 eq "\\\]"); - } + # check to see if \end{environment} fits with most recent \begin{...} + if($previousEnvironment eq $1) + { + # decrease the indentation (if appropriate) + &decrease_indent($1); + } + else + { + # otherwise put the environment name back on the stack + push(@environmentStack,$previousEnvironment); + print $logfile "Line $lineCounter\t WARNING: \\end{$1} found on its own line, not matched to \\begin{$previousEnvironment}\n" unless ($delimiters or $inverbatim or $inIndentBlock or $1 eq "\\\]"); + } - # need a special check for \[ and \] - if($1 eq "\\\]") - { - &decrease_indent($1); - pop(@environmentStack); + # need a special check for \[ and \] + if($1 eq "\\\]") + { + &decrease_indent($1); + pop(@environmentStack); + } } - # if we're at the end of the document, we remove all current - # indentation- this is especially prominent in examples that + # if we're at the end of the document, we remove all current + # indentation- this is especially prominent in examples that # have headings, and the user has chosen to indentAfterHeadings if($1 eq "document" and !(grep(/filecontents/, @indentNames)) and !$inpreamble and !$delimiters and !$inverbatim and !$inIndentBlock) { - @indent=(); - @indentNames=(); - print $logfile "Line $lineCounter\t \\end{$1} found- emptying indent array \n" unless ($delimiters or $inverbatim or $inIndentBlock or $1 eq "\\\]"); + @indent=(); + @indentNames=(); + + # tracing mode + if($tracingMode) + { + print $logfile "Line $lineCounter\t \\end{$1} found- emptying indent array \n" unless ($delimiters or $inverbatim or $inIndentBlock or $1 eq "\\\]"); + } } } } +sub print_aligned_block{ + # PURPOSE: this subroutine does a few things related + # to printing blocks of code that contain + # delimiters, such as align, tabular, etc + # + # It does the following + # - turns off delimiters switch + # - processes the block + # - deletes the block + $delimiters=0; + + # tracing mode + print $logfile "Line $lineCounter\t Delimiter body FINISHED: $1\n" if($tracingMode); + + # print the current FORMATTED block + @block = &format_block(@block); + foreach $line (@block) + { + # add the indentation and add the + # each line of the formatted block + # to the output + # unless this would only create trailing whitespace and the + # corresponding option is set + unless ($line =~ m/^$/ and $removeTrailingWhitespace) + { + $line = join("",@indent).$line; + } + push(@lines,$line); + } + # empty the @block, very important! + @block=(); +} + sub format_block{ - # PURPOSE: Format a delimited environment such as the + # PURPOSE: Format a delimited environment such as the # tabular or align environment that contains & # # INPUT: @block array containing unformatted block @@ -1448,7 +1754,7 @@ sub format_block{ print $logfile "\t\tFormatting alignment block\n" if($tracingMode); # step the line counter back to the beginning of the block- - # it will be increased back to the end of the block in the + # it will be increased back to the end of the block in the # loop later on: foreach $row (@tmpblock) $lineCounter -= scalar(@block); @@ -1479,7 +1785,7 @@ sub format_block{ my %stringsize=(); # loop through the block and count & per line- store the biggest - # NOTE: this needs to be done in its own block so that + # NOTE: this needs to be done in its own block so that # we can know what the maximum number of & in the block is foreach $row (@block) { @@ -1512,7 +1818,7 @@ sub format_block{ # tracing mode print $logfile "\t\tmaximum number of & in any row: $maxNumberAmpersands\n" if($tracingMode); - + # loop through the lines in the @block foreach $row (@block) { @@ -1560,11 +1866,11 @@ sub format_block{ { # increment column counter $aligncolcounter++; - + # remove leading and trailing space from element $column =~ s/^\s+//; $column =~ s/\s+$//; - + # assign string size to the array $stringsize{$alignrowcounter.$aligncolcounter}=length($column); if(length($column)==0) @@ -1583,7 +1889,7 @@ sub format_block{ } } - + # put $linebreak back on the string, now that # the measurement has been done $tmpstring .= $linebreak; @@ -1598,7 +1904,7 @@ sub format_block{ } else { - # if there are no & then use the + # if there are no & then use the # NOFORMATTING token # remove leading space s/^\s+//; @@ -1632,16 +1938,16 @@ sub format_block{ # the numbers represent how wide each column is # the s represents string # the & needs to be inserted - + # join up the maximum string lengths using "s %-" $fmtstring = join("s & %-",@maxmstringsize); - + # add an s to the end, and a newline $fmtstring .= "s "; - + # add %- to the beginning $fmtstring = "%-".$fmtstring; - + # process the @tmpblock of aligned material foreach $row (@tmpblock) { @@ -1689,7 +1995,7 @@ sub format_block{ # remove trailing whitespace if ($removeTrailingWhitespace) { - print $logfile "Line $lineCounter\t removing trailing whitespace from delimiter aligned line\n" if ($tracingMode); + print $logfile "\t\tLine $lineCounter\t removing trailing whitespace from delimiter aligned line\n" if ($tracingMode); $tmpstring =~ s/\s+$/\n/; } @@ -1711,7 +2017,7 @@ sub increase_indent{ my $command = pop(@_); - # if the user has specified $indentRules{$command} and + # if the user has specified $indentRules{$command} and # $noAdditionalIndent{$command} then they are a bit confused- # we remove the $indentRules{$command} and assume that they # want $noAdditionalIndent{$command} @@ -1726,7 +2032,7 @@ sub increase_indent{ delete $indentRules{$command}; } - # if the command is in verbatimEnvironments and in indentRules then + # if the command is in verbatimEnvironments and in indentRules then # remove it from %indentRules hash # to avoid any further confusion if($indentRules{$command} and $verbatimEnvironments{$command}) @@ -1745,7 +2051,7 @@ sub increase_indent{ push(@indent, $indentRules{$command}); # tracing mode print $logfile "Line $lineCounter\t increasing indent using rule for $command (see indentRules)\n" if($tracingMode); - push(@indentNames,"$command (rule)"); + push(@indentNames,"$command"); } else { @@ -1753,7 +2059,7 @@ sub increase_indent{ if(!($noAdditionalIndent{$command} or $verbatimEnvironments{$command} or $inverbatim)) { push(@indent, $defaultIndent); - push(@indentNames,"$command (default)"); + push(@indentNames,"$command"); # tracing mode print $logfile "Line $lineCounter\t increasing indent using defaultIndent\n" if($tracingMode); } @@ -1775,10 +2081,21 @@ sub decrease_indent{ if(!($noAdditionalIndent{$command} or $verbatimEnvironments{$command} or $inverbatim)) { + print $logfile "Line $lineCounter\t removing ", $indentNames[-1], " from indentNames\n" if($tracingMode); pop(@indent); pop(@indentNames); # tracing mode - print $logfile "Line $lineCounter\t decreasing indent to: ",join(", ",@indentNames),"\n" if($tracingMode); + if($tracingMode) + { + if(@indentNames) + { + print $logfile "Line $lineCounter\t decreasing indent to: ",join(", ",@indentNames),"\n" ; + } + else + { + print $logfile "Line $lineCounter\t indent now empty \n"; + } + } } } |