Scaling and Translating a Function

Scaling and translating functions

Complete Code

Download file: ScalingTranslating.pg

POD for Macro Files

PG problem file

Explanation

DOCUMENT();

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

Preamble

Load parserFunction.pl so that a named function can be added to the context.

parserFunction(f => 'sin(e * x) + 5.5 * pi * x^2');

$answer = Formula('f(x - 2) + 1');

Setup

The parserFunction method allows the addition of a named function to the context. For this problem a function is chosen whose formula would be difficult to guess, whose domain is all real numbers. Once a named function is added to the context, it can be used like any other named function.

BEGIN_PGML
A function [`f(x)`] is shifted to the right [`2`] units and up [`1`] unit.  Find
a formula for this shifted function in terms of the function [`f(x)`].

[_]{$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.