acer

33425 Reputation

29 Badges

20 years, 347 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

I'd be surprised if there weren't some easier way.

restart;

kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

(1)

vec:=Vector(3, {(1) = 0, (2) = x*z/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))-z*ell__1/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))-x*z/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2))-z*ell__2/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2)), (3) = -s*x/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))+s*ell__1/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))+s*x/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2))+s*ell__2/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2))});

vec := Vector(3, {(1) = 0, (2) = x*z/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))-z*ell__1/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))-x*z/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2))-z*ell__2/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2)), (3) = -s*x/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))+s*ell__1/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))+s*x/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2))+s*ell__2/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2))})

(2)

G:=proc(u, T::anything:=simplify) local P,Q;
           Q:=remove(type,[ifelse(denom(u)::`*`,op(denom(u)),denom(u))],constant);
           P:=( s->s=freeze(s) )~(Q);
           thaw(collect(eval(numer(u),P)/eval(denom(u),P),rhs~(P),T));
end proc:

 

G~(vec);

Vector(3, {(1) = 0, (2) = -z*(ell__2+x)/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2))-z*(ell__1-x)/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2)), (3) = s*(ell__2+x)/((s^2+z^2)*sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2))+s*(ell__1-x)/(sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)*(s^2+z^2))})

(3)

simplify(vec-%);

Vector(3, {(1) = 0, (2) = 0, (3) = 0})

(4)

G~(vec, expand);

Vector(3, {(1) = 0, (2) = (-ell__2*z-x*z)/(sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2)*(s^2+z^2))+(-ell__1*z+x*z)/((s^2+z^2)*sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2)), (3) = (ell__2*s+s*x)/(sqrt(ell__2^2+2*ell__2*x+s^2+x^2+z^2)*(s^2+z^2))+(ell__1*s-s*x)/((s^2+z^2)*sqrt(ell__1^2-2*ell__1*x+s^2+x^2+z^2))})

(5)

simplify(vec-%);

Vector(3, {(1) = 0, (2) = 0, (3) = 0})

(6)

 

Download Maple_example_ac.mw

I suggest that, with a simple correction to your choice of location, the with(...) package loading should work without having to append to libname either in your session or in an .ini initialization file.

The "toolbox" location can work like that, but the files should go into a "lib" folder that resides under the package-folder. For example,
   "Cliffordlib/lib"
instead just "Cliffordlib", for the bottom-most location of the library archive files.

The first portion you can get/check using the Maple command,
    cat(kernelopts(homedir),"/maple/toolbox")

Then completely close Maple and all its GUI instances. Then relaunch, and tell us whether you can load your package using the with(...) command, but without having to adjust libname at all (either manually in the sesssion, or within an .ini file).

 

ps. Library archives used to come in a pair of files, eg. "foo.lib" and "foo.ind", but in modern Maple that is done using a single file named "foo.mla". If you don't have the original source files, and if it works ok, then you could just leave it.

There's always room for improvement in the algorithm that selects methods and results. (A real-valued result that's continuous for real x has quite a bit of appeal...)

restart;

interface(version);

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

int(D(tanh)(x),x,method=derivativedivides);

tanh(x)

int(D(tanh)(x),x,method=parallelrisch);

tanh(x)

int(D(%tanh)(x),x);

%tanh(x)

simplify(combine( int(D(tanh)(x),x) )) assuming real;

((1/2)*I)*Pi+tanh(x)

Download some_integral.mw

The running-icon for my Maple 2026.1 was just a generic gear icon in my Ubuntu 24.04 LTS. I've now solved that issue.

I edited the already existing file from an earlier version's installation,
    /usr/share/applications/maple2024.desktop

I added to that file the line,
    StartupWMClass=com-maplesoft-application-Launcher

Strangely, editing that particular file doesn't make the running-icon be the blue-maple-leaf, for my Maple 2024.2. But it does, if I launch my Maple 2025.2 or Maple 2026.1.

I didn't know what to set the StartupWMClass item to, originally. But then I looked here.

I usually don't bother checking the box to add it to the Desktop, when I install Maple. I'd expect that doing so would get me the basic maple2026.desktop file. And to that I could add the StartupWMClass item (as above) if it were missing.

So now it works properly for my Maple 2026.1 (and Maple2025.2) as well. I simply copied that .desktop file from an older install, and then edited its version numbers, and added the StartupWMClass item which I described above.

