Boring plot of 5000 functions!
#1
This is another program that would only display graphic silliness. Don't expected colored, fractal stuff; a program such as this might have been attempted with QuickBASIC or Turbo Pascal, trying to burn those weak single-core CPU's to a crisp. Many pictures are just an useless line at the top or at the side of the screen. Others are just near-diagonal lines. Others are "steps" as if trying to plot binary or something else. But there are a few good ones here.

The program tries to plot a function with 500 points of Cartesian coordinates taking part in a polar scheme. If the function is not plottable, it's skipped. The "Illegal function call" had to be trapped for it. The functions were fabricated from another QB64 program I wrote. Don't spend too much time looking at them or it will cause some loss of sanity!

Press [ESC] to quit, or on Linux leave it for long enough and then it seg-faults, I don't know why. (shrugs)

At the terminal command line it's possible to follow the executable file's name with an integer from 1 to 5000, to start from the function indicated by the huge "SELECT CASE... END SELECT" block. This has nothing to do with random numbers. It was already taken care of by my "extreme function maker" LOL.

That is the first parameter. There is a second parameter which is a float-type factor. The default is to just plot a circle with X,Y for 500 points. The circle is always created by this program with a "radius" of 2. The factor in this program can only cause the effect of an open shape. In other words, the chosen factor by the user cannot be smaller than the default value of 1.3888.

The actual program is too big to post into this forum, so I'm posting only a portion of it. Otherwise you will have to download the attachment. Smile

Code: (Select All)

'by mnrvovrfc 06-Jun-2023
option _explicit
dim v(1 to 500) as double
dim as double n, x, y, z, mult, factdiv, smaller, largger
dim as integer i, j, cn
dim redu$

if command$(1) = "" then
cn = 1
else
cn = val(command$(1))
if cn = 0 then
cn = 1
elseif cn < 1 or cn > 5000 then
cn = 1
end if
end if
if command$(2) = "" then
mult = 1.3888
else
mult = val(command$(1))
if mult < 1.3888 or mult > 5.0 then
mult = 1.3888
end if
end if

screen _newimage(1000, 500, 12)

for i = cn to 5000
on error goto 100
for z = 1 to 500
x = 2 * cos(_d2r(z / mult))
y = 2 * sin(_d2r(z / mult))
select case i
case 1
n = Z10B46#(x, y, z)
case 2
n = Z10B48#(x, y, z)
case 3
n = Z10B4A#(x, y, z)
case 4
n = Z10B4C#(x, y, z)
case 5
n = Z10B4E#(x, y, z)
case 6
n = Z10B50#(x, y, z)
case 7
n = Z10B52#(x, y, z)
case 8
n = Z10B54#(x, y, z)
case 9
n = Z10B56#(x, y, z)
case 10
n = Z10B58#(x, y, z)
' :
' :
case 4990
n = Z13240#(x, y, z)
case 4991
n = Z13242#(x, y, z)
case 4992
n = Z13244#(x, y, z)
case 4993
n = Z13246#(x, y, z)
case 4994
n = Z13248#(x, y, z)
case 4995
n = Z1324A#(x, y, z)
case 4996
n = Z1324C#(x, y, z)
case 4997
n = Z1324E#(x, y, z)
case 4998
n = Z13250#(x, y, z)
case 4999
n = Z13252#(x, y, z)
case 5000
n = Z13254#(x, y, z)
end select
endoflongcase:
v(z) = n
next

on error goto 0

smaller = 0
largger = 0
for z = 1 to 500
if v(z) < smaller then smaller = v(z)
if v(z) > largger then largger = v(z)
next

if int(smaller * 1e+6) = 0 and int(largger * 1e+6) = 0 then
cls
_continue
end if

redu$ = ""
if abs(smaller) > abs(largger) then factdiv = abs(smaller) else factdiv = abs(largger)
do while factdiv > 1e+6
redu$ = "*"
smaller = smaller / 100
largger = largger / 100
if abs(smaller) > abs(largger) then factdiv = abs(smaller) else factdiv = abs(largger)
loop

_title _trim$(str$(i)) + ": " + redu$ + "Smaller =" + str$(smaller) + "| " + redu$ + "Larger =" + str$(largger)
window screen(smaller, 1)-(largger, 500)

doscreen:
pset(v(1), 1), 15
for z = 2 to 500
line -(v(z), z), 15
next

for j = 1 to 30
_delay 0.1
if _keydown(27) then exit for
next

cls
if _keydown(27) then exit for
next
system

100 n = 0
resume endoflongcase
' :
' :
'then what follows are the functions to plot graphs with.


.zip   forceq-graph.bas.zip (Size: 125.59 KB / Downloads: 34)
Reply
#2
I got tired of waiting for qb64 to finish checking the 30102 LOC, perhaps trying the top 100 Functions instead?
b = b + ...
Reply
#3
bplus
you can compile from the command prompt, qb64pe -c forceq-graph.bas
but it take a couple of minutes, didn't actually time it, just a guess
Reply
#4
If it's taking a while to compile, remember to click off the option for compiler optimizations.  Those -o2 settings increase compile times by a ton.
Reply
#5
(07-05-2023, 10:51 PM)bplus Wrote: I got tired of waiting for qb64 to finish checking the 30102 LOC, perhaps trying the top 100 Functions instead?

Originally it was going to be over 7000 functions. :O

But your computer is supposed to be more advanced than mine! What I have is an 11-year-old Hewlett-Packard laptop with Intel "Sandy Bridge" CPU. I don't think any compiler switches should have anything to do with it.

In my last compile on Debian XFCE it did take me five minutes. Could reduce it to 1000 functions which is what I had to do once while debugging it.
Reply




Users browsing this thread: 1 Guest(s)