## Fun with the Maple Leaf – Celebrate Canada 150!

by: Maple 2017

This Saturday is Canada’s 150th birthday. As you can imagine, the country has been paying a lot more attention to this year’s anniversary than our usual low key approach, and as a Canadian company, we at Maplesoft decided to join in the fun.

And what better way for Maplesoft to celebrate Canada’s birthday than to create a maple leaf in Maple!

So here is a maple leaf inspired by the Canada 150 logo, which was created by Ariana Cuvin, a student at the University of Waterloo and former co-op here at Maplesoft:

Here’s the code to reproduce this plot (more details can be found in this follow up post):

p:=thickness=5,color="#DC2828":
plots:-display(

plot([[-.216,-.216],[0,0],[-.216,.216],[-.81,0],[-.216,-.216]],p),
plot([[-.55,.095],[-.733,.236],[-.49,.245]],p),
plot([[-.376,0],[0,0],[0,.376],[-.705,.705],[-.376,0]],p),
plot([[-.342,.536],[-.355,.859],[-.138,.622]],p),
plot([[-.267,.267],[0,0],[.267,.267],[0,1],[-.267,.267]],p),
plot([[.342,.536],[.355,.859],[.138,.622]],p),
plot([[0.,.376],[0,0],[.376,0],[.705,.705],[0.,.376]],p),
plot([[.55,.095],[.733,.236],[.49,.245]],p),
plot([[.216,.216],[0,0],[.216,-.216],[.81,0],[.216,.216]],p),
plot([[0,-.5],[0,0]],p),

scaling=constrained,view=[-1..1,-.75..1.25],axes=box);

Know other ways to plot a maple leaf in Maple?  If so, please share them below - we’d love to see them!

## Tetrational code viewer vs 1.0.1

Maple MaplePrimes

Hi everyone,

at the suggestion of Carl I am making my question a post.

History:

Newbies often get fascinated with the power tower: x^x^x^...

The generalized power tower z^z^z^... is a special case of the Euler sequence:

z_{n+1}=c^z_n, for c\in C.

Like the Mandelbrot set: z_{n+1}=z^2-c, the power tower, often called infinite exponential, also has a general periodic map. It is included below and is taken from Daniel Geisler's site:
www.tetration.org

Shel and Thron proved that the infinite exponential conveges whenever c belongs to the red region, called today Shell-Thron region.

Definition of Julia Sets for the iterated exponential map:

Also like the Mandelbrot set, the infinite exponential admits Juila Sets. The Julia Sets of the infinite exponential however, are defined differently from the Julia Sets of the Mandelbrot set. They are defined to be  the closure of the periodic repellers of the Euler sequence . They are Cantor Bouquets.  Geisler's colored map then is a general map of how the corresponding Julia set behaves roughly, with c taken from the map.

We can then introduce small cuts which go from the interior of the Shell-Thron region to the exterior, crossing at various angles, and this will tells us how the infinite exponential evolves. Generally speaking, each time one crosses the Shell-Thron boundary, one wittnesses what's called a Knaster explosion, wherein the exponential explodes into p subregions, where p is the pre-period of the multiplier.

When the parameter c exits the Shell-Thron region at angles of 2*Pi and Pi from the real axis (cuts right and left, p=1, 2), the infinite exponential either transitions from converging to a single feature to exploding into multiple indecomposable contiua (p=1), or it breaks into a period 2 bifurcation (p=2), which itself, also may explode into continua.

When it exits at angles 2*Pi/p, where p>2 is the preperiod of the multiplier, then the infinite exponential evolves from converging to a single feature, to exploding into  p major regions, called Fatou regions, each one having its own attractor, displaying a p-furcation.

In all cases,  the Knaster explosions may introduce the presence of indecomposable continua, as some Fatou regions end up covering entire parts of the complex plane after each transition. In the animations, Knaster explosions occur whenever the background is red. There may be more than one explosion present in the evolution of the power tower.

Cantor Bouquets are strange creatures. They are essentially quantum sets, and no point of them is actually visible. The probability a point is visible varies directly with the area of the corresponding bouquet "finger" which is rendered in the area of interest. Devaney uses these "fingers"  to obtain "iteneraries" of the iterated exponential map.

Points "close"  to the fingers-hairs o the Cantor Bouquets escape towards complex infinity at (final) angles 2*Pi/p.

The "hairs" of a Cantor Bouquet are C^\infty curves, hence they can be termed easthetically pretty. Only hairs from the main Cantor bouquet for c=e^{1/e} are globally convex/concave. Every other bouquet may contain hairs which change curvature "unpredictably".

Inlcuded files:

1) Euler.mw

Code for static fractal with given parameters in 1). Parameters can be changed in the constant section (Try p=2,4 or Pi)

Code for morphing animations through cuts in the Shell-Thron region in 2). Parameters d1-d2, N

Code for zooming animations in 3). Parameters M, M1-M2,

Limitations:

Will show attractors of broken Fatou basins only up to pre-period p=5. No big deal though. If you want to increase the preperiod past p=5, you need to add the relavnt tests in procedure ppc(c), otherwise the new attractors are not calculated and the plot ends up red.

Colors are assigned a bit more dispersed, using ln(m). You can also use m in that place. It depends on which area you are in.

