Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Y-axis is inverted #1545

Closed
jesper-olsen opened this issue Dec 22, 2023 · 1 comment
Closed

Y-axis is inverted #1545

jesper-olsen opened this issue Dec 22, 2023 · 1 comment
Labels
mojo-repo Tag all issues with this label

Comments

@jesper-olsen
Copy link

jesper-olsen commented Dec 22, 2023

The y-axis is inverted in the mandelbrot plot on this page

https://docs.modular.com/mojo/notebooks/Mandelbrot.html

because the plot is centered on 0,0 and mandelbrot is symmetric around the x-axis, this inversion is not obvious in the plot. But it is obvious if y_max,y_min is not not centered on 0 ...

Here is a fix - update compute_mandelbrot() - like this:

fn compute_mandelbrot() -> Tensor[float_type]:
    # create a matrix. Each element of the matrix corresponds to a pixel
    var t = Tensor[float_type](height, width)

    let dx = (max_x - min_x) / width
    let dy = (max_y - min_y) / height

    #y = min_y
    var y = max_y
    for row in range(height):
        var x = min_x
        for col in range(width):
            t[Index(row, col)] = mandelbrot_kernel(ComplexFloat64(x, y))
            x += dx
        y -= dy
        #y += dy
    return t
@jesper-olsen
Copy link
Author

Also see
#1471

@ematejska ematejska added the mojo-repo Tag all issues with this label label Apr 29, 2024
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

2 participants