acer

33325 Reputation

29 Badges

20 years, 286 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

You could put,

   $include "NODEXML.mm"

into some parent text file, and read that instead (or $include it from something else that is read, etc).

But you have to trigger the $include directives with some other mechanism instance. It could be read. Or you could use a shell call to the TTY/CLI `maple` script with that parent text file fed in as input.

The point is that you need some parent action that is not an $include directive.

For your Maple 2015 you could adjust the actual procedure used by the command plots:-sparsematrixplot.

restart;

B := LinearAlgebra:-ToeplitzMatrix([1, 2, 3, 0, 0, -3, -2, -1], symmetric):

 

plots:-sparsematrixplot(B, color=orange, labels=["",""]);


Adjust the code in the procedure itself. We only need do this once per session (or in init).

`plots/sparsematrixplot`:=FromInert(subsop([5,3]=[op([5,3],ToInert(eval(`plots/sparsematrixplot`))),_Inert_STATSEQ(_Inert_ASSIGN(_Inert_LOCAL(8), _Inert_FLOAT(_Inert_INTPOS(0), _Inert_INTPOS(0))))][],ToInert(eval(`plots/sparsematrixplot`)))):

 

plots:-sparsematrixplot(B, color=orange, labels=["",""]);

plots:-sparsematrixplot(B, color=orange, labels=["",""],
                        overrideoption, style=polygonoutline);

Download spmp_2015_ac.mw

For Maple 2024 and later the alternate command plots:-matrixplot offers its dimension and gap options, and as of Maple 2025 it offers a sparse option.

restart; with(plots); B := LinearAlgebra:-ToeplitzMatrix([1, 2, 3, 0, 0, -3, -2, -1], symmetric)

matrixplot(B, dimension = 2, sparse, color = orange, colorbar = false, gap = 0., style = polygon, labels = ["", "", ""])

matrixplot(B, dimension = 2, sparse, color = orange, gap = 0., style = polygonoutline,
           colorbar = false, labels = ["", "", ""])

Download spmp_2026_ac.mw

In that example I forced only a single color, so as to focus on comparison of the gap with the sparsematrix command. But the default is actually a range/variety of colors,

In recent Maple versions the plots:-matrixplot command can also do custom coloring, including accepting the colorscheme option. Eg,

restart;

interface(version);

`Standard Worksheet Interface, Maple 2026.1, Linux, April 28 2026 Build ID 2011354`

with(plots):

B := LinearAlgebra:-ToeplitzMatrix([1, 2, 3, 0, 0, -3, -2, -1], symmetric):

 

matrixplot(B, dimension = 2, sparse, gap = 0., style = polygonoutline,
           colorscheme="turbo",
           colorbar = false, labels = ["", "", ""], size=[400,400]);

Download spmp2_2026_ac.mw

When you call,

    plot([h(7.7,x),x=0..30]);

the evaluation of h(7.7,x) happens before the plot procedure receive any arguments, and before the symbol x takes on any numeric values. Hence, you are seeing the same error message that you would if you executed,

    h(7.7,x)

alone.

You could try,

    plot([ 'h(7.7,x)[1]', 'h(7.7,x)[2]', x=0..30 ]);

or,

    plot([ x->h(7.7,x)[1], x->h(7.7,x)[2], 0..30 ]);

If that works, but seems slower than you expect, then let us know as there may be some memoization adjustment possible, to avoid duplication of computation.  (Eg, procedure h might be given option remember; or option remember, system; etc).

Did you perhaps intend that the target list of options would also contain the color from Inputs, ie. overriding the colour from PlotDefaults?

Also, are all your options meant to be actual plot,options? I mean, with something like "solidbox" rather than your square?

And, are these meant to be passed to stock Maple Library commands or procedures of your devising. That makes a big difference because the stock plotting commands's handling of optional parameters makes later options override earlier options automatically. Ie, you don't have to select and remove and construct new lists, etc, to override.

For example,

restart;

plots:-setoptions(size=[300,300]);

PlotDefaults:=['colour'="blue", 'symbol'=':-solidcircle', 'symbolsize'=20, 'thickness'=2]:

