Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi, please how do I delete only the 0*I of the complex expression: 0.*I - 3?

I tried this:  remove(`=`, [0.*I-3, 5, 7, -2], 0.*I);

But couldn't work.

I want to replace   expression that contains function whose first argument is always R0 with r0.

I can do it when the function is  f(R0) or f(R0,x) but I do not know how to tell Maple to do the replacement of the first argument, if the function has 0 or more arguments beyond R0.  This is what I tried

restart;

#this works
expr:=A+f(R0);
evalindets(expr, 'anyfunc(identical(R0))', Z-> subsop(1 = r0, Z ));

A+f(R0)

A+f(r0)

#this also works, when there is one argument after R0
expr:=A+f(R0,x);
evalindets(expr, 'anyfunc(identical(R0),anything)', Z-> subsop(1 = r0, Z ));

A+f(R0, x)

A+f(r0, x)

#but how to do it for any number of arguments after R0? This does not work
expr:=A+f(R0,x,y);
evalindets(expr, 'anyfunc(identical(R0),anything)', Z-> subsop(1 = r0, Z ));

A+f(R0, x, y)

A+f(R0, x, y)

#I do not want to keep adding anything to match the number of argument, as I do not know how many there could be
expr:=A+f(R0,x,y);
evalindets(expr, 'anyfunc(identical(R0),anything,anything)', Z-> subsop(1 = r0, Z ));

A+f(R0, x, y)

A+f(r0, x, y)

 

Download oct_11_2022_anyfunc.mw

I do not want to keep writing anything,anything,anything, for as many times as there could be more arguments.  I wan to say something like

evalindets(expr, 'anyfunc(identical(R0),anything_zero_or_more_arguments)', Z-> subsop(1 = r0, Z ));

Is there a better way to do this whole thing than what I am doing?

Update

Just after I posted this question, I found another structured type that worked

expr:=A+f(R0,x,y,z,h);
evalindets(expr, 'patfunc(identical(R0),anything)', Z-> subsop(1 = r0, Z ));

So patfunc works for zero or more argument after R0, which is what I wanted.

Given that types are core part of Maple, I find it so amazing that the help page "Definition of a Structured Type in Maple"  has so little examples and description of all these types in it. I can't figure what 80% of the types there do, since there are no examples.

Maplesoft should really do a better job on this page and add much much more examples and description. After all, strong typing is what is supposed to be the strength of Maple. But looking at this help page, it does not give one this impression at all.

After I refer to the Mersenne prime number table, I found the following result
5, 31, the number of digits is too large to be determined
13, 8191
17, 131071
19, 524287
If the following elements all yield composite numbers
So:
2, 3, 7, 127
The length of the sequence with only 2 only generators reaches 4.
Due to its particularity, it is guessed whether 2^(2^127-1)-1 is also a prime number,
and whether the sequence with 2 as the generator is an infinite sequence of prime numbers Woolen cloth? 
Then perfect numbers are also infinite.

I inadvertently discovered that the save command (and probably read, write, export and import commands too?) returns an error (something like "can't write ...") when the file length is too large (265 in my case).

Is this documented somewhere?
Is there a way to exceed this limit?
Assuming D=".../" and F="xxx.m", can we set the path of the directory D to some value and then use save something, F instead of save something cat(D, F) ?

Thanks in advance

I have a matrix and generate difference tables from it's diagonals. Works fine. Then I make a polynomial from the first row of the difference table. I have three polynomials. They are all acting inert, just will not evaluate.

I cannot see what the problem is.
 

restart

interface(rtablesize = 12)

[10, 10]

i) Recurrence relation

 

"Recurrence Relation for next column. . The matrix starts at 1,1 not 0,0 A(i,j)=A(i-1,j-1)*(j-2)+A(i,j-1)"
``

NULL``

Msize := 12

A := Matrix(Msize)

A[1, 1] := 1

1

for i from 2 to Msize do for j from i to Msize do A[i, j] := A[i, j-1]*(j-2)+A[i-1, j-1] end do end do

A

Matrix(%id = 36893489695842121836)

``

``

viia)  General formula for diagonals:-

Select diagonal  & Difference Table procedures

 

