MaplePrimes Questions

I have doubts as to whether this is possible, but I would like to ask anyway.

For example, can

`*`(`+`(a, b), c);
                           c (a + b)

be written with composed procedures (`*`@`+`) and somehow grouped arguments (a,b) for `+` and (a+b,c) for `*`.

So far I have only come across composed procedures in parethesis applied to one expression in parenthesis.

Since the second pair of parenthesis does a function application to everything what is inside the parenthesis it seems impossible that the right most procedure is only applied to a sub-term of the expression first.

If the answer to my question is no, I want to aks a related question:

Is it possible to separate procedures calls from arguments? So, in a first part of a statement I have a sequence (or a list or a composed function) of procedures/operators and in the second part a sequence of arguments instead of a nested construct of procedure calls?

How to convert this set of PDEs into ODEs? PDEs.mw

How do I draw this plot in Maple?

I have a list as follows:
lst := [`A=70`, `B=17`, `C=27`, `D=37`, `E=74`, `F=57`, `G=67`, `H=08`, `I=81`, `J=28`, `K=38`, `L=48`, `M=58`, `N=68`, `O=90`, `P=19`, `Q=29`, `R=39`, `S=49`, `T=59`, `U=96`, `V=010`, `W=110`, `X=210`, `Y=310`, `Z=410`, "SPACE=105", "DOT=106"]

however using tt:=convert(lst, table) gives

tt:=table([1 = `A=70`, 2 = `B=17`, 3 = `C=27`, 4 = `D=37`, 5 = `E=74`, 6 = `F=57`, 7 = `G=67`, 9 = `I=81`, 8 = `H=08`, 11 = `K=38`, 10 = `J=28`, 13 = `M=58`, 12 = `L=48`, 15 = `O=90`, 14 = `N=68`, 18 = `R=39`, 19 = `S=49`, 16 = `P=19`, 17 = `Q=29`, 22 = `V=010`, 23 = `W=110`, 20 = `T=59`, 21 = `U=96`, 27 = "SPACE=105", 26 = `Z=410`, 25 = `Y=310`, 24 = `X=210`, 28 = "DOT=106"])

I want this to be such that I can retrieve the numerical value assigned to each alphabet e.g.
tt[A] should produce 70.

Good day people, here just asking for your help please.

I am trying to do a taylor serie of a function but I recieved this error:

Error, (in Typesetting:-NeedsBrace) invalid input: the 1st argument to pointto is not a valid pointer handle

The aim of this is get the series to do its integration.

Thank you a lot for your responses.

maple_primes_question.mw

I need to produce some diagrams for the help pages of my package. I trying to typeset the dot product "." on a plot but keep getting a % symbol. I have tried without typesetting but makes no differance.

restart

 

 

Sdim:=proc(A,B,C,clr::string,S:=NULL)
    description"plots spread symbol";
    uses plots,plottools;
    local aa,bb,c,d,e,f,g,h,k,p1,v1,v2,vab,vac;
    vab:=Vector(B-A);
    vac:=Vector(C-A);
    aa:=(B-A)/5;
    bb:=(C-A)/5;
    p1:=plottools:-point([A,B,C],symbol=solidcircle);
    c:= plottools:-line(A+aa,A+bb);
    d:=plottools:-line(A,B);
    e:=plottools:-line(A,C);
    f:=plots:-textplot([op(1.1*(A+(aa+bb)/2)+[1.5,0]), typeset(S)]);   #print S
    g:=plots:-textplot([op(.9*A), typeset([x[1],y[1]])]);  #[x1,y1]
    h:=plots:-textplot([op(1.1*B), typeset([x[2],y[2]])]);  #x2,y2]
    k:=plots:-textplot([op(1.05*C), typeset([x[3],y[3]])]);  #x3,y3]
    v1:=plots:-textplot([op(A+(B-A)/2+[.2,-.2]), typeset(`#mover(mi("v"),mo("⇀"))`[a])]);   # vector symbol
    v2:=plots:-textplot([op(A+(C-A)/2+[-.2,.2]), typeset(`#mover(mi("v"),mo("⇀"))`[b])]);   #vector symbol
    display(p1,c,d,e,f,g,h,k,v1,v2,axes=none,scaling=constrained,caption="Spread between two vectors");    #place title under diagram