How about plotting the absolute difference?

restart;

Digits:=15:

forget(evalf); forget(`evalf/int`);

CodeTools:-Usage(
  plot(a->(u->log[10](abs(u)))(Int(unapply(sinh((Pi-a)*x)/(cosh(Pi*x)*sinh(a*x)), x),
                                    -100 .. 100, epsilon = 0.1e-8, method = _Dexp)
                                -Int(unapply(sinh((Pi-a)*x)/(cosh(Pi*x)*sinh(a*x)), x),
                                    -10 .. 10, epsilon = 0.1e-7, method = _Dexp)),
       0 .. 2*Pi, adaptive = false, numpoints = 200,
       axis[2] = [tickmarks = [seq(i = sprintf("%1.0e", 10.0^i), i = -16 .. 3)]],
       thickness = 2, view = -16 .. 3, size = [600, 400])
);

memory used=189.61MiB, alloc change=68.00MiB, cpu time=2.07s, real time=2.09s, gc time=93.51ms

Download testint3_acc.mw

Another way,

sort(sigma+i*t,sigma):

plots:-textplot([2,3,Zeta(sigma+i*t)=Sum(1/n^(sigma+i*t),
                                         n=1..infinity)]);

Is this the kind of thing you're after?

Note that your code part that uses satisfies could be simpler.

Note that also that it's not enforcing strictly two entries in the set. (You did not explain exactly what you want to do. I've got guesses.) Relying on a list element being sorted and put before a Vector element within a set seems like suboptimal coding to me; I'd prefer to specify a list [] of precisely those two typed entries, in such a case.

restart;

TypeTools:-AddType(_L3DP,set({satisfies(s->type(s,[algebraic$3])),'Vector[column](3,algebraic)'}));

type({[7,8,9],<1,2,3>},_L3DP);

true

type({[a,b,c],[7,8,9],<1,2,3>},_L3DP);

true

restart;

TypeTools:-AddType(_L3DP,set({[algebraic$3],'Vector[column](3,algebraic)'}));

type({[7,8,9],<1,2,3>},_L3DP);

true

type({[a,b,c],[7,8,9],<1,2,3>},_L3DP);

true

Download Ronan_TT1.mw


ps. I changed your code's original text TT:-AddType to TypeTools:-AddType

In your Questions original example (and also mentioned in a followup Reply) you tried passing in a list. I'm going to guess that this aspect is something you want in particular, and show a way to use do it while assigning the passed values to locals a,b,c,d.

So, here is one way you can do that, using a single keyword parameter. As Carl mentioned, you could also have four separate keyword parameters for each of a,b,c,d. (Below, my second example re-uses his suggestion, just for comparison of how they both can get used.)

nb. I don't know whether you'd prefer terser source code, or more readily understandable source code, or code that is easier to use, oder...

restart;


You can declare locals a,b,c,d with whatever default values you want.

p := proc( {vlist::list(identical(a,b,c,d)=anything):=[]} )
  local a:=undefined, b:=999, c:=0, d:=undefined, V:=lhs~(vlist);
  a,b,c,d := ifelse(':-a' in V,eval(':-a',vlist),a),ifelse(':-b' in V,eval(':-b',vlist),b),
             ifelse(':-c' in V,eval(':-c',vlist),c),ifelse(':-d' in V,eval(':-d',vlist),d);
  return a,b,c,d;
end proc:

 

p( foo, vlist=[d=11,a=4,b=3,c=-5], bar, blech );

4, 3, -5, 11

# Perhaps you get the list in this form, from elsewhere.
# Perhaps that's why you asked about passing in a list. (A guess...)
#
L := [d=11,a=4,b=3,c=-5];

[d = 11, a = 4, b = 3, c = -5]

p( foo, vlist=L, bar, blech );

4, 3, -5, 11

p( foo, bar, blech, vlist=[d=11] );

undefined, 999, 0, 11

p( foo, bar, blech );

undefined, 999, 0, undefined

The globals were not assigned.
a,b,c,d;

a, b, c, d

q :=  proc( {a:=undefined, b:=999, c:=0, d:=undefined} )
  return a,b,c,d;
end proc:

q( foo, d=11, a=4, bar, blech, b=3, c=-5 );

4, 3, -5, 11

