Julia set: Difference between revisions

1,519 bytes added ,  8 years ago
(Added the Common Business-Oriented Language)
Line 6:
* [[Mandelbrot_set|Mandelbrot Set]]
 
=={{header|AWK}}==
<lang AWK>
# syntax: GAWK -f JULIA_SET.AWK [real imaginary]
# converted from COBOL
BEGIN {
c_real = (ARGV[1] != "") ? ARGV[1] : -0.8
c_imaginary = (ARGV[2] != "") ? ARGV[2] : 0.156
printf("%s %s\n",c_real,c_imaginary)
for (v=1; v<=320; v+=10) {
for (h=1; h<=560; h+=10) {
x = (h - 280) / 200
y = (v - 160) / 100
plot_char = "#"
for (i=1; i<=50; i++) {
if (plot_char == "") {
break
}
z_real = ((x * x) - (y * y)) + c_real
z_imaginary = ((x * y) * 2) + c_imaginary
if (z_real ^ 2 > 10000) {
plot_char = ""
}
x = z_real
y = z_imaginary
}
printf("%1s",plot_char)
}
printf("\n")
}
exit(0)
}
</lang>
<p>Output:</p>
<pre>
# #
## ##
# ### #### #
################# ###
## # ######## ## # ## ######
### ##### ########### # #### # ##
######## ### ##### # ## ## # ## ##
#### ##### # ##### ## ##### ### #
## # ### # # ######### ## ## ######
# # #### # ########### ###### #
### ### ## # ############# #
# # ######### #### #
# ### #####
##
###
#
</pre>
=={{header|C++}}==
[[File:JuliaSetCpp.png|200px|thumb|right]]
477

edits