Maple 2018 Questions and Posts

These are Posts and Questions associated with the product, Maple 2018

Probably I'm doing something severely wrong, but


does not evaluate to the geometric series result 1/(1-x), why?

Similarly this happens for the sum(x^n/n,n=1..infinity)


It works with Maple17 though.

Hi everyone !!

I have a problem to find a solution for some symbolic nonlinear equations. I used the solve command but it takes much time and finally, I stopped the process because doesn't give me a solution. I have attached the code. 

Please, help me


I*mu*A(t[2])*omega[0]*(1/2)-A(t[2])*omega[0]*(diff(B(t[2]), t[2]))+I*(diff(A(t[2]), t[2]))*omega[0]-(1/4)*A(t[2])^5*beta[2]*omega[0]^2-(1/4)*A(t[2])^3*beta[1]*omega[0]^2-(1/2)*F[0]*exp(I*sigma*t[2]-I*B(t[2]))+5*alpha[2]*A(t[2])^5*(1/16)+3*alpha[1]*A(t[2])^3*(1/8);

((1/2)*I)*mu*A(t[2])*omega[0]-A(t[2])*omega[0]*(diff(B(t[2]), t[2]))+I*(diff(A(t[2]), t[2]))*omega[0]-(1/4)*A(t[2])^5*beta[2]*omega[0]^2-(1/4)*A(t[2])^3*beta[1]*omega[0]^2-(1/2)*F[0]*exp(I*sigma*t[2]-I*B(t[2]))+(5/16)*alpha[2]*A(t[2])^5+(3/8)*alpha[1]*A(t[2])^3



-(1/2)*F[0]*exp(-I*(-sigma*t[2]+B(t[2])))+I*(diff(A(t[2]), t[2]))*omega[0]+(1/2)*(-2*(diff(B(t[2]), t[2]))*omega[0]+(-(1/2)*beta[2]*omega[0]^2+(5/8)*alpha[2])*A(t[2])^4+(-(1/2)*beta[1]*omega[0]^2+(3/4)*alpha[1])*A(t[2])^2+I*mu*omega[0])*A(t[2])



-(1/2)*F[0]*exp(-I*(-sigma*t[2]+B(t[2])))+I*(diff(A(t[2]), t[2]))*omega[0]+(1/2)*(-2*(diff(B(t[2]), t[2]))*omega[0]+(-(1/2)*beta[2]*omega[0]^2+(5/8)*alpha[2])*A(t[2])^4+(-(1/2)*beta[1]*omega[0]^2+(3/4)*alpha[1])*A(t[2])^2+I*mu*omega[0])*A(t[2])






C_t := -A(t)*omega[0]*(sigma-(diff(C(t), t)))-(1/4)*A(t)^5*beta[2]*omega[0]^2-(1/4)*A(t)^3*beta[1]*omega[0]^2-(1/2)*F[0]*cos(C(t))+5*alpha[2]*A(t)^5*(1/16)+3*alpha[1]*A(t)^3*(1/8) = 0;

-A(t)*omega[0]*(sigma-(diff(C(t), t)))-0.3297500000e-1*A(t)^5*omega[0]^2-0.8345000000e-1*A(t)^3*omega[0]^2-cos(C(t))+0.4059375000e-1*A(t)^5+.1249125000*A(t)^3 = 0



A_t := (1/2)*mu*A(t)*omega[0]+(diff(A(t), t))*omega[0]-(1/2)*F[0]*sin(C(t)) = 0;

0.5000000000e-2*A(t)*omega[0]+(diff(A(t), t))*omega[0]-sin(C(t)) = 0



F[0] :=2: w0 := 1: alpha[1]:=0.3331:alpha[2]:=0.1299:beta[1]:=0.3338:beta[2]:=0.1319:mu:=0.01:sigma=0:

sigma = `0:`




-A(t)*omega[0]*(sigma-(diff(C(t), t)))-0.3297500000e-1*A(t)^5*omega[0]^2-0.8345000000e-1*A(t)^3*omega[0]^2-cos(C(t))+0.4059375000e-1*A(t)^5+.1249125000*A(t)^3 = 0


