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

julia_plot sometimes does not draw the entire julia set #28557

Closed
DaveWitteMorris opened this issue Oct 5, 2019 · 23 comments
Closed

julia_plot sometimes does not draw the entire julia set #28557

DaveWitteMorris opened this issue Oct 5, 2019 · 23 comments

Comments

@DaveWitteMorris
Copy link
Member

The algorithm for julia_plot (and fast_julia_plot) erroneously assumes that if |z| > 2, then z is not in the Julia set of the function f(z) = z2 + c, because the orbit of z is unbounded under iteration of f(z). (To see that this is not always true, let c = -6. Then z = 3 is a fixed point, so its orbit is obviously not unbounded.) Looking on the bright side, the algorithm does give correct results whenever |c| <= 2 (which includes all points in the Mandelbrot set), so most users will never see a problem.

To fix this, the bound 2 should be replaced with an appropriate bound R that depends on c. By the quadratic formula, the largest (positive) fixed point of the function f*(x) = x2 - |c| is R = (1 + sqrt(1 + 4|c|))/2. It is then easy to see that f*(x) > x for x > R. Then, by the triangle inequality, we have |z2 + c| > |z| whenever |z| > R. So the orbit of z tends to infinity whenever |z| is greater than this value R.

I have uploaded a PR that replaces 2 with this value of R, but I have not done this before, and I apologize if I goofed up anything about this ticket.

Component: dynamics

Keywords: complexdynamics

Author: Dave Morris

Branch/Commit: a5a0408

Reviewer: Markus Wageringel

Issue created by migration from https://trac.sagemath.org/ticket/28557

@DaveWitteMorris
Copy link
Member Author

@DaveWitteMorris

This comment has been minimized.

@DaveWitteMorris
Copy link
Member Author

Commit: f3bff2a

@mwageringel
Copy link

Reviewer: Markus Wageringel

@mwageringel
Copy link

comment:3

Ok, thank you. This change looks correct to me. Just in the documentation of julia_plot, I think you accidentally defined R_c as the square of the intended value. I changed it to \bigl(1 + \sqrt{1 + 4|c|}\bigr)/2 as you explained in the ticket description. Is this correct?

I also rebased and squashed your commits and removed some trailing whitespace. If you agree with my changes, please set this ticket to positive review.


New commits:

9310d7928557: fixed the radius in julia_plot
9adac1728557: fix R_c in documentation and remove whitespace

@mwageringel
Copy link

Changed commit from f3bff2a to 9adac17

@mwageringel
Copy link

Changed branch from u/gh-DaveWitteMorris/fix_julia_radius to u/gh-mwageringel/28557

@DaveWitteMorris
Copy link
Member Author

comment:4

You are right. Thanks for the review, for correcting the docstring, and for fixing my newbie mistakes.

@mwageringel
Copy link

Changed stopgaps from none to none

@mwageringel
Copy link

comment:5

There is a merge conflict with the latest beta.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 14, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

b098431Merge tag '9.0.beta9' into 28557

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 14, 2019

Changed commit from 9adac17 to b098431

@mwageringel
Copy link

comment:7

Since #23740, Sage can now plot julia sets of more general polynomials. I merged in the latest beta, but this branch will only affect the case of polynomials of the form f(z) = z^2 + c. As this is the most common case, this seems acceptable to me.

@DaveWitteMorris: Please check whether this is ok, or change the implementation if possible.

@DaveWitteMorris
Copy link
Member Author

comment:8

Thanks for doing the merge. I'm sorry not to have done anything, but I moved to a different computer last month and have not been able to get git and sagemath working properly yet. Now that the semester is coming to an end, I should have more time and expect to be able to get my installation straightened out enough to work on this ticket later in the week.

@DaveWitteMorris
Copy link
Member Author

comment:9

I fixed two minor pyflakes complaints in mandel_julia.py. (DynamicalSystem was imported twice, and QQ was imported but never used.) I am happy with the state of this patch, and I recommend a positive review if the patchbots are green.

However, I also think that julia_plot needs further work, as explained in the new metaticket #28923 (which tracks this ticket).

@mwageringel : Thanks again for your help with this ticket.

@DaveWitteMorris
Copy link
Member Author

Changed branch from u/gh-mwageringel/28557 to u/gh-DaveWitteMorris/28557

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 30, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

a5a0408fix pyflakes failures

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 30, 2019

Changed commit from b098431 to a5a0408

@mwageringel
Copy link

comment:12

Thanks for the updates.

@DaveWitteMorris

This comment has been minimized.

@mwageringel

This comment has been minimized.

@mwageringel
Copy link

comment:14

Replying to @DaveWitteMorris:

This branch was merged into #28772 (to deal with a merge conflict). My intention was for this ticket to be merged first, and then #28772. On the other hand, if #28772 is merged first, then I think this ticket would be redundant, so it could be closed without being merged.

No problem, as this ticket is now a dependency of #28772, so this one gets merged first. It is still useful to merge this ticket individually, as it makes for a cleaner history which makes it easier to figure out where a change is coming from, later on. Try for example git log --first-parent --oneline develop.

@vbraun
Copy link
Member

vbraun commented Jan 5, 2020

Changed branch from u/gh-DaveWitteMorris/28557 to a5a0408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants