Maple 2020 Questions and Posts

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

Hello everyone,

I should solve the diffusivity equation using Maple. The equation and BSc are as follow: 

pde := W*diff(C(z, t), z $ 2) - diff(C(z, t), t $ 1) = 0

bc[1] := C(x, 0) = 0;
bc[2] := D[1](f)(0, t) = VMK*D[1](f)(t)/ZRTWA;
bc[3] := C(infinity, t) = 0;

The equation should be solved using Laplace method. Can anyone please help me ?

I will appreciate your insightful comments.

 

If you are interested in experimenting with simple antenna arrays, this worksheet may prove useful.  I have provided a few examples of arrays that repeat in the x, y and z directions, but it will be very easy to tweak this tool if you are more interested in circular or triangular arrays.

This is one of the example arrays:

Antenna_arrays.mw

antenna_arrays.pdf

Hello there, 

First of all, happy new year to you and those around you!

One question: would you teach me how to replace the 'Zs/Z_AB' expression in the last term of the expression 'eq_5_m5'?

In other words, I wanted to see the 'desired' expression, but the 'subs()' command repalced the first occurance of the 'Zs/Z_AB' expression. 

(Perhaps, this applet behind of this edit box does not like the Microsoft Edge browser)

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/Q20210103.mw .
 

Download Q20210103.mw


Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/Q20210103.mw .

Download Q20210103.mw

 

Recently, I encountered warnings and errors when size of my list is big. Maple says use array instead of list because of ... . When the list is just a list of numbers or a list of lists of the same size, I can rewrite it as an array, but how about a list like the following?

[seq([[0,0],0],i=1..10)]

This is just an example. So the elements of this list are lists containing a vector (a point in the plane) and a number (a property of this point). One idea is to use two arrays, a two dimensional array for recording the vectors, and one 1-dimensional array for recording the numbers and keep in mind that the i-th number of the second array is related to the i-th vector (row) in the first array. But is there any possibility to have this data recorded similar to when we are using lists, i.e. similar to the above code?

How can I get the follow graph of paraboloidal surfaces (ξ=1,η=2) with the coordinate vectors ξ, η0 , φ0 as shown in the picture.

Realation between cartesian coordinates and paraboloidal :

x=1/2 (ξ2 - η2), y=ξ η cos(φ), z=ξ η sin(φ)

I wrote the following code:

Student:-VectorCalculus

S1 := PositionVector([1/2*(-eta^2 + 1), eta*cos(phi), eta*sin(phi)], cartesian[x, y, z]):

LH := PlotPositionVector(S1, eta = -2 .. 0, phi = 0 .. 2*Pi, coordcurve = [eta = -2, tangent = true, binormal = true, vectornum = 1], scaling = constrained)

S2 := PositionVector([1/2*(xi^2 - 4), 2*xi*cos(phi), 2*xi*sin(phi)], cartesian[x, y, z]):

LG := PlotPositionVector(S2, xi = -1 .. 1, phi = 0 .. 2*Pi, coordcurve = [xi = 1, tangent = true, vectornum = 1], scaling = constrained)

 

And I got the two paraboloidal surfaces with the vectors separently.How can I get only one graph with these two surfaces as shown in the picture (with ξ=1, η=2) ?

This website suggests that the viewer write equations containing differentials and use them to plot topographical lines.

https://mathcurve.com/courbes3d.gb/topographic/topographic.shtml

I am basically familiar with equations containing derivatives, but not with equations containing differentials.

How can one employ these to draw the lines shown in the website's various plots of surfaces?

Hello, 

when trying to solve equation using fsolve, it returns just what i wrote and didn't solve. Can anyone help? I tried all i know. File is attached below.

Thanks a lot.

II.01.mw

 

restart;
f:=(x,y)-> x*y^3-x^2/y^3;
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y));
lis:=[]:
for tmp in op(eq) do
    if has(tmp,alpha) then
       lis:=[op(lis),op(2,simplify(select(has,tmp,alpha)))];
    fi;
od;
lis;
PDEtools:-Solve(lis[1]=lis[2],p)

This method happend to work for this example, but it does not work in general. This is because the function can be anything. Here is a second example

restart;
f:=(x,y)-> -2/3*x+1/3*(x^2+3*y)^(1/2);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y));

We see by inspection if p=2 then we can write the above as, by setting p=2 as 

But the Maple code I had above does not work on this

restart;
f:=(x,y)-> -2/3*x+1/3*(x^2+3*y)^(1/2);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y));
lis:=[]:
for tmp in op(eq) do
    if has(tmp,alpha) then
       lis:=[op(lis),simplify(select(has,tmp,alpha))];
    fi;
