Maple 2019 Questions and Posts

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

When making a proc that accepts positional and keyword based arguments, Maple allows the caller to put the keyword arguments before or after the positional arguments, or in between.

Is there a way to force the keyword arguments (if they are used) to only be placed after the (required) positional arguments during the call? 

An example will make it more clear. Given this proc

foo := proc(a::integer, b::integer, {c::integer:= 1, d::integer:= 1},$)
    print("a=",a," b=",b," c=",c," d=",d);
end proc:

It can be called as any one of these cases

foo(1,2);                                #case 1                                             
foo(1, 2,'c' = 1, 'd' = 2);              #case 2
foo('c' = 1, 1, 'd' = 2, 2);             #case 3
foo('c' = 1, 1, 2);                      #case 4
foo(1, 'c'=1, 2);                        #case 5
#more combinations possible

Is it possible to change how proc is defined, so that Maple will accept case1, and case 2 only in the above when the call is made and give an error otherwise?

i.e. only allow keyword arguments after all positional arguments.  I read https://www.maplesoft.com/support/help/Maple/view.aspx?path=argument_processing  and it says

After all arguments matching keyword parameters have been processed, matching of required positional and optional or expected ordered parameters is carried out

So from above, it looks like what I am asking for is not really possible. But I thought to ask, in case there is some way.

I find ability to put keyword arguments in the call anywhere and in-between required positional arguments confusing that is all.

Maple 2019.1

Is there a command or method in Maple to list all initially protected names?

This page https://www.maplesoft.com/support/help/Maple/view.aspx?path=UndocumentedNames list undocumented protected names, and this page https://www.maplesoft.com/support/help/Maple/view.aspx?path=initialconstants  lists initially known names, which I assume are all protected.

But what about a list of all protected names? sin,cos, eval, uneval, etc.. any name that can't be assigned to. In my search so far, I could not find how to find these names. There are 100's of such names. Can one get them all in a list to look at?

Using Maple 2019.1

Could someone confirm if this is a problem in this sample application?

In 2019, in the folder 

    C:\Program Files\Maple 2019\samples\ProgrammingGuide\RandomnessTests

There is sample application. Opening the main module file RandomnessTests.mpl  and scrolling down a little bit to the include statements show

$include "WaldWolfowitz.mm"
$include "BitFrequency.mm"
$include "SequenceFrequency.mm"
$include "Compressibility.mm"
$include "BinaryRank.mm"
$include "Entropy.mm"

$include "Data.mm"
$include "Visualization.mm"

However, in the same folder, there is no Data.mm file. There is only Data.mpl file.

So how could this sample application work?  

This sample app have more problems. The file Visualization.mm  say

Data := module()
option package;
...

And the file Data.mpl has

Data := module()
....

This is all so confusing. Seems someone made some typos and not tested this app? Why put a sample application which makes learning packages in Maple more confusing?

ps. I did not yet try to figure how to locad it and run it myself, I was just browsing it.

 

 

I have the following expression

I would like to know if is it possible avoid negative exponent goes to denominator when I use expand().

Thank you!

 

 

 

 

 

 

Maple always starts a new document with a 2D input style and Times New Roman font. How to change the boot style? (default).
Oliveira

I have to solve the equation rH''(r)+H'(r)+(rk^2-r^2*b^2/R^2)=0 where k, b, and R are real constant positive number, with condition H(R)=0 and H(1/R)=R to be solved into series of power. I know from the literature that xy''+y'+xy=0, can't be solved in terms of elementary function(see G.Nagy-ODE-November 29, 2017) that's why I'm interested in an approximate solution based on series, or any results as long as it satisfied the too condition H(R)=0 and H(1/R)=R of the real function H(r). 

Please advice!.

    I have encountered a peculiar behavior in Maple 2019 worksheets. I have attached a worksheet which illustrates a reversal of the coefficient and the blade in the following types of expression.  My Maple installation is set in options to use maple input and output (1D notation).  I am using build ID 1399874.

The procedure I was testing used the add function to expand a multivector over basis blades and coefficients represented by indexed names; for example
    add(a[indx[]]*e[indx[]], indx = indxes); where indxes:={[1],[2],[3],[1,2],[1,3],[1,4],[2,3],[2,4]};

The expected result
a[1]*e[1]+a[2]*e[2]+a[3]*e[3]+a[4]*e[1, 2]+a[5]*e[1, 3]+a[6]*e[1, 4]+a[7]*e[2, 3]+a[8]*e[2, 4] in 1D notation but instead I got

e[1]*xx[1]+e[2]*xx[2]+e[3]*xx[3]+e[1, 2]*xx[4]+e[1, 3]*xx[5]+e[1, 4]*xx[6]+ e[2, 3]*xx[7]+e[2, 4]*xx[8]