Inputs:=['color'=["red","black","blue"], 'symbol'=':-solidbox', 'linestyle'=':-dash']:


In this next call the color and symbol items in Inputs comes after the colour and symbol items
from PlotDefaults, and the options handling is set up so that the later options automatically

override the earlier ones.

So, to get the Inputs items to override the PlotDefaults items you only need to supply them
them later. You don't have to select and remove and actually form a new merged list.


In these examples with dataplot, that nice merging overriding can happen in the parameter-
processing of some of the plotting commands to which dataplot dispatches, or in its own
methodology which strives to adhere to this behavioral model.

dataplot([[1,2,3],[2.5,3.5,5],[4,6,8]], PlotDefaults[], Inputs[]);


These are the items than would actually get passed into dataplot in the previous call.

But we don't have to expend the effort of forming this explicitly. The options handling
too care of that for us, in the previous example! I'm just demonstrating that the plots look
the same.

plotdata:=['color'=["red","black","blue"], 'symbol'=':-solidbox','linestyle'=':-dash',
           'symbolsize' = 20, 'thickness'=2]:

dataplot([[1,2,3],[2.5,3.5,5],[4,6,8]],plotdata[]);


For some (many) stock plotting commands the parameter-processing mechanism
itself resolves such overriding.

plot(sin, 'color'="red", 'colour'="green");


Download 2026-05-18_Q_Select_from_Two_Lists_to_get_New_List_ac.mw

Is it satisfactory if you call   get_name(o)  ?

There are several ways to do that. Here are two:

restart

with(plots)

freq := 1

1

n := 50

50

dt := 1/(freq*n)

1/50

s1 := proc (m) options operator, arrow; sin(2*Pi*freq*m*dt) end proc

proc (m) options operator, arrow; sin(2*Pi*freq*m*dt) end proc

s2 := Array(1 .. 1500, s1, datatype = float[8])

s2[1 .. 5]

Array(%id = 36893623679002935036)

dataplot(s2[1 .. 50], style = line, color = blue, labels = ["Index", "Value"])

listplot(s2[1 .. 50], color = blue, labels = ["Index", "Value"])

NULL

Download plot_exercise_a_ac.mw

If you really want to use the plot command itself, then (again, one of several ways) you could do it as follows, with the first argument being a list or Vector (and not merely a range as you tried, etc).

plot(<$(1..50)>, s2[1..50],
     color=blue, labels=["Index","Value"]);

or,

plot([$(1..50)], s2[1..50],
     color=blue, labels=["Index","Value"]);

See the third bullet-point in the Description of the Help-page for the plot command, which describes the v1,v2 in the calling sequence choice plot(v1,v2) with the sentence,
"The plot(v1, v2) calling sequence creates a curve from the points with x-coordinates v1 and y-coordinates v2, where v1 and v2 are lists or Vectors."
It's also allowing a 1D Array, such as your s2.

Personally I like to use plots:-listplot for this kind of example. It accepts the 1D data as a list, or 1D Vector, or 1D Array, and doesn't need the additional argument.

The RHS expression in your first example is not of any of the types that are documented for evalb to evaluate to true|false. See the Help page for the evalb command. Note in pareticular that the exact symbolic expression 3^(1/2) is not of type extended_numeric.

For such an expression, which is of type realcons, you could try using is rather than evalb. That is also demonstrated explicitly, by an analogous example invovling the exact radical 5^(1/2), in the Examples section of the evalb Help-page.

This is not a venue for that kind of query.

You could use this web form.

Or you could send email to  support@maplesoft.com

See also phone numbers and details at the bottom of this page.

The commands CoefficientList and CoefficientVector from the PolynomialTools package share a single Help page.

The following is an example on that page,

    PolynomialTools:-CoefficientVector(5*x^1000000000 + 1, x, storage = sparse);

The result of that command is the following:

    Vector[column](1000000001,{1=1, 1000000001=5},datatype=anything,
                             storage=sparse,order=Fortran_order,shape=[])

In your Maple 2025, that seems to cause a (Java memory resource) problem when pretty-printed as 2D Output using the "Scrollable Matrices" feature new in Maple 2024.

