i just finished writing the first version of an application that creates images by the manipulation of complex( number) equations using the methods described by Mandlebrot.
its very beautiful to see how mathematics so aptly describes the inherently complex intricacies of nature...
oh ho, im getting a bit carried away here! anyway i'll post the code later(im not on my computer at present), i just couldn't wait to tell you.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
Does the code include graphics? I seem to remember a program that graphed parts of the Mandlebrot set in some pretty nice colors. They made really cool patters, and you could zoom in on different parts for a close-up. Unfortunately, this was on something like a 286, so you could only zoom in REEEEAALLY SLLLLOOOOWWWLY.
TheAlchemist: It should not be too difficult to write code to create a fascinating fractal from the Newton iteration for cube root.
I assume you know that there are three cube roots of any real or complex number. Just work with the cube root of one.
Pick a point in the complex plane as the first approximation to the cube root of one. Use the Newton method to arrive at one of the three cube roots. Color the original point Red, Yellow or Blue depending on which root you converged to. Pick another point and do the same computations. Keep this up for many points to create the fractal image.
I have no idea how they did it, but it has been proven that this fractal has a weird counterintuitive property. All boundary points between regions are triple points. There are no ordinary finite length borders between two regions.
If you do not understand the concept of a triple boundary point, think of a circle divided into three equal pie-shaped regions by three radii. Imagine one region to be red, one yellow, and one blue. Imagine that there are no black lines showing the three regions. Only the colors indicate which points are in which region. The three radii consist of ordinary boundary points and are finite length borders between two regions. The center of the circle is a triple point boundary. It is a border point for all three regions.
The cube root fractal has only triple point boundaries.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
cool!, Shaggy Hiker
i'm still a bit new to fractals and so my images are very simple and i don't have the zooming abiblity yet. but not to worry i'm working on it. it's just that i have my finals coming up in 2 weeks, so i can't spend as much time as i'd like to on it.
Guv
thanks for the cool idea!! i understand what you mean by triple boundary points. seems like an esoteric field to delve into. but we're programmersand that what we do right!
i am going to start working on the cube root of one immediately. maybe i'll add more colours.
i keep forgetting to bring my project, please bear with me,i promise i'll bring it tomorrow.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
Guv:
just a question: the cue root of one is one. so the approxiamtions will always converge to one. am i right or am i missing something. is it something to do with complex numbers?
isn't the complex equation for the cube root of one:
z = 11/3 + 0i
so if theres no complex part then the equation does not exist in the complex set. is this right or is my definition wrong.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: Complex arithmetic is required for convergence to complex as well as real roots. The following is the Newton method for various roots, starting with square root. The pattern is obvious if you want to work with higher roots.
NextZ = Z / 2 + Number / 2*Z (Number is the value you want the square root of).
NextZ = 2*Z / 3 + Number / 3*z2
NextZ = 3*Z / 4 + Number / 4*Z3
NextZ = 4*Z / 5 + Number / 5*Z4
Use NextZ as Z for the next iteration. It converges fairly fast.
NotLKH had it right: Z3 - 1 = 0 is the polynomial to be solved for cube root of one.
When I write applications requiring complex arithmetic, I use a Type declaration and Functions for Add, Subtract, Multiply, & Divide. The following code is from an application I wrote, so it should work.
VB Code:
Public Type Complex
Real As Double
Imaginary As Double
End Type
[b]. . . .[/b]
Public Function Sum(A As Complex, B As Complex) As Complex
Dim Result As Complex
Result.Real = A.Real + B.Real
Result.Imaginary = A.Imaginary + B.Imaginary
Sum = Result
End Function
Public Function Difference(A As Complex, B As Complex) As Complex
Dim Result As Complex
Result.Real = A.Real - B.Real
Result.Imaginary = A.Imaginary - B.Imaginary
Difference = Result
End Function
Public Function Product(A As Complex, B As Complex) As Complex
If MsgBox("Small divisor: Problem?", vbOKCancel) = vbCancel Then
Result.Real = 0
Result.Imaginary = 0
Catastrophe = True
Else
Result.Real = Result.Real / Msquare
Result.Imaginary = Result.Imaginary / Msquare
End If
End Select
Quotient = Result
End Function
The above worked in an application I wrote for finding roots of a polynomial. Note that the Quotient function sets a global boolean called Catastrophe, which my main line code checks. You could use an On Error Statement. I did not use On Error because I wanted to check for trouble due to very small divisors, as well as zero divisors.
My Polynomial Roots application used the Rnd function to choose pseudo random complex initial guesses. One pseudo random number for the radius and one for an angle between zero and 2*Pi, to get the polar form of a complex number. That requires Sin & Cos functions to get real and imaginary parts. You might want to use Rnd to get the real and complex parts directly. I felt that my application would benefit by using the polar form.
Your application might do better by generating initial guesses in some systematic way rather than using random initial guesses.
For fractals based on nth roots, you do not want more that 3 colors for cube root, 4 colors for 4th root, et cetera.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
ok guys here it is,
i haven't had enough time to add the newton method iteration image. i have managed to do a rough zoom.
i found that the best zooms are produced when the step in the for loops are set to 0.00196. since this is pretty small it takes ages to generate so i am using 0.009 instead. the only problem is that i now have to set the drawwidht to 2 and this produces fuzzy images. i have an idea of how to deal with this but no time!!!!. i have also been working on automatic polynomial generation. this will produce a much more exciting range of images.
please ignore all reference to the julia form, its something else i'm working on.
does anyone know how julia sets are actually calculated?
i am pretty new to vb and programming so fell free to let me know if theres anything i can do in a better way, i welcome constructive criticism.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: Both the Mandelbrot set and Julia sets use the same iteration.
NextZ = Z2 + C, where C is a constant.
For the Mandelbrot Set, the iteration always starts with zero. If Z starts growing without bound, C is a point in the Mandelbrot set.
The above is for the benefit of those who do not know the iteration. Since TheAlchemist has wrriten the application, he must know.
There is a Julia Set for every value of C. It is easiest to describe it by mentioning that a circle of radius one is the Julia Set boundary for C = zero. Note that the iteration approaches (0, 0) for Z inside the unit circle. It grows without bound for Z outside the unit circle. It stays on the unit circle if you start on the uunit circle. (0, 0) is called an attractor.
Values of C near zero behave similarly, except that instead of a circle for the boundary, you get a fractal boundary. For values of C not so close to zero, you get stranger boundaries, and can get more than one one attractor. For large values of Z you get what is called Fatou Dust, no closed curve as a boundary. Points of the Julia Set for large C are disconnected.
There is a relationship between Julia Sets and the mandelbrot Set. The type of Julia set is related to where C is in the Mandelbrot Set.
BTW: All the real work on the MandelBrot and Julia Sets was done some time between 1900 and 1930 by two Frenchmen: Juila & Fatou. Much of the other work on fractals was done by people other than Mandelbrot. It was pretty much unknown due to there being no computers and modern printers to make the graphics. Without the graphics, the ideas had little appeal except to a few mathematicians. Mandelbrot did not do much more than write some programs based on the work of Julia and Fatou. When the graphics were published, Mandelbrot got more credit than he deserved.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
Guv
thanks a lot man. check my code for generating julia sets(just the one for Zn = Z2n-1+ C.
what am i doing wrong with the calculation? The idea was to iterate(roughly) the values of x and y rouhgly between -2 and 2. p and q are constant in the equation.
i recently read a post by you in the chat section about the universe being governed by probabilities. very interesting stuff! i agree with you.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: When not being paid for my time, I am too lazy to do a good job of analyzing code written by somebody else. Excuse me if I have misinterpreted something, resulting in my making a dumb remark. The following relates to your Mandelbrot code, which I do not think is quite right. I will post later relating to Julia Set code, which is slightly more complicated.
Some of my remarks relate to the problem in general, rather than being a critique or comment about your code.
Checking the square of the magnitude seems like a good idea, saving the time required for square root.
I tend to pre-initialize variables when the application starts, prior to Loops, et cetera as appropriate. I do not like to rely on the initialize done by a compiler. When I switch to another compiler or language, I might take a long time to figure out what went wrong because the new environment uses junk in memory as initial values or has different initialize rules. In addition, explicit pre-initialization makes the intent of the code more obvious, which is important if it is not your own code or if you have not looked at the code for months or years.
Your Mandelbrot iteration is Do While Magnitude(Z)2 < 1000 AND LoopCount < 64. It seems to me that the test should be Loop Until Magnitude(Z) > 4 OR LoopCount > MaximumCount
When Magnitude(Z) exceeds 2 (test the square for > 4), I think the iteration will go to infinity, and you want to stop iterating because you know that the point does not belong to the Mandelbrot Set. You then color the point based on the LoopCount value.
When LoopCount goes beyond some predetermined maximum, you assume the point is in the Set and color it black. The smaller the maximum, the faster you get the job done, but the more points you assign incorrectly. I think you should tinker with this value until you find the largest value which gets the job done in some reasonable amount of time.
The programs I have seen usually assign colors based on ranges of LoopCount values. For example
0-100 red
101-200 orange
201-300 yellow
301-400 blue
. . ..
901-1000 green
I have seen the entire range (0 to 100, or 0 to 1000, or 0 to 10000) divided into equal interval sub ranges. I have seen it divided into unequal ranges. I have seen some programs provide user options. Sub ranges based on equal interval ranges of the logarithm of the LoopCount value and/or other range options. The slicker programs keep an array of LoopCount values versus points and allow the user to make changes to the color choice algorithm. For some of the programs I have seen, the redraw seems so fast that I think the program fiddles with the color pallet used by the Graphics card.
I think you need to fiddle with coloring algorithms to find good ones. I do not think the first guess is likely to be good. I suspect that you do not want to use too many colors, which might make adjacent regions difficult to distinguish. As the number of colors increase, you start getting many shades of 6-12 basic hues. This decreases contrast. It is difficult to predict what is going to happen, and you do not want adjacent regions to be slightly different shades of the same hue.
There might be reasons why using equal interval sub ranges is not a good idea.
Note that for most fractals, the most interesting graphics are near the boundary of a region. This is particularly true of Mandelbrot and Julia sets. Giving the user zoom options and the ability to center the graphic on a particular point make for a great application.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
TheAlchemist: The following relates to your Julia Set code. Most of the following is about Julia Set coding in general, rather than relating to your code.
Your code seems to be checking for square of magnitude > 3, instead of greater than 4.
Code for Julia Set graphics is more complicated than the code for Mandelbrot Set graphics. There are several types of Julia Sets.
There are Julia Sets topologically the same as a circle, which is a Julia Set with zero as the iteration constant. This is the only Julia Set with a non-fractal boundary. These have a single attractor inside and a single attractor (infinity) outside of a simply connected region. They have a simple closed curve as the boundary. Simple meaning it does not cross itself.
Some Julia Sets have more than one non-infinite attractor. I am not sure if this type of Julia Set can be a simply connected region with a boundary that does not cross itself. I think there can be more than two non-infinite attractors, but I am not sure.
Some Julia Sets have a single boundary which crosses itself (not a simple closed curve), resulting in the region not being simply connected. Each sub-region might have an interior attractor. I am not sure about the number and location of multiple attractors, and how the attractors relate to multiple sub-regions.
I think that some Julia Sets have regions isolated from each other, but I am not sure about this.
I think some Julia Sets have one or more regions that are filament-like. No inside or outside: Just fractal curves.
I think some sets of points called Fatou Dust are Julia Sets. These are an infinite (I think) collection of isolated points, but my memory of these is not reliable.
The Mandelbrot Set indicates what type of Julia Set you get for a given constant. Points deep in the interior correspond to Julia Sets topologically like circles. Points outside the Mandelbrot Set probably correspond to Fatou Dust and/or the filament-like Julia Sets. I have no memory of the details of the relationship between the Mandlebrot Set and the various types of Julia Sets.
The code required for Julia Sets topologically like a circle includes the following.
Code is required to plot the boundary (simple closed curve), which is usually shown as black. You can find extremely precise approximations to boundary points by doing reverse iterations. For each iteration, subtract the constant and take square root. Just as repeated square root in the complex plane converges to a circle of radius one (from points outside or inside), reverse Julia Set iterations converge to a fractal boundary.
I do not know how to decide when you have reached a good approximation to a boundary point. For Next iteration with a fixed number of loops might be a good idea. 50-100 iterations would surely get very close to a boundary point, and 10-25 are likely to be sufficient from any internal point. Some simple experimental code is likely to tell you how many iterations are reasonable. I am not sure how many starting points you must use to get a set of boundary points which convey the fractal nature of the boundary. More than one starting point might iterate to the same boundary point (I am not sure about this).
Reverse iteration starting at a boundary point results in another boundary point. Perhaps the code should do some number of reverse iterations to reach a very close approximation to a boundary point. Once on (actually very near) the boundary, do twenty or so (maybe 100) iterations, marking each point reached as a boundary point. I think there might be certain boundary points with attractor-like properties, which could cause a problem. These points are analogous to (1,0) on the circular Julia Set. Once there, you stay there.
Code is required to determine the attractor point, which is not the iteration constant, except for the circular Julia Set. Perhaps this point should be indicated on the graphic by a black dot inside a small white (circular?) region.
I am not sure about coloring algorithms. Internal points closer to the boundary converge to the internal attractor slower than points further from the boundary. Similarly, external points closer to the boundary converge slower to the attractor at infinity. I suppose coloring algorithms based on how many iterations it takes to converge make sense. I imagine that considerations similar to those for the Mandelbrot Set apply here. Of course, you need two convergence tests. Perhaps, you do not color points that converge to the infinite attractor.
Obviously, the more complicated Julia Sets require a lot more code than the simply connected sets.
I am not sure of the exact definition of a Julia Set. It could be that the fractal boundary is defined as the set. It could be that the interior is defined as the set. I have seen Julia set graphics that used coloring algorithms similar to Mandelbrot coloring algorithms. Anyway, who cares what the formal definition is? It is the graphic that is important.
You should probably do some research before trying to write Julia Set code.
BTW: For both Mandelbrot and Julia Set graphics, I suggest using a Picture Box for the graphic, with Command Buttons and Text Boxes to provide user options. Perhaps the controls could be on one form and the graphic on another. If the latter approach was used, loss of focus for the graphic form would suspend the drawing process, requiring neither a Key nor a command button to stop the drawing process.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
ok guys,
i just managed to create very pretty julia sets. i also managed to save and retrive the images created. i think so far my major problem has been the color coding. im working on that.
Guv, i have really been trying to get the newton iteration going but i cant separate the real and imaginary parts, please help.( for the cube root of 1)
i will post the code later
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: The Newton iteration for roots is as follows. In order: Square root, cube root, 4th root, 5th root, 6th root.
Next = Last / 2 + Number / 2 * Last
Next = 2 * Last / 3 + Number / 3 * Last2
Next = 3 * Last / 4 + Number / 4 * Last3
Next = 4 * Last / 5 + Number / 5 * Last4
Next = 5 * Last / 6 + Number / 6 * Last5
The iteration converges to a root of Number. The three cube roots of one are
One, in case you did not know.
-.5, + .866 254 403 784i
-.5, - .866 254 403 784i
.866 254 403 784 is SquareRoot(.75)
If you start with a real initial guess, you will always converge to a real root. You must do complex arithmetic starting with a complex initial guess to converge to complex roots. The complex iteration will converge to a real root for certain complex initial guesses.
A good library or a web search should turn up some graphics showing the cube root and 4th root fractals. They are fascinating, and will give you a clue about what to expect.
I find it worth while to simplify my code by using a Type declaration and Functions to do the four basic operations on complex variables. The extra run time is not noticeable, and the code is easier to understand if you do not look at it for several months. It is obviously easier for somebody else to follow, and less error prone when you are writing an application. The following is a copy of some code from a polynomial roots application.
VB Code:
[b]. . . .[/b]
Public Type Complex
Real As Double
Imaginary As Double
End Type
Public Catastrophe as Boolean
[b]. . . .[/b]
Public Function Sum(A As Complex, B As Complex) As Complex
Dim Result As Complex
Result.Real = A.Real + B.Real
Result.Imaginary = A.Imaginary + B.Imaginary
Sum = Result
End Function
Public Function Difference(A As Complex, B As Complex) As Complex
Dim Result As Complex
Result.Real = A.Real - B.Real
Result.Imaginary = A.Imaginary - B.Imaginary
Difference = Result
End Function
Public Function Product(A As Complex, B As Complex) As Complex
If MsgBox("Small divisor: Problem?", vbOKCancel) = vbCancel Then
Result.Real = 0
Result.Imaginary = 0
Catastrophe = True
Else
Result.Real = Result.Real / Msquare
Result.Imaginary = Result.Imaginary / Msquare
End If
End Select
Quotient = Result
End Function
For finding roots via Newton, the Quotient function might not need the logic for small or zero divisors.
I hope the above helps. Let me know if you have further questions.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
Guv
Thank you again man. i appreciate it. i guess i was just going through a dense period, i could have done it with the information you had already given me.
anyway, since ive figured the newton iteration out, just give me till tomorrow to add it to the application. i shall post the new code tomorrow.
Everyone
just a word of advice from something i experienced earlier today; using DoEvents does appreciably slow things down, especially if used multiple times(i.e. same subroutine, different number of loops, DoEvnts in each loop) i added the statement to the loops in my code and my did it slow down!!! there was only visual basic running in the background, my system has 256MB RAM) does vb have a high background activity while running apps through it?
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
Originally posted by TheAlchemist Everyone
just a word of advice from something i experienced earlier today; using DoEvents does appreciably slow things down, especially if used multiple times(i.e. same subroutine, different number of loops, DoEvnts in each loop) i added the statement to the loops in my code and my did it slow down!!! there was only visual basic running in the background, my system has 256MB RAM) does vb have a high background activity while running apps through it? [/B]
DoEvent causes your application to give up its processing time to allow any pending tasks to be completed. This includes things like window updates, and background processes. I haven't looked at your code, but if you're drawing your fractals directly to the screen, it may be a good idea to double-buffer them. That would speed up processing time quite a bit.
ok guys here it is,
i still haven't sorted out the colors yet and the user interface is down right sloppy but bear with me, i'll get it done.
this code includes the julia,mandlebrot and newton method iterations for the generation of fractals. i also want to add L-Systam fractals(these mirror nature)
ignore the combobox in the startup form,just select an option and go! press d on your keyboard to start the drawing, esc to exit. read the comments and hopefully you'll get a picture of whats going on.
NotLKH
check out the mdlGenPolynomial moduel to see my code on calcuating combinations.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
Alchemist: Glad to hear your fractal application is working. Because of you, I started work on a similar project. Only cube, 4th, & 5th root drawings are working. I do not expect to implement roots beyond the 5th, but might.
I down loaded your zip file, but something is wrong. Visual Studio complained that frmMain was missing.
BTW: I only use my complex arithmetic functions when both operands are complex. For multiply/divide by real numbers, I just write the code.
I included a test that creates a black region indicating fast convergence. Points near the roots obviously converge very fast as expected. If I relax the test a bit, it shows some other regions that you might not expect.
Right now, I am thinking about a capability for zooming in and out. Unlike your application, I am drawing in a Picture Box.
I am also working on making the applications sensitive to changes in resolution and/or form size.
Mandelbrot & Julia set code is being held up waiting for the other enhancements.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
thats great Guv!!
im happy that i inspired you to go and create a fractal program too. i would love to have a look at it when you're done if you don't mind. theres probably a lot i could learn. im going to go and try and implement the fast convergence tests that you just decribed. you may have noticed that i have managed to produce pretty cool images by using just 2 colours.
anyway im also working on creating fractals for higeher powers and also for numbers other than 1. one strange thing thats hapening though is that i can't seem to work out fractals for numbers greater than 27(for the cube root) i suspect htis has something to do with me not having any vb service pack or updates!!!
i figured out an algorithm to find the complex cube roots of a number provided that the real root and the complex roots of 1 are known. i also added to your complex arithmetic code by adding a power function i.e. zn. it takes n and z as parameters and returns the resulting complex number after applying the power. will post it soon.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: It is a waste of time to do fractals for cube roots, 4th roots, et cetera for numbers other than one. They will look the same as the fractals for the roots of one.
My application draws a fractal in a Picture Box. It has labels showing the x-coordinates of the bottom corners of a Picture Box, and labels showing Y-coordinates of the left corners. Relabeling the corners would change the fractal for the cube root of one to a fractal for the cube root of some other real number. Unless you want to do such fractals for roots of imaginary or complex numbers, you might as well just work with the roots of one. I suspects that roots of imaginary or complex numbers would be the same fractals rotated and/or translated.
Are you familiar with De Moivres’s therorem and the polar coordinates form of complex numbers? I use the inverse of it to test for convergence when finding complex roots. The following shows some Declarations and initialize code followed by a version of my Root Finder Function modified to do 5th root. There is a bit of explanation after the code.
VB Code:
Public Const Dpi As Double = 6.28318530717959 '360 degrees
Public Const Pi As Double = 3.14159265358979 '180 degrees
Public Const Hpi As Double = 1.5707963267949 ' 90 degrees
Public Const Qpi As Double = 0.785398163397448 ' 45 degrees
Public Angle72 As Double 'Angles in radians
Public Angle120 As Double 'for root convergence tests
Public Angle144 As Double '90, 180, & 360 constants also used
Public Angle216 As Double
Public Angle240 As Double
Public Angle270 As Double
Public Angle288 As Double
[b]. . .[/b]
Angle72 = Dpi / 5#
Angle144 = 2# * Angle72
Angle216 = 3# * Angle72
Angle288 = 4# * Angle72
Angle120 = Dpi / 3
Angle240 = 2 * Angle120
Angle270 = 3# * Dpi / 4
ComplexOne.Real = 1 'Used with Quotient Function for reciprocals
ComplexOne.Imaginary = 0
[b]. . .[/b]
Public Function Root(N As Complex) As Byte
Dim CurrentP As Complex 'Current & next for Newton iteration
Dim NextP As Complex
Dim Power As Complex 'Divisor for Newton iteration
Case Abs(Rsquare - 1) > 0.00000001 'Check for radius near one
NotYet = True
Case Abs(Angle) < 0.0000001 'Check for angle near zero
Root = 0
NotYet = False
Case Abs(Angle - Dpi) < 0.0000001 'Check for angle near 360
Root = 0
NotYet = False
Case Abs(Angle - Angle72) < 0.0000001 'check for angle near 72
Root = 1
NotYet = False
Case Abs(Angle - Angle144) < 0.0000001 'check for angle near 144
Root = 2
NotYet = False
[b]. . .[/b]
Case Else
NotYet = True
End Select
Select Case True
Case NotYet
CurrentP = NextP
Case J < BlackTally
Root = BlackNumber
Exit Function
Case Else
Exit Function
End Select
Next J
Root = GrayNumber
End Function
The above code might not work because I modified a general purpose Root Function to do 5th root. Also: Out of context, there are some undefined variables or Functions; There is some missing code indicated by . . .
My actual Root Function uses some Global variables and Function Calls to provide for calculation of cube root, 4th root, and 5th root. It would do 6th, 7th, et cetera roots if the global variables and called Functions were modified appropriately. I might add 6th root, but see little gain in going any further.
I use Option Buttons to determine the fractal to be generated. I provide Buttons for Mandelbrot, Julia, Cube root, 4th root, and 5th root. If I wanted to provide any possible root, I would have one Option Button for nth root fractals and cause it to make a Text Box visible. The Text Box would be used to indicate n. The convergence test could use a For-Next Loop and generate the required angles inside the Root Function. The root function would have to use a for loop to generate the Power variable (see above code). The Newton Multipliers (2, 3, 4, 5 . . .) and divisors (3, 4, 5, 6 . . .) could be global variables outside the root function. The only problem here would be the number of colors required for really high roots. Right now, my application can only provide about 10 colors other than black & gray.
Gee! After writing the above paragraph for your benefit, I like the idea and might modify my application accordingly. Now that I think of it a bit, the angles could be generated outside the Root Function and put into an array.
Until ready to draw a pixel, I use a Byte Variable to indicate which color is to be used, and generate an array of the Color Bytes for use in doing a fast redraw of the fractal. I allow the user to change color assignments and redraw. The Root Function returns a Color Byte.
De Moivre’s Theorem relates to powers & roots of complex numbers in polar form (Radius and Angle instead of x & y)
It states that the nth power of (R, A) is (Rn, n * A)
The inverse can be used for roots: (R1/n, A / n)
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
hmm, let me go study your code. the logic is very cute. yes i am familiar with DeMoivre's theorem jsut never looked at it in that light before, im going to go and try and implement a similar color coding technique to your, thats just what i need!
anyway heres my code for expanding functions of the form
(x+iy)n. it return the complex resultant after performing all the additions using the binomial theorem.
VB Code:
Public Function power(ByVal Poly As Integer, z As Complex) As Complex
Dim Result As Complex
If Poly Mod 2 = 0 Then 'check if the power is odd or even
Result.Imaginary = 0 'if it is even then the result will only have a real component
TheAlchemist: The following assertion is not valid.
Check if the power is odd or even. If it is even then the result will only have a real component
Consider the following
Function(z) = Z6 - C has six roots, whether C is real or complex. Therefore, every complex number has six 6th roots.
At most two can be real (consider the De Moivre Theorem). Hence four will be complex.
Hence, there are at least 4 complex numbers for which C6 is not real.
Otherwise your code for (x + iy)n seems to be correct. I suppose that you can use your GetReal & GetImaginary Functions for n even.
For zn, I use my Product Function in a loop, something like the following.
VB Code:
Power = z
For J = 2 to n
Power = Product(z, Power)
Next J
I am not sure which method would be faster: Yours or mine. I suspect that for n < 25 to 50, there would not be a significant difference on a fast CPU. Note that methods which explicitly compute x2, x3, x4, x5, et cetera tend to do extra arithmetic operations. Hence, I believe that your method does a lot more arithmetic.
I like to minimize mental work. Whenever possible, I use my Complex functions: Sum, Difference, Product, and Quotient. Now that I have confidence in them, their use makes my code simpler to understand and debug.
I have modified my application as mentioned in previous post. It now can do nth root for any integer value of n. I have to add some logic to cope with values which exceed the number of colors available, currently eleven. Not sure how to deal with it.
Not allow n greater than number of colors. This might be a good idea.
Use VB Mod Operator to reuse existing colors. This might not be too bad, and is going to be my temporary solution.
Include some algorithm to generate additional colors when necessary. I do not think I can come up with an algorithm which will do a good job.
BTW: I am having trouble with overflow and failure to converge for higher roots (9th, 10th, 11th).
I think the problem is due to points in the vicinity of the origin. The magnitude of zn is small for z near the origin. It gets used as a divisor in the Newton method, resulting in zn having a very large magnitude for the next Newton iteration. Thus there is a tendency to alternate between large and small magnitudes. Since the magnitude of nth roots of one is one, Newton will not converge for certain points.
In my code, when the iteration counts exceeds a limit, the Newton iterations are terminated and the starting point is colored gray. As n increased, I noticed a growing gray region circling the origin. As n increased, I also noticed more and more gray regions elsewhere.
For 10th or 11th root, the application overflowed. The overflow and failure to converge are probably symptoms of the same problem: Small magnitudes used as divisors in the Quotient Function. This problem obviously gets worse as the order of the root increases.
1 / zn for z < 1 approaches zero as n increases, faster approach for larger n.
I intend to modify the application to cope with the above problems, probably by adding logic to the Quotient Function.
BTW: My complex Quotient Function often requires slightly different logic for different applications. Small and zero divisiors are not always treated the same way.
Keep in touch on this subject. Two minds can usually do more than one
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
TheAlchemist: The following assertion is not valid.
quote:
--------------------------------------------------------------------------------
Check if the power is odd or even. If it is even then the result will only have a real component
--------------------------------------------------------------------------------
but my code is not working out roots, it is merely working out expansions of the type f(x,y) = (x+iy)n
i have been experiencing the same overflow problems and lack of convergence. if you look at my code you'll notice that i have used a shortcut(not a real fix) to deal with it by exiting the do loop when the result of the iterations converges to 4.32....E-324.
i have discovered that this is why i have been unable to draw fractals of the cube roots of numbers larger than 27.
i implemented a convergence test of my own, wow! the effect on the fractal is beautiful! i also implemented a very sloppy quick redraw scheme. so far it is only designed to work with the newton iteration. im extending it slowly. i am not very conversant with the Byte data type. could you please explain it to me?
hows work on the zoom going? i have noticed that obtaining the cube root of number other than 1 produces an inward zoom effect on the fractal. i have not tried numbers less than one yet. this could be a possible way to zoom in on the newton fractals.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: There seems to be some misunderstanding. You seem to be saying that an even power of a complex number is always real.
(x + iy)2n has a nonzero imaginary component for many values of x, y, & n.
For example: (1 + i2)4 = (-7 + i24)
As mentioned in a previous post, I could not run your application. There is no frmMain, and the compile complained about some trivia.
The Newton Method is known to fail for certain functions. Polynomial and nth roots are one class of problem functions. It is possible to oscillate forever, never getting near a root. It is possible to use a very small divisor causing overflow.
The overflow can occur due to an operation performed after the division. computing the magnitude of a complex number is an example of this situation. The division by a small number can result in both the real and the imaginary components being very large. To compute the magnitude, you square both components and add.
To avoid the oscillation problem, I use a loop counter. The limit is larger for higher order roots. To solve the small divisor problem, my complex Quotient and Reciprocal Functions check for a small divisor and set a Boolean for the calling program to test. For Root Fractals, I color a point gray if a small or zero divisor is encountered. In other applications, I take whatever action is appropriate.
To verify a statement I made in a previous post, I modified my application to make a fractal for CubeRoot(8) instead of CubeRoot(1). I cannot tell the difference between the two images, except for their scale. Hidden in the computations might be different numbers of iterations for convergence. It seems to me that I could fool around with the XY coordinate values and make the images absolutely identical, but I am not sure.
Due to the above experiment, I suggest that you not bother with roots of any real number other than one. Also, I suspect that your code might be more complex than necessary due to not working directly with Pixels. I noticed the following code in your application.
VB Code:
frmJulia.ScaleMode = vbPixels
frmJulia.ScaleTop = -2
frmJulia.Scale.Left = -2
frmJulia.ScaleHeight = 4
frmJulia.ScaleWidth = 4
Are you aware that setting ScaleTop, Scaleleft, et cetera sets ScaleMode to zero (User defined instead of Pixels)? Are you sure you want ScaleTop to be negative? For my application ScaleTop and ScaleLeft correspond to positive Y and negative X, respectively.
The Byte variable is very simple, it is an unsigned integer in range 0-255 My application uses it as a subscript for a simple array of RBG Colors. See below.
BTW: I suspect that using randomly generated RBG colors is likely to result in some esthetically poor images. In addition, it is likely to cause adjacent regions to have colors which look the same (or almost the same) to the human eye. Most of the fractal images I have seen published use 6-20 colors. I am using 12, and expect it to be enough. I picked the colors myself after a little bit of experimentation. I can easily add more, and the user can change them. They revert to the defaults the next time the application is run.
My application uses PixFractal.ScaleMode = vbPixels, allowing it to work directly with the Pixels in a Picture Box. The Subroutine which does a fast redraw is as follows (some remarks after the code).
VB Code:
Private Sub Redrawer()
Dim J As Long
Dim K As Long
Dim Y As Single
Dim X As Single
Dim HueNumber As Byte
For J = pixFractal.ScaleTop To pixFractal.ScaleHeight
For K = pixFractal.ScaleLeft To pixFractal.ScaleWidth
Y = J
X = K
HueNumber = ColorNumber(J, K)
pixFractal.PSet (X, Y), _
lblColor(HueNumber).BackColor
Next K
Next J
End Sub
The ColorNumber Array contains a Byte for each Pixel in the Picture Box (PixFractal). There is a Redim Statement for the Array to make it conform to the current Screen Resolution. I have 12 Labels in a Control Array (lblColor). The BackColors from those Labels are used when I draw a fractal. My application allows the user to change the colors individually, shuffle them randomly, or cycle them (0 to 12, 1 to 0, 2 to 1, et cetera).
The following is the Subroutine which initially draws a fractal. Note that it loads the ColorNumber array. The Redrawer need not know what Fractal was initially drawn. If BackColors are changed, the Redrawer uses the new color assignments.
VB Code:
Private Sub cmdDraw_Click()
Dim X As Long
Dim Y As Long
Dim Px As Single
Dim Py As Single
Dim Z As Complex
Dim StartPoint As Complex
Dim TintNumber As Byte
StartPoint = UpperLeft
pixFractal.ScaleMode = vbPixels
'pixFractal.Cls
GrayTally = 0
SmallTally = 0
lblGrayTally.Visible = False
lblSmallTally.Visible = False
Z.Imaginary = StartPoint.Imaginary
For Y = pixFractal.ScaleTop To pixFractal.ScaleHeight
Z.Real = StartPoint.Real
For X = pixFractal.ScaleLeft To pixFractal.ScaleWidth
The code at the very end was used for debugging and experimentation. It will be removed someday.
Code and Declarations external to the above Subroutine take care of a lot of details. In particular, UpperLeft (Complex), DeltaX, and DeltaY are determined based on the location and size of a rectangle in the Complex Plane. Points in that rectangle are mapped to Pixels in the Picture Box.
My application only does roots (cube, 4th, 5th . . . 12th) of one. I am certain that the fractals for roots of other real numbers would look the same, making it unproductive to provide for roots of real numbers other than one.
I am considering adding code to produce fractals using the newton Method for roots of polynomials, perhaps up to cubic or quartics. I want to provide zoom in & zoom out capability first.
The Mandelbrot fractal is not very interesting without the ability to analyze very small regions of the complex plane near the boundary of the set. I have coded my application so that the basic drawing subroutine is the same no matter what part of the Complex Plane I am mapping to the Picture Box.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
when i said i could learn a lot from your code and experience, i made a huge understatement. you just helped me figure out how to make my code more efficient and scalable. i like!
i get your point about the GetReal function, its just that i observed in expanding the function that only the real term comes out i.e.
i tried this with some other even powers as well and they all produced the same result so i assumed that even powers only produce real components. that is why i said that i proved the above by induction. i just noticed a trend. is there an error with the above logic?
Last edited by TheAlchemist; Jun 12th, 2003 at 09:44 AM.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
I stared at your expansion for several minutes before I saw the problem.
Taking so long to notice the error makes me like to use my complex Arithmetic functions whenever possible. Once you get them debugged, they do not make dumb errors the way you and I do.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
oh my god!! i don't believe i actually did that! ah, im going to go get it fixed right now...im finally done with high school! now i have loadds of time on my hands, i can really concentrate on cleaning up my code.
Open the .vbp file with notepad and change the path to the frmMain.frm file. It is included in the project isn't it? if it isn't let me know i'll post again, or you could just wait a bit and i'll post a revised and updated edition.
i had to go to a wedding yesterday so i didn't get time to do much, im going to go and get cracking now.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: My fractal application is working fairly well. It does the Mandelbrot Set and nth roots (n = 3 to 12). I have not done much with the Mandelbrot Set due to working with nth roots. There is no Julia Set code yet. I might not implement Julia Sets.
I can now zoom in to any part of an image. I have had my screen map areas as small as .0000001 by .0000001, at which magnification I have been finding clusters of points which do not converge after 400 or more Newton iterations. These clusters are near the intersections of regions that converge to different roots. It is as if some points do not know which root should attract them, so they do not converge at all.
Next work will be on Zooming in to the Mandelbrot Set and making the application respond to maximizing the form and changes in screen resolution. The Zoom code should work without change, but who knows until I try it.
I expect to zoom farther into the Mandelbrot Set than the nth root fractals, which have less variety that the M Set.
How is your application working?
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
hey Guv,
its nice to hear your applications working. I have also implemented a zoom feature for all three types..(m,Julia and Newton). its the same code thats run, just with different coordinates.
i have the project on a floppy but this comp doesnt have a fdd so i'll post the code in about half an hour. you'll notice that i have abandoned all forms except the frmMain and i have cleaned up my code a bit. with my code it is possible to find mandelbrot and julia sets of any power that fits within the integer types limit. i altered the power function and it is now working fine.
check out this site : http://www.techlar.com/fractals/webs...ct/mandel.html
try the zoom function, my zoom works in exactly the same way. just one problem though, it can only zoom to the first degree. i.e. you can only do one zoom before the picture gets totally distorted. i suspect this is because the code heavily relies on the scaletop..... properties. i just got an idea of how to fix it, give me a day.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: After I fixed a few undefined variables, the application compiled and started with the Mandelbrot Set already drawn.
Cube root seemed to work, but was slow on my system (1000MHZ) so I did not wait for it to finish.
The Julia Set did not seem to work, but I might have tried to activate it improperly.
Your Mandelbrot Set seems slightly distorted. Height/Width ratio does not seem correct: Stretched a bit parallel to the Real Axis.
The virtual dimensions of my rectangular drawing area are scaled to match the pixel width and height. This makes the height/width ratio correct.
I am just starting on the Julia Set code. I had some problems with events firing at the wrong time. BeachBum gave me a fix. I needed DoEvents to force an event to fire at the correct time.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
hey Guv,
i don't understand why you had to make the variable changes. i work under option explicit. all variables are declared.
i purposely loaded the mandelbrot set from file when the app starts for debugging purposes(with the zoom facility) have you tried the zoom? draw a rectangle in the picture box with your mouse the way you would on the desktop and the zoom cmd button will appear.
i think you were getting the julia set, you just didnt realise that it was drawing as the intial colors are the same as the loaded madelbrot set. from the form load event remove this line to see a blank picture box at start up:
picFractal.Image = loadpicture(Madelbrot-2.bmp.....)
then try it. the initial lambda parameters are set to draw a very nice outline. check the juliaset code for additional interesting lambda parameters. how do you map your images to the screen without the stretching that i am experiencing?
how do you do the zoom, just tell me the logic behind it, i want to code it myself. i tried implicitly setting the scalemode to pixels just after setting the other scale.. properties and just before drawing and for some reason my OS crashed, my screen resolution got totally mixed up! i had to restart to get things back in order. try drawing julia sets for higher powers of z, they look pretty nice if you use the right values for lambda.
i am also trying to add L system fractal abilities to the app.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: The application uses Pixel Mode for a Picture Box within which fractal images are painted.
how do you map your images to the screen without the stretching that i am experiencing?
ScaleWidth and ScaleHeight specify the dimensions of the Picture Box in Pixels (PixelsX & PixelsY).
For each type of fractal, I have an initial part of the complex plane that I intend to map, which is specified by the coordinates of the upper left corner of a virtual rectangle (StartX & StartY) and the height of the rectangle (HeightX)
WidthX = HeightY * PixelsX / PixelsY gives the width of a virtual rectangle, forcing it to be proportional to the dimensions of the Picture Box. This prevents distortions.
DeltaX = WidthX / PixelsX and DeltaY = HeightX / PixelsY gives increments for virtual (x, y) variables which match pixel increments in the Picture Box.
Initialize the drawing process with x = StartX and y = StartY. z = (x + iy) is the complex variable used in fractal calculations.
Increment across and down (or down and across) the Picture box pixel by pixel. For each pixel increment, increment (x, y) by (DeltaX, DeltaY) respectively.
At each Pixel in a 2D array, z = (x + iy) is used in the fractal computations for that position in the Picture Box.
I have a Subroutine which converts Pixel coordinates into virtual XY coordinates. This subroutine is used when the user chooses a different virtual rectangle to be mapped. No matter what the user rectangle looks like, I force the width & height to be proportional to the Picture Box dimensions. I then compute new values for StartX, StartY, DeltaX, & DeltaY, using them to paint the next fractal image.
Setting scale properties changes ScaleMode to zero (user mode), which can cause problems. Set Picture Box Height and Width, then query the scale properties to determine dimensions in pixels. If the size of the form or the screen resolution changes, I resize the Picture Box accordingly and query scale properties to determine the new dimensions in pixels. My basic logic is to size the form at a percentage of the current screen size, and then size the Picture Box to use as much of the form as possible with space still left for Command Buttons, Text Boxes, et cetera.
how do you do the zoom, just tell me the logic behind it, i want to code it myself.
After the Picture Box gets focus, my code responds to Plus, Minus, and Arrow Keys.
Plus indicates Zoom In, magnifying a rectangle in the Picture Box.
Minus Zooms Out, and the Arrow keys indicate movement of the current virtual rectangle.
The Got Focus Event initializes values for the first Zooms or moves of the virtual rectangle. I use about 1/8 of the dimensions of the current virtual rectangle. I might change to using the MouseDown Event for this instead of the Got Focus Event.
If the rectangle is moved left, the next move right is set to half what it was previously and the next move left will be the same as it is currently. Similarly for other moves or Zooms. If the direction is the same, use the same percentage change as last time. If the direction changes, use half the previous change.
As the virtual rectangle is moved or zoomed, the code draws a box showing the new position and size. The algorithm seems to be intuitive and allows for easily homing in on an area of interest.
When the user clicks on a Command Button or some other control outside the Picture Box, the latest virtual rectangle is mapped to the Picture Box.
If any part of the virtual rectangle is moved or zoomed outside the rectangle for the current image, the new virtual rectangle is mapped immediately, terminating any further moving or zooming.
BTW: The code I downloaded had a few undefined variables.
Enough for now. I am not ignoring the rest of your comments/questions. My girl friend has just put dinner on the table.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
bon appetit!!!
im going to go put in some serious work into the app. i also want to add L-System fractals to it. give me some time and i'll get it going. how about you, how is your development going?
i found a site that had pictures of the newton iteration fractals. these fractals were different in that the large portions of single color that appear in mine are shaded. the author used an iteration count method like with the madelbrot and julia sets to creates different hues of the same colour giving a much more attractive effect. im in a bit of a hurry now, i'll post the address later as i dont remember it so i have to search for it.
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
TheAlchemist: Did you know that ordinary Julia Sets are related to the Mandelbrot Set? The type of Julia Set can be predicted from the location of the constant in the Mandelbrot Set. For example: If you choose the Julia Set constant from the heart of the Mandelbrot Set, you get a simple closed fractal curve, with (0, 0) being a special case, resulting in a circle of radius one centered on the origin.
Due to the above, the MouseDown in the Mandelbrot Set Event for my application records the virtual coordinates for later use with the Julia Set fractal.
I have been experimenting just a bit with your application. It seems slow, but I do not think it is due to inefficient code. I suspect that your iteration and precision limits are set very high.
After zooming in on the cube root fractal, I went to draw a Mandelbrot Set. The virtual coordinates seemed to be those used by the cube root fractal, giving me a zoomed in view of the Set. I think the application should reset to initial conditions when the type of fractal changes.
BTW: I am thinking of using my application to print fractal images. Some post or VB documentation which I read recently indicated that you can treat the printer similar to a Picture Box and make images pixel by pixel on paper, where pixels are defined by the printer resolution. Do you know anything about this?
Printer resolution is way higher than the screen resolution. 1600X1200 on a 17 inch monitor is about 100 pixels per inch, while 300 dpi is low resolution for an ink jet printer.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
After zooming in on the cube root fractal, I went to draw a Mandelbrot Set. The virtual coordinates seemed to be those used by the cube root fractal, giving me a zoomed in view of the Set. I think the application should reset to initial conditions when the type of fractal changes
you are right in saying this. the application changes the scale properties before doing a zoom. to restore the properties use the 'Reset' button. this will restore the properties to zero zoom.
i know nothing about printing pictures. why not save the picture as a bitmap, use some application to change the file type(.jpg,.gif) then print the new file? this is what d before i set one of my fractas as my desktop background.
i use freeware called MIR.NET(multiple image resizer) i think you should be able to find it on the web. i will look for the url and post it here.
I have been experimenting just a bit with your application. It seems slow, but I do not think it is due to inefficient code. I suspect that your iteration and precision limits are set very high.
you're right again! it is slow because of the incredible number of iterations it has to go through. e.g. for the default scale and setsize properties:
TheAlchemist: Thanx for that site. It had some interesting ideas.
why not save the picture as a bitmap, use some application to change the file type(.jpg,.gif) then print the new file?
Saving the picture will provide no more precision than that contained in the image generated. As mentioned in previous post, an ink jet printer provides 300 dpi (low) to 600 dpi or more. At 1600X1200, a 17 inch monitor provides about 100 dpi.
A program that generated an image directly to the printer and functioned at the printer pixel level could create a much better image than that shown on the monitor.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.