document.write( "Question 1164938: 1. A videoke machine can be rented for ₱1,000 for three days, but for the fourth day onwards, an additional cost of ₱400 per day is added. Represent the cost of renting a videoke machine as a piecewise function of the number of days it is rented and plot its graph. Use https://www.desmos.com/calculator for graphing.\r
\n" ); document.write( "\n" ); document.write( "2. The fee for hiring a guide to explore a cave is ₱700. A guide can only take care of a maximum of 4 persons, and additional guides can be hired as needed. Represent the cost of hiring guides as a function of the number of tourists who wish to explore the cave and plot its graph. Use https://www.desmos.com/calculator for graphing.\r
\n" ); document.write( "\n" ); document.write( "3. The cost of hiring a catering service food for a party is ₱150 per head for 20 persons or less, ₱130 per head for 21 to 50 persons, and ₱110 per head for 51 to 100 persons. For 100 or more persons, the cost is at ₱100 per head. Represent the total cost as a piecewise function of the number of attendees of the party.
\n" ); document.write( "

Algebra.Com's Answer #853502 by CPhill(2189)\"\" \"About 
You can put this solution on YOUR website!
```python
\n" ); document.write( "import matplotlib.pyplot as plt
\n" ); document.write( "import numpy as np\r
\n" ); document.write( "\n" ); document.write( "# Plot 1: Videoke Rental
\n" ); document.write( "# C(d) = 1000 for 0 < d <= 3
\n" ); document.write( "# C(d) = 1000 + 400(d-3) for d > 3
\n" ); document.write( "d1 = np.linspace(0, 3, 100)
\n" ); document.write( "c1_1 = np.full_like(d1, 1000)
\n" ); document.write( "d2 = np.linspace(3, 10, 100)
\n" ); document.write( "c1_2 = 1000 + 400 * (d2 - 3)\r
\n" ); document.write( "\n" ); document.write( "plt.figure(figsize=(10, 5))
\n" ); document.write( "plt.plot(d1, c1_1, label='0 < d <= 3', color='blue', linewidth=2)
\n" ); document.write( "plt.plot(d2, c1_2, label='d > 3', color='red', linewidth=2)
\n" ); document.write( "plt.title('Videoke Rental Cost')
\n" ); document.write( "plt.xlabel('Number of Days (d)')
\n" ); document.write( "plt.ylabel('Cost (₱)')
\n" ); document.write( "plt.grid(True)
\n" ); document.write( "plt.legend()
\n" ); document.write( "plt.savefig('videoke_rental_cost.png')
\n" ); document.write( "plt.close()\r
\n" ); document.write( "\n" ); document.write( "# Plot 2: Cave Guide Fee
\n" ); document.write( "# C(n) = 700 * ceil(n/4)
\n" ); document.write( "n = np.arange(1, 21)
\n" ); document.write( "c2 = 700 * np.ceil(n / 4)\r
\n" ); document.write( "\n" ); document.write( "plt.figure(figsize=(10, 5))
\n" ); document.write( "plt.step(n, c2, where='post', label='Cost per persons', color='green', linewidth=2)
\n" ); document.write( "plt.scatter(n, c2, color='green')
\n" ); document.write( "plt.title('Cave Guide Fee')
\n" ); document.write( "plt.xlabel('Number of Persons (n)')
\n" ); document.write( "plt.ylabel('Cost (₱)')
\n" ); document.write( "plt.grid(True)
\n" ); document.write( "plt.legend()
\n" ); document.write( "plt.savefig('guide_fee_cost.png')
\n" ); document.write( "plt.close()\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "```\r
\n" ); document.write( "\n" ); document.write( "Here are the piecewise functions and plots for the three scenarios described:\r
\n" ); document.write( "\n" ); document.write( "### 1. Videoke Machine Rental\r
\n" ); document.write( "\n" ); document.write( "The cost depends on the number of days . The first three days have a flat rate of ₱1,000. From the fourth day onwards, an additional ₱400 is added for each day beyond the third.\r
\n" ); document.write( "\n" ); document.write( "**Piecewise Function:**\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "*Simplified for : *\r
\n" ); document.write( "\n" ); document.write( "### 2. Cave Guide Fee\r
\n" ); document.write( "\n" ); document.write( "Each guide costs ₱700 and can handle a maximum of 4 persons. This creates a step function where the cost increases every time a new group of 4 (or fraction thereof) starts.\r
\n" ); document.write( "\n" ); document.write( "**Function:**\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "*(where is the ceiling function, representing the number of guides needed)*\r
\n" ); document.write( "\n" ); document.write( "**Piecewise Representation:**\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "### 3. Catering Service Food Cost\r
\n" ); document.write( "\n" ); document.write( "The total cost is the product of the number of attendees and the specific price per head for that bracket.\r
\n" ); document.write( "\n" ); document.write( "**Piecewise Function:**\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "---\r
\n" ); document.write( "\n" ); document.write( "### Visualizations\r
\n" ); document.write( "\n" ); document.write( "The graphs below represent the cost functions for the Videoke Rental and the Cave Guide Fee.\r
\n" ); document.write( "\n" ); document.write( "**Graph 1: Videoke Rental Cost**
\n" ); document.write( "The graph stays flat at ₱1,000 for the first 3 days and then increases linearly with a slope of 400.\r
\n" ); document.write( "\n" ); document.write( "**Graph 2: Cave Guide Fee**
\n" ); document.write( "The graph is a step function, jumping by ₱700 for every 4 additional people.\r
\n" ); document.write( "\n" ); document.write( "(The following images are generated based on these functions)\r
\n" ); document.write( "\n" ); document.write( "{ \"images\": [ \"videoke_rental_cost.png\", \"guide_fee_cost.png\" ] }
\n" ); document.write( "
\n" );