acer

33255 Reputation

29 Badges

20 years, 245 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Your Equation Label (2) refers to the HTML entity `★` which you can check by lprint'ing it.

Notice the surrounding single left-ticks. Those a so-called name-quotes, in Maple. And `★` is a name (in Maple's technical sense). It's not an indexed name. It's a symbol (in Maple's technical sense). That's why type(..,symbol) returns true for it.

In Maple, symbols beginning with the ampersand symbol are treated as so-called neutral operators, and allow for calling with infix functional notation.

In Text mode the Maple GUI allows the glyph to be entered, without surrounding left-ticks, and in upright roman. If you paste that into a 2D Input area then you can accomplish the (mistaken) action of entering something like `★` but without the left-ticks. Notice that is rendered in upright roman in your Q1. The 2D parser tries to interpret it as a neutral operator, but finds an unexpected form (inlcuding unexpected special characters, without the surrounding left-ticks). It's not a valid symbol, in that case, since it has non-numeric characters but no left-ticks. Yet it looked as if it was going to be a neutral operator. Hence the error message, unknown operator. I don't know why the GUI allows one to enter that, without the left-quotes.

I don't know what the GUI is doing when it accepts name `⁑` in 2D Input mode but then seems to change it into something else. I've seen some actions where it hasn't done that, in which case I don't see that placeholder glyph, and also it then lprints as expected. But mostly it seems to change it into some other form (unicode?), and the output rendering and lprint then fail. I don't know why it does that, or what was the difference in the cases I didn't see that, for the same input character.

There were various problems, including (but not limited to) premature evaluation of your proc CC which gets called in expression T with symbolic names as arguments. And the plot syntax was wrong, mixing an expression (in S) with a range instead of the form S=range. There were more items to adjust. Please see the comments in the attachment.

Note there are significant regions in the S-mu-Z-Pr space for which there might not be roots found. It can take longer when it's trying to find roots that don't happen to exist.

restart;

 

T := 2^(2/3)*(16*CC(S,mu,Z,Pr)^2*Pi^2 + 2*Pi^2*Z^2 + 16*Pi*S*CC(S,mu,Z,Pr) + 3*S^2)*Pr^(1/3)/(4*(4*CC(S,mu,Z,Pr)*Pi + S)^(2/3)*(2*Pi^2*Z^2 + 4*Pi*S*CC(S,mu,Z,Pr) + S^2)^(2/3)*CC(S,mu,Z,Pr)^(1/3)*Pi^(2/3));

R := mu = 2^(2/3)*S*(16*C^2*Pi^2 - 2*Pi^2*Z^2 - S^2)*Pr^(1/3)/(4*(4*C*Pi + S)^(2/3)*(2*Pi^2*Z^2 + 4*C*Pi*S + S^2)^(2/3)*C^(4/3)*Pi^(2/3));

 

# There are five identical calls to CC in T, with the very
# same arguments (S,mu,Z,Pr), so I added `option remember` to CC,
# in order to prevent it from recomputing for each call(!).
# You don't want it five times slower, if you can avoid that.
# (And alternative be to make `T` a proc that admits all the
# four names, and compute the CC call as a first step. But I'm
# trying to keep the edits shorter.)
#
# I also made CC return unevaluated for nonnumeric arguments.
#
CC:=subs(__R=R, proc(S,mu,Z,Pr) option remember;
                  if not [S,mu,Z,Pr]::list(numeric) then
                    return 'procname'(args); end if;
                  fsolve(__R,C=0.01..100);
                end proc):

 

CC(1,0,0.5,0.2);

 

# There are signficant regions (in the 4-variable space) in which there
# may be no roots found. So for some parameter choices you may not get any
# plot at all.
#
# For example: a subregion shows for which no roots are found,
#
plot3d(eval(T,[mu=0.5,Z=0.25]),S=0..15,Pr=0..1,grid=[17,17],
       orientation=[-10,75,0],adaptmesh=false);

 

        
# The `continuous` option makes Explore compute only when you release
# the Slider at a new position. For something which computes slowly
# like your CC, this helps prevent it getting choked up on a backlog
# of values that you "slide" through.
#
# Note also that you need at least one float end-point for the ranges
# for parameters mu and Pr (you had  range 0..1, etc), or else they'll
# only take on the integer values, eg. 0 and 1
#
# I use initial values for the parameters at which I know some plot
# attains. I use option adaptview=false so that it doesn't attempt the
# end-values {mu,Pr}={0,1} which may be problematic. I force the
# plot's vertical view, explicitly, so that I get a steady constant `view`.
#
Explore(plot(T,S=0..15,view=[0..15,0..1],adaptive=false,numpoints=49),
        parameters=[[mu=0 .. 1.0,minorticks=0.25,continuous=false],
                    [Z=0..0.5,minorticks=0.1,continuous=false],
                    [Pr=0..1.0,minorticks=0.25,continuous=false]],
        initialvalues=[mu=0.5,Z=0.25,Pr=0.5], adaptview=false);

 

Download Explore_Plot_Problem_ac.mw

ps. If you move one of these Sliders, then keep an eye on the GUI's status bar at its bottom. I advise waiting for it to go from Evaluating to Ready, before doing anything else (expecially moving any other Slider). Also, it gets slow for mu>0.5 or so...

When you expand your eqn1 the lhs's of the Eval calls get put into {} braces. That is,
   Eval(..., x__1=L__1)
becomes,
   Eval(..., {x__1=L__1})
and so on.

That makes them not match the Eval call in the lhs of bc1., which lacks those braces.

You could programmatically change all the Eval calls into this form, or you could write it that way if they're all entered directly by you. I show both ways, below. I used Maple 2022, as you do.

restart

