Maple 2020 Questions and Posts

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

Example of problematic file:

Maple 2020 (either 32- or 64-bit), Maple 2019, and Maple 2017 cannot open a .mw file that I created in 2006.  These Maple versions display this .mw file from 2006 as a garbled mess and cannot work with the garbled mess.  In contrast, Maple 18 opens this file from 2006 without problems.  Did the .mw file format change some time after Maple 18?  Interestingly, Maple 2020 can open a .mw version of the problematic 2006 file that I save with Maple 18.  Can Maple 2020 be updated so that Maple 2020 can open old .mw files (e.g., 2006 and earlier)?  Is the inability of Maple 2020 to open files from 2006 and earlier a bug in Maple 2020?  I can workaround this problem by using Maple 18.  But correcting a bug in Maple 2020 that garbles old .mw files would be helpful.

im solving 2 ODe with boundary conditions.. i got this error Error, (in dsolve/numeric/bvp/convertsys) too few boundary conditions: expected 10, got 8

from help, it says 

The expression assuming property calling sequence evaluates the expression under the assumption property on all names in expression.

Then why 

expr := Sum((-1)^n - 1, n = 1 .. infinity):
simplify(op(1,expr)) assuming n::even;

does not simplify expr to zero, while

expr := Sum((-1)^n - 1, n = 1 .. infinity):

does simplify expr to zero.

I would have expected both to give zero. 


I am trying to customize the Venn Diagram generated by the VennDiagram command in the Statistics package. I would like to be able to shade just any of the regions. For example, if only two sets (A and B) are being displayed, I would like to be able to shade just A, just B, both A and B, or both A and/or B. Also, is it possible to have a rectangle surrounding the circles which represents the universal set? Could the circles be labeled with the letter "A" or "B" to be able to identify each set?

Why is pdsolve's 'generalsolution' option giving the particular solution u(x, y) = 0 instead of the general solution u(x, y) = A sin(x) sin(2 y) + sin(2 x) sin(y) for the attached problem?

Is there a way to convert a Fourier series (from the OrthogonalExpansions package) automatically into the sum of odd/even terms if the even/odd terms are 0 respectively?




FourierSeries(x-2*Pi, x = 0 .. 4*Pi, infinity, series = cosine); simplify(subs(i = n, %))

Sum(8*((-1)^n-1)*cos((1/4)*n*x)/(n^2*Pi), n = 1 .. infinity)


Sum((-16*cos((1/4)*(2*k-1)*x))*(1/((2*k-1)^2*Pi)), k = 1 .. infinity)

Sum(-16*cos((1/4)*(2*k-1)*x)/((2*k-1)^2*Pi), k = 1 .. infinity)




@Carl Love

This Carl code works

Could someone please make my modified code work:

(Case D should be the same as P-Q=0 , when integer score P,Q is entered and P=Q)

EDIT: corrected and reuploaded: should have been if P-Q <> 0 rather than P-Q=0. changes in purple.

