This project is related to c programming

Assignment Help Business Management
Reference no: EM131290120

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.

Reference no: EM131290120

Questions Cloud

Traits and behaviors should an ethical salesperson possess : What traits and behaviors should an ethical salesperson possess? What role does the sales manager play in ethical selling behavior?
Importance of training and support : Write a 3-page paper that explains the importance of training and support after software is implemented.  Describe the methods whereby training materials can be delivered to the users of the software system.
Transfer pricing-business by adding ice-cream unit : Recently, Lindsey took charge of the family farm—Vande Hey Farms. The farm supplies milk in 15-gallons barrels to local grocery stores and farmers’ cooperatives. At the beginning of last year, she decided to put her own stamp on the business by addin..
Calculate 3m''s total annual cost of resources invested : Has this cost decreased or increased over the years? Since these exercises depend upon real-time data, your answers will change continuously depending upon when you access the Internet to download your data.
This project is related to c programming : This project is related to C programming. Please read and follow the intruction below. Thanks for helping!!!
Whats the maximum error of estimate of the mean : Construct a 95% confidence interval for the mean of the population sampled. What's the maximum error of estimate of the mean - Construct a 97.5% confidence interval for the mean of the population sampled. What's the maximum error of estimate of th..
Think what will make these strategies successful in general : Think what will make these strategies successful in general :Random strategy,Retrenchment strategy,Liquidation Startegy.
Develop special treatments for the dual-diagnosed clients : You have been given the task of writing an ongoing article for the upcoming staff newsletters. You are researching and developing special treatments for the dual-diagnosed clients who you will be treating at your new facility.
Estimate generated by the project team : Why is the cost estimate generated by the project team likely to be different from the cost estimate created by senior management?

Reviews

Write a Review

Business Management Questions & Answers

  Classifying the biracial employee

Specifically address how the supervisor should classify the biracial employee in terms of how the supervisor might treat the employee.

  Discuss the major environmental facts and trends

Describe the product you selected in terms of the four utilities of customer value and identify the product's target market at home and in your stated foreign market.

  Understanding business research methods

'Understanding Business Research Methods is essential for all successful business managers whether in profit or not for profit organizations.'

  Leadership skills through a college course or courses

Should leadership be the manager's job, or should leadership be a shared process? Explain your answer. Are you interested in sharing leadership, or do you prefer to be a follower. Explain your answer.

  What roles do the wbs and gantt chart play

What roles do the WBS and Gantt chart play in the plan? What are the challenges and benefits of including these documents?

  Opportunity cost of producing a motor

With respect to overhead, what is the opportunity cost of producing a Model 350 motor?

  Floor manager of an herbal manufacturing facility

Maxwell (Max) Shupe is the floor manager of an herbal manufacturing facility in the Midwest. He supervises six employees, all of whom are hardworking and dedicated to their jobs.

  Employee turnover and retentionexplain how can a struggling

employee turnover and retentionexplain how can a struggling company retain their employees without losing them? for

  What are the d-functions

What are the D-functions in excel, and how to do nested d-functions?

  What is the cost of new equity to the firm

What is cost of new equity to the firm? What are the advantages and disadvantages of issuing new equity in the capital structure? What are the advantages and disadvantages of using preferred stock in the capital structure?

  American psychological association

The research paper must be in American Psychological Association

  Explanations on the determinants of demand

Give your explanations on the determinants of demand. What happens to the demand curve when any of these determinants change? Distinguish between a change in demand and a change in the quantity demanded, noting the causes of each.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd