Maple 2020 Questions and Posts

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

I've never noticed this before, becuase I do not like to with()  packages, but like to add the name of the package at each command and alwsys try to use explicit commands.

Compare this first example, which does not work, since the "." in the codeis the global "dot" command ?dot

restart;
VC:=VectorCalculus:
f:=y*sin(x)+y^2;
VC:-Nabla . VC:-Nabla(f,[x,y])

So the dot above is the one used for normal dot product, which is visible without loading any package as in: <1,2>.<3,4> gives 11

Now when I next loaded the VectorCalculus explicitly, but kept the same code the same, i.e. using the same ".", now it worked

restart;
with(VectorCalculus);
VC:=VectorCalculus:  #do not need this now, but to keep the code the same
f:=y*sin(x)+y^2;
VC:-Nabla . VC:-Nabla(f,[x,y])

It worked because Maple now used VectorCalculus:-`.`  ,Even though I did not tell it to do this, it searched the package since it is loaded) and now decided to use VectorCalculus:-`.` instead of the global `.` dot defined before loading this package.

But how did Maple know which dot to use? 

Did it say to itself, the dot in the middile must be VectorCalculus:-`.` and not the global `.` due to the type of the operands around the dot, it automatically found the correct match? 

So imagine if one has loaded more packages, and some might have its own `.` operator that takes the same operands, does Maple search them all to find the correct dot to use based on type of operands to bind it to? and how in this case it knows which to use, if there is more than one match among all loaded packages? I can see this causing confusion, becuase one is never sure in this case which operator was used. I do not know if Maple issues a warning in this case or not.

I do not use input 2D math in document mode. But was trying it now to see if I can enter this to check my hand solution

In worksheet, this is what I do

restart;
VC:=VectorCalculus:
f:=y*sin(x)+y^2;
VC:-DotProduct(VC:-Del,VC:-Gradient(f,[x,y]))

But I do not know how to enter   if possible, in document mode 2D math. THis is what I tried. Created document mode. Picked the DEL operator from the left side common symbols window. But I do not know how to do the rest.

Clearly I am doing something silly. This is why I prefer plain Maple code, becuase I can see what I am typing :)

But was wondering, how to do the above in docuemnt mode + 2D math? To make it look close to how it shows in the book. Does one need special palette for this?

 

 

Hello

In Section 14.5 - External Calling ..., page 489, the authors gave an example on how to use the command line in Unix to call maple with arguments. I followed the example but added a mpl-file to see if the arguments were sent to it.  

Example (Linux):

/opt/maple2020/bin/maple -c n:=4 -c 'path:="/home/eduardo/examples";' example.mpl > output.txt &

Maple sends out the following error message: "Error, incorrect syntax in parse: '/' unexpected (near 7th character of parsed string)".

The msg is clear where the error is but I could not figure out what to do. The single quotes were supposed to take care of that, weren't they?  

Many thanks.

Ed

Edit: I have added the double-quotes.   The problem still persists.  

I wanted to overwrite an existing variable of type table by the one returned from a call to a proc().

But it does not work, unless eval() is called on the returned result from the proc()

But if the variable that recieves the return value from the proc() was not already a table type, then it works without using eval. Why is that? 

Here is an example

restart;
foo:=proc(A::table)
  A["c"]:=3; #add new field
  return A;
end proc;

A:=table():
A["a"]:=1:
A["b"]:=2:
B:=foo(A):
whattype(B);
print(B)

           table(["a" = 1, "c" = 3, "b" = 2])

In the above, it worked. is table now, and assigned the updated table from the proc.  But 

A:=table():
A["a"]:=1:
A["b"]:=2:
A:=foo(A): #without eval, it does not work.
whattype(A);
print(A)

             symbol
               A

I expected A to be overwritten, just like B was. To fix this, I have to change A:=foo(A): by A:=eval(foo(A)):

But why eval was not needed in the first example, and was needed for the second example?

btw, the same thing happens with Record(), not just table()

just like to understand the reasoning behind this. I expected both cases to work the same way. But it works different if the variable happend to be unassigned (like B above).

Hello all,

I was hoping to get some general tips for tackling numeric integrals. As someone with little experience in the subject, I find myself overwhelemed by the many different integration methods. 

Experts, what are the first steps you take when trying to find a numeric solution to an integral? How might you zero-in on a particular integration method? What about tweaking error parametrs, etc.? Is there a general framework for approaching these problems, or is it all guesswork?

Thanks!

How can I create an even function, g, in Maple? I want Maple to give g(x) - g(-x) as 0.

Hello, I was given the problem "Set N:=100. (i) Form four lists L[1], L[3], L[5], L[7] where L[r] contains all primes 2< p < N such that p mod 8 = r ." and came up with the following code:

N := 100;
List1 := [];
List3 := [];
List5 := [];
List7 := [];
for p from 2 to N do
    if isprime(p) and p mod 8 = 1 then List1 := [op(List1), p]; end if;
    if isprime(p) and p mod 8 = 3 then
        List3 := [op(List3), p];
    end if;
    if isprime(p) and p mod 8 = 5 then
        List5 := [op(List5), p];
    end if;
    if isprime(p) and p mod 8 = 7 then
        List7 := [op(List7), p];
    end if;
end do;
List1;
List3;
List5;
List7;
 

this gave me the answer I wanted, however using the above code I have to answer this second question: 

In the notation of Problem 1, make a procedure with input = arbitrary  positive integer N and output = the list [nops(L[1]), nops(L[3]), nops(L[5]), nops(L[7])]. Do some experiments to see for which (if any) r, L[r] is largest. 

I am unsure of how to create a procedure out of the code I already have. I created this: 
 

restart;
F := proc(n)

local N, p, List1, List3, List5, List7;

List1 := [];

List3 := [];

List5 := [];

List7 := [];

for p from N do

if isprime(p) and p mod 8 = 1 then List1 := [op(List1), p]; end if;

if isprime(p) and p mod 8 = 3 then List3 := [op(List3), p]; end if;

if isprime(p) and p mod 8 = 5 then List5 := [op(List5), p]; end if;

if isprime(p) and p mod 8 = 7 then List7 := [op(List7), p]; end if;

return [nops(List1), nops(List3), nops(List5), nops(List7)];

end do;

end proc;

 

however, when I input F(100) or any other value of N, I am receiving the error message "Error, (in F) initial value in for loop must be numeric or character"

 

Any ideas on how to improve my program to get the output I desire?

thank you 

 

 

 

Hello all ,

It's been years and years that I have been using Maple (since Maple V.2 in 1992 if my memory is still

correct. Now we are at Maple 2020 and the brilliant scientific library GMP is still in Maple at version

5.1.1.

kernelopts(gmpversion);
                            "5.1.1"

The relatively new GMP is 6.2.0 : https://gmplib.org/

I wonder if in a not too far version of Maple we could have GMP updated. It is really an impressive mathematical library alongside with GSL.

Voilà !

 

Kind regards to all,

 

Jean-Michel

 

Unfortunately, I can't solve the problem in MAPLE that appears in the last line of the picture (0=1 instead of a0=1) unless I write a0 seperately and add the partial sum starting from k=1 to it.

I assume the problem is with 00 in the power series but since MAPLE defines 00:=1 I'm not sure about it. Anyone knows a better solution or can tell me if I made a mistake somewhere?


 

This worksheet plots the non-overlapped images of two spheres, but plotted procedure p fails to successfully pass the choice of color to the implicitplot3d command.

How can this be accompished?

Sphere_exclusions.mw

Hi there.

I noticed that in Maple 2020 default font size of document (Times New Roman 12) looking bigger than in previous versions. How can I make the view the same as in previous versions?

Thank you

Hi there.

How supress this warning in Maple 2020 when I use "e" just like a variable not an exponent:

Warning, if e is meant to be the exponential e, use command/symbol completion or palettes to enter this special symbol, or use the exp function

?

Thank you

Recently Maple started freezing on me for a few minutes; after that it continues to work and then freezes again and so on (it does not so much freezes as it pauses).  I do not know what changed on my system (which is Windows 10) for this to happen.  I had been using Maple 2019 when this started and then upgraded to Maple 2020 but that did not solve my problem.

It does not seem to have to do with the type of computations I am doing.

I have problem with usage of solve for the solution of the system of six and eight symbolic equations. I need to get expressions for variables: R__xl, R__xs, R__xsi, R__zl, R__zs, R__zsi, dbeta__l(t), dbeta__s(t). I tried to find solution for 8 equations, but I got the message: Warning, solutions may have been lost. I thought that the system is non-linear and tried to solve it for six variables (R__xl, R__xs, R__zl, R__zs, R__zsi, R__xsi), in this case equations are linear, but Maple ignored the solve command and did not give a solution or error. Could someone help me with this problem?

Quasi-static.mw

Hello

I am not sure how to choose between Threads:-Seq and Grid:-Seq.  

The problem:  a procedure, proc1, that calls two other procedures, proc2 and proc3, verifies if a set of parameters fulfills a certain condition. Proc1, proc2 and proc3 are not part of Maple available functions.  

Right now I am using Grid:-Seq to return the result of applying proc1 to chunks of a thousand parameters.  I wonder whether I could use Thread:-Seq instead.   What are the advantages of using one instead of the other?  And when do I choose one over the other?  

 

I would appreciate if you could provide simple examples to explain the differences.  

 

Many thanks.

 

Ed

PS.  There is a problem with Grid:-Seq as reported in one of my previous questions.

1 2 3 4 5 6 Page 1 of 6