Basins of attraction and Fatou regions change appearance under different epsilons. If you want different shapes for the basins, you can try using the Manhattan metric in proc Jhf, instead of |z-lim|.

Included below are the main map of tetration by Daniel Geisler, a short excerpt of the Shell-Thron region which shows pre-periodic cuts and  6 morhing transitions, for p\in {1,2,3,4,5} and one which exits at the angle of 2 radians (p=Pi).

References:

More than 300. To be published with my thesis. Patches, problems and code corrections in the original question page:

http://www.mapleprimes.com/questions/203593-Maple-13-Fast-Maple-18-Crawling

## Super-easy Collatz snowman fractal

by:

It is a relatively recent innovation that complex-number computations can be done in the evalhf environment. When combined with plots:-densityplot, this makes escape-time fractals in the complex domain very easy to plot. This fractal is based on the Collatz problem. This Wikipedia article has a high-resolution picture of this fractal. I've switched the real and imaginary axes and reversed the direction of the real axis purely for asthetic reasons.

 Collatz:= proc(b,a)  #Axes switched local z:= -a+b*I, k;  #real part negated      for k to 31 while abs(Im(z)) < 1 do           z:= (1+4*z-(1+2*z)*cos(Pi*z))/4      end do;      k #escape time end proc: #Test evalhf'ability: evalhf(Collatz(0,1)); plotsetup(      jpeg, plotoutput= "C:/Users/Carl/desktop/Collatz.jpg",      plotoptions="height= 1024, width= 1024, quality= 95" );   CodeTools:-Usage(      plots:-densityplot(           Collatz,           -1..1, # imaginary range           -0.5..4.5, #negative of real range           colorstyle= HUE, grid= [1024, 1024], style= patchnogrid,           labels= [Im,-Re], labelfont= [TIMES, BOLD, 14],          axes= boxed,           caption= cat("      Happy New Year ",                                   StringTools:-FormatTime("%Y")),           captionfont= [HELVETICA, BOLDOBLIQUE, 18]      ) ); memory used=24.08MiB, alloc change=24.00MiB, cpu time=7.78s, real time=7.79s

## Lyapunov fractals

by: Maple 16

The following (downsized) images of Lyapunov fractals were each generated in a few seconds, in Maple 16.

I may make an interface for this with embedded components, or submit it in some form on the Application Center. But I thought that I'd share this version here first.

I'm just re-using the techniques in the code behind an earlier Post on Mandelbrot and Julia fractals. But I've only used one simple coloring scheme here, so far. I'll probably try the so-called burning ship escape-time fractal next.

Here below is the contents of the worksheet attached at the end of this Post.

The procedures are defined in the Startup code region of this worksheet.

It should run in Maple 15 and 16, but may not work in earlier versions since it relies on a properly functioning Threads:-Task.

The procedure Lyapunov can be called as

Lyapunov(W, xa, xb, ya, yb, xresolution)

Lyapunov(W, xa, xb, ya, yb, xresolution, numterms=N)

where those parameters are,

- W, a Vector or list whose entries should be only 0 or 1

- xa, the leftmost x-point (a float, usually greater than 2.0)

- xb, the rightmost x-point (a float, usually less than or equal to 4.0)

- ya, the lowest y-point (a float, usually greater than 2.0)

- yb, the highest y-point (a float, usually less than or equal to 4.0)

- xresolution, the width in pixels of the returned image (Array)

- numterms=N, (optional) where positive integer N is the number of terms added for the approx. Lyapunov exponent

The speed of calculation depends on whether the Compiler  is functional and how many cores are detected. On a 4-core Intel i7 under Windows 7 the first example below had approximately the following performce in 64bit Maple 16.

 Compiled evalhf serial (1 core) 20 seconds 240 seconds parallel (4 cores) 5 seconds 60 seconds

 > with(ImageTools):
 > W:=[0,0,1,0,1]: res1:=CodeTools:-Usage( Lyapunov(W, 2.01, 4.0, 2.01, 4.0, 500) ):

memory used=46.36MiB, alloc change=65.73MiB, cpu time=33.87s, real time=5.17s

 > View(res1);
 > W:=[1,1,1,1,1,1,0,0,0,0,0,0]: res2:=CodeTools:-Usage( Lyapunov(W, 2.5, 3.4, 3.4, 4.0, 500) ):

memory used=30.94MiB, alloc change=0 bytes, cpu time=21.32s, real time=3.54s

 > View(res2);
 > W:=[1,0,1,0,1,1,0,1]: res3:=CodeTools:-Usage( Lyapunov(W, 2.1, 3.7, 3.1, 4.0, 500) ):

memory used=26.18MiB, alloc change=15.09MiB, cpu time=18.44s, real time=2.95s

 > View(res3);
 > W:=[0,1]: res4:=CodeTools:-Usage( Lyapunov(W, 2.01, 4.0, 2.01, 4.0, 500) ):

memory used=46.25MiB, alloc change=15.09MiB, cpu time=33.52s, real time=5.18s

 > View(res4);
 >

## An easy snowflake fractal curve

by: Maple

restart;
a:= 2.75:  b:= 7.:  N:= 2^4: