## DBsubject(Linear algebra) ## DBchapter(Abstract vector spaces) ## DBsection(Basis and dimension) ## Date(10/11/2013) ## Institution(NAU) ## Author(Nandor Sieben) ## Level(2) ## MO(1) ## KEYWORDS('linear algebra','span') DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserMultiAnswer.pl", "AnswerFormatHelp.pl", "MatrixReduce.pl", "rank.pl", "PGcourse.pl" ); $showPartialCorrectAnswers = 1; TEXT(beginproblem()); Context("Numeric"); $l=non_zero_random(-9,9,1); $p1=Formula("2*$l-1+x^2")->reduce; $p2=Formula("x")->reduce; $multians = MultiAnswer($p1, $p2)->with( singleResult => 1, checker => sub { my ( $correct, $student, $self ) = @_; my ($s1,$s2) = @{$student}; my @c = @{$correct}; my $s1D=$s1->D('x'); my $s2D=$s2->D('x'); my $s1DD=$s1D->D('x'); my $s2DD=$s2D->D('x'); if ($s1D->eval(x=>$l) != $s1->eval(x=>1)) { $self->setMessage(1,"Not in the subspace."); return 0 } if ($s2D->eval(x=>$l) != $s2->eval(x=>1)) { $self->setMessage(2,"Not in the subspace."); return 0 } my $s1DDD=$s1DD->D('x'); my $s2DDD=$s2DD->D('x'); if ($s1DDD != Formula("0")) { $self->setMessage(1,"Not in the subspace."); return 0 } if ($s2DDD != Formula("0")) { $self->setMessage(2,"Not in the subspace."); return 0 } my $a1=$s1->eval(x=>0); my $b1=$s1D->eval(x=>0); my $c1=$s1DD->eval(x=>0)/2; my $a2=$s2->eval(x=>0); my $b2=$s2D->eval(x=>0); my $c2=$s2DD->eval(x=>0)/2; if (rank(Matrix([$a1,$b1,$c1],[$a2,$b2,$c2])) ==2) { return 1; } $self->setMessage(1,"Not independent."); $self->setMessage(2,"Not independent."); return 0; } ); Context()->texStrings; BEGIN_TEXT Find a basis \( \lbrace p(x), q(x) \rbrace \) for the vector space \(\lbrace f(x)\in{\mathbb P}_3[x] \mid f'($l)=f(1) \rbrace\) where \({\mathbb P}_3[x]\) is the vector space of polynomials in \(x\) with degree less than 3. $BR \( p(x) = \) \{ $multians->ans_rule(15) \}, \( q(x) = \) \{ $multians->ans_rule(15) \} END_TEXT Context()->normalStrings; ANS( $multians->cmp() ); ; ENDDOCUMENT();