Function Transformations

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Timmy is learning about function transformations! For a function g(x)=af(k(x-d))+c, g(x) is the graph of f(x), but

  1. Vertically stretched by a factor of a
  2. Horizontally compressed by a factor of \frac 1k
  3. Horizontally translated by d units right
  4. Vertically translated c units up

For this problem, you can assume that a, d, and c are all nonnegative integers, and k is a positive integer. Additionally, the numbers will always be present (even if they are redundant, such as when k=1).

Can you help Timmy with his homework?

Constraints

0\le a,d,c\le 10^6

0<k\le 10^6

Input Specification

One line with one string, a function of the form af(k(x-d))+c

Output Specification

4 lines of the following form:

Vertically stretched by a factor of [a]
Horizontally compressed by a factor of 1/[k]
Horizontally translated by [d] units right
Vertically translated [c] units up

Where each square bracket ([n]) means that the number n replaces the bracket (we do not include the square brackets)

Sample Input

10f(3(x-4))+5

Sample Output

Vertically stretched by a factor of 10
Horizontally compressed by a factor of 1/3
Horizontally translated by 4 units right
Vertically translated 5 units up

Comments

There are no comments at the moment.