diag := proc (M::Matrix, dg::posint) local i, rd, c, dt; rd := LinearAlgebra:-RowDimension(M); dt := Matrix(rd, rd); for i from dg to rd do dt[1+i-dg, 1] := M[1+i-dg, i] end do; return dt end proc

proc (M::Matrix, dg::posint) local i, rd, c, dt; rd := LinearAlgebra:-RowDimension(M); dt := Matrix(rd, rd); for i from dg to rd do dt[1+i-dg, 1] := M[1+i-dg, i] end do; return dt end proc

diag(A, 5)

Matrix(%id = 36893489695866397388)

diftab := proc (M::Matrix) local i, j, cl, rd; rd := LinearAlgebra:-RowDimension(M); for i from rd by -1 to 1 do if M[i, 1] = 0 then rd := rd-1 else break end if end do; cl := rd; for i from 2 to cl do for j to rd-i do M[j, i] := M[j+1, i-1]-M[j, i-1] end do end do; print(M); return M end proc

proc (M::Matrix) local i, j, cl, rd; rd := LinearAlgebra:-RowDimension(M); for i from rd by -1 to 1 do if M[i, 1] = 0 then rd := rd-1 else break end if end do; cl := rd; for i from 2 to cl do for j to rd-i do M[j, i] := M[j+1, i-1]-M[j, i-1] end do end do; print(M); return M end proc

diftab(diag(A, 4))

Matrix(%id = 36893489695866348116)

gnrpoly := proc (M::Matrix) local i, p, rd, n; rd := LinearAlgebra:-RowDimension(M); for i from rd by -1 to 1 do if M[1, i] = 0 then rd := rd-1 else break end if end do; p := 0; for i from 0 to rd-1 do p := p+M[1, i+1]*binomial(n, i) end do; return p end proc

proc (M::Matrix) local i, p, rd, n; rd := LinearAlgebra:-RowDimension(M); for i from rd by -1 to 1 do if M[1, i] = 0 then rd := rd-1 else break end if end do; p := 0; for i from 0 to rd-1 do p := p+M[1, i+1]*binomial(n, i) end do; return p end proc

"for i from 0 to 3 do print("Diagonal  ",i);   eqn:=gnrpoly(diftab(diag(A,i+1)));    cat(poly,i):=unapply(factor(expand(eqn)),n);    print("--------------------------------------------------------------");  end do"

"--------------------------------------------------------------"

NULL

``

``

The equations do not evaluate. They are acting inert

poly1(n)

(1/2)*n*(1+n)

poly1(2)

(1/2)*n*(1+n)

poly2(n)

(1/24)*n*(3*n+5)*(n+2)*(n+1)

poly2(3)

(1/24)*n*(3*n+5)*(n+2)*(n+1)

poly3(n)

(1/48)*n*(n+1)*(n+3)^2*(n+2)^2

poly3(-1)

(1/48)*n*(n+1)*(n+3)^2*(n+2)^2

eqn

6*n+38*binomial(n, 2)+93*binomial(n, 3)+111*binomial(n, 4)+65*binomial(n, 5)+15*binomial(n, 6)

value(eval(eqn, n = 4))

6*n+38*binomial(n, 2)+93*binomial(n, 3)+111*binomial(n, 4)+65*binomial(n, 5)+15*binomial(n, 6)

eqn1 := expand(eqn)

(3/4)*n+2*n^2+(97/48)*n^3+(47/48)*n^4+(11/48)*n^5+(1/48)*n^6

eval(eqn1, [n = 4])

(3/4)*n+2*n^2+(97/48)*n^3+(47/48)*n^4+(11/48)*n^5+(1/48)*n^6

NULL


 

Download Q_10-10-22_gentrate_eqn.mw

convert(series(f(x),x,10),list) will produce a list with exponents rather than 0's. Is there a natural way to simply get a list with 0 padding? Also, can one make their own type converter?  (obviously I can make a procedure but talking about something in accordance with convert)

I have never use Maple before and have the following equation

ca, cb, Ka, Kb, Kw and Va are either constants or pre-determined (Va).  I know it should be easy to tabulate/calculate values of Vb for given values of [H+] (hydrogen ion concentration) but how easy would it be to determine values of [H+] for selected values of Vb?  Would it be easy to set up bearing in mind my lack of experience?

Hi everyone 

I would like to plot something in 3d. I have to functions both depending on the time. (x(t), z(t))

