scholarly journals How to use Fibonacci numbers to teach recursive programming

2021 ◽  
Vol 1 (1) ◽  
Author(s):  
Jürgen Gerhard

There are too many examples and programming guides (which, e.g., an internet search for "recursive procedure Fibonacci" will turn up) to count that use Fibonacci numbers as an example to illustrate recursive programming. The motivation for this article is to show why the naive way of doing this is a bad idea, as it is horrendously inefficient. We will exhibit much more efficient ways of computing Fibonacci numbers, both iterative and recursive, and analyze and compare worst case running times and memory usages. Using some mathematical properties of Fibonacci numbers leads to the most efficient method for their computation. For illustration and benchmarking, we will use Maple and its programming language, however, similar behaviour can be demonstrated in almost any other programming language. This exposition combines and explores the mathematical properties of Fibonacci numbers, notions of algorithmic complexity, and efficient Maple programming and profiling techniques, and may be used as an introduction to any of these three subjects. The techniques described can be readily generalized to more general types of linear recurrences with constant coefficients.

2015 ◽  
Vol 2015 ◽  
pp. 1-5 ◽  
Author(s):  
Bing Xu ◽  
Janusz Brzdęk

We study the Hyers-Ulam stability in a Banach spaceXof the system of first order linear difference equations of the formxn+1=Axn+dnforn∈N0(nonnegative integers), whereAis a givenr×rmatrix with real or complex coefficients, respectively, and(dn)n∈N0is a fixed sequence inXr. That is, we investigate the sequences(yn)n∈N0inXrsuch thatδ∶=supn∈N0yn+1-Ayn-dn<∞(with the maximum norm inXr) and show that, in the case where all the eigenvalues ofAare not of modulus 1, there is a positive real constantc(dependent only onA) such that, for each such a sequence(yn)n∈N0, there is a solution(xn)n∈N0of the system withsupn∈N0yn-xn≤cδ.


2000 ◽  
Vol 10 (3) ◽  
pp. 321-359 ◽  
Author(s):  
ANDREW M. PITTS

Studies of the mathematical properties of impredicative polymorphic types have for the most part focused on the polymorphic lambda calculus of Girard–Reynolds, which is a calculus of total polymorphic functions. This paper considers polymorphic types from a functional programming perspective, where the partialness arising from the presence of fixpoint recursion complicates the nature of potentially infinite (‘lazy’) data types. An approach to Reynolds' notion of relational parametricity is developed that works directly on the syntax of a programming language, using a novel closure operator to relate operational behaviour to parametricity properties of types. Working with an extension of Plotkin's PCF with ∀-types, lazy lists and existential types, we show by example how the resulting logical relation can be used to prove properties of polymorphic types up to operational equivalence.


Author(s):  
Athanasios Tsadiras

The main advantage of a Recursive Algorithm (an algorithm defined in terms of itself) is that it can be easily described and easily implemented in a programming language (van Breughel, 1997). On the other hand, the efficiency of such an algorithm is relatively low because for every recursive call not yet terminated, a number of data should be maintained in a stack, causing time delays and requiring higher memory space (Rohl, 1984). Solving the same problem iteratively instead of recursively can improve time and space efficiency. For example, to solve a problem that involves N recursive procedure calls, it will require stack space linear to N. On the contrary, using iteration, the program will need a constant amount of space, independent of the number of iterations. There are programming languages, such as Prolog, that do not possess built-in iterative structures and so recursion should be used instead. Nevertheless, there are ways to write recursive programs that have similar behaviour with that of the corresponding iterative programs.


2020 ◽  
Vol 43 (2) ◽  
pp. 345-353
Author(s):  
Khushnoor Khan

This corrigendum focuses on the correction of numerical results derived from Poisson-Lomax Distribution (PLD) originally proposed by Al-Zahrani & Sagor (2014). Though the mathematical properties and derivations by Al-Zahrani & Sagor (2014) were immaculate but during the execution ofthe R codes using Monte Carlo simulation some anomalies occurred in the calculation of the mean values. The same  anomalies are addressed in thepresent corrigendum. The outcome of the corrigendum will provide basic guidelines for the academia and reviewers of various journals to match thenumerical results with the shape of the probability distribution under study. The results will also emphasize the fact that code writing is a cumbersome process and due diligence be exercised in executing the codes using any programming language. Relevant R codes are appended in Appendix 'A'.


