acer

32343 Reputation

29 Badges

19 years, 327 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

If you have followup or closely releated queries (possibly because you didn't understand some answer) then please add it as a Reply here, instead of posting a separate Question thread.

Please don't post a duplicate of this query. Duplicate Question threads will get flagged as such and may be deleted.

@mmcdara Your code and commentary for Question 2 seem to indicate that you consider,
   diff(f(x), x) = diff(g(x), x)
to be sufficient for both f and g to attain an extreme point. But that's not true, as that equation doesn't imply that either derivative is zero.

Also, I wonder whether there may have been a transcription or translation error by the OP. If the formulas are right (aside from implicit multiplication) then perhaps the actual question (in Dutch?) is something like: for what value of p do both f and g attain a minimum at the same x value? If so, then...

f := x^2-6*x+p+3:
g := (4*x^2)-(p-8)*x+7:
sol := solve({diff(f,x),diff(g,x)});

       {p = 32, x = 3}

eval([diff(f,x), diff(g,x)], sol);

            [0, 0]

eval([diff(f,x,x), diff(g,x,x)], sol);

            [2, 8]

Your request is missing some important details.

Could your inert expressions contain noninert (but unevaluated) function calls?

What exactly do you mean by "one reduction of inert operations"? Does that entail evaluation? (Presuambly you know about automatic simplification.)

What should happen when multiple operands (at the same call level) are inert calls? Should they be dealt with one step at a time, or together as a single "reduction" step?

Do you want the reductions done first by depth, or by order of operands? 

What is the set of possible inert calls? Is it just arithmetic operators, or can there also be calls to %fsolve, etc.

Do you expect to handle expressions that contain rtables (eg. Matrix, Array) or series, for which the entries do not correspond to individual operands. Ie. structures for which the op command is not going to walk entries.

Better would be to provide an example that contains the most involved kinds of things you want handled, as opposed to the most trivial.

@tomleslie The default for implicitplot is find values where the sign changes, specified by its signchange=true (default) option.

If you supply the option as signchange=false then the result of the above example is an empty plot.

From the Help page,

   The option signchange = true/false (default true), when set to true,
    implicitly plots sign changes of the function. This includes, for
    example, the line y=0 for the input x/y. If this is not desired, and
    only the zeros of the input function are of interest, then signchange
    should be set to false.

Thankfully the OP has since provided his actual example, in which the signchange (and rational) option does not figure prominently. So mmcdara's example is a tangent discussion.

@abdulganiy You are calling implicitplot for first argument M (which implies M=0), and you are calling contourplot on first argument M with option contours=[1] (which implies M=1).

So which are you trying to plot, M=0 or M=1?

ps. I'd marked your Question as Maple 2016, as that is the version in which your attachment was last saved.

@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.

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