Can anybody help me to solve this? Its a Triangle sequence

조회 수: 3 (최근 30일)
Anthony Zúñiga
Anthony Zúñiga 2019년 1월 15일
댓글: Walter Roberson 2019년 5월 26일
A sequence of triangles is constructed in the following way:
1) the first triangle is Pythagoras' 3-4-5 triangle
2) the second triangle is a right-angle triangle whose second longest side is the hypotenuse of the first triangle, and whose shortest side is the same length as the second longest side of the first triangle
3) the third triangle is a right-angle triangle whose second longest side is the hypotenuse of the second triangle, and whose shortest side is the same length as the second longest side of the second triangle etc.
Each triangle in the sequence is constructed so that its second longest side is the hypotenuse of the previous triangle and its shortest side is the same length as the second longest side of the previous triangle.
What is the area of a square whose side is the hypotenuse of the nth triangle in the sequence?

답변 (1개)

Abdul Muneeb
Abdul Muneeb 2019년 5월 26일
n=3
sides=[3 4 5];
if (n>1)
for i=1:(n-1)
sides=[sides(2) sides(3) (sides(2)^2+sides(3)^2)^0.5]
end
end
sort([sides])
Area =(sides(3))^2 % sides(3) is long side
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 5월 26일
This is not incorrect (though the sort is not doing anything for you there). However, the question reads to me as a formula question, what the formula is for arbitrary n.
There is a fomula that is not too difficult to recognize with a small bit of experimentation. It can even be calculated directly, thanks to Binet's formula.

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

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by