I can plot in 2d: (t, x(t)) or (t,z(t)) or (x(t), z(t)) 

Now I want to show the flight path (x(t), z(t)) over time t. So I thought a 3d plot would be suitable for this. 

The problem is that I dont know how to plot this. With plot3d I am only able to plot some planes. What I want to plot is the flight path in the 3d room with the axis x(t),z(t) and t.

Does anybody know how to do this?

thanks in advance!

L’éventail de la Geisha
restart:with(plots):with(geometry):
NULL;
_EnvHorizontalName := 'x':
_EnvVerticalName := 'y':

NULL;
EqBIS := proc(P, U, V) 
local a, eq1, M1, t, PU, PV, bissec1; 
description "P est le sommet de l'angle dont on chercche la bissectrice" ;
a := (P - U)/LinearAlgebra:-Norm(P - U, 2) + (P - V)/LinearAlgebra:-Norm(P - V, 2); 
M1 := P + a*t; eq1 := op(eliminate({x = M1[1], y = M1[2]}, t)); 
RETURN(op(eq1[2])); end proc:

with(plottools);
with(plots);


r1 := 1/2;
r2 := r1/2;
R := r1*(21 - 12*sqrt(3));
                            21      (1/2)
                       R := -- - 6 3     
                            2            

a := arc([0, 0], 2*r1, Pi/6 .. (5*Pi)/6);
b := arc([0, 0], r1, Pi/6 .. (5*Pi)/6);


with(geometry);
eq := EqBIS(<sqrt(3)/2, 1/2>, <0, 0>, <0, 1/2>);
line(bis, eq);
                         (1/2)                  
                eq := 2 3      y - 2 x + 4 y - 2

                              bis

OpT := 2*sqrt(r1*R);
line(lv, x = OpT);
intersection(Omega, bis, lv);
coordinates(Omega);
evalf(%);
                                (1/2)    
                      OpT := 2 3      - 3

                               lv

                             Omega

                 [                / (1/2)    \]
                 [   (1/2)      2 \3      - 1/]
                 [2 3      - 3, --------------]
                 [                     (1/2)  ]
                 [                2 + 3       ]

                  [0.464101616, 0.3923048456]

retarrt;
with(plots);
with(plottools);
[cos((5*Pi)/6), sin((5*Pi)/6)];
                        [  1  (1/2)  1]
                        [- - 3     , -]
                        [  2         2]

a := arc([0, 0], 2*r1, Pi/6 .. (5*Pi)/6);
b := arc([0, 0], r1, Pi/6 .. (5*Pi)/6);
NULL;
A:=[cos(Pi/6), sin(Pi/6)];
B:=[cos(5*Pi/6), sin(5*Pi/6)];
Oo:=[0,0];
Op:=[0,1/2];
poly:=[A,B,Oo];
R := r1*(21 - 12*sqrt(3))
                            [1  (1/2)  1]
                       A := [- 3     , -]
                            [2         2]

                           [  1  (1/2)  1]
                      B := [- - 3     , -]
                           [  2         2]

                          Oo := [0, 0]

                                [   1]
                          Op := [0, -]
                                [   2]

                [[1  (1/2)  1]  [  1  (1/2)  1]        ]
        poly := [[- 3     , -], [- - 3     , -], [0, 0]]
                [[2         2]  [  2         2]        ]

                            21      (1/2)
                       R := -- - 6 3     
                            2            


Omega := [2*sqrt(3) - 3, 2*(sqrt(3) - 1)/(2 + sqrt(3))];
Omega1 := [3 - 2*sqrt(3), 2*(sqrt(3) - 1)/(2 + sqrt(3))];

                     [                / (1/2)    \]
                     [   (1/2)      2 \3      - 1/]
            Omega := [2 3      - 3, --------------]
                     [                     (1/2)  ]
                     [                2 + 3       ]

                     [                 / (1/2)    \]
                     [    (1/2)      2 \3      - 1/]
           Omega1 := [-2 3      + 3, --------------]
                     [                      (1/2)  ]
                     [                 2 + 3       ]


r3 := 3/16;
EF := sqrt(r3);

                                  3 
                            r3 := --
                                  16

                               1  (1/2)
                         EF := - 3     
                               4       

