MaplePrimes Questions

When composing multiple plots, plots:-display's normal behavior is to set the overall plotting region to what is necessary to accommodate the union of the individual plots.  That works correctly most of the time but not in the case shown below.  This may indicate a bug in one of plots:-shadebetween,  plots:-display,  plottools:-extrude.  I have not been able to pinpoint the problem.  Any ideas?

restart;

Make a 3D plot:

plots:-shadebetween(x^2, 2-x^2, x=-1..1, color=red, transparency=0):
p1 := plottools:-extrude(%, 0..0.3);

 

Make another 3D plot:

plottools:-sphere([1.5,0,0], 1, color="Green"):
p2 := plots:-display(%);

 

Combine the plots:

plots:-display([p1,p2], scaling=constrained, style=surface);

 

We see that most of the green sphere has been cut off.  One way to fix things is
to add a view option (see below), but that wouldn't have been necessary if things
were working properly.

plots:-display([p1,p2], scaling=constrained, style=surface,
  view=[-1..3, DEFAULT, DEFAULT]);

 

This was done in Maple 2019.

Maple 2017 behaves the same way.  I don't know whether this ever worked properly in earlier Maples.
 

Download bug-in-3D-view.mw

 

Dear, I would like to kindly request your help with the following problem I have: 

L:= [0, 3,0,7];

for i from 1 to 4 do
if L[i] > 0 then 
x[i]:= [L[i]/2]
end if;
end do;

I need to write the elements x[i] as a list, however if I type x[i];  Maple just returns the last value of L[i]/2, namely 7/2. I do not know how to obtain the full list [3/2, 7/2]. What am I doing wrongly?

Many thanks in advance for your kind help. 

Dear Friends,
Please help to generate the following matrix.

I get this warning when ever I create a function that uses a sum or sequence:

 

g := x->sum(...,j=1..5);

 

I'm pretty sure I used to not get it at all in previous versions, I just upgraded recently and started seeing it. Is there any way to disable it? It is polluting the worksheet. Sometimes I might have several local's and I want them to be implicitly local but I do not want 10 warning messages.

Hello;

What trick if any is needed to obtain zero for this sum in Maple?

sum(sin(Pi*n/2)*sin(n*Pi*(x + 1)/2)*cos(n*Pi*t/2),n=1..infinity)

The above sum, according to Mathematica is zero. I am trying to see if same result can be obtained by Maple in order to verify this result. It is possible ofcourse that Mathematica result is not correct. I am also trying to verify the sum is zero by hand, but no success so far.

mySum:=sum(sin(Pi*n/2)*sin(n*Pi*(x + 1)/2)*cos(n*Pi*t/2),n=1..infinity)

sum(sin((1/2)*Pi*n)*sin((1/2)*n*Pi*(x+1))*cos((1/2)*n*Pi*t), n = 1 .. infinity)

value(mySum)

sum(sin((1/2)*Pi*n)*sin((1/2)*n*Pi*(x+1))*cos((1/2)*n*Pi*t), n = 1 .. infinity)

simplify(mySum)

sum(sin((1/2)*Pi*n)*sin((1/2)*n*Pi*(x+1))*cos((1/2)*n*Pi*t), n = 1 .. infinity)

 


Here is Mathematica result

Using Maple 2019.2 on windows 10. 

Thanks

Download q2.mw

It is easy to draw all the types of arcs in plots. Hence a multiple plot may help under such situations. I attempted to draw for a few problems, but found it difficult. Can any one help in drawing the same to get neat and clean output drawings for me to explain the answer to students.

Thanks
 

Find the area of the shaded portion (b) . (portion b not shaded)

 

 

 

 

Find the area of the shaded portion.

 

 

 

 

 

 Area b = Area (a+b) - Area a =    -     =

 

 

Find the radius of the circle.

 

 

 

 Mistake : It shd be 0.25 and not 4 times (x+...)

 

 

Find the height of the cone.

 

``

``

A circle with radius 1 is tangent to 2 points of the parabola y = x2   What is the area between the circle ana parabola?

 

 

 

 

 

 

 

NULL


Maple drawing shows all outer portions of circles.I used snipping tool to get cropped picture for first problem.

I already got a similar problem and got a response that i should use being forward and backward, but that seems to be not worth it many a times since figures become bigger in maple drawing with outer rectangles used for eliminating portions. (Ex: problem 1, not shown here)

Thanks.

Download GeometryProblems_Sketches_Problems.mw

Hello,

a follow up question.