od;
lis;

The problem is finding all powers of alpha in each term and setting up an equation to find p such that all terms have same numerical value.

So I abandoned this method as too messy to program (it works well for hand solution, this is an example where solving something by hand is easier than on the computer) and then tried solve directly, like this (on the first example)

restart;
f:=(x,y)-> x*y^3-x^2/y^3;
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^r*f(x,y)=0;

And here is where I am stuck. I need to ask Maple if it can find alpha, r that are rational numbers, such that the above equation is solved.

PDEtools:-Solve(eq,[p,r])

But we know from above that p=1/6 and r=3/2 is solution

simplify(subs([p=1/6,r=3/2],eq))

             0=0

The question is: Can Maple solve such an equation for  p,r? I remember now reading something about parameteric solver in Maple. I need to look that up to see if it helps. I tried SolveTools:-SemiAlgebraic on this, but it did not help.

Are there better methods to determine in Maple if function is isobaric and to find the index p and r?

Reference: book

Notice, some places define isobaric function as one in which we can find p such that

But this is not correct. I've seen it on 2 pages on the net. The correct definition is 

Also note: When p=1 isobaric function becomes a homogeneous function which is special case of isobaric and r is now called the degree of homogeneity 

But for isobaric, p do not have to be 1. This is the main difference.

f(x,y) will always be a function of x,y.  I will add more examples of isobaric functions to test against.

edit. Simplified question is restated below

After looking more into this. I found I actually wanted to solve the simpler problem, which is

So please ignore the general case of isobaric where r<>p-1 which is harder. 

I only need to look at this case where r=p-1 which is actually simpler. It turned out this is what I need for my solver and not the general case.

I will now give my solution to this and show where the problem I am having.

I am using Maple solve to find p. So no r any more. Only solving for one variable. But Maple solve fails sometimes. And this is the problem.

The problem is that solve can find p for many cases, but fails on some, where there is clearly a solution. I will show 5 examples below.

#example 1. WORKS
restart;
f:=(x,y)-> 3*sqrt(x*y);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;

#example 2. WORKS
restart;
f:=(x,y)-> 4*(x*y)^(1/3);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;

#example 3. WORKS
restart;
f:=(x,y)-> (-3*x^2*y-y^2)/(2*x^3+3*x*y);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;

#example 4 WORKS
restart;
f:=(x,y)-> (-(x*y)/2+sqrt(x^2*y^2-4*y)/2)*y;
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;

And here is the one that does not work

#Example 5. Does not work. How to make it work?
restart;
f:=(x,y)-> -2*x/3+sqrt(x^2+3*y)/3;
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;

There is a solution for this. p=2 works. Why solve did not find it? I mean, it gives RootOf, which does not help me decide if this is isobaric or not. Why it did not find the solution p=2?

simplify(subs(p=2,eq)) assuming alpha>0

                 0=0

Using Mathemtica, it found p=2 solution. How to make Maple find this solution is my question.

Sorry for the long question. I first thought I needed the general isobaric case, but found later i needed the simpler one.

 

 

Plot the solid that lies between the cylinder z= y^2 and the xy -plane that is bounded by the planes x = 0, x =1, y = −1, y =1.

This might be something basic. But looking at help I do not see it now.

why has(expr,sqrt) do not give true?  is something special about sqrt function?

restart;
mysol :=sin(x);
has(mysol,sin); #works

mysol :=ln(x);
has(mysol,ln);  #works

mysol :=sqrt(x);
has(mysol,sqrt);  #does not work
hasfun(mysol,sqrt);  #does not work

Just wondering why, that is all. Only this worked

hastype(mysol,sqrt)

                true

I am sure there is a good reason for this. sqrt seems to be special function.

Maple 2020.2

I tried to draw a normal boxplot for the a simple data using Maple. My attempt is in below.

X := [13, 15, 16, 16, 19, 20, 21, 21, 22, 22, 25, 25, 25, 25, 30, 33, 33, 35, 35, 35, 35, 36, 40, 45, 46, 52, 70]:
P1 := Statistics[BoxPlot](X, offset = 1, distance = 1, width = 1, orientation = horizontal, outliers = true);
plots[display](P1, view = [1 .. 80, 0.5 .. 2.5]);

But I am not happy from the result.

  1. It seems the box-plot range doesn't include the max, 70, instead it puts a circle there!

      2. What are the small rectangles and circles? I just need a simple box-plot with the line-range starting from min and ending at max, then a box starting from the first quartile and ending at the third quartile and a vertical line at the median. No extra feature and not ignoring any data.

      3. I don't want the vertical axis which is for the index of the data, I just have one data and that vertical axis is just distracting the audience.

