acer

32328 Reputation

29 Badges

19 years, 318 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@mmcdara For your example implicitplot could be passed the rational=true option.

plots:-implicitplot( 1/sin(x*y),
                       x = -Pi..Pi,
                       y = -Pi..Pi,
                       color=blue,
                       gridlines=false,
                       axes=boxed,
                       rational=true,
                       gridrefine=4  # or higher
                     );

And one way of considering the difference between contourplot and implicitplot is that the latter accepts several additional options (which control its different and more generally sophisticated approach to the computation).

There is a way to get contourplot to use implicitplot to do its work, by passing it the (undocumented) method=alternate option. But I don't know that all the various additional implicitplot options might be easily passed along. So this is not so generally useful. Eg,

plots:-contourplot( 1/sin(x*y),
                      x = -Pi..Pi,
                      y = -Pi..Pi,
                      contours=[0],
                      color=blue,
                      gridlines=false,
                      axes=boxed,
                      method=alternate
                    );

Yet another approach is to use plots:-inequal (though it may be inefficient, with duplicated computations, or more). This may utilize implicitplot for some computation, and its options may be passed along, as is documented. I only mention this because it's on-topic; equations are better directly passed to implicitplot itself, and attempting to pass only the equation 1/sin(x*y)=0 to inequal results in an error message to that effect.

plots:-inequal( [1/sin(x*y)<=0, 1/sin(x*y)>=0],
                       x = -Pi..Pi,
                       y = -Pi..Pi,
                       optionsclosed=[color=blue],
                       gridlines=false,
                       axes=boxed,
                       optionsimplicit=[gridrefine=4]
                     );

 

@lekcha There are somewhat simpler ways to do the following, ie. you could simply construct monochromatic images from the color list/Matrix and concatenate them all together, using ImageTools & ColorTools. It might be tricky to make that very fast, if the dimensions of Matrix m get large.

I'll reuse the earlier approach, at least for now.

If the dimensions of Matrix m get large then I'd recommend keeping it as an Image and using ImageTools:-Embed, instead of using it as background in a plot.

restart;

kernelopts(version);

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

m := Matrix([[1, 2, 3], [4, 5, 6]]):

cm := ["aquamarine","blue","brown",

       "coral","cyan","black"]:

A := ImageTools:-Scale(Array(m, datatype=float[8]),
                       2, method=nearest):

P := plots:-surfdata(A, style=surface, dimension=2,

                     colorscheme=["zgradient", cm]):

img := ImageTools:-Scale(op([2],indets(P,specfunc(COLOR))[1]),
                         1..400, method=nearest):

ImageTools:-Embed(img):

plot([], background=img, axes=none);

 

``

heat_img_Maple18.mw

The initial scaling of m by a factor of 2 is only there to avoid surfdata getting confused by the special case of dimension 2x3 which by default would get interpreted as sparse data. An alternative is to specify the data for surfdata as regular, ie. not sparse format:

m := Matrix([[1, 2, 3], [4, 5, 6]]):
cm := ["aquamarine","blue","brown",
       "coral","cyan","black"]:
A := Array(m, datatype=float[8]):
P := plots:-surfdata(A, style=surface, dimension=2, source=regular,
                     colorscheme=["zgradient", cm]):
img := ImageTools:-Scale(op([2],indets(P,specfunc(COLOR))[1]),
                         1..400, method=nearest):
ImageTools:-Embed(img):

@lekcha Twice I asked you to state exactly what you wanted,  and twice you stated that I'd already shown what you wanted. Perhaps you only meant the custom-coloring aspect.

And now you are asking about a different kind of result, "number of convergence cycles", instead of the (present) escape-time. That's fine, but you should ask it in a new and separate Question thread.

Be sure to explain precisely what you mean by number of convergence cycles. Give an example of a particular complex scalar starting value, and show what output number you expect (...and why).

@lekcha Here is something, done in Maple 18.02.

The constructed image is assigned to img, and can be embedded directly. Or it can be used as the background in a plot with axes, optionally adding symbols at the polynomial's roots.

restart;

kernelopts(version);

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

bl, ur := -6 - 6*I, 6 + 6*I:

f := t^3 - t^2 - 12;

t^3-t^2-12

rts := [fsolve(f, t, complex)]:
rts := evalf[4](rts);;

[-.8379-1.945*I, -.8379+1.945*I, 2.676]

