16566 Reputation

29 Badges

14 years, 16 days

On google groups. (comp.soft-sys.math.maple and sci.math.symbolic)

On stackoverflow.


MaplePrimes Activity

These are answers submitted by acer

In Maple 2018 and Maple 2019 something similar attains without having to specify method=ftocms for the int command.

Below I use Maple 2017.2,



   Maple 2017.2, X86 64 LINUX, Jul 19 2017, Build ID 1247392

ig := R^2/(cosh(2*R)+cosh(rho))^2:

res := int(ig, R=-infinity..infinity, method=ftocms) assuming rho::real:



eval(res, rho=1.2);


evalf(Int(eval(ig, rho=1.2), R=-infinity..infinity));


You asked why it goes wrong. It looks like the undesirable infinite result is coming out of the ftoc method (using regular series and limit).

Let's just take a rough look at the indefinite integration result, and compare :-limit vs Multiseries:-limit .

foo := int(ig, R):

limit(foo, R=infinity) assuming rho>0:


MultiSeries:-limit(foo, R=infinity) assuming rho>0:
lprint(simplify(%)) assuming rho>0;


alt := MultiSeries:-limit(foo, R=infinity)
       - MultiSeries:-limit(foo, R=-infinity) assuming rho>0:

altres := simplify(alt) assuming rho>0:



eval(altres, rho=1.2);


[edit] In Maple 2019.1 the result attains for int even with method=ftoc, and :-limit also handles the latter computation.

Why the need to post this in a whole new Question thread? It simply duplicates this earlier topic, and senselessly splits the responses. (And you were provided a few robust and fast ways to compute a floating-point result in Answers in that thread.)

In your definition of operator L you have just speed and not speed(t). But you subsequently redefined speed as an operator. So you have confused expressions and operators.

You may have intended something like,
   L := proc(b) local t; int(speed(t), t = 0 .. b); end proc;

Do you think that symbolic int will be able to handle all your examples or r, for symbolic upper bound b? Why not stick with floating-point approximation as in your previous example?

What are you planning to do when the symbolic integration takes a very long time? Or when the equation involving the symbolic integration result cannot be solved explicitly for name b? Or when -- for nonnumeric upper bound b - the symbolic integration with method=ftoc runs amok while method=elliptic produces a result with special function calls that evaluates more slowly?

What are you really trying to accomplish with this entirely symbolic approach?

In the following attachment I illustrate some of the issues with your approach, and once again demonstrate a fast root-finding approach.

For some reason Mapleprimes is not inlining my attachments today.

I am guessing that you are using Maple 2019.

You'll need interface(typesetting) to be set to extended, and Typesetting:-Settings(useprime) to return true.

You can set those as follows,

The attachment illustrates your example. It also shows how 2D Output can get the same effect of derivatives using prime notation, and how the dependency can be visibly suppressed in the 2D Output.

Here are some worksheets, with it laid out for you.

Here are some ideas, including some various kinds of automatic application.

Note that calling a blanket expand on expressions containing ``() function calls may expand more than you wish. Similarly calling blanket value on expressions containing inert % calls may make more than you wish active.



`Maple 2018.2, X86 64 LINUX, Nov 16 2018, Build ID 1362973`

ee := (x^3-2*x^2+5*x-7) * x%^(-1);

(x^3-2*x^2+5*x-7)*`%^`(x, -1)

ff := (1/x) %* (x^3-2*x^2+5*x-7);

`%*`(1/x, x^3-2*x^2+5*x-7)


Display(ee, inert=false);

(x^3-2*x^2+5*x-7)*`%^`(x, -1)

Display(ff, inert=false);

0, "%1 is not a command in the %2 package", _Hold, Typesetting

value(ee), value(ff);;

(x^3-2*x^2+5*x-7)/x, (x^3-2*x^2+5*x-7)/x

eval(ee, `%^`=`^`), eval(ff, `%*`=`*`);

(x^3-2*x^2+5*x-7)/x, (x^3-2*x^2+5*x-7)/x

Value(ee), Value(ff);

(x^3-2*x^2+5*x-7)/x, (x^3-2*x^2+5*x-7)/x


gg := (x^3-2*x^2+5*x-7) * x^``((-1));


hh := ``(1/x) * (x^3-2*x^2+5*x-7);







`print/%*` := proc()
  InertForm:-Display(`%*`(args), ':-inert'=false);
end proc:

`print/%^` := proc()
  InertForm:-Display(`%^`(args), ':-inert'=false);
end proc:


kk := (x^3-2*x^2+5*x-7) * x%^(-1);