(Note and the different coefficient names illustrates the exchange is caused by sorting.)

Initially, I assumed that this resulted from the add command, but after I directly entered an indexed expression into the worksheet and obtained a similar result I realized it must be occurring during the output.  Apparently, before the expression is written, it is first sorted. I know this because, if the coefficient is named a,b,c,d ( less than e), the expression is not exchanged. In addition, if I convert the expression to 2D output, the expression is written in the normal order specified in the add command.

I also confirmed this behavior in Maple 2018.2 as well.  Hopefully, the example worksheet attached will illustrate this behavior.  Am I correct in assuming that when the code I am using in the worksheet with is incorporated into a module in an mpl file and loaded, this will not be an issue.

exchangeproblem.mw

Hello,

How I can extract coefficients from and by calculating determinant for Eigenvalue problem, the value of omega.

For more details please see attached PDF file.

Thanks so much.

eign.pdf

 

We solve Laplace's equation in the domain a < r and r < b, c < t and t < d
in polar coordinates subject to prescribed Dirichlet data.

Maple produces a solution in the form of an infinite sum,
but that solution fails to satisfy the boundary condition
on the domain's outer arc.  Is this a bug or am I missing
something?

restart;

kernelopts(version);

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

with(plots):

pde := diff(u(r,t),r,r) + diff(u(r,t),r)/r + diff(u(r,t),t,t)/r^2 = 0;

diff(diff(u(r, t), r), r)+(diff(u(r, t), r))/r+(diff(diff(u(r, t), t), t))/r^2 = 0

a, b, c, d := 1, 2, Pi/6, Pi/2;

1, 2, (1/6)*Pi, (1/2)*Pi

bc := u(r,c)=c, u(r,d)=0, u(a,t)=0, u(b,t)=t;

u(r, (1/6)*Pi) = (1/6)*Pi, u(r, (1/2)*Pi) = 0, u(1, t) = 0, u(2, t) = t

We plot the boundary data on the domain's outer arc:

p1 := plots:-spacecurve([b*cos(t), b*sin(t), t], t=c..d, color=red, thickness=5);

Solve the PDE:

pdsol := pdsolve({pde, bc});

u(r, t) = Sum((1/6)*cos(3*signum(n1-1/4)*(-1+4*n1)*t)*(2*Pi*sin((1/2)*signum(n1-1/4)*Pi)*abs(n1-1/4)-6*Pi*sin((3/2)*signum(n1-1/4)*Pi)*abs(n1-1/4)+cos((3/2)*signum(n1-1/4)*Pi)-cos((1/2)*signum(n1-1/4)*Pi))*signum(n1-1/4)*8^(signum(n1-1/4)*(4*n1+1))*(r^((-3+12*n1)*signum(n1-1/4))-r^((3-12*n1)*signum(n1-1/4)))/(abs(n1-1/4)*Pi*(-1+4*n1)*(16777216^(signum(n1-1/4)*n1)-64^signum(n1-1/4))), n1 = 0 .. infinity)+Sum(-(1/3)*((-1)^n-1)*sin(n*Pi*ln(r)/ln(2))*(exp((1/6)*Pi*n*(Pi+6*t)/ln(2))-exp((1/6)*Pi*n*(7*Pi-6*t)/ln(2)))/(n*(exp((1/3)*n*Pi^2/ln(2))-exp(n*Pi^2/ln(2)))), n = 1 .. infinity)

Truncate the infinite sum at 20 terms, and plot the result:

eval(rhs(pdsol), infinity=20):
value(%):
p2 := plot3d([r*cos(t), r*sin(t), %], r=a..b, t=c..d);

Here is the combined plot of the solution and the boundary condition.
We see that the proposed solution completely misses the boundary condition.

plots:-display([p1,p2], orientation=[25,72,0]);


 

Download mw.mw

I spend some time searching and reading help. But not able to find if this is possible.

I use worksheet only (i.e. not 2D document). I have my display set as

 

I'd like diff(y(x),x) to display as y'(x) in output.

I know I can do this 

PDEtools:-declare(y(x), prime = x);

And that will make diff(y(x),x) display as y'  but I want y'(x). And the same for diff(y(x),x$2) to display as y''(x). And to be clear, y(x) will still display as y(x).  I am mainly interested in making the derivative display a little nicer if possible.

Is there a way to do this?

I am using 2019.1 on windows 10.

 

pde := (diff(u(r, theta), r) + r * diff(u(r, theta), r, r) + diff(u(r, theta), theta, theta) / r ) / r:
iv := u( 1, theta) = 0, u( 3, theta) = theta, u( r, 0) = 10, u( r, Pi/2) = 0:
           Maple 2019 returns a symbolic solution for PDE:
pdsolve([pde, iv], u(r, theta));
   But for the numeric option, it returns a message saying that Maple is unable to handle elliptical PDEs.
pdsolve(pde, {iv}, numeric, time = t, range = 1 .. 3);

Error, (in pdsolve/numeric) unable to handle elliptic PDEs
I found it strange.

Oliveira.

In answers given in 

In https://www.mapleprimes.com/questions/227546-How-To-Make-Odetest-Verify-Dsolve

It shows that odetest() did not verify a solution to ODE becuase solution was using hypergeom special functions. If the solution to the ODE was in integral form, then odetest() will verify it OK.

But what to do if the solution I want to verify is already in hypergoem? If I try odetest() it will fail to verify now. Then I can try to convert the solution to integral form and try again.

But when  using convert(sol,Int) followed by odetest() it did not work.

The solutions I try to verify are hand solutions or book solutions, and not coming from dsolve. 

But some of them are the same solution that comes from dsolve() when not using the useInt option. 

Also, I am doing this all inside a Maple program. It is not an interactive process. So I can't do plots and look at them to decide on anything. So verification must all be implemented in code.

The question is: Why did convert(hand_solution,Int) not give the same result as dsolve(ode,useInt)? Is there another way around this? (May be I am asking for too much in this one based on answers in the above link, So that is OK if not possible. But I really like the solution given when using "useInt" option. Much more clear than otherwise).
 

restart;

ode := diff(y(x), x)*(x^3 + 1)^(2/3) + (1 + y(x)^3)^(2/3) = 0;
sol_int:=dsolve(ode,useInt);
odetest(sol_int,ode); #OK now, since solution in integral form

(diff(y(x), x))*(x^3+1)^(2/3)+(1+y(x)^3)^(2/3) = 0

Int(1/(x^3+1)^(2/3), x)+Intat(1/(_a^3+1)^(2/3), _a = y(x))+_C1 = 0

0

hand_solution:= x*hypergeom([1/3, 2/3], [4/3], -x^3) + y(x)*hypergeom([1/3, 2/3], [4/3], -y(x)^3) + _C1 = 0;
convert(hand_solution,Int); #Why this did not give same result as ABOVE?

x*hypergeom([1/3, 2/3], [4/3], -x^3)+y(x)*hypergeom([1/3, 2/3], [4/3], -y(x)^3)+_C1 = 0

(2/9)*x*Pi*3^(1/2)*(Int(1/(_t1^(1/3)*(1-_t1)^(1/3)*(x^3*_t1+1)^(1/3)), _t1 = 0 .. 1))/GAMMA(2/3)^3+(2/9)*y(x)*Pi*3^(1/2)*(Int(1/(_t1^(1/3)*(1-_t1)^(1/3)*(y(x)^3*_t1+1)^(1/3)), _t1 = 0 .. 1))/GAMMA(2/3)^3+_C1 = 0

odetest(%,ode); #does not give zero

-y(x)^3*(1+y(x)^3)^(2/3)*(Int(_t1^(2/3)/((1-_t1)^(1/3)*(y(x)^3*_t1+1)^(4/3)), _t1 = 0 .. 1))+(x^3+1)^(2/3)*(Int(_t1^(2/3)/((1-_t1)^(1/3)*(x^3*_t1+1)^(4/3)), _t1 = 0 .. 1))*x^3-(x^3+1)^(2/3)*(Int(1/(_t1^(1/3)*(1-_t1)^(1/3)*(x^3*_t1+1)^(1/3)), _t1 = 0 .. 1))+(1+y(x)^3)^(2/3)*(Int(1/(_t1^(1/3)*(1-_t1)^(1/3)*(y(x)^3*_t1+1)^(1/3)), _t1 = 0 .. 1))

 

 

Maple 2019.1

Download 072619_2.mw

 

 

 

It seems that the answer to my question is deleted!!!

So, I again repeat it.

How I can calculate this integral?

I want to calculate integral with the constants Aj]j=1,2.

The Amount of these constants  unknown this stage.

Thanks

INTEGRAL

integral.mw

I am trying to evaluate any which way the integral:

int(exp(-(sqrt(4*x^2+4*y^2+4*z^2)^3)), z = -sqrt(4-x^2-y^2).. sqrt(4-x^2-y^2),y=-sqrt(4-x^2)..sqrt(4-x^2),x=-2..2);

The program just hangs, so i click on 'stop current operation'.

Then I tried:

evalf(Int(exp(-(sqrt(4*x^2+4*y^2+4*z^2)^3)), z = -sqrt(4-x^2-y^2).. sqrt(4-x^2-y^2),y=-sqrt(4-x^2)..sqrt(4-x^2),x=-2..2));

