
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
A clothing factory produces a type of clothing, with each piece costing $40$ to produce and having an ex-factory price of $60$. To encourage sales agents to order more, the factory decides that for every order exceeding $100$ pieces, the ex-factory price for the entire order will be reduced by $0.02$ yuan for each additional piece ordered. According to market research, sales agents will not order more than $500$ pieces at a time.

1. Let $x$ represent the number of pieces ordered and $P$ denote the actual ex-factory price per piece. Express the function $P=f(x)$.
2. Determine the number of pieces a sales agent should order to maximize the factory's profit and calculate the maximum profit. (The profit from selling one piece of clothing equals the actual ex-factory price minus the cost.)

Present the answer in LaTex format: \boxed{Your answer}
user