(x^3-2*x^2+5*x-7)*`%^`(x, -1)

mm := (1/x) %* (x^3-2*x^2+5*x-7);

`%*`(1/x, x^3-2*x^2+5*x-7)

InertForm:-Value(kk), InertForm:-Value(mm);

(x^3-2*x^2+5*x-7)/x, (x^3-2*x^2+5*x-7)/x

eval([kk, mm], [`%^`=`^`, `%*`=`*`]);

[(x^3-2*x^2+5*x-7)/x, (x^3-2*x^2+5*x-7)/x]

value(kk), value(mm);

(x^3-2*x^2+5*x-7)/x, (x^3-2*x^2+5*x-7)/x

expr := A(x)/(x*y*K^(b));


foo := numer(expr) * denom(expr)%^(-1);

A(x)*`%^`(x*y*K^b, -1)

InertForm:-Value(foo), value(foo);

A(x)/(x*y*K^b), A(x)/(x*y*K^b)


`print/%/` := proc()
  local num, den, S;
  uses Typesetting;
  if nargs<>2 then return `%/`(args); end if;
  S := {`+`,`*`,specfunc(anything,{Int,int})};
  (num,den) := Typeset(EV(args[1])), Typeset(EV(args[2]));
  if args[1]::S and nops(args[1])>1 then
    num := mfenced(num);
  end if;
  if args[2]::S and nops(args[2])>1 then
    den := mfenced(den);
  end if;
end proc:

bar := (x^3-2*x^2+5*x-7) %/ (x*y*K^(b));

`%/`(x^3-2*x^2+5*x-7, x*y*K^b)

InertForm:-Value(bar), value(bar);

(x^3-2*x^2+5*x-7)/(x*y*K^b), (x^3-2*x^2+5*x-7)/(x*y*K^b)

blah :=  (x^3-2*x^2+5*x-7) %/ (x);

`%/`(x^3-2*x^2+5*x-7, x)

InertForm:-Value(blah), value(blah);

(x^3-2*x^2+5*x-7)/x, (x^3-2*x^2+5*x-7)/x

boo := Int(f(x),x) %/ (a+b);

`%/`(Int(f(x), x), a+b)

eval(boo, `%/`=`/`)

(Int(f(x), x))/(a+b)



How about scaling the problem by exp (eg, taken at the largest argument of the present calls to sinh for B>0)? Or something similar.



`Maple 2019.1, X86 64 LINUX, May 21 2019, Build ID 1399874`

