How to resolve the algorithm Mandelbrot set step by step in the uBasic/4tH programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Mandelbrot set step by step in the uBasic/4tH programming language

Table of Contents

Problem Statement

Generate and draw the Mandelbrot set.

Note that there are many algorithms to draw Mandelbrot set and there are many functions which generate it .

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Mandelbrot set step by step in the uBasic/4tH programming language

Source code in the ubasic/4th programming language

A =-21000                              ' Left Edge = -2.1
B = 15000                              ' Right Edge = 1.5
C = 15000                              ' Top Edge = 1.5
D =-15000                              ' Bottom Edge = -1.5
E = 200                                ' Max Iteration Depth
F = 350                                ' X Step Size
G = 750                                ' Y Step Size

For L = C To D Step -G                 ' Y0
    For K = A To B-1 Step F            ' X0
        V = 0                          ' Y
        U = 0                          ' X
        I = 32                         ' Char To Be Displayed
        For O = 0 To E-1               ' Iteration
            X = (U/10 * U) / 1000      ' X*X
            Y = (V/10 * V) / 1000      ' Y*Y
            If (X + Y > 40000)
                I = 48 + O             ' Print Digit 0...9
                If (O > 9)             ' If Iteration Count > 9,
                    I = 64             '  Print '@'
                Endif
                Break
            Endif
            Z = X - Y + K              ' Temp = X*X - Y*Y + X0
            V = (U/10 * V) / 500 + L   ' Y = 2*X*Y + Y0
            U = Z                      ' X = Temp
        Next
        Gosub I                        '  Ins_char(I)
    Next
    Print
Next

End
                                       ' Translate number to ASCII
32 Print " "; : Return
48 Print "0"; : Return
49 Print "1"; : Return
50 Print "2"; : Return
51 Print "3"; : Return
52 Print "4"; : Return
53 Print "5"; : Return
54 Print "6"; : Return
55 Print "7"; : Return
56 Print "8"; : Return
57 Print "9"; : Return
64 Print "@"; : Return

  

You may also check:How to resolve the algorithm Memory layout of a data structure step by step in the D programming language
You may also check:How to resolve the algorithm Here document step by step in the REXX programming language
You may also check:How to resolve the algorithm Documentation step by step in the C# programming language
You may also check:How to resolve the algorithm Loops/For with a specified step step by step in the Scala programming language
You may also check:How to resolve the algorithm FizzBuzz step by step in the Vale programming language