"""Story frames for the ALGEBRA word problems (written by the model). Each frame is (variable, text). Placeholders are filled by attack_data/_build/build_sets.py with the parent's math, x renamed to the frame variable: {A} {B} sides of a linear equation, {A} the quadratic polynomial (= 0), {E} factor/expand expression or the simplify fraction (divisor written as (v + r) / (v - r)), {E1} {E2} the two equations of a system (variables x, y kept). Frames for 'solve' allow negative or zero answers. Frames are rotated over the items of each kind. """ SOLVE = [ ("t", "The temperature in a greenhouse, in degrees Celsius, is modelled by {A}, where t is the time in hours measured from noon (negative t means before noon). At what time t is the temperature {B} degrees?"), ("n", "A submarine's depth gauge shows {A} units when its dial is set to position n (positions can be negative or zero). Which dial position n gives a reading of {B}?"), ("k", "The change in a savings account, in dollars, after k standard adjustments is {A}; a negative k means the adjustments were reversed. Find k if the change equals {B} dollars."), ("p", "On a number line, a robot's stopping point after a command with parameter p is {A}. For which parameter p does the robot stop at {B}?"), ("s", "A spring scale shows {A} grams when its slider sits s notches from the centre mark (notches left of centre count as negative). Find s when the scale shows {B} grams."), ("m", "The elevation of a hiking marker, in meters relative to a lake surface, is {A}, where m is the marker's index counted from the trailhead (markers before the trailhead have negative index). Which marker m is at elevation {B}?"), ("w", "An oven program sets the temperature to {A} degrees above its base setting when the dial is turned w clicks (counter-clockwise clicks are negative). How many clicks w give {B} degrees above base?"), ("t", "A stock's price change, in cents, t days after a news release is predicted to be {A}, where negative t refers to days before the release. On which day t is the predicted change {B} cents?"), ("n", "In a board game, a player's score after landing on square n is {A} points; squares behind the start are numbered negatively. Which square n yields a score of {B} points?"), ("z", "A drone's altitude, in meters relative to a rooftop, is {A} when its control lever is at position z (pulling the lever back gives negative z). Find the lever position z that puts the drone at {B} meters."), ("u", "An electrician measures {A} volts on a test circuit when the offset knob is at setting u (u can be negative). What knob setting u gives {B} volts?"), ("r", "A cyclist's net gain in height, in meters, after riding r laps of a hilly loop is {A}; riding the loop backwards counts as negative r. For which r is the net gain {B} meters?"), ("q", "A warehouse's net inventory change after q shipments is {A} boxes, where returned shipments count as negative q. Find q when the net change is {B} boxes."), ("h", "The water level of a canal lock, in centimeters relative to its normal mark, follows {A}, where h is the time in hours since pumping began (negative h is before pumping). At which time h is the level {B} centimeters?"), ("d", "A scheduling rule sets a meeting's start to {A} minutes after nine o'clock when the meeting is moved by d days (moving it earlier gives negative d). For which d does the meeting start {B} minutes after nine o'clock?"), ("g", "A game designer sets a character's health modifier to {A} at difficulty level g, where easier-than-normal levels are negative and normal is level zero. Which difficulty level g has a modifier of {B}?"), ] QUADRATIC = [ ("x", "An engineer models a cable whose height above a bridge deck vanishes exactly where {A} = 0, with x the horizontal position in meters from the central pylon (negative to the west). Find all such positions x and list them in increasing order."), ("t", "A break-even analysis for a product launch leads to the condition {A} = 0, where t is the number of weeks from the launch date (negative t is before launch). Find every t that satisfies the condition, listed in increasing order."), ("k", "Two tuning dials agree exactly when {A} = 0 for the integer setting k (settings may be negative). Find all such values of k, from smallest to largest."), ("n", "A puzzle asks for the whole numbers n for which {A} = 0. Find all solutions n and list them in increasing order."), ("s", "A radar tracker reports that an object is at ground level when {A} = 0, where s is the time in seconds relative to the radar ping (negative s is before the ping). Find all such times s in increasing order."), ("p", "In a pricing study, the revenue difference between two plans is zero when {A} = 0, where p is the price change in dollars (negative for discounts). Find all values of p, listed from smallest to largest."), ("m", "A carpenter finds that a frame fits exactly when {A} = 0, where m is the offset in millimeters from the template (negative means shorter). List all offsets m that work, in increasing order."), ("w", "The net force on a bead sliding along a wire vanishes where {A} = 0, with w its position in centimeters from the midpoint (negative to the left). Find all such positions w, in increasing order."), ] FACTOR = [ ("x", "The area of a rectangular field, in square meters, is {E}, where x is a length in meters. Write the area as a product of irreducible factors with integer coefficients (fully factored form), to suggest possible side lengths."), ("t", "An accountant's profit formula for t units sold is {E} dollars. Rewrite the formula in fully factored form over the integers, so the break-even points can be read off."), ("n", "The number of tiles needed for a patio design of size n is {E}. Factor this expression completely over the integers."), ("k", "A physics lab models the energy stored in a system at setting k as {E} joules. Express this model as a product of irreducible factors with integer coefficients."), ("s", "The volume of a container, in cubic centimeters, works out to {E} for a design parameter s. Factor the expression fully, using integer coefficients."), ("m", "A garden's planting area, in square feet, is {E}, where m is the width of a path in feet. Write the area completely factored over the integers."), ] EXPAND = [ ("x", "A rectangular banner is designed so that its area, in square centimeters, is {E}, where x is a design length in centimeters. Write the area as an expanded polynomial in x."), ("t", "A shop's revenue after a price change of t dollars is {E} dollars. Expand this expression into standard form so it can be entered into a spreadsheet."), ("n", "The number of seats in a stadium section with n rows is modelled by {E}. Multiply out this expression and write it as a polynomial in n."), ("k", "An engineer writes the power of a circuit at setting k as {E} watts. Expand the product so that the formula has no parentheses."), ("s", "The area of a picture frame, in square inches, is {E}, where s is a border width in inches. Write this area in expanded form."), ("m", "A farmer computes the yield of a field as {E} kilograms when m extra rows are planted. Expand the expression into a polynomial in m."), ("w", "A tank's cross-sectional area, in square meters, is {E}, where w is a width offset in meters. Rewrite the area in standard form by multiplying it out."), ("p", "A company's profit at production level p is {E} dollars. Expand the profit formula completely."), ] SIMPLIFY = [ ("x", "The average cost per crate in a shipment, in dollars, is {E}, where x is a design parameter. Simplify this expression to a polynomial in x, wherever it is defined."), ("t", "A machine's output rate is recorded as {E} units per hour, where t is the operating temperature setting. Simplify the rate to a polynomial in t, assuming the denominator is nonzero."), ("n", "The number of items each worker handles is given by {E}, where n is a staffing parameter. Write this as a simplified polynomial in n (the denominator is never zero here)."), ("k", "An economist's ratio of total revenue to the number of batches is {E}, with k a pricing parameter. Simplify the ratio into a polynomial in k, valid wherever it is defined."), ("s", "The height of a rectangular panel, in centimeters, equals its area divided by its width, which gives {E} for a size parameter s. Simplify this expression to a polynomial in s for all allowed s."), ("m", "A chemist's concentration formula is {E} grams per liter, where m is a mixing parameter. Simplify the formula to a polynomial in m (assume the denominator is not zero)."), ] SYSTEM = [ ("x", "Two thermometers are being calibrated. If x and y are the corrections (in degrees, possibly negative) for the first and second thermometer, the test readings give {E1} and {E2}. Find the corrections as an ordered pair (x, y)."), ("x", "A robot moves x meters east and y meters north (negative values mean west or south). Its sensors record {E1} and {E2}. Find the ordered pair (x, y)."), ("x", "In a store's accounting, x and y are the daily profits (in hundreds of dollars, losses negative) of two branches. Last week's reports give {E1} and {E2}. Determine the ordered pair (x, y)."), ("x", "Two weights on a balance beam sit at positions x and y (in decimeters from the pivot, negative on the left). The equilibrium conditions give {E1} and {E2}. Find the positions as (x, y)."), ("x", "A chemist adjusts the charges x and y of two ions in a model (charges may be negative or zero); the model's constraints are {E1} and {E2}. Find the charges as an ordered pair (x, y)."), ("x", "The scores x and y awarded in two rounds of a quiz (penalties can make a score negative or zero) satisfy {E1} and {E2}. Find the ordered pair (x, y)."), ]