end proc

 

proc (A, B, C, clr::string, S := NULL) local aa, bb, c, d, e, f, g, h, k, p1, v1, v2, vab, vac; description "plots spread symbol"; vab := Vector(B-A); vac := Vector(C-A); aa := (1/5)*B-(1/5)*A; bb := (1/5)*C-(1/5)*A; p1 := plottools:-point([A, B, C], symbol = solidcircle); c := plottools:-line(A+aa, A+bb); d := plottools:-line(A, B); e := plottools:-line(A, C); f := plots:-textplot([op(1.1*(A+(1/2)*aa+(1/2)*bb)+[1.5, 0]), typeset(S)]); g := plots:-textplot([op(.9*A), typeset([x[1], y[1]])]); h := plots:-textplot([op(1.1*B), typeset([x[2], y[2]])]); k := plots:-textplot([op(1.05*C), typeset([x[3], y[3]])]); v1 := plots:-textplot([op((1/2)*A+(1/2)*B+[.2, -.2]), typeset(`#mover(mi("v"),mo("⇀"))`[a])]); v2 := plots:-textplot([op((1/2)*A+(1/2)*C+[-.2, .2]), typeset(`#mover(mi("v"),mo("⇀"))`[b])]); plots:-display(p1, c, d, e, f, g, h, k, v1, v2, axes = none, scaling = constrained, caption = "Spread between two vectors") end proc

(1)

Spr:=S=1-(`#mover(mi("v"),mo("⇀"))`[b-a]%.`#mover(mi("v"),mo("⇀"))`[b-a])^2/(`#mover(mi("v"),mo("⇀"))`[a]%.`#mover(mi("v"),mo("⇀"))`[a])/(`#mover(mi("v"),mo("⇀"))`[b]%.`#mover(mi("v"),mo("⇀"))`[b]);

S = 1-`%.`(`#mover(mi("v"),mo("⇀"))`[b-a], `#mover(mi("v"),mo("⇀"))`[b-a])^2/(`%.`(`#mover(mi("v"),mo("⇀"))`[a], `#mover(mi("v"),mo("⇀"))`[a])*`%.`(`#mover(mi("v"),mo("⇀"))`[b], `#mover(mi("v"),mo("⇀"))`[b]))

(2)

Sdim([1,2],[5,1],[4,7],"blue",Spr);

 

 

 

Download Q_2024-02-15_Help_Spread_diagram.mw

I've got a problem where I need to find the shortest route between a list of points. Each point must only be visited once.

To solve the problem I admit that I have used ChatGPT. While the answer was very helpful, the thing is that it apparently doesn't work (yet). The problem is that the function in the package is not existing.

Here's the ChatGPT code.

Any help appreciated.

euclidean_distance := proc (p1, p2) options operator, arrow; sqrt((p1[1]-p2[1])^2+(p1[2]-p2[2])^2) end proc; points := [[0, 0], [1, 2], [3, 1], [5, 4]]; distance_matrix := Matrix([`$`([`$`(euclidean_distance(points[i], points[j]), i = 1 .. 4)], j = 1 .. 4)]); solution := Optimization:-LinearSumAssignment(distance_matrix); optimal_route := [`$`(points[i], `in`(i, solution[1]))]; total_distance := add(`$`(distance_matrix[i, solution[1][i]], `in`(i, solution[1]))); print("Optimal route:", optimal_route); print("Total distance:", total_distance)

"Total distance:", total_distance

(1)

NULL

Download TravellingSalesManChatGPT.mw