0.5000000000e-2*A(t)*omega[0]+(diff(A(t), t))*omega[0]-sin(C(t)) = 0




Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations



 Atime:=odeplot( sol, [t, A],t=pRange, numpoints=10000 ):


odeplot(sol, [t, A], t = 0 .. 20, numpoints = 10000)





Currently, I have some definitions of modules and or functions in one worksheet, say A.

To reduce clutter in A, I'd like to open second worksheet, say B, and invoke the functions defined in A in the B worksheet. This way I keep the definitions in one worksheet, and the tests/trying them, in another worksheet.  I do this all the time in Mathematica. It useful, as I like to keep one notebook for just definitions, and second one for testing and calling the functions.

I just found out, that a function defined in worksheet is not "seen" in worksheet B.  I looked at options and settings, googled a little, but not able to find an option to allow me to do this. I tried Tools->General->Share one engine among all documents. Clicked Apply. But that still did not do it.  From worksheet B, it tells me it does know the function I am trying to call. Only in worksheet A it can see the function.

Is there an option to allow one to have the function definition be seen on all open worksheets?

I know I could save the functions as mpl files, and then load them in the second worksheet. But during development, the first method is easier.

Dear sir / madam

I'm a student of mechanical engineering and looking for some HPM ( homotopy perturbation method) maple codes with the related article to practice more in this field.
can I ask you for help?
unfortunately, I couldn't find any articles with maple solution about HPM.


As an exercise to gain familiarity with the maple programming platform, I am attempting to repackage a geometric algebra program written for Maple V as a module. I have attached file NewGlyph.mpl containing the initialization code for a module to support the GA routines in the package. The text file was created in the Maple code editor (Maple 2018) and loaded by reading it into a worksheet (configured for maple input instead of 2D math). I have two questions: one: how to get the GAinit procedure to execute completely, and two: to understand the puzzling warnings produced by the code editor.  The behaviour I observe when the module is loaded into a worksheet is: NewGlyph:= a maple id.  At this point the load=setup procedure has registered type blade, but not executed the remaining procedures in the setup routine. When I execute with(NewGlyph) the exported procedures are displayed properly.  However, I still have to execute the GAversion procedure and
the GA_addmetric procedure manually to properly initialize the metric table in the module. It would appear that the module load process permits the execution of the addtype procedure but not the output of the version procedure or the metric table constructor. Is there a way to autoexecute these procedures when the NewGlyph module is invoked by the with(NewGlyph) command? Are there any criteria for the kinds of processes that can be included using option load=setup? My second question concerns the compiler warning raised by the code editor.  It warns that "These names were used as global names but were not declared: blade, sig. Also "These local variable were assigned a value but not otherwise used: cleanup.

NewGlyph := module ()
description "Basic Geometric Algebra Functions";
local setup, cleanup;
global e;
export GAversion,GAinit, GAadd_metric,GAmetric,GAmv;
option package, load = setup, unload = cleanup;

setup := proc ()
TypeTools:-AddType(`blade`, proc (a) type(a, indexed) and op(0, a) = 'e' end proc);
end proc;
end proc;

GAinit := proc()
global `&@`, `&.`, `&^`, `&x`, `&s` , `&/`, `&l`, `&v`;
protect('`&@`','`&.`', '`&^`', '`&x`', '`&s`', '`&/`', '`&l`', '`&v`');
GAadd_metric('default', signum, -infinity, infinity);
GAadd_metric('SA', proc () 1 end proc, 1, 3);
GAadd_metric('STA', proc (i) `if`(i = 0, 1, -1) end proc, 0, 3);
GAadd_metric('MSTA', proc (i) `if`(modp(i, 4) = 0, 1, -1) end proc, 0, infinity);
GAadd_metric('Homogeneous', proc () 1 end proc, 0, infinity);
GAadd_metric('Conformal', proc (i) `if`(i = -1, -1, 1) end proc, -1, infinity);
end proc:

