Circular reference


A circular reference is a series of references where the last object references the first, resulting in a closed loop.

Contents

In language


A circular reference is not to be confused with the logical fallacy of a circular argument. Although a circular reference will often be unhelpful and reveal no information, such as two entries in a book index referring to each other, it is not necessarily so that a circular reference is of no use. Dictionaries, for instance, must always ultimately be a circular reference since all words in a dictionary are defined in terms of other words, but a dictionary nevertheless remains a useful reference. Sentences containing circular references can still be meaningful;

Her brother gave her a kitten; his sister thanked him for it.

is circular but not without meaning. Indeed, it can be argued that self-reference is a necessary consequence of Aristotle's Law of non-contradiction, a fundamental philosophical axiom. In this view, without self-reference, logic and mathematics become impossible, or at least, lack usefulness.[1][2]

In computer programming


Circular references can appear in computer programming when one piece of code requires the result from another, but that code needs the result from the first. For example, the two functions, posn and plus1 in the following Python program comprise a circular reference:[further explanation needed]

def posn(k: int) -> int:
    if k < 0:
        return plus1(k)
    return kdef plus1(n: int) -> int:
    return posn(n + 1)
>>> posn(-1)
0

Circular references like the above example may return valid results if they have a terminating condition. If there is no terminating condition a circular reference leads to a condition known as livelock.

In ISO Standard SQL circular integrity constraints are implicitly supported within a single table. Between multiple tables circular constraints (e.g. foreign keys) are permitted by defining the constraints as deferrable (See CREATE TABLE for PostgreSQL and DEFERRABLE Constraint Examples for Oracle). In that case the constraint is checked at the end of the transaction not at the time the DML statement is executed. To update a circular reference two statements can be issued in a single transaction that will satisfy both references once the transaction is committed.

In spreadsheets


Circular references also occur in spreadsheets when two cells require each other's result. For example, if the value in Cell A1 is to be obtained by adding 5 to the value in Cell B1, and the value in Cell B1 is to be obtained by adding 3 to the value in Cell A1, no values can be computed. (Even if the specifications are A1:=B1+5 and B1:=A1-5, there is still a circular reference. It does not help that, for instance, A1=3 and B1=-2 would satisfy both formulae, as there are infinitely many other possible values of A1 and B1 that can satisfy both instances.)

Circular reference in worksheets can be a very useful technique for solving implicit equations such as the Colebrook equation and many others, which might otherwise require tedious Newton-Raphson algorithms in VBA or use of macros.[3]

A distinction should be made with processes containing a circular reference between those that are incomputable and those that are an iterative calculation with a final output. The latter may fail in spreadsheets not equipped to handle them but are nevertheless still logically valid.[2]

See also


References


  1. ^ Terry A. Osborn, The future of foreign language education in the United States , pp.31-33, Greenwood Publishing Group, 2002 ISBN 0-89789-719-6.
  2. ^ a b Robert Fiengo, Robert May, Indices and identity , pp.59-62, MIT Press, 1994 ISBN 0-262-56076-3.
  3. ^ "Solve Implicit Equations Inside Your Worksheet By Anilkumar M, Dr Sreenivasan E and Dr Raghunathan K" . Archived from the original on 2009-08-17. Retrieved 2009-06-25..







Categories: Causal fallacies | Philosophical logic | Self-reference




Information as of: 19.06.2020 11:44:39 CEST

Source: Wikipedia (Authors [History])    License : CC-by-sa-3.0

Changes: All pictures and most design elements which are related to those, were removed. Some Icons were replaced by FontAwesome-Icons. Some templates were removed (like “article needs expansion) or assigned (like “hatnotes”). CSS classes were either removed or harmonized.
Wikipedia specific links which do not lead to an article or category (like “Redlinks”, “links to the edit page”, “links to portals”) were removed. Every external link has an additional FontAwesome-Icon. Beside some small changes of design, media-container, maps, navigation-boxes, spoken versions and Geo-microformats were removed.

Please note: Because the given content is automatically taken from Wikipedia at the given point of time, a manual verification was and is not possible. Therefore LinkFang.org does not guarantee the accuracy and actuality of the acquired content. If there is an Information which is wrong at the moment or has an inaccurate display please feel free to contact us: email.
See also: Legal Notice & Privacy policy.