Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
neural net attractors
#1
Code: (Select All)
'Program NNET256.BAS produces neural net attractors
'(VGA 320 x 200 x 256 color version)
'Copyright (c) 1997 by J. C. Sprott
Screen 13
N% = 4 'Number of neurons
D% = 16 'Number of inputs (dimension)
s = .5 'Scaling factor (network gain)
tmax& = 80000 'Number of iterations
sw% = 319 'Screen width - 1
sh% = 199 'Screen height - 1
nc% = 254 'Number of colors - 2
Dim w(N%, D%), B(N%, D%), x(N%), y(D%), PAL&(nc% + 1)
PAL&(0) = 65536 * 63 + 256 * 63 + 63 'PAL&(0) IS WHITE
PAL&(1) = 65536 * 55 + 256 * 55 + 55 'PAL&(1) IS GRAY
For i% = 2 To nc% + 1
    B% = Int(32 + 32 * Cos(.02464 * i%))
    G% = Int(32 + 32 * Cos(.02464 * i% + 4.1888))
    R% = Int(32 + 32 * Cos(.02464 * i% + 2.0944))
    PAL&(i%) = 65536 * B% + 256 * G% + R%
Next i%
Randomize Timer
While InKey$ <> Chr$(27)
    Cls
    Palette Using PAL&(0)
    p& = 0
    For i% = 1 To N%
        For j% = 1 To D%
            w(i%, j%) = 1 - 2 * Rnd
        Next j%
        B(i%, 1) = s * Rnd
        x(i%) = .5
    Next i%
    For t& = 1 To tmax&
        y(0) = 0
        For i% = 1 To N%
            y(0) = y(0) + B(i%, 1) * x(i%)
        Next i%
        For j% = D% To 1 Step -1
            y(j%) = y(j% - 1)
        Next j%
        For i% = 1 To N%
            u = 0
            For j% = 1 To D%
                u = u + w(i%, j%) * y(j%)
            Next j%
            x(i%) = 1 - 2 / (Exp(2 * u) + 1)
        Next i%
        If t& > tmax& / 50 Then
            If 10 * p& + 50 < t& - tmax& / 50 Then t& = tmax&
            x% = .5 * (sw% + sw% * x(1))
            y% = .5 * (sh% - sh% * x(2))
            z% = .025 * (sw% + sw% * x(3))
            c% = 2 + Int(nc% * (.5 * x(4) + .5))
            If Point(x%, y%) < 2 Then p& = p& + 1
            If c% > Point(x%, y%) Then PSet (x%, y%), c%
            x% = x% + z%: y% = y% + z%
            If Point(x%, y%) = 0 Then PSet (x%, y%), 1
        End If
    Next t&
Wend
End
Reply
#2
Re: 4th Sprott in row fractal keeper

This one just needs Sleep 5 before Wend in main loop.

Man! @J.C. Sprott what are you doing these days?
b = b + ...
Reply
#3
(11-16-2023, 08:54 PM)bplus Wrote: Re: 4th Sprott in row fractal keeper

This one just needs Sleep 5 before Wend in main loop.

Man! @J.C. Sprott what are you doing these days?

He's still chaosing and fractaling away!   https://sprott.physics.wisc.edu/FRACTALS.HTM    <-- His Fractal of The Day site.

https://sprott.physics.wisc.edu/sprott.htm  <-- And a site all about him.
Reply
#4
Whats with automatic download when I link to Fractal gallery? eee...

But thanks for link, physics guy huh!
b = b + ...
Reply
#5
I'm going to try to change the program presented in this thread. There are at least three parameters to mess about with, see if it makes a difference. Also change to 32-bit color and stretch it to 640x480 because ```SCREEN 13``` is just too small and "blocky" for me these days. (Although I do like jaggies, I don't like them with fractals and other computer-aided graphics.)

I cheer the author of the program, but he chose GIF format, which I tend to convert away from. You know, one of these programs could be a good test for benchmarking the QOI format that QB64PE v3.9 supports now...

Thank you for posting this.
Reply




Users browsing this thread: 1 Guest(s)