temp := Fractals:-EscapeTime:-Newton(400, bl, ur, f, output=layer1):

cm := ["aquamarine","blue","brown",

       "coral","cyan","black"]:

P := plots:-surfdata(temp, -6..6, -6..6, style=surface, dimension=2,
                     colorscheme=["zgradient", cm]):

img := op([2],indets(P,specfunc(COLOR))[1]):

 

We can embed the image.

 

ImageTools:-Embed(img);

plot([],
     style=point,symbol=diagonalcross,color=red,symbolsize=15,
     background=img,view=[-6..6, -6..6]);

 

With additional red cross symbols at the roots.

 

plot(map(p->[Re,Im](p),rts),
     style=point,symbol=diagonalcross,color=red,symbolsize=15,
     background=img,view=[-6..6, -6..6]);

``

newt_fractal_colorscheme_Maple18.mw

The steps to generate the image should also work in later versions (although in point-release 2021.1 the further use of background images placed into 2D plots has a regression bug related to positioning -- ie. offset&axes).

What's different here is that I used surfdata and a colorscheme (and ripped out the result's color Array) instead of HeatMap, in order to force your custom coloring.

@mmcdara One reason this is "simple" is that it relies on your knowing that the expression contains exactly two function calls, both trig, with mathematically equivalent operands.

@JAMET Since your libname is just a single location then your use of  libname[1]  looks wrong.

If you accept the idea of using your Maple installation's own lib folder, then try,
   cat(kernelopts(':-mapledir'),"/lib/Filters.mla")
or,
   cat([libname][1],"/Filters.mla")
instead.

Or hard code it without using cat at all.

 

@lekcha I've altered your Question, to mark it as Product: Maple 18.

I'll wait for you to properly explain, in adequate detail, what exactly you want to accomplish.

@Sauberschrauber If you know the identity of some particular Code-Edit Region then you can toggle it between visible and non-visible with commands. Eg,

DocumentTools:-SetProperty("CodeEditRegion1", visible, true);

DocumentTools:-SetProperty("CodeEditRegion1", visible, false)

That was the point of my original Answer above.

If you don't know the identity of the various Code-Edit Regions then you can discover them programmatically (within Maple) using the code in my followup comment.

Of course you could also use the right-click context-menu Component Properties to discover the identity of each, individually, but that's a manual act and not programmatic. Naturally you cannot do that unless the component is currently visible.

@MapleUser2017 It is possible that the extra package rebinds the plot command (name), which then tries to utilize the Compile command but does not adequately guard against the case that the user's machine does not have gcc installed.

I am not aware of the external compiler being accessed by the stock version of the plot command, whether dealing with its single or multiple expression calling sequences. But it may be used by some extra package that redefines/rebinds the plot command name, and it's possible that such a redefinition might be the source of the problem.

It might help if you could tell us the same and source of the extra Maple package which your students are using.

@MapleUser2017 I suggest trying it without that additional package "similar to Gym" installed.

It helps to narrow down the conditions-to-reproduce as far as possible. Thanks.

Can you provide an example of f,g,h for which this occurs?

What is the OSX version?

Does it happen if libname is not augemted by the user, and if no initialization file is used?

Are there extra packages (eg. Gym) loaded of in libname?

@tomleslie Your latter workaround can also be adapted for plot3d with style=point, which allows for multiple, differing symbols and symbolsizes. Eg,

restart;
with(geom3d):
point(A, [1, 2, 3]):
point(B, [-2, 3, -1]):
point(C, [0,-3, 1]):
plot3d( [ coordinates(A),
          coordinates(B), coordinates(C)
        ], style=point,
           color=[red, blue, green],
           symbolsize=[34,24,30],
           symbol=[soliddiamond,solidsphere,asterisk],
           axes=none
       );

@greatpet That is the same issue as in my example: a module export declaration following an assignment statement.

And your workaround is the same approach as in one (of the pair) that I gave.

@Oktopus If one of the alternatives that I suggested does not work for you then perhaps it's because you are using an older version. If that's so then you ought to provide us with the details.

Even better would be if you uploaded and attached an actual worksheet that showed exactly what you have done.

If the desired tickmarks are to be spaced evenly then a terser solution (in Maple 2020.1 at least), is something like:

   plot(x, x = 0 .. Pi/2, xtickmarks=spacing(Pi/10));

First 124 125 126 127 128 129 130 Last Page 126 of 591