StringTools - Maple Programming Help

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Combinatorics on Words : StringTools/Fibonacci

StringTools

 Fibonacci
 generate a Fibonacci string

 Calling Sequence Fibonacci( n, a, b )

Parameters

 n - non-negative integer; specifies that Fibonacci return the nth Fibonacci string a - character; (optional) first symbol to use b - character; (optional) second symbol to use

Description

 • The Fibonacci(n, a, b) generates the nth Fibonacci string, with initial values a and b. The arguments after the first are optional, and default to the strings $"0"$ and $"1"$, respectively.
 • Given starting symbols a and b, the nth Fibonacci string is defined by the recurrence Fibonacci( n, a, b ) = cat( Fibonacci( n - 1, a, b ), Fibonacci( n - 2, a, b ) ), for $1, and the initial conditions Fibonacci( 0, a, b ) = b and Fibonacci( 1, a, b ) = a. The length of Fibonacci( n ) is equal to the nth+1 Fibonacci number.
 • The Fibonacci procedure has option remember.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Fibonacci}\left(5\right)$
 ${"01001010"}$ (1)
 > $\mathrm{Fibonacci}\left(5,"u","v"\right)$
 ${"uvuuvuvu"}$ (2)
 > $\mathrm{seq}\left(\mathrm{length}\left(\mathrm{Fibonacci}\left(i\right)\right),i=1..10\right)$
 ${1}{,}{2}{,}{3}{,}{5}{,}{8}{,}{13}{,}{21}{,}{34}{,}{55}{,}{89}$ (3)
 > $\mathrm{seq}\left({\mathrm{combinat}}_{'\mathrm{fibonacci}'}\left(1+i\right),i=1..10\right)$
 ${1}{,}{2}{,}{3}{,}{5}{,}{8}{,}{13}{,}{21}{,}{34}{,}{55}{,}{89}$ (4)