r := (150 - 72*sqrt(3))/193*1/2;
alpha := -5/3*r + 1/2*1/2;
p := sqrt(3)/3*1/2 - sqrt(3)/18*r;
                          75    36   (1/2)
                     r := --- - --- 3     
                          193   193       

                             307   60   (1/2)
                  alpha := - --- + --- 3     
                             772   193       

               1  (1/2)   1   (1/2) /75    36   (1/2)\
          p := - 3      - -- 3      |--- - --- 3     |
               6          18        \193   193       /

p2 := textplot([[A[], "A"], [B[], "B"], [Oo[], "O"]], align = ["above", "right"]);
display(a, b, p2, polygonplot(poly, thickness = 3, color = blue, transparency = 0.3), circle(Omega, R, color = blue, filled = true), circle(Omega1, R, color = blue, filled = true), circle([0, 3/4], 1/4, color = yellow, filled = true), circle([EF, 1/2 + r3], r3, color = green, filled = true), circle([-EF, 1/2 + r3], r3, color = green, thickness = 5), circle([p, 3/4 + alpha], r, color = red, thickness = 5), circle([-p, 3/4 + alpha], r, color = red, thickness = 5), axes = none, scaling = constrained, size = [500, 500]);
how to put color inside circles ? Thabk you.

There are a couple of warnings in the Maple Code Editor that are unneccessary. Those are valid parameters of in Maple functions.

Would it be possible to have those removed in future editions?

Info: Line 794: These names were used as global names but were not declared: enabled
Info: Line 837: These names were used as global names but were not declared: itemList
Info: Line 847: These names were used as global names but were not declared: nolist
Info: Line 854: These names were used as global names but were not declared: selectedindex
Info: Line 905: These names were used as global names but were not declared: nolist
Info: Line 910: These names were used as global names but were not declared: itemList
Info: Line 911: These names were used as global names but were not declared: selectedindex
Info: Line 961: These names were used as global names but were not declared: enabled
Info: Line 992: These names were used as global names but were not declared: unit_free

I want to set the EQ equations equal to zero and get the answers for a[0], a[1], b[1], c . How might I achieve this?

I am trying to produce a two-dimensionanl grid spanned by 2 non-standard vectors as shown below.  How might I achieve this?

How to draw a phase portrait of (2) same as in the attached figure? I tried it by using dsolve, but couldn't redraw it.  

restart

with(DEtools); with(plots)

alias(phi = phi(xi))

phi

(1)

eq := (1/2)*m*(diff(phi, xi))^2+`&Phi;__&mnplus;` = h

(1/2)*m*(diff(phi, xi))^2+`&Phi;__&mnplus;` = h

(2)

NULL

`&Phi;__&mnplus;` = `&-+`(1-cos(phi))

`&Phi;__&mnplus;` = `&-+`(1-cos(phi))

(3)

``

Download PP.mw

I want to solve for y in   exp(sqrt(y))= tanh(x) and get y=ln( tanh(x)^2).  But unable to figure what options or assumptions Maple needs.

For reference, here is Mathematica solution that I'd like to duplicate in Maple

Here is my Maple attempts, which uses same assumptions, but Maple solution converts the tanh(x) into exponentials which is much more complicated to look at. I tried to also simplify the answer to tanh(x) but no success so far.

Any ideas what else to try for solve? 

I know that PDEtools:-Solve does the job. Which is why I find this strange. I thought that both PDEtools:-Solve and solve end up using same core code at one point. May be I should switch all my code to use PDEtools:-Solve?  Should not solve here have given same answer as PDEtools:-Solve?

Maple 2022.1 on windows 10.

eq:=sqrt(exp(y))=tanh(x);

(exp(y))^(1/2) = tanh(x)

sol:=solve(eq,y) assuming y::real, x>0

ln((-1+(exp(x))^2)^2/((exp(x))^2+1)^2)

simplify(sol)  assuming real, x>0;
convert(%,trigh)

2*ln(exp(2*x)-1)-2*ln(exp(2*x)+1)

2*ln(cosh(2*x)+sinh(2*x)-1)-2*ln(cosh(2*x)+sinh(2*x)+1)

sol:=PDEtools:-Solve(eq,y) assuming y::real, x>0

y = 2*ln(tanh(x))

 

Download oct_9_2022_simplifcation.mw

First 271 272 273 274 275 276 277 Last Page 273 of 2218