detA:= -(-((-16*cosh(beta*`&ell;`*xi[2])*sinh(beta*`&ell;`)+16*sinh(beta*`&ell;`*xi[2])

xi1_val:= 0.05: xi2_val:= 0.10: ell_val:= 12:

H := subs([xi[1] = xi1_val, xi[2] = xi2_val, `&ell;` = ell_val], detA):

HH := combine(subsindets(combine(H),specfunc(anything,{sinh,cosh}),u->convert(u,exp)));


fact := max(%) assuming beta>0;

{-12.00*beta, -11.40*beta, -10.80*beta, -1.20*beta, -.60*beta, .60*beta, 1.20*beta, 10.80*beta, 11.40*beta, 12.00*beta}


new := collect(combine(HH/exp(fact)),exp,simplify);


Student[Calculus1][Roots](new, 1 .. 15, numeric);

[5.235987756, 10.47197551]



You haven't said just how the values of those other parameters may vary, so it's not so easy to be general about handling that.

Alternatively, you could raise the working precision (Digits), but that is slower.

[edit] If you notice that all the terms in new are products involving sin of multiples of 0.6*beta then it's not difficult to see that the roots you've mentioned are at 5*Pi/3 and 10*Pi/3, which concurs with what Axel showed. In Maple 2019.1 the solve command can find those too, if given the expanded form of the expression.

solve({expand(H), beta>0, beta<15});
Warning, solutions may have been lost
           {beta = 5.235987758}, {beta = 10.47197551}

solve({expand(convert(H,rational,exact)), beta>0, beta<15});
Warning, solutions may have been lost
                /       5   \    /       10   \ 
               { beta = - Pi }, { beta = -- Pi }
                \       3   /    \       3    / 

What precisely do you mean by your use of the term define here?

How are you planning on using this Matrix or its entries, such that this effect is seen?

Is it enough to place assumptions on the names that are the values of the entries?


k:=1: M:=1:



Matrix(2, 2, {(1, 1) = u[1, 1], (1, 2) = u[1, 2], (2, 1) = u[2, 1], (2, 2) = u[2, 2]})

map(p->is(p>1), U);

Matrix(2, 2, {(1, 1) = true, (1, 2) = true, (2, 1) = true, (2, 2) = true})

type(U, 'Matrix'(satisfies(p->is(p>1))));


andmap(p->is(p>1), U);


map(p->sqrt((p-1)^2), U);

Matrix(2, 2, {(1, 1) = u[1, 1]-1, (1, 2) = u[1, 2]-1, (2, 1) = u[2, 1]-1, (2, 2) = u[2, 2]-1})



I manually inserted the page-breaks using the GUI. Then I exported as PDF.

The file uses DocumentTools:-Tabulate. You could optionally call that command so that the interior and/or exterior borders of the Tables were suppressed.

And of course you can play with the number of graphs per row, etc. And you could also adjust the font size for the vertex labels (changing the value that I forced).

The 2D Input for your worksheet's last computation is corrupted and missing in the .mw file.

Here is what I was able to recover. It has only the output for that last computation.

@Jayaprakash J If you are using a version as old as Maple 17 then you should mark that as the product and version when you first submit your Question.  (You have a habit of marking them as Product=Mapleprimes, which is incorrect. I have adjusted this Question.)

In Maple 17 you could execute the following call to Explore.




Explore(F(B,C),parameters=[B=-5...5., C=-5...5.]);

Explore won't produce an animation even when called with options, in Maple 17. It produces an interactive interface with sliders which you have to move yourself. If you want an actual animation that can be played then you should answer my query about how you want B and C to change as it plays.

In order to have your package be automatically available by virtue of utilizing a path in libname you need to store the module in a Maple Library Archive file. That means storing it in a .mla file and not a .mpl file.

Try this, in a session in which your package module MyModule is defined,

LibraryTools:-Save(MyModule, "/Users/eduardo/maple/toolbox/personal/lib/MyPackage.mla");

And then,


That leaves the matter of automatically augmenting libname. You wrote of using a .mapleinit file. What Operating System are you using? Is it OS X? Where did you put that file?

If we cannot get an initialization file to work for you then there are alternatives. If your home directory is in fact "/Users/eduardo" then the above LibraryTools calls may make it all work already, without your even having to augment libname as a I did above. That's because toolbox lib directories in the appropriate location get automatically appended to libname by Maple.


There seemed to be some unclosed XML elements in line 957 of the .mw file itself. (In the worksheet that seems to be section titled "Øvelse 2.2".

If I add the closing XML tags in manually (in an external editor) then the resulting .mw file loads in the Maple 2019.1 GUI without warning messages. The Sections that follow that now appear, although that particular Section may or may not be what you had originally.

Here is the resulting file:

It may be prudent for you to make backups at judicious times as you progress in your ongoing work with this file (with various different filenames).

Here are two ways.

The type approach may be a bit faster (if you have very many small lists, or a very long list).






I'm not entirely sure what your problem case is. That's because you have not provided code that reproduces the issue. You have provided only a procedure and a vague description that things goes badly when something else calls that procedure.

I can imagine that one problem might be that you are trying to use the index 0, which is not guarded for by your conditional. Note that you cannot index a list by the position 0. I adjust the conditional for that case below.

Another possible difficulty might be premature evaluation where you call f with an unassigned symbolic argument. Your description mentions that you dealt with some prior, similar issues using `` quotes, ie. single left quotes or name quotes. You probably meant single right quotes instead (ie. unevaluation quotes), in order to delay evaluation or prevent premature evaluation. Below I show an alternative to using unevaluation quotes, which may be more robust since single right quotes may get stripped off inadvertantly by intermediate evaluation.

The following supposition that you stated, about how Maple evaluates procedure bodies, is completely wrong. You wrote, "It seems that maple tries to evaluate everything in the proc regardless of the actual inputs used or the if statements before the evaluation(unlike traditional programming which can be sequentially reasoned)."

The problems likely stem from how you are calling your procedure f. That's why code that can be run to reproduce an equivalent failure is important.

Perhaps this will help.

f := proc(i) local A;
  if not i::numeric then return 'procname'(args); end if;
  A := [3,4,5];
  if i <= 0 then return 0; fi;
  return A[i]; end proc:



seq(f(k), k=-4..3);
                     0, 0, 0, 0, 0, 3, 4, 5


foo := f(max(0,j-1));
                    foo := f(max(0, j - 1))

eval(foo, j=0);

eval(foo, j=2);

eval(foo, j=-1);

In Maple syntax the equation of a plane could be entered as,


Or, in 2D Input mode you could put a space between a coefficient like 2 and the x, or 2 and z.

But 2x is not valid input.

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