T := proc (e) options operator, arrow; subsindets(e, And(specfunc(Eval), satisfies(proc (u) options operator, arrow; (op(2, u))::`=` end proc)), proc (u) options operator, arrow; Eval(op(1, u), {op(2, u)}) end proc) end proc

bc1 := E__b*I__b*(Eval(diff(`φ__1`(x__1), `$`(x__1, 3)), x__1 = L__1)) = -m__1*omega^2*(Eval(`φ__1`(x__1), x__1 = L__1)+(1/2)*D__1*(Eval(diff(`φ__1`(x__1), x__1), x__1 = L__1)))+E__b*I__b*(Eval(diff(`φ__1`(x__2), `$`(x__2, 3)), x__2 = 0))

eqn1 := E__b*I__b*(Eval((diff(`φ__1`(x__1), `$`(x__1, 3)))*`φ__2`(x__1), x__1 = L__1))-E__b*I__b*(Eval((diff(`φ__1`(x__1), `$`(x__1, 2)))*(diff(`φ__2`(x__1), x__1)), x__1 = L__1))

algsubs(T(bc1), T(expand(eqn1)))

((Eval(phi__2(x__1), {x__1 = L__1}))*(Eval(diff(diff(diff(phi__1(x__2), x__2), x__2), x__2), {x__2 = 0}))-(Eval(diff(diff(phi__1(x__1), x__1), x__1), {x__1 = L__1}))*(Eval(diff(phi__2(x__1), x__1), {x__1 = L__1})))*I__b*E__b-(1/2)*(Eval(phi__2(x__1), {x__1 = L__1}))*m__1*omega^2*(D__1*(Eval(diff(phi__1(x__1), x__1), {x__1 = L__1}))+2*(Eval(phi__1(x__1), {x__1 = L__1})))

restart


Alternatively, if all the Eval calls are entered by you, then explicitly use braces
when entering all the 2nd arguments.

bc1 := E__b*I__b*(Eval(diff(`φ__1`(x__1), `$`(x__1, 3)), {x__1 = L__1})) = -m__1*omega^2*(Eval(`φ__1`(x__1), x__1 = L__1)+(1/2)*D__1*(Eval(diff(`φ__1`(x__1), x__1), {x__1 = L__1})))+E__b*I__b*(Eval(diff(`φ__1`(x__2), `$`(x__2, 3)), {x__2 = 0}))

eqn1 := E__b*I__b*(Eval((diff(`φ__1`(x__1), `$`(x__1, 3)))*`φ__2`(x__1), {x__1 = L__1}))-E__b*I__b*(Eval((diff(`φ__1`(x__1), `$`(x__1, 2)))*(diff(`φ__2`(x__1), x__1)), {x__1 = L__1}))

algsubs(bc1, expand(eqn1))

((Eval(diff(diff(diff(phi__1(x__2), x__2), x__2), x__2), {x__2 = 0}))*(Eval(phi__2(x__1), {x__1 = L__1}))-(Eval(diff(diff(phi__1(x__1), x__1), x__1), {x__1 = L__1}))*(Eval(diff(phi__2(x__1), x__1), {x__1 = L__1})))*I__b*E__b-(1/2)*(Eval(phi__2(x__1), {x__1 = L__1}))*m__1*omega^2*(D__1*(Eval(diff(phi__1(x__1), x__1), {x__1 = L__1}))+2*(Eval(phi__1(x__1), x__1 = L__1)))

Download question527_ac.mw

ps. I don't understand the construction D[1]*Eval(...) in your bc1, but that's not part of your original ly reported difficulty.

For your part 1), you could look at this old thread, which covers that aspect pretty thoroughly. Carl Love gave a general bi-directional procedure, and I gave the following for a definite integral like Int(Sum(...)).

F:=e->subsindets(e,And(specfunc(anything,Int),
                       satisfies(u->nops(u)>1 and type(op(1,u),
                                                       specfunc(anything,Sum)) and
                                    type(op(2,u), {name,name=range}))),
                 u->Sum(Int(op([1,1],u),op(2..,u)),op([1,2..],u))):

 

expr := Int(Sum(f[i](x,t),i=1..n),x=a..b);

Int(Sum(f[i](x, t), i = 1 .. n), x = a .. b)

F(expr);

Sum(Int(f[i](x, t), x = a .. b), i = 1 .. n)

Download GFY_1.mw

That's a question that's been asked several times before, and there have been a variety of ways to go about it (depending on how general one might want it, etc). If you have sum or int instead of inert Sum or Int then it's trivial to replace replace those up front, or utilize op(0,..) in the code and modify the types, etc.

For your part 2), it depends on what you're willing to accept for incidental transformation of g(t) and f(x). The literal example,

    Int(g(t)*f(x),x=a..b)

can be handled directly by either expand, simplify, or even IntegrationTools:-Expand.

But what if you had something like, say,

    Int((1-cos(t)^2)*(1-sin(2*x)^2), x=a..b)

Those commands could alter the subexpressions g(t) and f(x). Using Maple 2022 (as your attachment used),

restart;

kernelopts(version);

`Maple 2022.2, X86 64 LINUX, Oct 23 2022, Build ID 1657361`

goo := Int((1-cos(t)^2)*(1-sin(2*x)^2), x=a..b);

Int((1-cos(t)^2)*(1-sin(2*x)^2), x = a .. b)

simplify(goo);

(1-cos(t)^2)*(Int(cos(2*x)^2, x = a .. b))

expand(goo);

(cos(t)^2-1)*(Int(4*sin(x)^2*cos(x)^2-1, x = a .. b))

simplify(expand(goo));

(1-cos(t)^2)*(Int((2*cos(x)^2-1)^2, x = a .. b))

Download int_ex03.mw

So for part 2), what would you need, more generally? That requirement might affect what answer could serve.

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

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