2020 ◽  
Vol 34 ◽  
pp. 01002
Author(s):  
Musa Demirci ◽  
Ismail Naci Cangul

Special numbers have very important mathematical properties alongside their numerous applications in many fields of science. Probably the most important of those is the Fibonacci numbers. In this paper, we use a generalization of Fibonacci numbers called tribonacci numbers having very limited properties and relations compared to Fibonacci numbers. There is almost no result on the connections between these numbers and graphs. A graph having a degree sequence consisting of t successive tribonacci numbers is called a tribonacci graph of order t. Recently, a new graph parameter named as omega invariant has been introduced and shown to be very informative in obtaining combinatorial and topological properties of graphs. It is useful for graphs having the same degree sequence and gives some common properties of the realizations of this degree sequence together with some properties especially connectedness and cyclicness of all realizations. In this work, we determined all the tribonacci graphs of any order by means of some combinatorial results. Those results should be useful in networks with large degree sequences and cryptographic applications with special numbers.


1996 ◽  
Vol 6 (3) ◽  
pp. 527-534 ◽  
Author(s):  
Andrew J. Kennedy

AbstractThis article describes the application of functional programming techniques to a problem previously studied by imperative programmers, that of drawing general trees automatically. We first consider the nature of the problem and the ideas behind its solution (due to Radack), independent of programming language implementation. We then describe a Standard ML program which reflects the structure of the abstract solution much better than an imperative language implementation. We conclude with an informal discussion on the correctness of the implementation and some changes which improve the algorithm's worst-case time complexity.


10.37236/2008 ◽  
2011 ◽  
Vol 18 (2) ◽  
Author(s):  
Arthur T. Benjamin ◽  
Halcyon Derks ◽  
Jennifer J. Quinn

We provide two combinatorial proofs that linear recurrences with constant coefficients have a closed form based on the roots of its characteristic equation. The proofs employ sign-reversing involutions on weighted tilings.


2014 ◽  
Vol 64 (2) ◽  
Author(s):  
Hacène Belbachir ◽  
Takao Komatsu ◽  
László Szalay

AbstractOur main purpose is to describe the recurrence relation associated to the sum of diagonal elements laying along a finite ray crossing Pascal’s triangle. We precise the generating function of the sequence of described sums. We also answer a question of Horadam posed in his paper [Chebyshev and Pell connections, Fibonacci Quart. 43 (2005), 108–121]. Further, using Morgan-Voyce sequence, we establish the nice identity $F_{n + 1} - iF_n = i^n \sum\limits_{k = 0}^n {(_{2k}^{n + k} )( - 2 - i)^k } $ of Fibonacci numbers, where i is the imaginary unit. Finally, connections to continued fractions, bivariate polynomials and finite differences are given.


Author(s):  
Christophe Jouis ◽  
Julien Bourdaillet ◽  
Bassel Habib ◽  
Jean-Gabriel Ganascia

This chapter is a contribution to the study of formal ontologies. It addresses the problem of atypical entities in ontologies. The authors propose a new model of knowledge representation by combining ontologies and topology. In order to represent atypical entities in ontologies, the four topological operators of interior, exterior, border and closure are introduced. These operators allow to specify whether an entity, belonging to a class, is typical or not. The authors define a system of topological inclusion and membership relations into the ontology formalism, by adapting the four topological operators with the help of their mathematical properties. These properties are used as a set of axioms which allows to define the topological inclusion and membership relations. Further, the authors define combinations of the operators of interior, exterior, border and closure that allow the construction of an algebra. They model is implemented in AnsProlog, a recent logic programming language that allows negative predicates in inference rules.


Sign in / Sign up

Export Citation Format

Share Document