How are the functions determined for real-world applications (business, population models, etc.) of calculus? The following problem has been taken from Paul's Online Notes:

"We need to enclose a rectangular field with a fence. We have 500 feet of fencing material and a building is on one side of the field and so won’t need any fencing. Determine the dimensions of the field that will enclose the largest area."

This problem is easy to model in the real-world because the area of the field will depend upon the length x and the width y.
Therefore, the area of the field can be modeled as function of either x or y: $A(x) = xy$
Likewise, the perimeter can be modeled as a function with the given constraint:
$500 = 2x + y$
You can then find the answer by relating the two functions to each other and taking the derivative to find the critical points. This type of problem makes sense to me because the functions that are required are easy to determine.
However, take another problem from Paul's Online Notes, particularly from the section of business applications:

An apartment complex has 250 apartments to rent. If they rent x apartments, then their monthly profit in USD is given by the function:
$P(x)=-8x^2 +3200x-80000$
How many apartments should they rent to maximize their profits?

I do understand the mathematical theory of finding the extrema via critical points, and I also understand the business reasons as to why the maximum profit cannot be equal to the maximum apartments available to rent (i.e. the answer isn't going to be "all of them"). But if I were the owner of this apartment complex, how would I even determine the original function $P(x)$ in order to actually determine my maximum profit?
For other applications such as population modeling, how is the function determined for population growth? I see problems in textbooks such as, "The population of flies grows at a rate of $e^{2t}-19.23$.
In how many years will the population..."
How are these functions determined in real-life? And how would they change if something were to happen to the business? For example, how would the function in the apartment complex problems change if they suddenly had 300 apartments available to rent?
 A: What you're asking is a question of how mathematical modelling works. The details will change depending on what kind of real-world system is being modelled, but it usually boils down to:

*

*Identifying factors that contribute to the behaviour of the system.


*Proposing a relationship between those factors and the system.


*Collecting data relating to that relationship.


*Checking whether the data and the relationship are consistent with each other.


*Refining the model and possibly going back to step 1 to find additional factors.
For example, the simplest population growth model would be to assume that in every time period $t$ some fraction $b$ of the population produces babies, and some fraction $d$ of the population dies, so $P(t+1) = P(t) \times (1 + b - d)$, which results in an exponential model. More complicated models would consider factors like limitations on resources, or would include predator-prey relationships, or would vary the birth and death rates over time depending on environmental factors.
As another example, in working out how much to offer apartments for, you might note that you have some flat cost $C$ that you incur regardless of how many are being rented, and you note that nobody wants to rent at 2000 dollars per month but you'll definitely rent all the apartments if you charge 500 dollars per month, so you can approximate the number of apartments rented as a linear function of the rent amount, and hence your total profit is the product of that linear function with the rent itself (giving a quadratic function), less the fixed cost $C$.
It's worth noting that coming up with models that (a) fit the data well, (b) explain how the system works, and (c) let you successfully predict what will happen under different scenarios, is an extremely lucrative field, especially if those models are for operations that are very expensive (such as financial markets, or high-risk engineering works where mistakes could cost millions of dollars).
A: In the apartment example, it makes sense to represent overhead cost as the expense of 80000, by the constant term. That is a fixed cost that covers taxes on property, payments on loans, and anything else not affected by the number of renters. The linear term likely represents the income of 3200, paid by each renter. As far as the quadratic term, it may just be an estimate based on the history of actual profits made. If the landlord notices that profit drops a little when there is a little overcrowding, and drops exponentially as more units are rented, that term could be fitted to the data until it looks similar. Maybe it represents more expense on security, or more turnover due to renters unhappy with more noise and traffic.
