Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Management Expert

This project is related to C programming. Please read and follow the intruction below. Thanks for helping!!!

A code in C of the Mandelbrot Set

The Mandelbrot set is a set of all complex numbers that satisfy the following condition: for any c in the Madelbrot set, the absolute value of mandelbrot(n) remains bounded when n tends to infinity, where

mandelbrot(n) = mandelbrot(n-1)*mandelbrot(n-1) + c;
mandelbrot (0) = c.

Here the addition and multiplication are complex number addition and multiplication.

If the absolute value of mandelbrot(15), |mandelbrot(15)|, is smaller than 10000 for a given c, then c is in the Mandelbrot set. If we consider a c as a 2D coordinates on a plane, the points in the area from (-2.0, -1.12) to (0.47, 1.12) will contain the Mandelbrot set. Our goal is to calculate an array of points that covers the Mandelbrot set in this area and display it. You may save the area in a file if you want the area to contain many points beyond your display.

Implementation

First, we need to use the complex functions in this project.

Second, include mandelbrot.c, which implement the recursive function mandelbrot(n). In general, you should avoid using global variables, so the recursive function has to carry another input value, c, and mandelbrot(n) checks whether c belongs to the Mandelbrot set. In other words, your function should be mandelbrot(n, c) instead. Optionally, for the purpose of learning, you may define a global variable c in mandelbrot.c, and use "extern" in mandelbrot.h to make it visible in main.c, so you can just use mandelbrot(n).

Also, mandelbrot(n) uses complex number addition and multiplication, so you should include complex.h in mandelbrot.c to allow mandelbrot(n) to access complex functions. In the recursive function, |mandelbrot(n)| can be quite large beyond the computer's representation. Therefore, in the recursion, if |mandelbrot(n-1)| is bigger than 10000, your recursion should consider that it is not bounded, so you return mandelbrot(n) = (10000, 10000) instead of the calculated number to indicate that current c is not in the Mandelbrot set. Also, in the recursion, mandelbrot(n-1) is calculated twice, which is really wasting effort, so you should just calculate once for efficiency.

Third, in order for main.c to see the recursive function and c, you need to include mandelbrot.h. Because you use complex number in main.c, you need to include complex.h as well.

In main.c, for all point c in the area from (-2.0, -1.12) to (0.47, 1.12), we can check the corresponding mandelbrot(15) to see if it is in the Mandelbrot set. If it is in the set, which means |mandelbrot(15)| is smaller than 10000, we print a "#"; otherwise, we print a "-" or an empty space. Therefore, we can actually print an image of the Mandelbrot set. For example, you can check 40*30 points with a double for loop. That is, we start in x direction from -2.0 with step size (0.47-(-2))/40 = 0.06175 to 0.47, and in y direction from -1.12 with step size (1.12-(-1.12))/30 = 0.077 to 1.12. You may notice that this arrangement will be an up-side-down image, but the image is symmetric, so we can ignore this problem.

If you want, which is not required for this project, you may save the image in a two dimensional array of characters first and then print out the image. This way, you can actually flip the image. Better yet, you can save this image in a file, so you can check out a much larger image in the file with many more points.

The final executable is called mandelbrot. Make sure your Makefile will compile and generate the three object files, and link them together with correct dependencies.

Business Management, Management Studies

  • Category:- Business Management
  • Reference No.:- M92044796
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Business Management

Evaluate the processes that are involved in a systems

Evaluate the processes that are involved in a systems development lifecycle (SDLC) and how the processes relate to each other.

How to navigate through the various leadership styles

How to navigate through the various leadership styles within an organization and adjust to the differences in leadership?

What does it mean to differentiate a service how can you

What does it mean to differentiate a service? How can you use it to increase target market interest?

Do you all think that fear of retaliation may affect

Do you all think that fear of "retaliation" may affect decisions by individuals in today's health care organizations? Do you all think that some of the specialized areas of expertise i.e. surgical areas, may have some in ...

Management and consulting1 what is flawless consulting2

Management and consulting 1. What is 'flawless consulting'? 2. Describe the problem analysis approach? 3a. What is positive defiance? 3b. Explain one positive implication of positive defiance? 4. Look at BDO Internationa ...

Auburn creed i believe that this is a practical world and

Auburn Creed: I believe that this is a practical world and that I can count only on what I earn. Therefore, I believe in work, hard work. I believe in education, which gives me the knowledge to work wisely and trains my ...

Communication planthis communication plan will be a roadmap

Communication Plan This communication plan will be a roadmap on how the new division will best be able to communicate with Biotech's corporate headquarters, suppliers, other divisions, and internally. This should lay out ...

What contributes to making change communication effective

What contributes to making change communication effective within an organization?

According to the bureau of labor statistics 71 of the labor

According to the Bureau of Labor Statistics, 7.1% of the labor force was recently unemployed. A random sample of 100 employable adults was selected. Using the normal approximation to the binomial distribution, what is th ...

Low cost leader strategywhat are some of the risks

Low Cost Leader Strategy: What are some of the risks associated with a low cost leadership strategy? Provide one original example of a company that you believe employs this strategy and why?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As