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

Unexpected and idiosyncratic failures to converge #1

Open
RoyWiggins opened this issue Mar 17, 2019 · 5 comments
Open

Unexpected and idiosyncratic failures to converge #1

RoyWiggins opened this issue Mar 17, 2019 · 5 comments

Comments

@RoyWiggins
Copy link
Contributor

RoyWiggins commented Mar 17, 2019

I have been using this code to map the interior of the Koch snowflake. This is my most successful, but the algorithm seems to fail on very similar polygons.

image

If I make my snowflake slightly spikier, it just fails entirely:

image

And if I iterate the snowflake one more time, it pretty much always fails.

This is not, I believe, a fundamental problem with the Zipper algorithm, as I was able to render a higher iteration snowflake using the FORTRAN implementation that Marshall has provided. It's a lot harder to work with his implementation though, so I had hoped that I'd be able to use it in Julia instead.

anim39

I don't suppose you have any ideas what might be going wrong?

@RoyWiggins
Copy link
Contributor Author

a test case using my fork that works in julia 1.0

sswatson pushed a commit that referenced this issue Mar 18, 2019
@sswatson
Copy link
Owner

Thanks for working to convert this package to Julia 1.0.

You'll find that you can get your example to work with k = 0.9 if you use BigFloats instead of Float64s. Of course, this is much slower, but depending on your situation, you might find the speed acceptable.

Given that the Fortran code does not have this problem, I suspect that I'm using an unstable arithmetic operation somewhere (like subtracting two very close numbers). If I figure it out, I will follow up on this thread.

@RoyWiggins
Copy link
Contributor Author

RoyWiggins commented Mar 18, 2019

My update for Julia 1.0 seemed to work- I just took the automatic updates suggested by Julia's upgrade-bot. I'm very new to Julia so my understanding of how Julia deals with modules/packaging is rudimentary.

BigFloat does indeed work great. We'll see how the speed goes... I'm hoping to calculate the map to the circle to a high resolution so I can paint things onto the circle and color the snowflake with it. Depending on exactly how long that ends up taking, it could well be just fine, since once it's calculated for a given resolution I won't need to do it again.

@RoyWiggins
Copy link
Contributor Author

I ended up finding a test case. This triangle works:

vertices = [
    -.5  -1;
    1  -1;
    -.5  1.; 
]
f = ConformalMap(vertices,-.25)
visualize(f)

image

And this one explodes:

vertices = [
     1  -1;
     -.5  1.; 
     -.5  -1;
]
f = ConformalMap(vertices,-.25)
visualize(f)

image

They're exactly the same triangle, but with the vertices rotated around.

@copyrite
Copy link

Hi,
First of all I've been working on a MATLAB implementation of Zipper and @sswatson's ConformalMaps has been very helpful to study. I happened to test my implementation on various Koch snowflakes, and on fourth generation or so the forward map started to fail on certain configurations. The slit algorithm exhibits similar problems. So it's probably not (just) the algorithm.

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

No branches or pull requests

3 participants