If you issue that command in a worksheet then that worksheet Tab/Window may become frozen and unusable. That command also prevents the CoefficientList Help page from being displayed.

There is now a bug report against this. (I don't recall seeing such a report earlier. It's helpful to use the form to submit such a bug report, when posting; better two reports than none.)

If I change the relevant line to,
    ScrollableMathTableOutput=true
in my Maple 2026 GUI Preferences file then I can get that Help page to display in my Maple 2026.0. The commands mentioned above then get the output pretty-printed ok, as well.

Could you utilize the useunits option of the plot command?

I did the following in Maple 2025, but you could try it in your Maple Flow 2025.
 

B := (4.*10^(-6))*Unit('m'*'kg'/('A'*'s'^2))/I__gap

 

plot(B, I__gap = 0 .. .1*Unit('mm'), y = 0 .. .5, gridlines, useunits = [mm, T])

Related example, with the independent range being supplied in
meters, with the specification that the plot show it for mm.
Ie, with unit conversion for the x-axis also.

plot(B, I__gap = 0 .. 0.1e-3*Unit('m'), y = 0 .. .5, gridlines, useunits = [mm, T])


Download bagraara_1_ac.mw


nb: Units in expressions get rendered on this site within double-braces. That's done by the Mapleprime's very old back-end. In the actual products Maple & Maple Flow the units get rendered as usual, ie. in upright Roman font and without double-braces.

Your objective expression is an integral that contains the name r as a dummy variable-of-integration. The Minimize command can get confused by its presence in the objective expression. This can be clarified for Minimize by specifying the names over which to optimize, using its variables option.

It's also a good idea to use inert Int rather than active int (you don't want Maple to attempt symbolic integration for every numeric set of values for s,t,u,v.

restart

with(Optimization)

"term(a,b,c,d,r):=(exp(sin(r))-(a&lowast;sin(b&lowast;r+c)+d));"

proc (a, b, c, d, r) options operator, arrow, function_assign; exp(sin(r))-a*sin(b*r+c)-d end proc

Minimize(term(s, t, u, v, r)^2, {-100 <= s, -100 <= t, -100 <= u, -100 <= v})

[0.443734259186819141e-30, [r = HFloat(0.8573907336951694), s = HFloat(1.0651237756780674), t = HFloat(0.9373750940497176), u = HFloat(0.9414213728272717), v = HFloat(1.0810520913486565)]]

Minimize(abs(term(s, t, u, v, r)), {-100 <= s, -100 <= t, -100 <= u, -100 <= v})

[0.206279437975354085e-12, [r = HFloat(0.8598182185084339), s = HFloat(1.0763500233776817), t = HFloat(0.9650602699090793), u = HFloat(0.9650599306574976), v = HFloat(1.0839652198942415)]]

"term1(a,b,c,d):=Int((term(a,b,c,d,r))^(2),r=0..2*Pi):"

Minimize(term1(s, t, u, v), [], s = -1 .. 2, t = -1 .. 2, u = -1 .. 2, v = -1 .. 2, variables = [s, t, v, u])

[.236863805171295988, [s = HFloat(1.135097446580192), t = HFloat(1.0082336929148168), v = HFloat(1.2660536931610444), u = HFloat(-0.024551890862007708)]]

Minimize(term1(s, t, u, v), [s >= -100, t >= -100, u >= -100, v >= -100], variables = [s, t, v, u])

[.236863805171299013, [s = HFloat(1.135097426582723), t = HFloat(1.0082336959143356), v = HFloat(1.2660536793966521), u = HFloat(-0.024551920976264435)]]

NULL

Download test_AlfredF_2_ac.mw

Note also that Minimize does local optimization, in general, for multivariable problems. The result may be only locally optimizal wrt s,t,u,v. That might not be the global optimum for which you're searching. If that's the case then you could consider the DirectSearch v.2 package (available from the Maple Cloud or Application Center).

It does not make much convenient sense to use the writeto command in this context. That's more for things like getting all input & output echoed to a file, rather than storing an expression purely for convenient re-use. (It could be done, but it'd be somewhat awkward. It's not a natural way to do this task.)

You can accomplish your stated task most simply by using the save and read commands, and efficiently using Maple's .m (dotm) format. For example,

