acer

23454 Reputation

29 Badges

15 years, 359 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@jrive Let me know if you'd prefer seeing 6e-10 formatted as 600e-12 rather than 0.6e-9, etc.

I chose different normalized ranges for the cases of positive versus negative exponents of 10, which may be nonstandard but is a preference of my own purposes. That is mostly because I wrote that code long ago, for myself. It could be adjusted.

ps. The ability to strip trailing zeroes (which may or may not be desired here) can be useful on its own, though I didn't make it as export of the module.

@mmcdara I think that you forgot to call your EngForm on ftest for processing the legend value. You left it as EN(ftest).

Also, I am seeing some problem cases in your implementation, seen as follows using an unedited copy of your (original) code:

restart;

EngForm := proc(x)
  local n, L, p, r, m, e, f:
  if abs(x) < 10^4 and abs(x) > 1 then
    cat(`#mo("`, x, `")`)
  elif abs(x) > 10^4 then
    n := length(op(1, x));
    L := log[10](abs(x));
    p := floor(L);
    r := irem(p, 3);
    m := 10^(L-p+r);
    m := evalf[n](m);
    e := p-r;
    cat(`#mrow(mo("`, m, `"),mo("&#xd7;"),msup(mo("10"),mo("`, e, `")))`)
  elif abs(x) < 1 then
    n := length(op(1, x));
    L := -ceil(log[10](abs(x)));
    r := 3-irem(L, 3);
    p := L+r;
    m := x*10^(p);
    e := -p;
    f := max(r, n);
    m := nprintf(cat("%", r, ".", f-r, "f"), m);
    cat(`#mrow(mo("`, m, `"),mo("&#xd7;"),msup(mo("10"),mo("`, e, `")))`);
  end if;
end proc:

EngForm(1e3); # shows exponent 4

`#mo(".1e4")`

EngForm(1e4); # returns NULL

EngForm(10000.0); # returns NULL

EngForm(1.0); # returns NULL

EngForm(-31000.0); # drops minus sign

`#mrow(mo("31.0000"),mo("&#xd7;"),msup(mo("10"),mo("3")))`

Download EngineerNotation_ac.mw

@vicky2811 You may have uploaded it, but (as I cautioned) you also have to attach it after uploading.

After you upload the file then (inside the same popup menu) there will appear buttons that allow you to insert either a link to the attachment (URL) or an inlined display of the file along with a link.

You'd know you'd succeeded if you saw a blue hyperlink to the attachment, in your message.

Use the green up-arrow in the Mapleprimes editor to upload (and attach!) your Document here.

Nobody should have to retype your equations based on a screenshot.

@jeffreyrdavis75 Thanks for clarifying what you wanted.

restart;

f := x -> x^3 + 3^x:

plots:-densityplot(1, a=-17..23, b=-36..36,
                   grid=[401,401], style=surface,
                   colorscheme=["xyzcoloring",
                                [(x,y,z)->`if`(Im(f(x+y*I))>0,0.0,1.0),
                                 (x,y,z)->`if`(Re(f(x+y*I))<17 and Im(f(x+y*I))<0,1.0,0.0),
                                 (x,y,z)->`if`(Re(f(x+y*I))>17,0.0,1.0)]],
                   labels=["",""], size=[700,400], axes=boxed):

cplx_xyzcoloring.mw

Since f gets called several times with the same values then it could be more efficient as, say,
    f:=proc(x) option remember,system; x^3+3^x; end proc
though the above example wasn't terribly slow. I didn't bother.

If you really like the subdued colors in one of your question's images then something close can be obtained with minor adjustment to options and the color scheme functions.

f := x -> x^3 + 3^x:
plots:-densityplot(1, a=-17..21.5, b=-36..36,
                   grid=[615,600], style=surface,
                   colorscheme=["xyzcoloring",
                                [(x,y,z)->`if`(Im(f(x+y*I))>0,0.5,1.0),
                                 (x,y,z)->`if`(Re(f(x+y*I))<17 and Im(f(x+y*I))<0,1.0,0.5),
                                 (x,y,z)->`if`(Re(f(x+y*I))>17,0.5,1.0)]],
                   labels=["",""], size=[615,300],
                   axes=normal, axesfont=["Helvetica",8], xtickmarks=spacing(5));

Upload and attach your Maple Document, so that we might see what it actually contains.

@The function Your second function  (-2)^x  is complex-valued.

Ie,

(-2)^1.35;
        -1.157276832 - 2.271283669 I

Re((-2)^1.35);
              -1.157276832

Im((-2)^1.35);
              -2.271283669

In the first plot above the two separate curves represent its real and imaginary components, respectively, versus the independent parameter.

The second plot is by the complexplot command. You could compare that with the following parametric plot, in which the horizontal and vertical coordinates (at each point on the single curve) represent the real and imaginary components.

plot([Re((-2)^t), Im((-2)^t), t=0..10]);

@lekcha You can use colorscheme when calling densityplot (analogously to how I used it in the earlier code above, when using surfdata as part of the substitute for HeatMap in Maple 18).

Note that this is slower and less efficient that the earlier code I showed. The result of densityplot with such a high grid setting can also make the GUI slow and sluggush. The result may be harder to export. And the Maple 18.02 GUI may not be able to save the worksheet with such a high resolution densityplot output. These things get much worse as the grid gets large. All those consderations are a major part of why the method of using images (and the EscapeTime package) instead of plots was invented for such goals.

restart:

newton := proc(x, y)
    local z, m;
    z := evalf(x+y*I);
    for m from 0 to 15 while abs(z^3-1) >= 0.001 do
       z := z - (z^3-1)/(3*z^2)
    od;
    m;
 end:

cm := ["turquoise","cyan","blue", "brown","coral", "maroon",
       "orange", "pink", "magenta", "red", "sienna", "violet",
       "wheat", "yellow", "aquamarine", "black"]:

plots:-densityplot(newton, -2 .. 2, -2 .. 2, grid = [500, 500],
                   colorscheme=["zgradient",cm],
                   axes = none, scaling = constrained,
                   style = patchnogrid, size = [500, 500]);

 

newt_dens_Maple18_colorscheme.mw

Are you asking also about using a .m (dotm) file from within Maple, and not just about putting it as an attachment on a Mapleprimes posting?

Please put your closely related followup queries on this same topic as Replies under this Question thread, instead of posting a separate Question thread. (You've been asked this before.)

Duplicate Question threads will be flagged as such and may be delated.

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.

1 2 3 4 5 6 7 Last Page 1 of 467