GAversion := proc ()
print(`GA Package`);
print(`Version 2.0`);
print(`Written by: Mark Ashdown,`);
print(`Extended by: Alan Macdonald,`);
print(`Re-Packaged for Maple 2018 by: Ian McCreath`);
end proc;

GAadd_metric := proc (fred::name, signature::procedure, minind::{integer, infinity}, maxind::{integer, infinity})
global MetricTable;
MetricTable['fred'][sig] := eval(signature);
if maxind < minind then
ERROR(`The minimum index is greater than the maximum index`)
end if;
MetricTable['fred'][min] := minind;
MetricTable['fred'][max] := maxind;
print(`The GA package knows about metric ` . fred . `.`)
end proc:

GAmetric := proc (a::name)
global Metric, Sig, MetricTable, MinIndex, MaxIndex;
if member([a], [indices(MetricTable)]) then
unprotect('Metric', 'Sig', 'MinIndex', 'MaxIndex');
Metric := a;
Sig := MetricTable[Metric][sig];
MinIndex := MetricTable[Metric][min];
MaxIndex := MetricTable[Metric][max];
protect('Metric', 'Sig', 'MinIndex', 'MaxIndex');
print(`Metric is now set to: ` . Metric)
ERROR(`The metric ` . a . ` is unknown to the GA package`)
end if
end proc:

# Creates multivector with name x of with grade or set of grades g with
# indices ind
GAmv := proc(x::name,g::{nonnegint,set(nonnegint)},ind::set(integer))
local i;
if g::set then
add(procname(x,i,ind), i=g)
elif g > nops(ind) then
ERROR(`grade too large for number of indices.`)
elif g=0 then
add(x[op(i)]*e[op(i)], i=combinat:-choose(sort([op(ind)]),g))
end if

end module;

Download NewGlyph.txt


When running this code in Maple 13 and 16 this works just fine,

GenMs:= (k::posint)-> assign(m||(1..2*k) =~ seq([dx||i, dy||i][], i= 1..k)):
GenMs(k), m || (1 .. 2*k);
gln := evalDG(l1 &s n1+`&s`(l2, n2)+sum('epsilon || i'*(cat(m, 2*i-1) &s cat(m, 2*i-1)+cat(m, 2*i) &s cat(m, 2*i)), i = 1 .. k));

But running the same code in Maple 2018 I get the following error:

Error, (in DifferentialGeometry:-Tensor:-SymmetrizeIndices) expected 1st argument to be a tensor. Received: `m2*i-1`^2

I don't know if it's related to Maple 2018 screwing with my tensor formatting:


For whatever reason I just noticed that my inline &t's have been turned into `&t` but that's a separate issue.

I am learning how to do parsing in Maple. 

I want to check that a user supplied an expression with correct argument to y(*) from some complicated expression. So I need to find all instanced of y() to check that its agument is only y(x) and nothing else.  For example, given this 


I need to obtain all these y(anything), like this

No matter where they show up in the expression. The above is just some made up example. The actual input will be a differential equation, and I want to check that the dependent variable y(x) has only x as its argument.

So I did the following


The problem now, is how to scan this list and check that each entry in it, the "y" in there has form y(x) and nothing else, so I can reject or accept the input. For example, the first one above is Ok, so the second one, but the third is not, since it function of z and not x. #4 is OK, #5 is not OK, since it has y without (x), and the last one is no OK, since it has 3 arguments, and so on.

I am not good in pattern matching in Maple. do I need to check match() for this? or patmatch()? If given single expresion like y(x), then I can handle it. I do something like

if type(expr,'function') and nops(expr)=1 and op(0,expr)=y and op(1,expr)=x then
   print("not ok");

But when the expression gets more complicated, like 1/y(z), then I need to check other things, and things gets complicated quickly. I think pattern matching is needed? or is there a better approach to do this that works in general? 

How does Maple do it internally? When I type


Error, (in dsolve) found the indeterminate function y with different arguments {y(x), y(z)}


Error, (in dsolve) found the indeterminate function y with different arguments {y(x), y(z)}


