2. Se tienen 15 libros distintos, de los cuales 3 son de matemáticas, 2 de física, 5 de informática y 5 de finanzas.
  1. ¿De cuántas formas podemos colocarlos en una estantería con un espacio vacío para 15 libros?
  2. ¿Cuáles son?
  3. ¿Y si queremos que los 5 de informática estén ubicados en los extremos?
  4. ¿Y si queremos que estén agrupados por materias?

댓글 수: 2

Walter Roberson
Walter Roberson 2026년 1월 26일
Approximate translation:
What is the answer?
2. You have 15 different books, of which 3 are math books, 2 are physics books, 5 are computer science books, and 5 are finance books.
In how many ways can you arrange them on a bookshelf with space for 15 books?
What are the ways?
What if you want the 5 computer science books to be placed at the ends?
What if you want them grouped by subject?
Walter Roberson
Walter Roberson 2026년 1월 26일
This a question about permutations and combinations, not about MATLAB.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sam Chak
Sam Chak 2026년 1월 26일
편집: Sam Chak 2026년 1월 26일

0 개 추천

I believe the mathematical puzzle involves the use of the factorial () operator. However, the factorial can rapidly grow to an exceptionally large value for relatively small integers n, which may make it challenging for students with ordinary math skills in permutations and combinations to verify the results. Nevertheless, you can test this approach using small numbers. But I haven't tested whether it truly works for very large numbers, as the formula may be purely coincidental for integers lesser than 4.
As for the last one, I don't know how to group the books by subject. What are your ideas?
% Total number of books
n = 3;
% Calculate total arrangements
total_arrangements = factorial(n);
disp(['Total arrangements of ', num2str(n), ' books: ', num2str(total_arrangements)]);
Total arrangements of 3 books: 6
% 1, 2, 3
% 1, 3, 2
% 2, 3, 1
% 2, 1, 3
% 3, 1, 2
% 3, 2, 1
% Number of computer science books
cs_books = 2;
% Calculate arrangements with CS books at the ends (on the right-hand side)
arrangements_with_cs_ends = factorial(cs_books) * factorial(n - cs_books);
disp(['Arrangements with ', num2str(cs_books), ' CS books at the ends: ', num2str(arrangements_with_cs_ends)]);
Arrangements with 2 CS books at the ends: 2
If Book 1 and Book 3 are CS books, only these arrangements are possible:
% 2, 3, 1
% 2, 1, 3

댓글 수: 1

If the books of each type can be differentiated between, then the number of ways you can arrange them is
format long g
factorial(15)
ans =
1307674368000
if you were to list all of the arrangements, 5 to a line, then it would require
ans/5
ans =
261534873600
lines to list them, and it would require
ans * ((15+1)*4+15) / 2^30
ans =
19242.293214798
gigabytes of storage. It would then be completely impractical to list all of the arrangements.
The only way the question makes sense is if the books on each particular subject cannot be told apart, such as 3 copies of the same math book.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Financial Toolbox에 대해 자세히 알아보기

태그

질문:

2026년 1월 26일

댓글:

2026년 1월 26일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by