Maple 2020 Questions and Posts

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

This is the context: I call LinearAlgebra:-LinearSolve to solve system of linear equations. If there are infinite solutions, then Maple return the solution that has free variables, calling them using  _t[n] where can change each time and be different. It can also be _t0[n] and _t1[n] etc.. but these all are indexed variables.

I want to obtain a list of all these free variables in the resulting solution vector, so that later I can assign them some values.

But I do not know what can be. And how many of them there are. There could be _t[3] and _t[4] for example in the same solution vector.

Here is what I do now, where I just check for indexed type. This seems to work, since only _t[n] should be in the resulting solution if any.

restart;
A:=Matrix([[0,1,-1],[-1,-2,2],[-1,-2,2]]):
v:=Vector([-1,1,1]):
sol := LinearAlgebra:-LinearSolve(A,v);

map(x->select(type,x,'indexed'),convert(sol,set))

I do not know how to tell it to look for all something that starts with  _t and also indexed type.

Is there a better way to obtain list of all _t[n] that LinearAlgebra:-LinearSolve could return? Will LinearAlgebra always return the free variables as indexed variables so I am sure the above will always work?  Do you see a problem with the above solution?

It is annoying that some functions in Maple wants input like (a,b,c,.....) which represents numbers, and I am not able to find how to use such a function, because the list of numbers I have are in a list.

For example, ilcm and igcd.  This is not a good design. The input should have been a list or set, or vector, etc.... 

I wanted to find least common multiplier of a list of numbers. These numbers are allready in a list, since this is a result of a computation done earlier. Now I want to find ilcm of them. 

How to use ilcm in this case? How to unpack them to make ilcm happy? In Mathematica there a special function to do this, called Sequence, which takes a list and unpack it to call function. 

But I am not able to find one in Maple. There is no convert(list,exprseq). 

Here is a MWE

v:=[2,4,7];
ilcm( v ); #does not work, since ilcm does not accept a list

The variable v above has to be in a list (or set, or vector). This is result from another computation. This is all done non-interactive. 

So I am looking for some magic function to use it like this

v:=[2,4,7];
ilcm( convert_to_expression_sequence(v) )

Is there a way to unpack or convert list to expression sequence, so I can use ilcm?

This is my attempt. But I suspect there is a build-in way in Maple to do this which I have not found yet.

restart;

convert_list_to_exprsequence:=proc(L::list)::exprseq;
local r:=NULL,item;

for item in L do
    r:=r,item;
od;

return r;
end proc:

v:=[2,4,7];
ilcm(convert_list_to_exprsequence(v)); #now it works

                  #28

Maple 2020.1

How I can find the coefficient an, and bn according to the following solution?

the coefficients an and bn can be found by solving the
two linear equations that come from V = V[0] at eta=eta[0] and 
V = V[1] at eta=eta[1], and comparing with following Eq in each
case.

Best

1.mw

 

 

I'm thinking of better demonstrating the cartesian product of a graph.
With the help documentation, we can easily find the cartesian product of two graphs.

with(GraphTheory):
G := CycleGraph([v__1,v__2,v__3,v__4]);
H:=Graph({{u__1,u__2}}):
DrawGraph(G,size=[250,250],stylesheet=[vertexborder=false,vertexpadding=10,edgecolor = "Red",
vertexcolor="navy",edgethickness=3]);
DrawGraph(H,size=[250,250],stylesheet=[vertexborder=false,vertexpadding=10,edgecolor = "Blue",
vertexcolor="Gold",edgethickness=3]);


GH:=CartesianProduct(G,H)
DrawGraph(GH,style=spring)

 

 

 

When I saw Wikipedia's demo diagram, https://en.wikipedia.org/wiki/Cartesian_product_of_graphs

I was fascinated,and I also wanted to visually reflect the nature of Cartesian product by doing different staining of vertices.
It is easy for me to dye the vertices in one color, but it is difficult for 
two different colors .

 

restart;

kernelopts(version);

`Maple 2020.1, X86 64 LINUX, Jul 30 2020, Build ID 1482634`

This one works as expected:

solve({x + y = 5, x - y = 3});

{x = 4, y = 1}

This one fails:

solve({x(0) + y(0) = 5, x(0) - y(0) = 3});

That shouldn't fail.  According to ?solve,details, under the Description

heading, it says that the unknown may be a name or a function.  Note that

type(x(0), function);

true

so there seems to be a contradiction.  Nevertheless, there is a workaround:

solve({x(0) + y(0) = 5, x(0) - y(0) = 3}, {x(0), y(0)});

{x(0) = 4, y(0) = 1}

 

Now try with fsolve().  This one works as expected:

fsolve({x + y = 5, x - y = 3});

{x = 4., y = 1.}

This one fails:

fsolve({x(0) + y(0) = 5, x(0) - y(0) = 3});

But the previous workaround does not help:

fsolve({x(0) + y(0) = 5, x(0) - y(0) = 3}, {x(0), y(0)});

I can temporarily rename the variables to plain symbols, or perhaps

freeze/thaw them.  But is there a simpler workaround?

 

 

Download fsolve-problem.mw

 

Maple's gamma constant appears to misbehave.

restart;

kernelopts(version);

`Maple 2020.1, X86 64 LINUX, Jul 30 2020, Build ID 1482634`

evalf(gamma);     # this one is expected

.5772156649

evalf(gamma(0));  # this one may be explained

.5772156649

evalf(gamma(1));  # how to explain this one?

-0.7281584548e-1

Things get more puzzling.  Let's declare gamma as local:

local gamma:

Warning, A new binding for the name `gamma` has been created. The global instance of this name is still accessible using the :- prefix, :-`gamma`.  See ?protect for details.

evalf(gamma);     # this is good

gamma

evalf(gamma(0));  # expected an unevaluated gamma(0) here!

.5772156649

evalf(gamma(1));  # expected an unevaluated gamma(1) here!

-0.7281584548e-1

 

Download gamma-puzzle.mw

 

Is there a way to prevent Maple from applying the product rule for exponents? That is, keep x*x as it is instead of automatically simplifying it to x^2. Or, alternatively, is there a way to decompose x^2 as x*x?

Hi there.

It seems like a bug in modp1(('Rem')(...)) with large polynomials with large coefficients.

Please look at the file:

bug_rem.mw

It needs the file polys.m there:

https://dropmefiles.com/9fATR

File polys.m too big for this forum so I used dropmefiles.

Polys.m contain two polynomials x and f_t with large degrees: degree(f_t) = m = 50021, degree(x) = 2*m - 2 = 100040 and large coefficients up to 2^N, where N = ceil(m / 2)+2 = 25013.

I just compute rem(x,f_t) mod 2^N.

As you can see in the first part of doc bug_rem.mw I decreased coefficients of polynomials by additional mod 2^N (with Embed function), where N = floor(N / 2) = 12506. WIth these decreased polynomials and decreased N modp1(('Rem')(...)) function works well and use maximum about 2.5 Gb of RAM.

But in the second part of doc bug_rem.mw with original polynomials and N = 25013 modp1(('Rem')(...)) use maximum about 3.5 Gb of RAM and crash with error:

Error, Maple was unable to allocate enough memory to complete this computation.  Please see ?alloc
 

This is strange and looks like a bug considering that the test server has 48 Gb of RAM.

Is it a bug or modp1(('Rem')(...)) just need more than 48 Gb of RAM?

How many RAM it needs for this computation?

Thank you

Hello, I am trying to fix the problem reported below.

I am using the 64 bit version of Maple 2020.1. I am experiencing similar problems with other java applications. So I believe it must be something related to Java.

Moreover, it looks like the local refreshing problem is following the cursor of the mouse, therefore it must be something related to the interaction of the mouse with the GUI.

I am using a I7 CPU, 32 GB of Ram and a Nvidia Geforce RTX 2070.

Is anyone experiencing something like this? How can I fix this?