restart;

p := randpoly(x,degree=10,dense);

-7*x^10+22*x^9-55*x^8-94*x^7+87*x^6-56*x^5-62*x^3+97*x^2-73*x-4


So here you are, with a polynomial, assigned to some name.

Now you can store it to a file, for later re-use and efficient direct access, with
a single command.
 

save p, "pfile.m";


And that's all you have to do to store it. Now you can read it into any other session,
with a single other command.
 

restart;

read "pfile.m";


And that's all you need to do, to get that same stored polynomial, assigned to the same
name `p`, in your new sessions.

p;

-7*x^10+22*x^9-55*x^8-94*x^7+87*x^6-56*x^5-62*x^3+97*x^2-73*x-4

Download save_read_ex.mw

You could, of course, use a full path to the file, in the string above. Please ask, if you don't know how to construct such.

An alternative would be to use fprintf to write your polynomial to a text file. For a very large polynomial that might be measurably slower. You might prefer this way if you think that you'd ever want to access the polynomial using some program other than Maple (ie. as plaintext source). Here below are two variants on that, which differ slightly. The first example reads and evaluates from the text file, but doesn't assign -- though it shows that as a second step, with your choice of variable name. The second example reads from the text file and (always) assigns to name p.

restart;

p := randpoly(x,degree=10,dense):

fprintf("pfile.txt", "%a;", p):


And that's all you have to do to store it in plaintext. You can open that
file with your favorite editor program.

And now you can read it into any other session.
 

restart;

read "pfile.txt";

-7*x^10+22*x^9-55*x^8-94*x^7+87*x^6-56*x^5-62*x^3+97*x^2-73*x-4

p := %;

-7*x^10+22*x^9-55*x^8-94*x^7+87*x^6-56*x^5-62*x^3+97*x^2-73*x-4


In that variant it didn't assign the polynomial to any name, merely by
reading it in. The assignment to a name happens in its own statement.

In the next variant it always assigns, and always to name `p`,
when read in.
  

restart;

p := randpoly(x,degree=10,dense):

fprintf("pfile.txt", "p := %a;", p):

 

restart;

read "pfile.txt":

p;

-7*x^10+22*x^9-55*x^8-94*x^7+87*x^6-56*x^5-62*x^3+97*x^2-73*x-4

Download fprintf_read_ex.mw

ps. There is no Plots package, with a capital P, in stock Maple 2026. It's unclear what you were trying to convey about that.

If that's the first time you're doing it in Maple 2026.0 then, yes, it is a known thing.

That manual installation using PackageTools:-Install (from the Maple cloud) should get you the first one for Maple 2026.0. And that should contain an update of SupportTools itself, so that SupportTools:-Update would work for subsequent updates.

See the Comment here, for a note on that.

You can get that error message if you are assigning the result to a name, and the statement ends with a semicolon.

Perhaps the easiest remedy for that is to terminate the assignment statement with a full colon, and then evaluate the name in another line.

Eg,

  P := plots:-implicitplot(...):
  P;

If that's not the issue, then upload and attach your worksheet using the green up-arrow in the toolbar of the Mapleprimes editor.

@Honigmelone I don't understand what you mean by, "However I found that I inject e^(...) at some point." Are you saying that action is not something under your control and which you cannot avoid doing, and that you simply want to undo it before calling invlaplace?

restart;

kernelopts(version);

`Maple 2024.2, X86 64 LINUX, Oct 29 2024, Build ID 1872373`

expr := e^(-s*a_pos)/(b*s^2 + c);

e^(-s*a_pos)/(b*s^2+c)

lprint(expr);

e^(-s*a_pos)/(b*s^2+c)

new := subsindets(expr, identical(e)^anything, u->exp(op(2,u)));

exp(-s*a_pos)/(b*s^2+c)

lprint(new);

exp(-s*a_pos)/(b*s^2+c)

inttrans[invlaplace](new, s, t) assuming a_pos>0;

Heaviside(t-a_pos)*sin((c/b)^(1/2)*(t-a_pos))*(c/b)^(1/2)/c

Download Honigmelone_1_ac.mw

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