It returns the integral back unevaluated.

It's true that I could use a change of variables, changing to spherical coordinates would be best here. But I would like to know if I did set up the original Cartesian integral correctly. Is there some workaround I can apply to get a numeric answer. I am satisfied with a decimal approximation. Then I can compare to the change of variable result. An exact answer would be even better of course.

THis is another ode which I am not able to get odetest to give zero. Any one knows of a trick to verify this solution? It might be just that the solution is too complicated for odetest to verify?


 

restart;

ode:=diff(y(x),x)*(x^3+1)^(2/3)+(1+y(x)^3)^(2/3) = 0;
sol:=dsolve(ode);

(diff(y(x), x))*(x^3+1)^(2/3)+(1+y(x)^3)^(2/3) = 0

x*hypergeom([1/3, 2/3], [4/3], -x^3)+y(x)*hypergeom([1/3, 2/3], [4/3], -y(x)^3)+_C1 = 0

odetest(sol,ode);

-9*(1+y(x)^3)^(1/3)*(x^3+1)^(2/3)*hypergeom([4/3, 5/3], [7/3], -x^3)*x^3*GAMMA(2/3)*(-y(x)^3)^(1/6)/(9*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*y(x)^3*(-y(x)^3)^(1/6)*(1+y(x)^3)^(1/3)*GAMMA(2/3)-4*Pi*3^(1/2)*LegendreP(-1/3, -1/3, -y(x)^3/(1+y(x)^3)+1/(1+y(x)^3)))+9*y(x)^6*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*GAMMA(2/3)*(-y(x)^3)^(1/6)/(9*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*y(x)^3*(-y(x)^3)^(1/6)*(1+y(x)^3)^(1/3)*GAMMA(2/3)-4*Pi*3^(1/2)*LegendreP(-1/3, -1/3, -y(x)^3/(1+y(x)^3)+1/(1+y(x)^3)))+9*y(x)^3*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*GAMMA(2/3)*(-y(x)^3)^(1/6)/(9*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*y(x)^3*(-y(x)^3)^(1/6)*(1+y(x)^3)^(1/3)*GAMMA(2/3)-4*Pi*3^(1/2)*LegendreP(-1/3, -1/3, -y(x)^3/(1+y(x)^3)+1/(1+y(x)^3)))-4*(1+y(x)^3)^(2/3)*Pi*3^(1/2)*LegendreP(-1/3, -1/3, -(y(x)^3-1)/(1+y(x)^3))/(9*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*y(x)^3*(-y(x)^3)^(1/6)*(1+y(x)^3)^(1/3)*GAMMA(2/3)-4*Pi*3^(1/2)*LegendreP(-1/3, -1/3, -y(x)^3/(1+y(x)^3)+1/(1+y(x)^3)))+4*(1+y(x)^3)^(1/3)*(x^3+1)^(1/3)*Pi*3^(1/2)*LegendreP(-1/3, -1/3, -(x^3-1)/(x^3+1))*(-y(x)^3)^(1/6)/((-x^3)^(1/6)*(9*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*y(x)^3*(-y(x)^3)^(1/6)*(1+y(x)^3)^(1/3)*GAMMA(2/3)-4*Pi*3^(1/2)*LegendreP(-1/3, -1/3, -y(x)^3/(1+y(x)^3)+1/(1+y(x)^3))))

simplify(%);

-9*((4/9)*(1+y(x)^3)^(2/3)*Pi*3^(1/2)*LegendreP(-1/3, -1/3, (-y(x)^3+1)/(1+y(x)^3))*(-x^3)^(1/6)+(-(4/9)*(1+y(x)^3)^(1/3)*(x^3+1)^(1/3)*Pi*3^(1/2)*LegendreP(-1/3, -1/3, (-x^3+1)/(x^3+1))+(-x^3)^(1/6)*((-y(x)^6-y(x)^3)*hypergeom([4/3, 5/3], [7/3], -y(x)^3)+x^3*(1+y(x)^3)^(1/3)*hypergeom([4/3, 5/3], [7/3], -x^3)*(x^3+1)^(2/3))*GAMMA(2/3))*(-y(x)^3)^(1/6))/((-x^3)^(1/6)*(9*hypergeom([4/3, 5/3], [7/3], -y(x)^3)*y(x)^3*(-y(x)^3)^(1/6)*(1+y(x)^3)^(1/3)*GAMMA(2/3)-4*Pi*3^(1/2)*LegendreP(-1/3, -1/3, (-y(x)^3+1)/(1+y(x)^3))))

 


 

Download 072619.mw

Maple 2019.1, Physics 395

Download 072619.mw

 

 

3 4 5 6 7 8 9 Page 5 of 12