How to resolve the algorithm Feigenbaum constant calculation step by step in the FreeBASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Feigenbaum constant calculation step by step in the FreeBASIC programming language

Table of Contents

Problem Statement

Calculate the Feigenbaum constant.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Feigenbaum constant calculation step by step in the FreeBASIC programming language

Source code in the freebasic programming language

' version 25-0-2019
' compile with: fbc -s console

Dim As UInteger i, j, k, maxit = 13, maxitj = 13
Dim As Double x, y, a, a1 = 1, a2, d, d1 = 3.2

Print "Feigenbaum constant calculation:"
Print
Print "  i     d"
Print "==================="

For i = 2 To maxIt
    a = a1 + (a1 - a2) / d1
    For j = 1 To maxItJ
        x = 0 : y = 0
        For k = 1 To 2 ^ i
            y = 1 - 2 * y * x
            x = a - x * x
        Next
        a = a - x / y
    Next
    d = (a1 - a2) / (a - a1)
    Print Using "###    ##.#########"; i; d
    d1 = d
    a2 = a1
    a1 = a
Next

' empty keyboard buffer
While Inkey <> "" : Wend
Print : Print "hit any key to end program"
Sleep
End

  

You may also check:How to resolve the algorithm ABC problem step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Doubly-linked list/Definition step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Compiler/lexical analyzer step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Apply a callback to an array step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Fibonacci word/fractal step by step in the FreeBASIC programming language