Step 1: Understand the arrangement condition.
Since the books on each subject must remain together, we can treat the entire set of Math books and the set of Physics books as individual "blocks".
Thus, we have 2 "blocks" (one for Math and one for Physics).
Step 2: Calculate the number of ways to arrange the blocks.
These 2 blocks can be arranged in \( 2! \) ways.
This is because we can place the Math block first or the Physics block first.
Step 3: Calculate the number of arrangements within each block.
The 5 Math books can be arranged in \( 5! \) ways within their block.
The 3 Physics books can be arranged in \( 3! \) ways within their block.
Step 4: Total number of arrangements.
The total number of arrangements is:
\[
2! \times 5! \times 3! = 2 \times 120 \times 6 = 1440
\]
Step 5: Conclusion.
Therefore, the total number of arrangements is 1440, which is option (a).