Question: Help with Mandelbrot set!! ... Question: Some help editing this code for Mandelbrot Set!! W... Bookmark Edit question Some help editing this code for Mandelbrot

Help with Mandelbrot set!! ...

Question: Some help editing this code for Mandelbrot Set!! W...

Bookmark

Edit question

Some help editing this code for Mandelbrot Set!! When I run it right now, it is only printing ###### when it should be printing 1s and 0s. I have the functions mandelbrot.h and mandelbrot.c and these functions work correcly.

The requirments:

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 that |mandelbrot(15)| is smaller than 10000, we print a '1' or '#'; otherwise, we print a '0' 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 in a rectangular area. 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. You can google images on Mandelbrot, and see the Mandelbrot set images with very fine points at the screen resolution with vivid colors.

It also should ask the user to put in a number,n

My code:

#include #include "complex.h" #include "mandelbrot.h"

int main (void)

{ complex_t c; for (c.imag = -2.0; c.imag < -1.12; c.imag+=0.06175) { for (c.real = 0.47; c.real < 1.12; c.real+=0.077) { if (abs_complex(mandelbrot(15,c)).real > 10000) { printf("1"); } else { printf("#"); } } printf(" "); } return (0); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!