Hello community:

I'm using ImplicitPlane context to ask students to input a line's equation in point-slope form. However, students can enter the equation in any form and the answer is still counted right. For example, if the answer I want is y-1=2(x-3), students can enter y=2x-5 and it's counted right.

If I use two text boxes _____=_____ and use Formula object in the second box, I cannot force students to enter 2(x-3). They can enter 2x-6 and it would still be counted right.

Has anyone written problems where students must enter point-slope form?

Codes are below. Thank you for any help!

Carl Yao

Portland Community College

# WeBWorK problem written by Carl Yao

# Portland Community College

#

# Given a line's slope and a point on the line, find the line's equation in

# both slope-intercept and point-slope form. All numbers are positive.

#

# Last edited: Yao 6/25/13

#

# ENDDESCRIPTION

## DBsubject('Algebra')

## DBchapter('Basic Algebra')

## DBsection('Slope-Intercept','Linear Equations','Point-Slope')

## KEYWORDS('slope','linear equation','slope-intercept','point-slope','line','equation')

## DBCCSS('8.F.3','A-CED')

## TitleText1('')

## EditionText1('')

## AuthorText1('')

## Section1('')

## Problem1('')

## Author('Carl Yao')

## Institution('PCC')

##############################################

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGcourse.pl",

"PGML.pl",

"parserImplicitPlane.pl",

"parserAssignment.pl"

);

##############################################

Context("Numeric");

Context("Numeric")->variables->add(y=>'Real');

parser::Assignment->Allow;

$m=random(2,5,1);

$b=random(1,5,1);

$x1=random(1,5,1);

$y1=$m*$x1+$b;

$ansSI=Formula("y=$m*x+$b");

Context("ImplicitPlane");

Context()->variables->are(x=>'Real',y=>'Real');

Context()->flags->set(reduceConstants=>0);

$ansPS = ImplicitPlane("y=$m*x+$b");

##############################################

TEXT(beginproblem());

BEGIN_PGML

A line's slope is [`[$m]`]. The line passes the point [`([$x1],[$y1])`]. Find this line's equation in both slope-intercept form and point-slope form.

Solution in slope-intercept form: [_______________]{$ansSI}.

Solution in point-slope form: [________________]{$ansPS->cmp(correct_ans_latex_string=>"y-$y1 = $m(x-$x1)",

correct_ans=>"y-$y1 = $m(x-$x1)"

),}.

END_PGML

##############################################

$s1 = $m*$x1;

BEGIN_PGML_SOLUTION

*Find Equation in Slope-Intercept Form*

To find a line's equation in slope-intercept form, we first write the formula [`y=Mx+B`], where [`M`] is the slope and [`B`] is the [`y`]-intercept.

It's given that the slope is [`[$m]`], so we have [`y=[$m]x+B`].

Next, we need to plug in the point [`([$x1],[$y1])`] and solve for [`B`].

[`

\begin{alignedat}{2}

y &= [$m]x+B \\

[$y1] &= [$m] \cdot [$x1] +B \\

[$y1] &= [$s1] +B \\

-[$s1] & \quad -[$s1] \\

[$b] &= B

\end{alignedat}

`]

The line's equation in slope-intercept form is [`y=[$m]x+[$b]`].

*Find Equation in Point-Slope Form*

To find a line's equation in point-slope form, we first write the formula [`y-y_{1}=M(x-x_{1})`], where [`M`] is the slope and [` (x_{1},y_{1}) `] is a point on the line.

Next, it's given the line's slope is [`[$m]`] and it passes the point [` ([$x1],[$y1]) `]. We plug in these numbers into the formula, and we have:

[`

\begin{alignedat}{2}

y-y_{1} &= M(x-x_{1}) \\

y-[$y1] &= [$m](x-[$x1])

\end{alignedat}

`]

The line's equation in point-slope form is [` y-[$y1] &= [$m](x-[$x1]) `].

END_PGML_SOLUTION

ENDDOCUMENT();