(ps I don't want a substitution D when P-Q=0)

Is there a way to get the generalized Fourier series with respect to an arbitrary orthogonal system (instead of just sin, cos, exp, etc.) using the OrthogonalExpansions package or any other way in Maple?

Having read-only, public proprty of class is very useful. But I am not able to see if Maple supports this.

The idea is to have an object with public variable that can only be read from outside. But to change it, one must call a setter() method.  The advantage of this over having a getter() method to read the variable back is that it simplifies the code and makes it easier to read.  

There is good discussion here on this subject  

and  :

"A property, in some object-oriented programming languages, is a special sort of class member, intermediate in functionality between a field (or data member) and a method. The syntax for reading and writing of properties is like for fields, but property reads and writes are (usually) translated to 'getter' and 'setter' method calls. The field-like syntax is easier to read and write than many method calls"


In Maple, if I make the variable inside the object an export then now one can not only read it, but also change it from outside. I want to allow only reading from outside. Here is an example

module my_class()
  option object;

  export name::string; #made it export to allow direct reading
  export set_name::static:=proc(o::my_class,name::string)
      o:-name := name;
  end proc;

end module;

And now one can do

o:-name;  #read it

But one can also change it from outside by doing o:-name:="new name";  and this ofcurse breaks the whole idea of encapsulation.

I think allowing reading only of object variables is OK and many OO language allow this. They are called properties.

If the variable above is made local, then one can not read it directly, and a getter() method is needed for each object properties, in addition to setter() method.

Is it possible in Maple to make local object variables read only from outside? If not and if Maplesoft wants to improve its OO, this will be something useful to add for next version.


When I try to substitute a value for j, it doesn't evaluate.

Is it possible in Maple to add new type, and assign initial/default value that the variable of that type will take on?

I can't figure if this is possible or not and if it, what is the correct syntax. This is something very common in strong typed Language such as Ada for example.

For example, in Ada one can create new type wiith default value like this

              type My_Float is digits 20   with Default_Value => 0.5;

Later on, when declaring variable of the above type, if no explicit value is given then, then the variable will have the value 0.5

             A: My_float;

Or one can override the default value:

             A: My_float := 0.1;

I am trying to do the same with Maple using that handle in AddType(typename, handler)

But no success. Here is an example

TypeTools:-AddType(age_type,t->evalb(t::nonnegint and t>0 and t<150));

Now, I want to change the above to tell TypeTool to have default value as say 30. So when I do 


Then the variable p will have value of 30 automatically.

Is this possible in Maple? 


After a little bit of trying things, I came up with this. May be not prefect, but does what I want for now.

The idea is to make the initialization of the variable, as a proc() which takes in default values. I plan to use this for record types, so this example below is meant for this use, but the idea is the same for other types.

TypeTools:-AddType(age_type,t->evalb(t::nonnegint and t<150));
TypeTools:-AddType(name_type,t->evalb(t::string and StringTools:-Length(t)<100));
make_person_type:=proc({the_age::age_type:=30, the_name::name_type:="joe doe"},$)::person_type;
   local p::person_type;
   return p
end proc;


And now one can make a variable of new type, which takes in default values like this


which returns 

              p := Record(age = 30, name = "joe doe")

And to set specific initial values:


Which returns

            p := Record(age = 35, name = "joe doe")

It would have been better is Maple allows one to set the default value for type when it is defined, so everything is in one place and there would have been no need to make an explicit proc() for to set the initial value of the variable.

Does anyone know why pdetest is not giving [0, 0, 0] for the solution of pdsolve?


eq := diff(u(x, t), t)-k*(diff(u(x, t), x, x)) = 0

diff(u(x, t), t)-k*(diff(diff(u(x, t), x), x)) = 0


ic := u(x, 0) = g(x)

u(x, 0) = g(x)


bc := (D[1](u))(0, t) = 0, eval(diff(u(x, t), x)+u(x, t), x = 1) = 0

(D[1](u))(0, t) = 0, eval(diff(u(x, t), x), {x = 1})+u(1, t) = 0


sol := `assuming`([simplify(pdsolve([eq, ic, bc]))], [k > 0, 0 < x and x < 1, t > 0])

u(x, t) = `casesplit/ans`(Sum(4*exp(-k*lambda[n]^2*t)*lambda[n]*cos(lambda[n]*x)*(Int(g(x)*cos(lambda[n]*x), x = 0 .. 1))/(2*lambda[n]+sin(2*lambda[n])), n = 0 .. infinity), {And((sin(lambda[n])*lambda[n]-cos(lambda[n]))/cos(lambda[n]) = 0, 0 < lambda[n])})


`assuming`([simplify(pdetest(sol, [eq, ic, bc]))], [k > 0, 0 < x and x < 1, t > 0])

[-(diff(diff(`casesplit/ans`(sum(4*exp(-k*lambda[n]^2*t)*lambda[n]*cos(lambda[n]*x)*(Int(g(x)*cos(lambda[n]*x), x = 0 .. 1))/(2*lambda[n]+sin(2*lambda[n])), n = 0 .. infinity), {And(-(1/2)*(I*lambda[n]*exp(I*lambda[n])-I*lambda[n]*exp(-I*lambda[n])+exp(I*lambda[n])+exp(-I*lambda[n]))/cos(lambda[n]) = 0, 0 < lambda[n])}), x), x))*k+diff(`casesplit/ans`(sum(4*exp(-k*lambda[n]^2*t)*lambda[n]*cos(lambda[n]*x)*(Int(g(x)*cos(lambda[n]*x), x = 0 .. 1))/(2*lambda[n]+sin(2*lambda[n])), n = 0 .. infinity), {And(-(1/2)*(I*lambda[n]*exp(I*lambda[n])-I*lambda[n]*exp(-I*lambda[n])+exp(I*lambda[n])+exp(-I*lambda[n]))/cos(lambda[n]) = 0, 0 < lambda[n])}), t), `casesplit/ans`(Sum(4*lambda[n]*cos(lambda[n]*x)*(Int(g(x)*cos(lambda[n]*x), x = 0 .. 1))/(2*lambda[n]+sin(2*lambda[n])), n = 0 .. infinity), {And(-(1/2)*(I*lambda[n]*exp(I*lambda[n])-I*lambda[n]*exp(-I*lambda[n])+exp(I*lambda[n])+exp(-I*lambda[n]))/cos(lambda[n]) = 0, 0 < lambda[n])})-g(x), eval(diff(`casesplit/ans`(Sum(4*exp(-k*lambda[n]^2*t)*lambda[n]*cos(lambda[n]*x)*(Int(g(x)*cos(lambda[n]*x), x = 0 .. 1))/(2*lambda[n]+sin(2*lambda[n])), n = 0 .. infinity), {And(-(1/2)*(I*lambda[n]*exp(I*lambda[n])-I*lambda[n]*exp(-I*lambda[n])+exp(I*lambda[n])+exp(-I*lambda[n]))/cos(lambda[n]) = 0, 0 < lambda[n])}), x), {x = 0}), eval(diff(`casesplit/ans`(Sum(4*exp(-k*lambda[n]^2*t)*lambda[n]*cos(lambda[n]*x)*(Int(g(x)*cos(lambda[n]*x), x = 0 .. 1))/(2*lambda[n]+sin(2*lambda[n])), n = 0 .. infinity), {And(-(1/2)*(I*lambda[n]*exp(I*lambda[n])-I*lambda[n]*exp(-I*lambda[n])+exp(I*lambda[n])+exp(-I*lambda[n]))/cos(lambda[n]) = 0, 0 < lambda[n])}), x), {x = 1})+`casesplit/ans`(Sum(4*exp(-k*lambda[n]^2*t)*lambda[n]*cos(lambda[n])*(Int(g(x)*cos(lambda[n]*x), x = 0 .. 1))/(2*lambda[n]+sin(2*lambda[n])), n = 0 .. infinity), {And(-(1/2)*(I*lambda[n]*exp(I*lambda[n])-I*lambda[n]*exp(-I*lambda[n])+exp(I*lambda[n])+exp(-I*lambda[n]))/cos(lambda[n]) = 0, 0 < lambda[n])})]





inside my module, I create types to be used by only procs, and other sub modules inside the main one package I have.

but TypeTools:-AddType invoked inside my package, adds the type to system. So a user after loading the package can still see it and use this type.

Adding local before TypeTools:-AddType is not supported.

How to make the type only visible inside the package? Here is example

 option package;
 TypeTools:-AddType(age_type,t->evalb(t::nonnegint and t<150));
 export foo:=proc()
    local age::age_type:=20;
 end proc;
end module;


And now a user can do this


It worked, since age_type is now in the system. This can also cause a problem, since loading this package, could overwrite a type name allready set there by another package the user happened to load before.

If I can make it at least such that the user has to do 


That would be better. But the best solution is to make the type name completely not visible from outside the package. i.e. private type to the package only.

I looked at Extension Mechanisms under typetools in help, but do not see how to use that for what I want.


Maple 2020.1

Any idea why Maple can simplify this expression only when multiplied by -1 but not otherwise?

expr:=sqrt(-2 + 2*I*sqrt(3));

But now


Multiplying by -1 should not have mattered. Becuase -2 + 2*I*sqrt(3)=(1+I*sqrt(3))^2  Therefore sqrt(-2 + 2*I*sqrt(3)) is the same as 1+I*sqrt(3) and Maple knows this:

simplify((1 + sqrt(3)*I)-expr) gives zero.

But Maple only simplifies -expr  and not +expr.

Just wondering is someone can suggest why that is and if this is considered OK?

Maple 2020.1, Physics 724


I need to check if the solution (sols) of a (nonlinear) polynomial system of equations (the coefficients are not numeric) has only one solution for, let's say, y and (one solution for y and one solution for z).  I cannot use allvalues (not threadsafe according to CodeTools:-ThreadSafetyCheck) and then count the number of solutions. 

I have removed all solutions that fit the command 


(RootOf works too).  (Please tell me if I am using ormap correctly).  

Even using the above command and then checking if nops(sols)=1, not all one solutions are caught.  

Many thanks






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