Solution for an Equation

Answer is any solution to an equation

Complete Code

Download file: SolutionForEquation.pg

POD for Macro Files

PG problem file

Explanation

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'parserSolutionFor.pl', 'PGcourse.pl');

Preamble

The macro parserSolutionFor.pl must be loaded.

Context('Vector');

$r      = random(3, 6);
$answer = SolutionFor("x^2 + y^2 + z^2 = $r^2", [ $r, 0, 0 ]);

$eqn = $answer->{f};

Setup

We use SolutionFor(equation, point) to define this MathObject. For more details and options, see parserSolutionFor.pl.

BEGIN_PGML
A solution to the equation [`[$eqn]`] is [`(x, y, z) =`] [_]{$answer}{15}
END_PGML

Statement

This is the problem statement in PGML.
BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

ENDDOCUMENT();

Solution

A solution should be provided here.