So I need to do the same thing as Maple does. I looked at dsolve() code, but did not understand it how or where it does the parsing. 

I am using this proc by Carl Love posted here

TSprintf:= proc() 
   local e;
   uses T= Typesetting; 
   T:-mrow(seq(`if`(e::string, T:-mn(e), T:-Typeset(T:-EV(e))), e= [args])) 
end proc:

when I do 

         TSprintf("Solving ", diff(y(x),x)=x);   

it works fine and it prints on the screen as expected. 

The problem is that inside a proc, if I use an error() later on, the message do not show up

   TSprintf("Solving ", _passed);   
   error "opps"
end proc;

And now when I call it like this 

      Error, (in foo) opps   # Where the message "solving...." gone?? it does not show on the screen

I only see the "opps" and never see the message.  If I remove error(), then it shows up. But with standard printf, both show up

   printf("Solving %a", _passed); 
   error "opps";
end proc;

    Solving diff(y(x),x) = x  # printf message shows OK
    Error, (in foo) opps      # from error 

Why TSprintf message do not show up if there is an error() after it?

I am learning to use module().  If one has a local private proc() inside  a module, then on calling this local proc from inside the module itself, does one need to call it using module_name:-local_proc() or is it safe  to just call it using local_proc()?

i.e. will Maple always look to resolve this name inside the module first, before looking outside? What order Maple uses to resolve names? 

Here is an example

private_proc:= proc()
    print("Opps, should not be calling this, global copy");
end proc;

foo :=module()
    local private_proc;
    export public_proc;

        print("inside private");
    end proc;

   public_proc:= proc()
        private_proc(); #will this always call foo:-private_proc() and not
                        #any other global proc with that name?                 
   end proc;

end module;


gives "inside private". So it seems to work without having to use foo:-private_proc(). But I thought to ask if the above will always work like this. 

I really like the new updated code region in Maple 2018. I am now using for everything.

One thing though I can't find out, is how to automatically indent/format code? Having to keep doing this by hand is tyring.

Matlab for example have smart indent. In the editor, one selects the code to indent, or select all, then just click on indent and it will automatically auto-format. I use it alot.

Not able to find such command in Maple. Is this something that will be added in future release? This is really very important feature.

I only just noticed the file being always number 1 in my Recent document list.  I don't recall it being there, ever, and I don't think it should.  Why is it there now?  Anyone else have this?

Hi All,

I recently switched from Maple 18 to Maple 2018. I was trying to execute and old worksheet created with Maple 18 in which a DAE have to be solved numerically. In Maple 18 the worksheet works flawlessly whereas Maple 2018 throws 'Error, (in dsolve/numeric/process_input) invalid specification of initial conditions...'

Initial conditions are given in the form {x1(0) = 1, x2(0) = 2, D(x1)(0) = 1, D(x2)(0) = 0 ....} and are the same in both cases ( I merely executed without any modification the same worksheet in the two Maple versions).

I feel I've missed out something in the changelog... any idea on what is happening?

PS. call to dsolve

dsolve(dsys_numeric, numeric, implicit = true, stiff = true, optimize = true, compile = true):



Hi Guys :)


I need some Help with solving a nonlinear system. 

I have 3 equations.

These 3 equations have 7 unknown variables in it. But 5 of them are constants which I don't want to solve. I just want to solve three of them.

I tried it with fsolve but I always get the error :

fsolve({eq1, eq3, eq5}, {a, b, c});
Error, (in fsolve) {eq1, eq3, eq5} are in the equation, and are not solved for


i tried to define the variables as Parameters but then i get this error: 

Parameters(t1, t2, t3, t4, t5, t6, t7, b1, t, v1, v2, s1, s2, j, a, b, c);

fsolve({eq1, eq3, eq5}, {ca, cb, cc});
Error, (in fsolve) {b1, eq3, eq5, j, t, t1, t2, t3, t4, t5, t6, t7} are in the equation, and are not solved for

Here is the script :

 has sb an Idea?


First 40 41 42 43 44 45 46 Page 42 of 46