acer

32333 Reputation

29 Badges

19 years, 319 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@emendes Controls for the animation (including a slider) are available in the top menubar when you put the (mouse pointer) focus on the animation.

They are also available by right-click upon the animation. The popup menu offers control buttons (but no slider) under the "Animation" submenu -- usually at the bottom of the popup.

FYI, you could also do this, which embeds a Slider along with the plot:

restart;
with(DynamicSystems):
num:=10*(s+alpha);
den:=s*(s^2+4*s+8);
Explore(RootLocusPlot(NewSystem(subs(alpha=a,num/den)),
                      view=[-10..3,-15..15]),
        parameters=[a=1..10.0],animate);

@Yiannis Galidakis If you look to this old Question thread started by yourself in 2015, I wrote a Reply in which I mentioned that there are (in that version at least) some specific issues with complex arithmetic under Compiler:-Compile. Those might be MS-Windows-64bit specific. (I had a vague recollection of this when putting together the code above -- but I did not unroll the complex arithmetic operations in your code, as I don't have a MS-Windows machine with Maple 18 at hand right now, on which to test.)

By the way, in that old Question thread there was quite a bit of discussion about using evalhf, etc, for acceleration. (That included the kind of simple edits in my original Answer above.)

As I mentioned above, there is no "general" Escape fractal command in Maple 18. It only has a few specific flavours, hard-coded as the exported commands of the Fractals:-EscapeTime subpackage.

In Maple 2015 the IterativeMaps package was added, and its Escape command can be used in some related ways. (It's not clear how I could use it for your orbit checking -- except by intoducing/storing as many variables/values per x-y entry as your N the orbit Vector dimension, and then post-processing...)

Here is a simple "exponential map" example (from about Feb 2016) which compares computation via plot3d (4.4 sec, even under evalhf) and IterativeMaps:-Escape (0.24 sec).  expmap4.mw

Here is a more involved example also using IterativeMaps:-Escape (from about Nov 2015) which has some bells&whistles for the coloring and stopping criteria, and an Explore (re-using the image/Array container).  tetration_escape0.mw

By the way, the "images" (float[8] Arrays) produced in this and the previous code can not only be inserted/displayed in a Worksheet (ImageTools:-Embed) but can also be saved to file (ImageTools:-Write).

Lastly, if your session crashes or acts funny while running any of this multi-threaded code, you might want to check your Task Manager to see if any orphaned kernels ("mserver" process) are still running after you quit the GUI.

This has been asked a few times in the past weeks.

Perhaps the main ?plot Help page should get such an example, that clearly states the purpose. It seems basic enough to warrant a clear and readily available example.

(There is a less clear polar plot example buried in the ?plot,details Help page.)

@Yiannis Galidakis I suspect a problem with the Compiler.

This is the same but with the use of the Compiler removed. It's 3+ times faster than what was in my answer on my quad-core, due to the multithreading.

parTet2_nocompile.mw

ps. This was very quick to write, as I just had to make relatively minor adjustments to previous escape fractal code that was set up almost identically.

If you're going to link to this page then I might dig out another worksheet I already had, that used the IterativeMaps:-Escape for a tetration fractal. (There are choices, in how to utilize the computed data for coloring...)

@Yiannis Galidakis The source is present in the Worksheet which I attached in my followup (link at bottom of my Reply), within a Code Edit Region that should be eminently visible when you open the sheet in the Maple GUI.

You can either run the code in that portion via right-click on it, or mark it as auto-execute and allow that to run, or expand it and copy the code to elsewhere in the Worksheet.

I used Maple 18.02, since your attachment was last saved in Maple 18.00.

Here is an attachment with the code simply copied to a regular Execution Group. parTet2.mw

@Yiannis Galidakis So, enabling plot3d to use evalhf to compute TF for each x-y point got the (wall-clock) timing for your original example from 412 sec down to 4 sec on my machine in Maple 18.

Below, by multi-threading and compiling the computational portion, as a direct, looped Array (image) computation, the (wall-clock, real) time decreases further to 0.7 sec for the original example on my quad-core machine in Maple 18. You may see further improvement if you try on an 8-core (but doubtful for an "old" 4-physical core, 8-virtual hyperthreaded...).

(It's possible that by manually unrolling the complex arithmetic into real and imaginary components a little more speed-up could be attained. I'm not sure.)

I included the functionality to have it respect the x-y aspect ratio, in terms of horizontal versus vertical pixel density.

I don't know what parameter value that site's author used, for iteration limits, etc.

restart;

kernelopts(version);

`Maple 18.02, X86 64 LINUX, Oct 20 2014, Build ID 991181`

kernelopts(':-numcpus');

4

source for Tetration module

NN := 400: N := 20: eps := 1e-2: ct := 1e6: maxiter := 100:
(a,b,c,d) := -4.0,4.0,-4.0,4.0:

res := CodeTools:-Usage( Tetration( NN, a, b, c, d, N, maxiter, ct, eps ) );

memory used=1.56MiB, alloc change=7.79MiB, cpu time=2.70s, real time=719.00ms, gc time=0ns

res := Vector(4, {(1) = ` 400 x 400 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

img := Array(1..op([1,1],res),1..op([1,2],res),1..3,1.0,datatype=float[8],order=C_order):
img[..,..,1] := 360*((ImageTools:-FitIntensity(res))):
RGBimg := ImageTools:-HSVtoRGB(img):
ImageTools:-Embed(RGBimg);

 

#PLOT3D(GRID(c..d,a..b,res),
#       SHADING(ZHUE), STYLE(PATCHNOGRID), LIGHTMODEL(NONE), SCALING(CONSTRAINED),
#       ORIENTATION(180., 0., 180.0), AXESLABELS(x, y, iter), AXESSTYLE(BOX)
#       ,ROOT(BOUNDS_X(0), BOUNDS_Y(0), BOUNDS_WIDTH(ceil(1.5*op([1,2],res))),
#             BOUNDS_HEIGHT(ceil(1.5*op([1,1],res))))
#);

#ImageTools:-Preview(RGBimg);

 

NN := 1000; N := 100; eps := 5e-2; ct := 1e6; maxiter := 400;
#(a,b,c,d) := -4.5,3.3,-2.9,2.9;
(a,b,c,d) := -3.5,3.3,-2.9,2.9;

res2 := CodeTools:-Usage( Tetration( NN, a, b, c, d, N, maxiter, ct, eps ) );

NN := 1000

N := 100

eps := 0.5e-1

ct := 1.*10^6

maxiter := 400

a, b, c, d := -3.5, 3.3, -2.9, 2.9

memory used=7.10MiB, alloc change=6.51MiB, cpu time=55.04s, real time=14.34s, gc time=0ns

Matrix(%id = 18446883920994884654)

img := Array(1..op([1,1],res2),1..op([1,2],res2),1..3,1.0,datatype=float[8],order=C_order):
fitres2 := ImageTools:-FitIntensity(res2):
img[..,..,1] := 360*fitres2:
#img[..,..,2] := 1-~(res2):
#img[..,..,3] := (fitres2):
#img[..,..,2] := map[evalhf](x->`if`(x=0.0,0.0,1.0),res2):
img[..,..,3] := map[evalhf](x->`if`(x=0.0,0.0,1.0),res2):
RGBimg := ImageTools:-HSVtoRGB(img):
ImageTools:-Embed(RGBimg);

 

 

``

parTet.mw

note. I have a faster version of HSVtoRGB, if you need it. It's not the bottleneck here.

@AHSAN Here are a few ways. Adjust options to taste.

help2_acc2.mw

@Preben Alsholm Yes, while I mentioned the setting itself I omitted that documented detail. I don't see why students and users new to Maple should be reasonably expected to understand its subtlety, even though they may comprise a significant portion of those include to use the syntax. Perhaps other readers disagree(?).

@Rouben Rostamian  Performing a Help query on the word gamma leads to the Help page for Topic gamma (because that name has various meanings in different contexts).

And that page contains a cross-reference link to the Help page with Topic initialconstants, which mentions that the constant gamma is equivalent to the call gamma(0) (aka Euler's constant, or the Euler-Mascheroni constant) and that gamma(n) is a placeholder for the Stieltjes constants.

Why did you not provide your actual, underlying, motivating question up front?

If you want to feel better about asking for answers to your coursework you could show us (explicitly) what you've been able to accomplish on your own.

@itsme I submit reports on issues I raise myself. But thanks for your interest!

I did not mention the ifactor command because I guessed that he was wanting to use the result (programmatically) for some futher purpose. I might have guessed wrong.

lprint(ifactor(725));
``(5)^2*``(29)

As can be seen, the structure returned by the ifactor command is far more awkward to query and manipulate than is that of the ifactors command. The former is fashioned purely for its display effect, when printed. But perhaps that's all he's aiming for here.

@user-JG 

H:=n->map(op,ifactors(n)[2]):
H(725);
              [5, 2, 29, 1]

H(1125);
               [3, 2, 5, 3]

H(2048);
                 [2, 11]

In modern Maple versions you can save a few keystrokes in the definition of that procedure H by applying op elementwise, rather than using map.

H := n->op~(ifactors(n)[2]):

@greatpet You can set the include path when you start up the Maple interface (GUI or commandline), using the -I option.

Or you can query or set the include path within a Maple session using the kernelopts command (see the item for includepath).

I make the strings in my $include directives be a reference relative to the location of the current file. And I ensure that the include path contains that (parent) location, when I read that file.

Hope that makes sense.

First 155 156 157 158 159 160 161 Last Page 157 of 591