What is the MatLab Program for this?

5 ビュー (過去 30 日間)
Alex Degaga
Alex Degaga 2015 年 3 月 31 日
編集済み: Walter Roberson 2015 年 5 月 4 日
The Pythagorean theorem states that a^2 + b^2 = c^2
Write a MATLAB program in a script file that finds all the combinations of triples a, b, and c that are positive integers all smaller or equal to 50 that satisfy the Pythagorean theorem. Display the results in a three-column table in which every row corresponds to one triple. The first three rows of the table are:
3 4 5
5 12 13
6 8 10
  2 件のコメント
James Tursa
James Tursa 2015 年 3 月 31 日
Please post what you have done so far. Then we can comment on it and make suggestions.
John D'Errico
John D'Errico 2015 年 3 月 31 日
編集済み: John D'Errico 2015 年 4 月 1 日
And rather than just paste in your homework assignment for us to do, what have you tried? Have you made an effort? If you cannot do so, then why should we?
Of course, if you cannot be bothered to do so, then we should get some credit for doing your homework. And while I know that you would honestly give us credit when you handed in your homework, a small part of me worries that you might not do so. So please add the e-mail address of your teacher. We can then send our solutions directly to that person.

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2015 年 3 月 31 日
  1 件のコメント
James Tursa
James Tursa 2015 年 3 月 31 日
The 2nd link is good advice in general, but I don't see that it applies in this case. Double arithmetic will be done exactly with integers of this size.

サインインしてコメントする。


Roger Stafford
Roger Stafford 2015 年 3 月 31 日
Here's a hint to get you started. Suppose you have two positive integers, a and b. How would you use matlab to determine whether or not the value a^2+b^2 is the square of another integer, c? If you can answer that question, you are well on your way to solving your problem.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by