q( foo, d=11, bar, blech );

undefined, 999, 0, 11

q( foo, bar, blech );

undefined, 999, 0, undefined

The globals were not assigned.
a,b,c,d;

a, b, c, d

Download varlist_param_ex.mw

Is this the kind of thing you're after?

restart;

ReduceM:= proc(C::{Matrix, :-_ProjM3})
            local i, tgdc, dnm, V1, Ml, SV1, ns, M, r, G;
            if C::'Matrix' then
                M := LinearAlgebra:-Copy(C);
            elif C::{':-_ProjM3'} then
                M := LinearAlgebra:-Copy(C[1]);
            end if;
            V1 := convert(normal(M), list);
            SV1 := convert(normal(M), set) minus {0};
            ns := nops(SV1);
            dnm := frontend(lcm, [seq(denom(SV1[i]), i = 1 .. ns)]);
            Ml := normal(dnm * M);
            V1 := convert(Ml, list);
            tgdc := numer(SV1[1]);
            if tgdc = 0 then
                tgdc := 1;
            end if;
            for i from 2 to ns do
                tgdc := frontend(gcd, [tgdc, numer(SV1[i])]);
            end do;
            G := simplify(factor~(Ml /~ tgdc));
            r := `if`(C::'Matrix', G, <[G]>);
            if member(_nresults,[1,undefined]) then
              return r;
            else
              return r,tgdc/dnm;
            end if;
        end proc:

 

A:=Matrix(3, 3, [[(x__2 - x__1)*(-y__2 + y__3) + (-y__1 + y__2)*(-x__3 + x__2), (x__2 - x__1)*(-y__1 + y__3) + (-y__1 + y__2)*(-x__3 + x__1), (x__2 - x__1)*(-y__1 + y__2) + (-y__1 + y__2)*(-x__2 + x__1)], [(x__3 - x__1)*(-y__2 + y__3) + (-y__1 + y__3)*(-x__3 + x__2), (x__3 - x__1)*(-y__1 + y__3) + (-y__1 + y__3)*(-x__3 + x__1), (x__3 - x__1)*(-y__1 + y__2) + (-y__1 + y__3)*(-x__2 + x__1)], [x__1*(-y__2 + y__3) + y__1*(-x__3 + x__2) - x__2*y__3 + x__3*y__2, (-y__1 + y__3)*x__1 + y__1*(-x__3 + x__1) - x__1*y__3 + x__3*y__1, (-y__1 + y__2)*x__1 + y__1*(-x__2 + x__1) - x__1*y__2 + x__2*y__1]])

Matrix(3, 3, {(1, 1) = (x__2-x__1)*(-y__2+y__3)+(-y__1+y__2)*(-x__3+x__2), (1, 2) = (x__2-x__1)*(-y__1+y__3)+(-y__1+y__2)*(-x__3+x__1), (1, 3) = (x__2-x__1)*(-y__1+y__2)+(-y__1+y__2)*(-x__2+x__1), (2, 1) = (x__3-x__1)*(-y__2+y__3)+(-y__1+y__3)*(-x__3+x__2), (2, 2) = (x__3-x__1)*(-y__1+y__3)+(-y__1+y__3)*(-x__3+x__1), (2, 3) = (x__3-x__1)*(-y__1+y__2)+(-y__1+y__3)*(-x__2+x__1), (3, 1) = x__1*(-y__2+y__3)+y__1*(-x__3+x__2)-x__2*y__3+x__3*y__2, (3, 2) = (-y__1+y__3)*x__1+y__1*(-x__3+x__1)-x__1*y__3+x__3*y__1, (3, 3) = (-y__1+y__2)*x__1+y__1*(-x__2+x__1)-x__1*y__2+x__2*y__1})

ReduceM(A);

Matrix(3, 3, {(1, 1) = 1, (1, 2) = 1, (1, 3) = 0, (2, 1) = 1, (2, 2) = 0, (2, 3) = -1, (3, 1) = -1, (3, 2) = 0, (3, 3) = 0})

ansA,facA := ReduceM(A);

Matrix(%id = 36893623723227604620), x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2