I am solving some overdetermined system of ODEs in cylindrical coordinates r,phi,Z. I obtain some equations of the following type:

(diff(_F1(phi, Z), phi)*r + diff(diff(s_r(phi, Z), phi), phi))/r = -s_r(phi, Z)/r

As can be seen, the differentiated functions do not depend on r, which is an independent variable. Thus, the correct solution is to separate the equation and have 

_F1(phi,Z)=_F1(Z), s_r(phi,Z)=s_r(Z).

By using dsolve, I always obtain a solution containing r.

A similar problem that does no contain derivatives is solved by solve/identity.

Is there something similar for dsolve?

EDIT: I again put here more info and file. I solve some overdetermined system of differential equations.

[diff(s_r(r, phi, Z), r) = 0, diff(s_r(r, phi, Z), phi) = -diff(s_phi(r, phi, Z), r)*r^2,
diff(s_Z(r, phi, Z), r) = -diff(s_r(r, phi, Z), Z), diff(s_phi(r, phi, Z), phi) = -s_r(r, phi, Z)/r, 
diff(s_Z(r, phi, Z), phi) = -diff(s_phi(r, phi, Z), Z)*r^2, diff(s_Z(r, phi, Z), Z) = 0, 
diff(m(r, phi, Z), r) = s_Z(r, phi, Z)*B_phi(r, phi, Z) - s_phi(r, phi, Z)*B_Z(r, phi, Z),
 diff(m(r, phi, Z), phi) = s_r(r, phi, Z)*B_Z(r, phi, Z) - s_Z(r, phi, Z)*B_r(r, phi, Z),
 diff(m(r, phi, Z), Z) = s_phi(r, phi, Z)*B_r(r, phi, Z) - s_r(r, phi, Z)*B_phi(r, phi, Z), 
s_r(r, phi, Z)*diff(W(r, phi, Z), r) + s_phi(r, phi, Z)*diff(W(r, phi, Z), phi) + 
s_Z(r, phi, Z)*diff(W(r, phi, Z), Z) = 0]

After some time, I arrive at the equation in the original question. So the independance of the other functions on r is the consequence of the other equations.

Here is the file (shortened): mwquestion2.mw

Why is constants not an envvar or differently, why is there no envvar to declare constants?

We can see the context of  Matlab code in the Windows preview pane as follows, but we can' t see the context of Maple codes.

I wonder whether it is possible for Maple, too or not. Is there any method to achieve this? Because it really offers a great advantage for the fast browsing context of code in a folder that includes a lot of maple files.

 

(I use Maple 2019 and Windows 10)

 

 
 
 
 
 

Sorry if it's a dumb question, i'm new with Sage.

I'm doing the multiplication of two matrix and I obtain the expression 

 

[142√(2x−2√)+122√y] 

I want to represent this on 3d, but I realized that the expression has to be written with operators '*'

How can I add the operators to my expression?

 

Let A=[V1, V2 ,..., Vn ] be a list of binary vectors such that the length of Vi for i=1...n is the positive integer number m. For instance, in the following example we have n=6 and m=5.

A := [[1, 1, 1, 0, 0], [0, 1, 0, 1, 1], [1, 0, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 0], [0, 1, 1, 1, 1]]

Suppose that ej with j=1...m are vectors of size m such that all entries of ej 's are zero except the jth entry where is equal to 1. Now set S=[e1,e2,...,em]. For example by m=5 we get 

S:=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]

First, we choose i,j in [1...m] such that i<>j and then we update S as follows S=[e1,e2,...,em,ei+ej mod 2]. For example, it follows from i=1 and j=2 that 

S:=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [1, 1, 0, 0, 0]]

Now consider the kth entry of A which is called Ak. Then we check that what is the minimum number of entries of S so that the summation of these entries mod 2 is equal to Ak. For example, for  S=[e1,e2,...,em,e1+e2 mod 2] we get [2, 3, 4, 3, 2, 4] which means the minimum number of entries of the S that are required to be added in order to obtain A1 is 2 and so on. Therefore, for the given example we get 

E:=[[1, 2, [2, 3, 4, 3, 2, 4], 18, 7.615773106],
[1, 3, [2, 3, 3, 3, 3, 4], 18, 7.483314774],
[1, 4, [3, 3, 3, 3, 2, 4], 18, 7.483314774],
[1, 5, [3, 3, 3, 3, 3, 4], 19, 7.810249676],
[2, 3, [2, 3, 4, 2, 3, 3], 17, 7.141428429],
[2, 4, [3, 2, 4, 2, 2, 3], 16, 6.782329983],
[2, 5, [3, 2, 4, 3, 3, 3], 18, 7.483314774], 
[3, 4, [3, 3, 3, 2, 3, 3], 17, 7.], 
[3, 5, [3, 3, 3, 3, 3, 3], 18, 7.348469229],
[4, 5, [3, 2, 3, 3, 3, 3], 17, 7.]];

