Just comparing posting something from Google newsgroup and Discourse with
something pretty…
On a Linux box with fpm, ps2pdf, and evince I ran it with
fpm run|ps2pdf - >view.pdf;evince view.pdf
see Fortran code here
xxprogram root3
integer,parameter :: dp=kind(0.0d0)
real(kind=dp),parameter :: const=1.905e-3_dp, r2r=0.4e0_dp
integer,parameter :: rows=900, cols=900, r=150
real(kind=dp) :: angle
complex(kind=dp) :: z, w, d
integer :: i, ix, iy, linebreak
character(len=2) :: zup
character(len=60) :: ps(7)=[character(len=60) :: &
&"%!", &
& "/str 256 string def", &
& "/go { image showpage } def", &
& "0 720 translate 72 72 scale", &
& "(I0, 1x, I0, ' 8 [', I0, ' 0 0 ', I0, ' 0 ', I0, ']')", &
& "{currentfile str readhexstring pop}", &
& "go" ]
write(*,'(A)') (trim(ps(i)),i=1,4)
write(*,ps(5)) rows, cols, r, -r, r
write(*,'(A)')(trim(ps(i)),i=6,7)
linebreak=0
do ix=-rows/2, rows-rows/2-1
do iy=-cols/2, cols-cols/2-1
! test for cmplx(0.0,0.0) which is undefined
z=cmplx(ix*const, iy*const, kind=dp)
do i=1,224
if ( z == (0.0_dp,0.0_dp) ) exit
w=z*z
z=z*w*2+1
z=z/w/3
d=z-1
if(abs(d)<r2r) exit
d=z+cmplx(0.5_dp, 0.866_dp, kind=dp)
if(abs(d)<r2r) exit
d=z+cmplx(0.5_dp, -0.866_dp, kind=dp)
if(abs(d)<r2r) exit
enddo
if(i>224) then
angle=atan2(0.0_dp,-1.0_dp)
else
angle=atan2(d%im, d%re)
endif
write(zup,'(Z2.2)') int(abs(angle/0.012272_dp))
write(*,'(A2)',advance='no') lower(zup)
linebreak=linebreak+1
if(linebreak==30)then
linebreak=0
write(*,*)
endif
enddo
enddo
contains
elemental pure function lower(str) result (string)
! ident="@(#) M_strings lower(3f) Changes a string to lowercase over specified range"
character(*), intent(in) :: str
character(len(str)) :: string
integer :: i
integer,parameter :: diff = iachar('A')-iachar('a')
string = str
do concurrent (i = 1:len_trim(str)) ! step thru each letter in the string in specified range
select case (string(i:i))
case ('A':'Z')
string(i:i) = achar(iachar(str(i:i))-diff) ! change letter to miniscule
case default
end select
enddo
end function lower
end program root3