I'm running Maple 2020 on a Mac with OS 14.3.1.  Maple is not seeing current files in folders, and when it saves files, it does so with an older date.  In Settings, Maple has permission to access the Desktop, Documents, and Downloads folders, the only options that my Mac provides.

It's a bit frustrating.  Any help would be appreciated.

Are the results consistent either we use simplify(expression) or simplify(expression,size)? It seems (2) and (3) are not consistent.

restart

with(PDEtools); with(LinearAlgebra)

b := -(2*I)*exp(2*t*Im(lambda1))*(exp(I*a*x/conjugate(lambda1))*exp((2*I)*a*x/lambda1)*exp((-I*a*x)*(1/conjugate(lambda1)))*exp(I*conjugate(lambda1)*t)+exp(I*lambda1*t)*exp(I*a*x/lambda1)*exp((-I*a*x)*(1/lambda1))*exp((2*I)*a*x/conjugate(lambda1))*(abs(`ε1`)^2+abs(`ε2`)^2))*conjugate(`ε1`)*Im(lambda1)/(exp((2*I)*a*x/lambda1)*abs(`ε1`)^2*exp(-(2*I)*a*x/conjugate(lambda1))*exp(2*t*Im(lambda1))+exp(-(2*I)*a*x/lambda1)*abs(`ε1`)^2*exp((2*I)*a*x/conjugate(lambda1))*exp(2*t*Im(lambda1))+exp(I*a*x/lambda1)*exp((-I*a*x)*(1/lambda1))*exp(I*a*x/conjugate(lambda1))*exp((-I*a*x)*(1/conjugate(lambda1)))*(abs(`ε2`)^4+2*abs(`ε1`)^2*abs(`ε2`)^2+abs(`ε1`)^4+2*abs(`ε2`)^2*exp(2*t*Im(lambda1))+exp(4*t*Im(lambda1))))

-(2*I)*exp(2*t*Im(lambda1))*(exp(I*a*x/conjugate(lambda1))*exp((2*I)*a*x/lambda1)*exp(-I*a*x/conjugate(lambda1))*exp(I*conjugate(lambda1)*t)+exp(I*lambda1*t)*exp(I*a*x/lambda1)*exp(-I*a*x/lambda1)*exp((2*I)*a*x/conjugate(lambda1))*(abs(epsilon1)^2+abs(epsilon2)^2))*conjugate(epsilon1)*Im(lambda1)/(exp((2*I)*a*x/lambda1)*abs(epsilon1)^2*exp(-(2*I)*a*x/conjugate(lambda1))*exp(2*t*Im(lambda1))+exp(-(2*I)*a*x/lambda1)*abs(epsilon1)^2*exp((2*I)*a*x/conjugate(lambda1))*exp(2*t*Im(lambda1))+exp(I*a*x/lambda1)*exp(-I*a*x/lambda1)*exp(I*a*x/conjugate(lambda1))*exp(-I*a*x/conjugate(lambda1))*(abs(epsilon2)^4+2*abs(epsilon1)^2*abs(epsilon2)^2+abs(epsilon1)^4+2*abs(epsilon2)^2*exp(2*t*Im(lambda1))+exp(4*t*Im(lambda1))))

(1)

bdif := simplify(diff(b, x)); bdifxzero := simplify(subs({x = 0}, bdif))