For instance, the interpretation of [3, 5, [3, 3, 3, 3, 3, 3], 18, 7.348469229] is that if S be [e1,e2,e3,e4,e5,e3+e5 mod 2] then we get [3, 3, 3, 3, 3, 3] where 18 is the summation of [3, 3, 3, 3, 3, 3] and also the number 7.348469229 is obtained from the following command: 

MatrixNorm(convert([3, 3, 3, 3, 3, 3], Matrix), Frobenius);

Now we choose Ek for k in [1..nops(E)] such that Ek[4] be minimum over all Ek[4]'s. For example we choose [2, 4, [3, 2, 4, 2, 2, 3], 16, 6.782329983] since 16 is minimum between Ek[4]'s.

There are two points: First one is that if we have Ei and Ej such that Ei[4]=Ej[4] then we choose Ei if  Ei[5]>Ej[5] . The second point is that if Ei[4]=Ej[4] and also Ei[5]=Ej[5] then we choose one of them such as the first one. Finally we update the set S from the first two entries of Ek that we have obtained. For instance, the updated S in our example is:

S=[e[1],e[2],e[3],e[4],e[5],S[E[6][1]]+S[E[6][2]] mod 2]=[e[1],e[2],e[3],e[4],e[5],e[2]+e[4] mod 2]

Now we repeat this procedure for the updated S until that in one of the entries of E such as Ek we get Ek[3]=[1,1,..,1].

I have written a procedure in Maple for the mentioned question. But my procedure takes long time to compute when I run it over a list such as A with parameters n=m=64.

I want to kindly request you please modify the following code or suggest another fast procedure for this question.

 
 restart;

 with(LinearAlgebra):
 with(ListTools): 
 with(combinat):
 
 BP := proc (A::list)
    local n, m, r, S, U, tt, P, E, t, Q, Z, R, k, T, j, PP, i, QQ; 
    n := nops(A); 
    m := nops(A[1]);
    r := [seq(0, i = 1 .. m)]; 
    r[1] := 1; 
    S := [seq(Rotate(r, m-i+1), i = 1 .. m)]; 
    unassign('r'); 
    U := []; 
    tt := 1;
 while 0 < tt do
     P := choose(nops(S), 2);
     E := [];
     for t to nops(P) do
          Q := P[t];
          Z := []; 
          R := [S[], `mod`(S[Q[1]]+S[Q[2]], 2)];
          for k to n do
               T := A[k];
               for j to nops(R) do 
                    PP := choose(nops(R), j);
                    for i to nops(PP) do 
                         QQ := PP[i]; r := `mod`(add(R[QQ[i]], i = 1 .. nops(QQ)), 2);
                         if Occurrences(0, r-T) = m then
                            Z := [op(Z), j];
                            i := nops(PP)+1; 
                            j := nops(R)+1 
                         end if; 
                      end do; 
                      unassign('i, QQ, r, PP'): 
                  end do;
              end do;
              E := [op(E), [Q[], Z, add(Z[i], i = 1 .. nops(Z)), evalf(MatrixNorm(convert(Z, Matrix), Frobenius))]]; 
              unassign('k, Z, Q, R'): 
          end do;
          r := FindMinimalElement([seq(E[i][4], i = 1 .. nops(E))]);
          R := []; 
         for i to nops(E) do 
             if E[i][4] = r then R := [op(R), E[i]] end if 
         end do;
         T := [FindMaximalElement([seq(R[i][5], i = 1 .. nops(R))], position)];
         S := [S[], `mod`(S[R[T[2]][1]]+S[R[T[2]][2]], 2)]; 
         U := [op(U), [R[T[2]][1], R[T[2]][2]]];
         if Occurrences(1, R[T[2]][3]) = n then tt := 0 end if;
         unassign('r, i, R, T, E')
     end do;
     return U;
 end proc:
 
 A := [[1, 1, 1, 0, 0], [0, 1, 0, 1, 1], [1, 0, 1, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 0], [0, 1, 1, 1, 1]];

 BP(A);
      [[2, 4], [3, 6], [5, 7], [1, 2], [1, 6], [3, 8], [3, 9], [8, 9]]
 