B:=Matrix(3, 3, [[-(y__1 - y__3)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2) + (y__1 - y__2)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), -(y__1 - y__3)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), -(y__1 - y__2)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2)], [(-x__3 + x__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2) - (-x__2 + x__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), (-x__3 + x__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), (-x__2 + x__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2)], [-(x__1*y__3 - x__3*y__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2) + (x__1*y__2 - x__2*y__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2) - 1, -(x__1*y__3 - x__3*y__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2), -(x__1*y__2 - x__2*y__1)/(x__1*y__2 - x__1*y__3 - x__2*y__1 + x__2*y__3 + x__3*y__1 - x__3*y__2)]])

Matrix(3, 3, {(1, 1) = -(y__1-y__3)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)+(y__1-y__2)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (1, 2) = -(y__1-y__3)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (1, 3) = -(y__1-y__2)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (2, 1) = (-x__3+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)-(-x__2+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (2, 2) = (-x__3+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (2, 3) = (-x__2+x__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (3, 1) = -(x__1*y__3-x__3*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)+(x__1*y__2-x__2*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)-1, (3, 2) = -(x__1*y__3-x__3*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2), (3, 3) = -(x__1*y__2-x__2*y__1)/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)})

ReduceM(B)

Matrix(3, 3, {(1, 1) = -y__2+y__3, (1, 2) = -y__1+y__3, (1, 3) = -y__1+y__2, (2, 1) = -x__3+x__2, (2, 2) = -x__3+x__1, (2, 3) = -x__2+x__1, (3, 1) = -x__2*y__3+x__3*y__2, (3, 2) = -x__1*y__3+x__3*y__1, (3, 3) = -x__1*y__2+x__2*y__1})

ansB,facB := ReduceM(B);

Matrix(%id = 36893623723215741764), 1/(x__1*y__2-x__1*y__3-x__2*y__1+x__2*y__3+x__3*y__1-x__3*y__2)

 

Download 2026-08-03_Q_Remove_Common_Factors_from_Matrix_ac.mw


ps. For fun I also added that _nresults bit, so that if you do assign the results of the call to a pair of names (multiple assignment) then the procedure returns both the Matrix and the yanked factor.
pps. I didn't much alter your approach (lcm & gcd, say), but one might...

In order to get one of the relatively more efficient ways of doing it, the precise nature of the structure of the elements of the models should be specified.

Are svars the only non-indexed names that will be present? Is alpha[n,m] the only flavor of indexed name possibly present?

Is each element of a list in models of the form,

   x^i*y^i*z^i*alpha[n,m]
, or a sum of such?

Also, are there very many elements in some of the lists in models, or is there just a very large number of modestly sized lists in models?

Depending on what is the known of the nature of the element structure affects how efficiently the result can be computed, because it affects what generalizations are (un)needed.

You small example might not characterize what kind of elements might be present in the lists in models.

Consider the following variants, which I just concocted to work with your small example. Depending on the restrictions on the structure of the elements, some of these may be faster or slower, and some may work or fail. And I could cook up lots more, many of which would not work ok for examples that break some structural details that I cannot correct deduce from your small example.

It's quite difficult to try and find a good implementation when it's unclear what possible other generalizations might hold for the elements. I think that's important and (IMO) should be obvious.

ps. I might well be a good idea to try and optimize the individual operation that you want to parallelize, up front. Consider the first variant below, which removes from your original one extra user-defined (non-kernel-builtin) proc call for every handled item. Overhead adds up...

svars:={x,y,z}:

models:=[[y^2*z*alpha[1, 17], z^3*alpha[2, 19], x*z^2*alpha[3, 15] + z^3*alpha[3, 19]], [y^2*z*alpha[1, 17], z^3*alpha[2, 19], x*z^2*alpha[3, 15] + y*z^2*alpha[3, 18]]];

[[y^2*z*alpha[1, 17], z^3*alpha[2, 19], x*z^2*alpha[3, 15]+z^3*alpha[3, 19]], [y^2*z*alpha[1, 17], z^3*alpha[2, 19], x*z^2*alpha[3, 15]+y*z^2*alpha[3, 18]]]

map(w->map([op],indets(w,name) minus svars),models);

[{[1, 17], [2, 19], [3, 15], [3, 19]}, {[1, 17], [2, 19], [3, 15], [3, 18]}]

map(w->map([op],indets(w,And(indexed,name))),models);

[{[1, 17], [2, 19], [3, 15], [3, 19]}, {[1, 17], [2, 19], [3, 15], [3, 18]}]

map(w->map([op],
           map(v->ifelse(v::`+`,
                         op(map(u->op(select(type,[op(u)],indexed)),v)),
                         op(select(type,[op(v)],indexed))),
               {w[]})),
    models);

[{[1, 17], [2, 19], [3, 15], [3, 19]}, {[1, 17], [2, 19], [3, 15], [3, 18]}]

H:=map(`=`,svars,1):

map(w->map([op],indets(eval(w,H),name)),models);

[{[1, 17], [2, 19], [3, 15], [3, 19]}, {[1, 17], [2, 19], [3, 15], [3, 18]}]

Download emendes_exS.mw

I did this with Maple 2026.1 (but it behaves the same in M2015, M2020, and I expect others).

Naturally, in the Maple GUI itself units are rendered in upright roman instead of being enclosed in double-braces.

A variety of test case examples, and programmatic usage:
[note: edited, to adjust for another special case example]

restart;

 

`print/__K`:=ex->Typesetting:-Typeset(ex): `value/__K`:=ex->ex:
unQ:=ex->eval(ex,__K=op):
Q:=ex->thaw(subsindets(
              subsindets(ex,
                         And(`*`,
                             satisfies(proc(u) local h;
                                         h:=selectremove(type,[op(u)],
                                                         specfunc(Units:-Unit));
                                         nops(h[1])>0
                                           and not member(h[2],[[-1],[1]]);
                                       end proc)),
                         freeze),
              specfunc(Units:-Unit),u->__K(content(u))*u)):


A collection of example expressions:

A := [[ Unit(s), 3*b*c*Unit(kg), 3*Unit(kg), c*Unit(L), 1.0*Unit(m), 4.0*Unit(m), Int(sin(x),x) ],
      [ -Unit(g), -3*b*c*Unit(kg), -3*Unit(kg), -c*Unit(L), -1.0*Unit(m), 4.0*Unit(m), -%sin(2.1)*Unit(kg) ]];

[[Units:-Unit(s), 3*b*c*Units:-Unit(kg), 3*Units:-Unit(kg), c*Units:-Unit(L), 1.0*Units:-Unit(m), 4.0*Units:-Unit(m), Int(sin(x), x)], [-Units:-Unit(g), -3*b*c*Units:-Unit(kg), -3*Units:-Unit(kg), -c*Units:-Unit(L), -1.0*Units:-Unit(m), 4.0*Units:-Unit(m), -%sin(2.1)*Units:-Unit(kg)]]

Notice the 1 s and the -1 g .  Others should appear as before.

new := Q(A);

[[__K(1)*Units:-Unit(s), 3*b*c*Units:-Unit(kg), 3*Units:-Unit(kg), c*Units:-Unit(L), 1.0*Units:-Unit(m), 4.0*Units:-Unit(m), Int(sin(x), x)], [-__K(1)*Units:-Unit(g), -3*b*c*Units:-Unit(kg), -3*Units:-Unit(kg), -c*Units:-Unit(L), -1.0*Units:-Unit(m), 4.0*Units:-Unit(m), -%sin(2.1)*Units:-Unit(kg)]]

Revert

value(new);

[[Units:-Unit(s), 3*b*c*Units:-Unit(kg), 3*Units:-Unit(kg), c*Units:-Unit(L), 1.0*Units:-Unit(m), 4.0*Units:-Unit(m), -cos(x)], [-Units:-Unit(g), -3*b*c*Units:-Unit(kg), -3*Units:-Unit(kg), -c*Units:-Unit(L), -1.0*Units:-Unit(m), 4.0*Units:-Unit(m), -.8632093666*Units:-Unit(kg)]]

Revert, leaving inert Int alone, others unevaluated, etc

unQ(new);

[[Units:-Unit(s), 3*b*c*Units:-Unit(kg), 3*Units:-Unit(kg), c*Units:-Unit(L), 1.0*Units:-Unit(m), 4.0*Units:-Unit(m), Int(sin(x), x)], [-Units:-Unit(g), -3*b*c*Units:-Unit(kg), -3*Units:-Unit(kg), -c*Units:-Unit(L), -1.0*Units:-Unit(m), 4.0*Units:-Unit(m), -%sin(2.1)*Units:-Unit(kg)]]

 

A - new;
value(%);

[[Units:-Unit(s)-__K(1)*Units:-Unit(s), 0, 0, 0, 0., 0., 0], [-Units:-Unit(g)+__K(1)*Units:-Unit(g), 0, 0, 0, 0., 0., 0]]

[[0, 0, 0, 0, 0., 0., 0], [0, 0, 0, 0, 0., 0., 0]]

Download unit_unit_2.mw

So, you have seen this page, then?

What does the GUI ribbon tab "My Maple" look like for you? Mine looks like this:

If I click on the "Maple MCP" icon in that image, I get a popup that contains a copyable "Access Code", as well as a URL link. If I click on that link then it takes me to this Maplesoft page.

I didn't follow all the instructions on that page, but I'd be interested to hear what success you might have with this path.

You piecewise's first condition implies that if t is greater than 0 then the returned value is 0.

And that's what you get, since for x=0..1 all the x values are greater than 0 and the evaluations all become 0 (zero). The curve is the flat line at height zero. If you added option thickness=5 then you'd see it more clearly. It's not an empty plot, it's just a line that is all zero in height.

Perhaps you intended some different first condition (eg. t<0), or some different range (eg. t=-1..1).

The call to dsolve is running with its userinfo statements activated by your infolevel[dsolve]:=5 .

The muddle with the Equation Labels (appearing beside the userinfo messages, which shouldn't happen at all, let alone with repeated values, IMO) appears to be triggered by the appearance of output from the 2nd Execution Group in that same Document Block, which is present after the 1st Execution Group that contains that dsolve call.

In other words, if you move the,
   DEtools:-odeadvisor(ode[1])
into a new, separate Document Block then the muddle seems to clear up.

I don't think that this is a new issue. I seemed to be able to recreated it in, say, Maple 2020.2.

nb. I have Annotation Markers toggled as visible, under View from the ribbon. That lets be see where the Document Block boundaries lie.

This seems like a bug to report.

If you only need to plot it then the tolerance for the numeric integration doesn't need to be super fine.

For some ostensbily complex expressions, simplify@evalc might produce en enormous new expression, or take a very long time. Since your integrand1 and integrand3 are quite short, maybe the numeric roundoff is acceptable.

restart; with(plots)

V := exp(-k^2*t)*((-4*k*(sin(k*x)/exp(1)+sin(k*(1-x)))*(k^2-1))*(1/((k^2+1)*(k^4+1))))/((2*Pi)*(exp(I*k)-exp(-I*k)))

L := 3/4; k1 := proc (r) options operator, arrow; L+(3/4)*I+r*exp(((1/6)*I)*Pi) end proc; k2 := proc (r) options operator, arrow; -L+(3/4)*I+r*exp(((5/6)*I)*Pi) end proc; k3 := proc (s) options operator, arrow; s+(3/4)*I end proc; dk1 := D(k1); dk2 := D(k2); dk3 := D(k3)

3/4

integrand1 := Re((eval(V, k = k1(r)))*dk1(r)-(eval(V, k = k2(r)))*dk2(r)); integrand3 := Re((eval(V, k = k3(s)))*dk3(s))

length(integrand1); length(integrand3)

1446

339

NULL

approx_u := proc (x, t) local temp1, temp2, res; temp1 := evalf(Int(eval(integrand1, [:-x = x, :-t = t]), r = 0 .. infinity, epsilon = 0.1e-3, method = _d01amc)); temp2 := evalf(Int(eval(integrand3, [:-x = x, :-t = t]), s = -L .. L, epsilon = 0.1e-3, method = _d01ajc)); res := temp1+temp2; if not res::numeric then lprint([x, t]) end if; res end proc

CodeTools:-Usage(approx_u(.5, .1))

memory used=485.92MiB, alloc change=28.00MiB, cpu time=2.23s, real time=2.02s, gc time=343.19ms

.6536368283

forget(`evalf/int`); forget(evalf); CodeTools:-Usage(plot3d(approx_u, 0 .. 1, 0 .. 2*Pi, grid = [13, 13], axes = boxed, labels = ["x", "t", "u(x,t)"], title = "Fokas Method of solution", shading = zhue, adaptmesh = false))

memory used=46.06GiB, alloc change=200.85MiB, cpu time=3.97m, real time=3.33m, gc time=51.14s

Download heat_equation_on_finte_interval_ac2.mw

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