4*Im(lambda1)*exp(2*t*Im(lambda1))*a*conjugate(epsilon1)*(conjugate(lambda1)*abs(epsilon1)^2*(abs(epsilon1)^2+abs(epsilon2)^2)*exp((t*(I*lambda1+2*Im(lambda1))*abs(lambda1)^2+(4*I)*a*(lambda1-(1/2)*conjugate(lambda1))*x)/abs(lambda1)^2)+exp(((I*conjugate(lambda1)+2*Im(lambda1))*t*abs(lambda1)^2-(2*I)*(lambda1-2*conjugate(lambda1))*a*x)/abs(lambda1)^2)*abs(epsilon1)^2*lambda1+2*abs(epsilon1)^2*(conjugate(lambda1)-(1/2)*lambda1)*exp((I*conjugate(lambda1)^2*t+(2*I)*a*x+2*t*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+2*abs(epsilon2)^2*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp((I*t*abs(lambda1)^2+(2*I)*a*x+2*t*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp((I*t*abs(lambda1)^2+(2*I)*a*x+4*t*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+2*conjugate(lambda1)*exp((I*t*abs(lambda1)^2+(2*I)*a*x+2*t*Im(lambda1)*lambda1)/lambda1)*abs(epsilon2)^2+conjugate(lambda1)*exp((I*t*abs(lambda1)^2+(2*I)*a*x+4*t*Im(lambda1)*lambda1)/lambda1)+(-abs(epsilon1)^2*(conjugate(lambda1)-2*lambda1)*exp((I*lambda1^2*t+(2*I)*a*x+2*t*Im(lambda1)*lambda1)/lambda1)+(abs(epsilon1)^2+abs(epsilon2)^2)*(lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp(I*(t*abs(lambda1)^2+2*a*x)/conjugate(lambda1))+conjugate(lambda1)*exp(I*(t*abs(lambda1)^2+2*a*x)/lambda1)))*(abs(epsilon1)^2+abs(epsilon2)^2))/((abs(epsilon1)^4+2*abs(epsilon1)^2*abs(epsilon2)^2+abs(epsilon2)^4+2*abs(epsilon2)^2*exp(2*t*Im(lambda1))+exp((2*t*Im(lambda1)*abs(lambda1)^2-(2*I)*(lambda1-conjugate(lambda1))*a*x)/abs(lambda1)^2)*abs(epsilon1)^2+exp((2*t*Im(lambda1)*abs(lambda1)^2+(2*I)*(lambda1-conjugate(lambda1))*a*x)/abs(lambda1)^2)*abs(epsilon1)^2+exp(4*t*Im(lambda1)))^2*abs(lambda1)^2)

 

12*Im(lambda1)*exp(2*t*Im(lambda1))*((2/3)*abs(epsilon2)^2*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp(t*(I*abs(lambda1)^2+2*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+(1/3)*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)*exp(t*(I*abs(lambda1)^2+4*Im(lambda1)*conjugate(lambda1))/conjugate(lambda1))+(2/3)*conjugate(lambda1)*exp(t*(I*abs(lambda1)^2+2*lambda1*Im(lambda1))/lambda1)*abs(epsilon2)^2+(1/3)*conjugate(lambda1)*exp(t*(I*abs(lambda1)^2+4*lambda1*Im(lambda1))/lambda1)+(1/3)*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2)^3*exp(I*abs(lambda1)^2*t/conjugate(lambda1))+(1/3)*conjugate(lambda1)*(abs(epsilon1)^2+abs(epsilon2)^2)^2*exp(I*abs(lambda1)^2*t/lambda1)+((-I*Im(lambda1)+(1/3)*lambda1+(1/3)*Re(lambda1))*exp((I*conjugate(lambda1)+2*Im(lambda1))*t)+(I*Im(lambda1)+(1/3)*conjugate(lambda1)+(1/3)*Re(lambda1))*(abs(epsilon1)^2+abs(epsilon2)^2)*exp(t*(I*lambda1+2*Im(lambda1))))*abs(epsilon1)^2)*a*conjugate(epsilon1)/(abs(lambda1)^2*((2*abs(epsilon2)^2+2*abs(epsilon1)^2)*exp(2*t*Im(lambda1))+abs(epsilon2)^4+2*abs(epsilon1)^2*abs(epsilon2)^2+abs(epsilon1)^4+exp(4*t*Im(lambda1)))^2)

(2)

bdif1 := simplify(diff(b, x), size); bdif1xzero := simplify(subs({x = 0}, bdif1), size)

4*Im(lambda1)*(2*exp(I*a*x/lambda1)*exp(I*conjugate(lambda1)*t)*(exp(I*a*x/conjugate(lambda1)))^2*exp(-I*a*x/lambda1)*((1/2)*abs(epsilon1)^4+abs(epsilon1)^2*abs(epsilon2)^2+(1/2)*abs(epsilon2)^4+abs(epsilon2)^2*exp(2*t*Im(lambda1))+(1/2)*exp(4*t*Im(lambda1)))*exp((2*I)*a*x/lambda1)*conjugate(lambda1)*(exp(-I*a*x/conjugate(lambda1)))^2+2*exp(I*a*x/conjugate(lambda1))*(((exp(I*a*x/lambda1))^2*lambda1*exp(I*lambda1*t)*((1/2)*abs(epsilon1)^4+abs(epsilon1)^2*abs(epsilon2)^2+(1/2)*abs(epsilon2)^4+abs(epsilon2)^2*exp(2*t*Im(lambda1))+(1/2)*exp(4*t*Im(lambda1)))*(abs(epsilon1)^2+abs(epsilon2)^2)*(exp(-I*a*x/lambda1))^2+exp(-(2*I)*a*x/lambda1)*exp((2*I)*a*x/lambda1)*exp(2*t*Im(lambda1))*exp(I*conjugate(lambda1)*t)*abs(epsilon1)^2*(conjugate(lambda1)-(1/2)*lambda1))*exp((2*I)*a*x/conjugate(lambda1))+(1/2)*(exp((2*I)*a*x/lambda1))^2*exp(2*t*Im(lambda1))*exp(I*conjugate(lambda1)*t)*exp(-(2*I)*a*x/conjugate(lambda1))*lambda1*abs(epsilon1)^2)*exp(-I*a*x/conjugate(lambda1))+exp(I*a*x/lambda1)*abs(epsilon1)^2*exp(I*lambda1*t)*exp(-I*a*x/lambda1)*exp((2*I)*a*x/conjugate(lambda1))*(conjugate(lambda1)*exp(-(2*I)*a*x/lambda1)*exp((2*I)*a*x/conjugate(lambda1))-exp((2*I)*a*x/lambda1)*exp(-(2*I)*a*x/conjugate(lambda1))*(conjugate(lambda1)-2*lambda1))*exp(2*t*Im(lambda1))*(abs(epsilon1)^2+abs(epsilon2)^2))*conjugate(epsilon1)*a*exp(2*t*Im(lambda1))/((2*exp(I*a*x/lambda1)*exp(I*a*x/conjugate(lambda1))*exp(-I*a*x/lambda1)*((1/2)*abs(epsilon1)^4+abs(epsilon1)^2*abs(epsilon2)^2+(1/2)*abs(epsilon2)^4+abs(epsilon2)^2*exp(2*t*Im(lambda1))+(1/2)*exp(4*t*Im(lambda1)))*exp(-I*a*x/conjugate(lambda1))+exp(2*t*Im(lambda1))*abs(epsilon1)^2*(exp(-(2*I)*a*x/lambda1)*exp((2*I)*a*x/conjugate(lambda1))+exp((2*I)*a*x/lambda1)*exp(-(2*I)*a*x/conjugate(lambda1))))^2*lambda1*conjugate(lambda1))

 

2*Im(lambda1)*exp(0)*conjugate(epsilon1)*exp(2*t*Im(lambda1))*a*(conjugate(lambda1)*exp(I*conjugate(lambda1)*t)+exp(I*lambda1*t)*lambda1*(abs(epsilon1)^2+abs(epsilon2)^2))/((((exp(0))^2*abs(epsilon2)^2+abs(epsilon1)^2)*exp(2*t*Im(lambda1))+(1/2)*(exp(0))^2*(exp(4*t*Im(lambda1))+(abs(epsilon1)^2+abs(epsilon2)^2)^2))*lambda1*conjugate(lambda1))

(3)

NULL

Download simplisize.mw

I want to use the resuls that I obtained  in MATLAB in my maple Program

something like this 

variables in scope: top scope

  Attr   Name        Size                     Bytes  Class
  ====   ====        ====                     =====  =====
         Rnx         1x3801                   30408  double

   1.6495e-02
   5.1389e-01
   1.0114e+00
   1.5091e+00
   2.0070e+00
   2.5049e+00
   3.0031e+00
   3.5013e+00
   3.9997e+00
   4.4982e+00
   4.9969e+00
   5.4956e+00
   5.9945e+00
   6.4935e+00
   6.9926e+00
   7.4919e+00
   7.9912e+00
   8.4906e+00
   8.9901e+00
   9.4898e+00
   9.9895e+00
   1.0489e+01
   1.0989e+01
   1.1489e+01
   1.1989e+01
   1.2489e+01
   1.2989e+01
   1.3490e+01
   1.3990e+01
   1.4490e+01

is there a way to set conjugate=true  to false as a default for BilinearForm?  This would be used inside a package.

restart;
with(LinearAlgebra);

v := <x, y>;
BilinearForm(v, v);
BilinearForm(v, v, conjugate = false);

 

I am trying to define a function f(x1+tau,x2)= (x1+tau)*a+x2*b. I need this to be able to take derivations w.r.t. the sum (x1+tau) and to only tau as well. Is there a way to do this?

I am presently working on bivariate functions defined this way

C := (u, v) -> (phi@@(-1))(phi(u)+phi(v));

phi is a function of specific expression named the "generator". Both u and v are assumed to be in the closed interval [0,1].

Here is an example:

restart
phi := u -> (u^(-theta)-1)/theta:
C := (u, v) -> (phi@@(-1))(phi(u)+phi(v)):
C(u, v)
                       / (-theta)        (-theta)    \
                      | u         - 1   v         - 1|
           @@(phi, -1)| ------------- + -------------|
                       \    theta           theta    /

This definition of C is correct providing that  theta in [-1, +infinity) \ {0}.
As you can see, the display of C(u, v) contains the inverse function phi@@(-1) which Maple doesn't seem to know what to do with.

What I would like is to get rid of  phi@@(-1) and get 

C(u, v);
        (-1+u^(-theta)+v^(-theta))^(-1/theta)

The only way I found to get this is to do that:

restart
phi := u -> (u^(-theta)-1)/theta:
(phi@@(-1)) := u -> solve(phi(x)=u, x): # explicit definition of (phi@@(-1))
C := (u, v) -> simplify((phi@@(-1))(phi(u)+phi(v))) assuming theta >= -1, theta <> 0:
C(u, v);
                                         /    1  \
                                         |- -----|
                                         \  theta/
             /      (-theta)    (-theta)\         
             \-1 + u         + v        /         

As you see I have been forced to tell Maple what the inverse function of phi was.
Is there another way do get this result without writting the bold red line?

Maple knows several inverse functions (trigonometric functions for instance), but how does it know that?
As Maple does not seem to use a (f@@(-1)) := u -> solve(f(x)=u, x) like definition, does it uses a correspondence table between functions and their inverse?
If it is so can we augment it?

Thanks in advance.

PS: the ultimate goal is to do something like this Download CAC.mw  for different generators.

For the moment I have defined my own table generator <--> inverse function  as I did above with the bold red line: this works but it is not very elegant.

Hi,
I have a problem and I haven't been able to solve it yet. I want to solve an ordinary diffrential equation similar to
                                                                                                   (dphi/dxi)^2+2*V(phi)=0
and plot phi versus xi for a the following conditions:
1) V(phi)=dphi/dxi=0 at (phi=0,phi_m) and
2) dV(phi)/dphi=0 at phi=phi_m and 
3) d^2V(phi)/dphi^2=0 at both phi=0 and phi=phi_m.
How can I do this by Maple?(see the attached file)
w1.mw

Has anyone else noticed that Mapleprimes response/loading/refreshing time has become relatively much slower in the past few weeks?

1 2 3 4 5 6 7 Last Page 2 of 2297