For more information please see Section 2.1 of the following paper: https://eprint.iacr.org/2019/856.pdf

Thanks in advance for your consideration of this request.

Dear friends, 

Lets say I have this procedure here. 
graph := proc(fn::anything, t::{integer, name}) if type(t, integer) then return fn; else return plot(fn, gridlines); end if; end proc

Currently it returns a function from input if I provide an addtional argument in integer form. And it provides the graph for the function if I include an extra argument of type name. 

However I would like to do (if possible) is to using the same proc to make the parameter t optional instead. Meaning if type 

graph(x^2)  then it only returns the input and if I type graph(x^2,g) then instead it returns the graph of the input function. 

Is this possible to do? I have this paragraph in the help files https://www.maplesoft.com/support/help/Maple/view.aspx?path=parameter_classes#optional But I am not sure if thats the way to go? 

Hope somebody has a hint/idea? Best regards 

Hello everybody,

I am new to MaplePrimes, so I am sorry for possible bad formatting.

I am solving some physical problem in cylindrical coordinates, so the EDIT independent variables are r,phi,Z. The equations I obtain contain constants _C from dsolve and constant parameters aplha[i,j], for example

sin(phi)*_C1*alpha[3, 5] + cos(phi)*_C1*alpha[3, 4] = sin(phi)*_C11*alpha[1, 3] - cos(phi)*_C11*alpha[2, 3]

I would like to solve this type of equations for all values of the variables, namely phi in the example above.

If I do not choose the variables for which to solve, I get phi=phi as one of the equations in the solution. If i choose all the variables except phi, i get an the expression for the constants containing the variable phi.

Is there a way to solve these equations automatically or do I have to separate them manually using collect and coeffs?

Or could the solution be the comand Parameters from Physics package?

Thank you in advance for your help.

EDIT: I did not explain the problem properly. I am solving some complicated set of determining equations to obtain integrals of motion. They are rce in the attached file. I substitute some ansatz for the magnetic field and I solve them for 

W(r), h_Z(r, phi, Z), h_phi(r, phi, Z), h_r(r, phi, Z), m(r, phi, Z), n_Z(r, phi, Z), n_phi(r, phi, Z), n_r(r, phi, Z), s_Z(r, phi, Z), s_phi(r, phi, Z), s_r(r, phi, Z), rho(r), sigma(r)

The first set of equation, called third in the file are solved by HOconds_polar_solved. This is where the  konstants alpha[i,j] appear. I substitute HOconds_polar_solved into the equations rce and try to solve them for the remaining functions.

Because it is an overdetermined system, I get some equations of the type in the original question or (for example)

8*r^5*_C1*((alpha[4, 4] - alpha[5, 5])*cos(2*phi) + sin(2*phi)*alpha[4, 5])=0

Because r and phi are the independent veriables of the system, the solution to the equation above should be 

_C1=0 or (alpha[4,4]=alpha[5,5] and alpha[4,5]=0)

But I get the following.

solve(8*r^5*_C1*((alpha[4, 4] - alpha[5, 5])*cos(2*phi) + sin(2*phi)*alpha[4, 5]));
 {_C1 = 0, phi = phi, r = r, alpha[4, 4] = alpha[4, 4], alpha[4, 5] = alpha[4, 5], alpha[5, 5] = alpha[5,5]}, 
{_C1 = _C1, phi = phi, r = 0, alpha[4, 4] = alpha[4, 4],  alpha[4, 5] = alpha[4, 5], alpha[5, 5] = alpha[5, 5]},
 {_C1 = _C1, phi = phi, r = r, alpha[4, 4] = -tan(2 phi) alpha[4, 5] + alpha[5, 5], alpha[4, 5] = alpha[4, 5], alpha[5, 5] = alpha[5, 5]}

The file (part of the original file, which is very long): question.mw

EDIT 2: I changed the title to contain independent variables, which makes the answer more clear. The second Answer from Carl Love works fine, at least in the presented case.

   1 1 1 2 2 3 3  

(  1 3 3 2 2 1 2 )

how to input this permutation into permgroup ?

 

Hi again friends. I simply can't get the command to work. My task is to dsolve the differential equation numerically, by using dsolve which has an option called numeric. I need to use the numeric and odeplot command to plot the numerical solution for f(t) for the timeinterval from 0 to 600 s.

So I searched and found this link: http://www.maplesoft.com/support/help/Maple/view.aspx?path=plots/odeplot

The example in the page was useful, I followed the steps, but I keep get this error-repport:

3 4 5 6 7 8 9 Last Page 5 of 1817