6.12: Exercise

Matlab and Octave Programming for STEM Applications · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC-SA 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    6.12: Exercise

    Before you go on, you might want to work on the following exercise.

    Exercise 6.1

    There is an interesting connection between Fibonacci numbers and Pythagorean triples. If \(F\) is a Fibonacci sequence, then

    \[\big(F_i F_{i+3}, \, 2 F_{i+1} F_{i+2}, \, F_{i+1}^2 + F_{i+2}^2 \big) \notag \]

    is a Pythagorean triple, for all \(i \ge 1\).

    Write a function named fib_triple that takes n as an input variable, computes the first n Fibonacci numbers, stores them in a vector, and checks whether this formula produces Pythagorean triples for numbers in the .


    This page titled 6.12: Exercise was last modified on Wed, 13 Jul 2022 23:52:12 GMT and is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Allen B. Downey (Green Tea Press) via source content that was edited to the style and standards of the LibreTexts platform.