How to resolve these three issues?

all in real domain, sqrt(A)*sqrt(B) can be combined to sqrt(A*B) when both A,B are non-negative.

Is there a way in Maple to  find the conditions when sqrt(A)*sqrt(B)=sqrt(A*B) ? i.e. the conditions on A,B where this is true?

A,B will only be functions of x,y.   

An example will make things clear.

restart;
expr1:=sqrt(x^2*y - 4)*sqrt(x^2*y);
expr2:=sqrt(  (x^2*y - 4)*(x^2*y));

By looking at the above, we see that expr1 = expr2 when  x^2*y-4>=0 and x>0 or x^2*y-4>=0 and x<0. Actually I think only x^2*y-4>=0 is needed, since x is being squared anyway.

How to make Maple show this? I can't get Maple to show this

solve(expr1=expr2,[x,y]) assuming real;

But this is wrong. it says it is true for all x and all y?.   Mathematica can do it using Reduce command

I know I can force the combination by using the command

combine(expr1,sqrt,symbolic);

ps. Maple took the x outside the sqrt. So x>0 is assumed here.

pps. I do not understand why simplify(expr1,symbolic) did not work here, and neither  simplify(expr1,symbolic,size=false) worked. Only combine worked.

But I wanted to see if Maple could tell the condition when this is allowed, so I can write these down.

It would be nice if the command above would also tell the conditions under which it combined the sqrts. But this information is not given.

This is all done non-interactive in a program without being able to look at the screen and decide what to do. Only thing I know is that if an expression has sqrts and functions of x,y.

Is there a way in Maple to have tell conditions when expr1=expr2?

Maple 2020.2

I am trying solve on the outout of odetest, in order to determine range of which x makes this output zero.

It works sometimes and  does not work another times. I mean, it gives correct domain something, and other times, it overlooks some domain. 

Here is an example

restart;
ode:=x*diff(y(x),x)*y(x) = (y(x)^2-9)^(1/2):
ic:=y(exp(4)) = 5:
sol:=dsolve([ode,ic],y(x)):
res:=odetest(sol,ode);
solve(simplify(res),x,allsolutions = true) assuming real;

It is true than when x=1, then is zero.  But so all values x>1 as well.

How to get solve to find those values as well and not just x=1?

I tried PDEtools:-Solve as well. It did not better

PDEtools:-Solve(simplify(res),x,allsolutions = true) assuming real;

Compare to Mathematica

Are there other commands in Maple which could obtain all the solutions like in the above?

Maple 2020.2 on windows 10

 

 

My problem is a hickup in the Maple 2020 version as compared to earlier versions :

In the Maple 2020 listtorec from package gfun asks for unknown value u(0) in recognition of series.

Example from the Maple help page:

with(gfun);
l := [1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786];
rec := listtorec(l, u(n));
Error, (in gfun:-listtorec) invalid unknown function, u(0)

This error also happens with the second example in the Maple help page:

rec2 := seriestorec(series(add(l[i]*x^(i - 1)*(i - 1)!, i = 1 .. nops(l)), x, 12), u(n), ['egf']);
Error, (in gfun:-seriestorec) invalid unknown function, u(0)

How to feed this unknown value in the  call?
 


 

I can't figure exactly why adding export on module wide variable when using option package makes the variable not writable from a function inside the module

restart;

dsolver :=module()
option package;
export X::boolean := true;

export foo:=proc()
   dsolver:-X :=false;
end proc;
end module;

dsolver:-foo();

Error, (in foo) attempting to assign to `X` which is protected.  Try declaring `local X`; see ?protect for details.

But this works

dsolver :=module()
export X::boolean := true;

export foo:=proc()
   dsolver:X :=false;
end proc;
end module;

dsolver:-foo();

    false;

I wanted to make the variable export, so it can be set from anywhere (by other modules for example, directly). if I make it local, then other modules can no longer access it?

I know I can change the export to local as the error says. But why is this needed? Only thing I found so far, is this

"Not all modules are packages. Package semantics differ from module semantics in two ways. First, (module-based) package exports are automatically protected. Second, packages can be used as the first argument to"

So the above says function inside module, can't change module wide variable, if this variable is exprted, when using option package? Why?

In general, I am still not sure when to use option package or not. 

Are there any general rules as to when one needs to add option package vs. Not using this option? i.e. just use module() without this option? or the question is: When must one use option package?

I put everything (all modules) eventually in an .mla file and both cases work the same in this respect, so not sure when to use this option now. 

Maple 2020.2 on windows 10

First 21 22 23 24 25 26 27 Last Page 23 of 55