Items tagged with compiler compiler Tagged Items Feed

Lyapunov fractals...

February 03 2013 acer 9686 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);

 

 

Download lyapfractpost.mw

Does maple 16  work with Visual studio 2012?

I installed M16 32 Bit on my new machine with Win7 64 Bit.

But the following results in crushing mserver.exe:

  tmp := proc( x :: float ) :: float; 2.3 * x end proc:
  cp:=Compiler:-Compile(tmp);

with system info below.

Do I have to set certain rights for the compiler or define a specific working directory?

The FAQ http://www.maplesoft.com/support/faqs/results.aspx?search=compiler does not help me.

Dito http://www.maplesoft...

I have a compiled function and want to integrate it numerically.  The integration procedure first tries to evaluate the integrand with symbolic values and return a error, since the compiled function accepts only real values.  So I have to write a STUPID workaround  for manual typechecking:

integrand2 := proc (kF1, kF2, m, k, omega, q) if type(kF1, numeric) and type(q, numeric) and type(kF2, numeric) and type(omega, numeric) and type(m, numeric) and type(k, numeric...

Using techniques previously used for generating color images of logistic maps and complex argument, attached is a first draft of a new Mandelbrot set fractal image applet.

A key motive behind this is the need for a faster fractal generator than is currently available on the Application Center as the older Fractal Fun! and Mandelbrot Mania with Maple entries. Those older apps warn against being run with too high a resolution for the final image, as it would take too long. In fact, even at a modest size such as 800x800 the plain black and white images can take up to 40 seconds to generate on a fast Intel i7 machine when running those older applications.

The attached worksheet can produce the basic 800x800 black and white image in approximately 0.5 seconds on the same machine. I used 64bit Maple 15.01 on Windows 7 for the timings. The attached implementration uses the Maple Compiler to attain that speed, but should fall back to Maple's quick evalhf mode in the case that the Compiler is not properly configured or enabled.

The other main difference is that this new version is more interactive: using sliders and other Components. It also inlines the image directly (using a Label), instead of as a (slow and resource intensive) density plot.

Run the Code Edit region, to begin. Make sure your GUI window is shown large enough for you to see the sides of the GUI Table conveniently.

The update image appearing in the worksheet is stored in a file, the name of which is currently set to whatever the following evaluates to in your Maple,

cat(kernelopts('homedir'),"/mandelbrot.jpg"):

You can copy the current image file aside in your OS while experimenting with the applet, if you want to save it at any step. See the start of the Code Edit region, to change this filename setting.

Here's the attachment. Comments are welcome, as I'd like to make corrections before submitting to the Application Center. Some examples of images (reduced in size for inclusion here) created with the applet are below.

doesnt compiled...

November 21 2011 icegood 265

ggg:=(y,a,b)->
(2*(-a+6*y^2*a^2+2*b*y^2*a^2+9*b*y^3*a+3*b*y^2*a+b*y^6*a^2+4*b*y^5*a^2+5*b*y^4*a^2+2*b*y^5*a+8*b*y^4*a+3*b*y^3*a^2+4*b*y^2-y^3*a-3*y^2*a+y^6*a^3+5*y^5*a^3+8*y^4*a^3+4*y^3*a^3+y^5*a^2+5*y^4*a^2+9*y^3*a^2+b*y^4+4*b*y^3+y*a^2+2*a*b*y+y^3*a*(y+1)^(-2*b)+a*(y+1)^(-2*b)+3*y^2*a*(y+1)^(-2*b)+3*y*a*(y+1)^(-2*b)-2*y^2*a^2*(y+1)^(-2*b)-y*a^2*(y+1)^(-2*b)-3*y*a-y^3*a^2*(y+1)^(-2*b))/(y^2*(a+b)*(y+1)*(y+2)^2*(y*a+1)^2)+(-2-y^2+2*y^2*a^2-2*y+4*b*y^3*a+8*b*y^2*a+2*b*y^4*a^2+4*b*y^3*a^2...

I just downloaded Maple 15 and am trying to install on a 64-bit Windows 7 machine.

 

About halfway through the installation, there is a step where you are either supposed to supply the path to a batch file that will supply the environment variables that will locate Microsoft Visual C compiler, or supply them later as an option. The instructions say that Maple has a default batch file that will do this, but when that option is chosen, nothing shows up in...

Dear Maple lovers,

As a classical worksheet user from the past years, now I'd like to be a "modern" Maple user, using the 2D Input in the modern worksheet mode (I will call it mwm from now on). But, alas, I cannot even solve a simple equation!

To describe my situation let me state the following:

1. I use 64 bit Maple 14 Student Edition (single user) under 64 bit Windows 7.

2....

There are two pieces of extended functionality that I quite often want from the Maple Compiler. The first (task A) is to be able to link in and use an arbitrary function from some other external ("3rd party") shared library, within my Compile'd Maple procedure. The second (task B) is to directly call the compiled Maple procedure from within some computational routine in a 3rd party shared library (which I would then access using define_external). This post is about the first of those, task A.

Page 1 of 1