# Piecewise Function Application Example

How do Piecewise Functions work?
A piecewise function is a function that is defined in "pieces". That is, it has a different definition for different intervals of the input variable. In this example, we are plotting the altitude of a model rocket for times from (launch) to (touchdown). During this time, the rocket experiences three distinct modes of flight: (1) For the first two seconds, the engine accelerates the rocket upward ever faster. (2) Between 2 and 12 seconds, the rocket coasts upward, slowed by gravity, and eventually begins to fall. (3) After 12 seconds, the parachute opens and the rocket drifts smoothly back to earth. Each of these three "pieces" (called subintervals) of the rocket's travel has a different function that calculates the altitude. In order to determine the altitude at any time t, we have to determine which of the three parts of flight the rocket is in at that time. So we find the interval containing our value of in the list, then we plug into the function that is on the same line in the list as the interval. You can run the simulation automatically, but you should also try manually setting the slider to various values of , to see how the piecewise function works. Whichever interval contains the selected value of is highlighted with a pointer. The function next to the pointer is the one that uses to calculate the altitude at that time.