Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

What is it that's wrong with the following input in Maple?
Note that all variables are real. The sample worksheet is attached. 


 

NULL

with(Physics[Vectors])

p_ := px_i+py_j+pz_k

px_i+py_j+pz_k

(1)

NULL

q_ := qx_i+qy_j+qz_k

qx_i+qy_j+qz_k

(2)

NULL

w_ := wx_i+wy_j+wz_k

wx_i+wy_j+wz_k

(3)

NULL

'`#mover(mi("p"),mo("→"))`^2/(((a^2+`#mover(mi("p"),mo("→"))`^2)^2)(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`).(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)+b1^2)'

`#mover(mi("p"),mo("→"))`^2/(Typesetting:-delayDotProduct(((a^2+`#mover(mi("p"),mo("→"))`^2)^2)(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`), `#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)+b1^2)

(4)

NULL

int(`#mover(mi("p"),mo("→"))`^2/(Typesetting:-delayDotProduct(((a^2+`#mover(mi("p"),mo("→"))`^2)^2)(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`), `#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)+b1^2), [px = -infinity .. infinity, py = -infinity .. infinity, pz = -infinity .. infinity])

`#mover(mi("p"),mo("→"))`^2*infinity/((a(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)^2+`#mover(mi("p"),mo("→"))`(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)^2)^2.(`#mover(mi("p"),mo("→"))`-`#mover(mi("q"),mo("→"))`+`#mover(mi("w"),mo("→"))`)+b1^2)

(5)

NULL

NULL

NULL


 

Download Integration-Vec-Example.mw

Hi,

I'm new into Maple and I need some serious help. I'm supposed to read numbers from file (teploty.txt) and according to value assign some text to them and write it in other file (barvy.txt). I think I've done it right (propably not, I learn it for like half a year), but Maple keeps writing "Error, cannot determine if this expression is true or false: value < 20".

Can anybody help me, please?

Thank a lot!

Hello,

      I've noticed a strange phenomenon involving simplify: given the exact same input, its output varies between two different results depending on memory usage patterns.

      I've attached a sample code. There, I have an equation which should simplify to 0=0. If I run the code with garbage collection gc uncommented, it will correctly give 0=0. However, with gc commented out, it gives the unsimplified result result ~80% of the time (with 0=0 the remaining 20%):

1/2*A1*k*epsilon*p*(-I*exp(I*psi__p)*(2-2*cos(2*psi__p))^(1/2)+exp(2*I*psi__p)-1)*exp(-I*psi__p-1/2*2^(1/2)*k^(1/2)*(-k*p*cos(psi__p)+(k^2*p^2+2*k*p*
cos(psi__p)+1)^(1/2)-1)^(1/2)*t)*(-exp(-I*k*x-1/2*I*2^(1/2)*k^(1/2)*(k*p*cos(psi__p)+(k^2*p^2+2*k*p*cos(psi__p)+1)^(1/2)+1)^(1/2)*t)+exp(I*k*x+1/2*I*
2^(1/2)*k^(1/2)*(k*p*cos(psi__p)+(k^2*p^2+2*k*p*cos(psi__p)+1)^(1/2)+1)^(1/2)*t)) = 0

For my particular machine, it seems that when the memory usage is <98.4MB, it gives 0=0, and the unsimplied case otherwise.

      Any idea why this is? It seems odd that simplify would return different results depending on garbage collection, especially since use of gc is now discouraged.

example.txt

A few notes:

  • It seems replacing gc with a simple call to kernelopts(memusage) also produces the correct output
  • This is a snippet of a larger body of code I wrote: there, even without gc, it will sporadically (with the exact same input) produce the correct answer ~50% of the time
  • Only the last 4 lines are relevant; the beginning of the attached code is simply to generate appropriate memory usage and doesn't affect the relevant, final 4 lines

EDIT

I could solve my problem already. I edit in the solution at the end, in case some one ever runs into the same issue, and is happy finding this post when searching for a solution.

/EDIT

 

Hi there!

I am starting to learn how to use the Optimization package. The help page for the NLPSolve command contains the example

NLPSolve(sin(x)/x, x=1..30)

which would spit out the local minumum at x=23.519… with value -0.042… .

I tried to use the initialpoint option in order to solve for other local minima or maxima, but regardless which initial point choose, I get

Warning, initial point option ignored by solver

and again the same local minimum as before. I entered the option as follows:

NLPSolve(sin(x)/x, x=1..30,initialpoint={x=17})

I am not sure why it doesn't work, since the NLPSolve help page contains an example using the initialpoint option right underneath this example, and there everything works as intended.

Does anyone know what is going on here?

Cheers!

 

EDIT

The problem was that NLPSolve uses the quadratic interpolation method by default if the function which should be extremised is univariate and unconstrained. This information can be found under the Optimization/General/Methods help page. This method however, is the only one which doesn't accept an initialpoint. Hence, the solution is to apply a different method, such as

NLPSolve(sin(x)/x, x=1..30,initialpoint={x=17},method=modifiednewton)

/EDIT

restart; with(Physics);
Setup(mathematicalnotation = true);
                 [mathematicalnotation = true]
Setup(signature = `-+++`);
                     [signature = - + + +]
Coordinates(M = [t, rho, z, phi]);
 

  Default differentiation variables for d_, D_ and dAlembertian 

   are: (Mequals(t,&rho;,z,&phi;))
 Systems of spacetime Coordinates are: (Mequals(t,&rho;,z,&phi;))
                              {M}
ds2 := -exp(2*psi(rho, z))*d*(t^2)+exp(2*gamma(rho, z)-2*psi(rho, z))*(drho^2+dz^2)+exp(-2*psi(rho, z))*(rho^2)*(dphi^2);
                                  2
    ds2 := -exp(2 psi(rho, z)) d t 

                                              /    2     2\
       + exp(2 gamma(rho, z) - 2 psi(rho, z)) \drho  + dz /

                                2     2
       + exp(-2 psi(rho, z)) rho  dphi 
Setup(metric = ds2);
Error, (in Physics:-Setup) expected the metric as an expression quadratic in [d_(t), d_(rho), d_(z), d_(phi)], or square Matrix, Array or table with 4 lines and 4 columns; or a set with the nonzero components of such a matrix; received: -exp(2*psi(rho, z))*d*t^2+exp(2*gamma(rho, z)-2*psi(rho, z))*(drho^2+dz^2)+exp(-2*psi(rho, z))*rho^2*dphi^2

Hi

In mathematics, the inverse problem for Lagrangian mechanics (Helmholtz inverse problem) is the problem of determining whether a given system of ordinary differential equations can arise as the Euler–Lagrange equations for some Lagrangian function. 

For more information read section IV.2. page 65 of the following reference:

http://www.unilim.fr/pages_perso/loic.bourdin/Documents/bourdin-thesis2013.pdf

________________________________________________________________________

 

I need some hints or procedures (if it is possible) for similar (but a little more complex) problem:

1- Assume that you have one ordinary differential equation, ode1(r) in polar coordinate system (i.e. (r, theta)). The ODE is taken to be independent from theta (It is not a PDE).

2- Assume that "Euler" is an operator that gives the Euler-Lagrange equation, I need a procedure to calculate ode2(r) such that

1/(2r)*Euler (ode2(r)) -Laplacian (1/(2r)*Euler(ode1(r)))=0

It is obvious that we need inverse of Euler operator (say IE) to calculate ode2(r).

ode2(r) =IE( 2r*Laplacian (1/(2r)*Euler(ode1(r))))

I calculate ode2(r) for some simpler cases via trial and error method.

s := proc (S) 
subs(w = w(r), w1 = diff(w(r), r), w2 = diff(w(r), r$2), S) 
end proc: 
Euler := proc (f) 
s(diff(f, w))-(diff(s(diff(f, w1)), r))+diff(s(diff(f, w2)), r$2) 
end proc:

Example:

ode1(r) = -r*(diff(w(r),r))^2:

ode2(r) = (diff(w(r),r))^2/r+r*(diff(w(r),r$2))^2:

-1/(2*r)*Euler(w1^2*r):

simplify(1/(2*r)*Euler(w1^2/r+r*w2^2)-VectorCalculus:-Laplacian(%,('polar')[r,theta]))

I will be grateful if you can hint me to write an appropriate procedure.

Thanks

I have this list

L := {a = b, e = f};

I want to extract b and f

How can i do it ?

Hi there,

I am looking at the system of equations

0=2*r*(H*(2-H)-3*sin(theta)^2)

0=-3*sin(2*theta)

with

H=sqrt(1-2*r*cos(theta))

Using the solve command with the assumption r >= 0 gives the solutions [r=0, theta=0], [r=1/2, theta=0] and [r=3/2, theta=pi].

However [r=0, theta=pi/2] is also a solution, which the solve command doesn't give me. Why not, and why doesn't if even give a warning that there are more solutions, which are not given?

Cheers!

 

Hi there,

Guess the title is already the full question. I want to write mathematical expressions in 2D math within a text segment of my Maple 15 document, but it should not be recognised as an execution group. How can I do this?

Cheers!

with(Logic):

logic := a &xor b

Then I get 'Error, invalid neutral operator'.

However the other &xxx operators in Logic do not error.

What am I doing wrong, or is it a bug?

the standard xor operator does work though.

I do remember copy and pasting

thoughts and answers please. At the moment I have resorted to the form without the '&'

 

 

Hi all.

Is there a kind soul who can enligthen me on the where abouts of the "print preview" feature in maple 2018?

It does not appear under the "file" -> "print" nor under "file" -> "page setup"

Macbook pro 2018

How do I create a timing diagram simular to

Image result for timing diagram

I do the following:-

1. 

2. TTdf := TruthTable(logic, form = MOD2)

I have tried the statistics package and the timing package. The problem is I get something like

Convert to matrix and add first column to indicate time, e.g 

Where we get an angle rise instead of a vertical rise.

I have also tried it in statistics. The best graph I can get is 

Also tried with no fill and with boarder around the columns, but still cannot get it to look right.

Help much appreciated. Really the Timing Graph should really be available in the Logic Package

Really I want to be able to split the Dataframe into seperate line graphs with a vertical rise and not a angle rise.

Any help would be much appreciated.

P.S I am still learning Maple. I have Maple 2018

Is there a way to put the 2 following animations together and synchronize them?

Maplesoft Help has an example of how to create the animation.  See last example on
https://de.maplesoft.com/support/help/maple/view.aspx?path=plots%2fanimate

but I couldn't get it to work on my Maple version 2015.

plots[animate](plot, [[cos(t), sin(t), t = 0 .. A]], A = 0 .. 2*Pi, scaling = constrained, frames = 50)

with(plots);
BACK := plot(sin(x), x = 0 .. 2*Pi);
oneFrame := proc (t) options operator, arrow; pointplot([t, sin(t)], color = blue, symbol = circle, symbolsize = 18) end proc;
animate(oneFrame, [t], t = 0 .. 2*Pi, background = BACK);

WC23_Unit_circle_and_sinewave_together.mw

I am rather new to using maple so I'm not super familiar with the syntax and sometimes get confused with some of my output. With that said, I am trying to derive some equations symbolically that can later be computed in Fortran. This requires that I find the Eigenvectors of a symbolic 5×5 matrix. I computed the eigenvalues with little problem, however, I cannot seem to compute the Eigenvectors with Maple (not sure if its a syntax issue or what). Here is my code where I am trying to determine the Eigenvectors of A. Any help and advice is appreciated.

E := [q2, q2^2/q1+(gamma-1)*(q5-(1/2)*q2^2/q1-(1/2)*q3^2/q1-(1/2)*q4^2/q1), q2*q3/q1, q4*q2/q1, q5*q2/q1+q2*(gamma-1)*(q5-(1/2)*q2^2/q1-(1/2)*q3^2/q1-(1/2)*q4^2/q1)/q1, q6*q2/q1]

F := [q3, q2*q3/q1, q3^2/q1+(gamma-1)*(q5-(1/2)*q2^2/q1-(1/2)*q3^2/q1-(1/2)*q4^2/q1), q4*q3/q1, q5*q3/q1+q3*(gamma-1)*(q5-(1/2)*q2^2/q1-(1/2)*q3^2/q1-(1/2)*q4^2/q1)/q1, q6*q3/q1]

G := [q4, q4*q2/q1, q4*q3/q1, q4^2/q1+(gamma-1)*(q5-(1/2)*q2^2/q1-(1/2)*q3^2/q1-(1/2)*q4^2/q1), q5*q4/q1+q4*(gamma-1)*(q5-(1/2)*q2^2/q1-(1/2)*q3^2/q1-(1/2)*q4^2/q1)/q1, q6*q4/q1]

Ebar := expand(E*xi_x+F*xi_y+G*xi_z)

U := [q1, q2, q3, q4, q5, q6]

with(VectorCalculus);
A := subs(q1 = rho, q2 = rho*u, q3 = rho*v, q4 = rho*w, q5 = rho*e, q6 = rho*nu, Jacobian(Ebar, U));

A := subs(e = P/((gamma-1)*rho)+(1/2)*u^2+(1/2)*v^2+(1/2)*w^2, A)

A := subs(P = rho*c^2/gamma, A)

A := simplify(A)

with(LinearAlgebra);
EigA := simplify(Eigenvalues(A));

with(LinearAlgebra);
EigenVectorA = Eigenvectors[A];

 

I have tried specifying which eigenvalue to take the eigenvector with respect to also with different synaxes but none seem to work. I am not claiming the last line of code should be correct, but am looking for how to make it correct. Sorry if I left out any information and thank you so much for your suggestions.

 

 

How to express the part of  unstable curve with a dashline.   Hope someone can help me achieve this.  

>  

(3/8)*alpha[2](t[1], t[2])*A(t[2])^3*exp(I*B(t[2]))*exp(-I*B(t[2]))+((1/2)*I)*alpha[1](t[1], t[2])*A(t[2])*exp(I*B(t[2]))*exp(-I*B(t[2]))+I*(diff(A(t[2]), t[2]))*exp(I*B(t[2]))*exp(-I*B(t[2]))-A(t[2])*(diff(B(t[2]), t[2]))*exp(I*B(t[2]))*exp(-I*B(t[2]))-(1/2)*f0*exp(I*sigma*t[2])*exp(-I*B(t[2]))

(13)

combine(%, 'exp');

(3/8)*alpha[2](t[1], t[2])*A(t[2])^3+((1/2)*I)*alpha[1](t[1], t[2])*A(t[2])+I*(diff(A(t[2]), t[2]))-A(t[2])*(diff(B(t[2]), t[2]))-(1/2)*f0*exp(I*sigma*t[2]-I*B(t[2]))

(14)

subs(I*B(t2)=I*sigma*t2-I*C(t2),B(t2)=sigma*t2-C(t2), %);

(3/8)*alpha[2](t[1], t[2])*A(t[2])^3+((1/2)*I)*alpha[1](t[1], t[2])*A(t[2])+I*(diff(A(t[2]), t[2]))-A(t[2])*(diff(sigma*t[2]-C(t[2]), t[2]))-(1/2)*f0*exp(I*sigma*t[2]-I*(sigma*t[2]-C(t[2])))

(15)

conds := combine(%, 'exp');

(3/8)*alpha[2](t[1], t[2])*A(t[2])^3+((1/2)*I)*alpha[1](t[1], t[2])*A(t[2])+I*(diff(A(t[2]), t[2]))-A(t[2])*(sigma-(diff(C(t[2]), t[2])))-(1/2)*f0*exp(I*sigma*t[2]-I*(sigma*t[2]-C(t[2])))

(16)

convert(conds, 'trig');

(3/8)*alpha[2](t[1], t[2])*A(t[2])^3+((1/2)*I)*alpha[1](t[1], t[2])*A(t[2])+I*(diff(A(t[2]), t[2]))-A(t[2])*(sigma-(diff(C(t[2]), t[2])))-(1/2)*f0*(cos(C(t[2]))+I*sin(C(t[2])))

(17)

cond1 := collect(coeff(%, I, 0), [diff(A(t2), t2), cos(C(t2))]);

(3/8)*alpha[2](t[1], t[2])*A(t[2])^3-A(t[2])*(sigma-(diff(C(t[2]), t[2])))-(1/2)*f0*cos(C(t[2]))

(18)

cond2 := collect(coeff(`%%`, I, 1), [diff(A(t2), t2), sin(C(t2)), cos(C(t2))]);

(1/2)*alpha[1](t[1], t[2])*A(t[2])+diff(A(t[2]), t[2])-(1/2)*f0*sin(C(t[2]))

(19)

A(t2):= A; C(t2):=C; cond1 = 0; cond2 =0;

A

 

C

 

(3/8)*alpha[2](t[1], t[2])*A^3-A*sigma-(1/2)*f0*cos(C) = 0

 

(1/2)*alpha[1](t[1], t[2])*A-(1/2)*f0*sin(C) = 0

(20)

remove(has, cond1, cos)^2+remove(has, cond2, sin)^2 = simplify(select(has, cond1, cos)^2+select(has, cond2, sin)^2, 'trig');

((3/8)*alpha[2](t[1], t[2])*A^3-A*sigma)^2+(1/4)*alpha[1](t[1], t[2])^2*A^2 = (1/4)*f0^2

(21)

af_eq:=%;

((3/8)*alpha[2](t[1], t[2])*A^3-A*sigma)^2+(1/4)*alpha[1](t[1], t[2])^2*A^2 = (1/4)*f0^2

(22)

 alpha[1]:=0.0087;alpha[2]:=2.5871;f0:=f[0]

0.87e-2

 

2.5871

 

f[0]

(23)

 

 

 

 

##

 

 

e:='e':    f0:='f0':   alpha[1]:='alpha[1]':   alpha[2]:='alpha[2]':

cond1;

(3/8)*alpha[2](t[1], t[2])*A^3-A*sigma-(1/2)*f0*cos(C)

(24)

cond2;

(1/2)*alpha[1](t[1], t[2])*A-(1/2)*f0*sin(C)

(25)

``

linalg[jacobian]([-cond2,-cond1/A],[A,C]);

Matrix(2, 2, {(1, 1) = -(1/2)*alpha[1](t[1], t[2]), (1, 2) = (1/2)*f0*cos(C), (2, 1) = -((9/8)*alpha[2](t[1], t[2])*A^2-sigma)/A+((3/8)*alpha[2](t[1], t[2])*A^3-A*sigma-(1/2)*f0*cos(C))/A^2, (2, 2) = -(1/2)*f0*sin(C)/A})

(26)

 

``

subs(cos(C)=solve(cond1,cos(C)),sin(C)=solve(cond2,sin(C)),%);

Matrix(2, 2, {(1, 1) = -(1/2)*alpha[1](t[1], t[2]), (1, 2) = (1/8)*A*(3*alpha[2](t[1], t[2])*A^2-8*sigma), (2, 1) = -((9/8)*alpha[2](t[1], t[2])*A^2-sigma)/A+((3/8)*alpha[2](t[1], t[2])*A^3-A*sigma-(1/8)*A*(3*alpha[2](t[1], t[2])*A^2-8*sigma))/A^2, (2, 2) = -(1/2)*alpha[1](t[1], t[2])})

(27)

``

map(simplify,%):

``

linalg[charpoly](%,lambda):

``

p:=collect(%,lambda);

(1/4)*alpha[1](t[1], t[2])^2+lambda*alpha[1](t[1], t[2])+lambda^2+(27/64)*A^4*alpha[2](t[1], t[2])^2-(3/2)*A^2*alpha[2](t[1], t[2])*sigma+sigma^2

(28)

 

``

coeff(p,lambda,0);

(1/4)*alpha[1](t[1], t[2])^2+(27/64)*A^4*alpha[2](t[1], t[2])^2-(3/2)*A^2*alpha[2](t[1], t[2])*sigma+sigma^2

(29)

 

``

stab_cond:=%;

(1/4)*alpha[1](t[1], t[2])^2+(27/64)*A^4*alpha[2](t[1], t[2])^2-(3/2)*A^2*alpha[2](t[1], t[2])*sigma+sigma^2

(30)

 

``

af_eq;

((3/8)*alpha[2](t[1], t[2])*A^3-A*sigma)^2+(1/4)*alpha[1](t[1], t[2])^2*A^2 = (1/4)*f0^2

(31)

``

with(plots, implicitplot,implicitplot3d):

 

 f0 :=0.1; alpha[1]:=0.0087;alpha[2]:=2.5871;

.1

 

0.87e-2

 

2.5871

(32)

 

``

p1:=implicitplot(stab_cond,sigma = -1.2 .. 2, A = 0 .. 2,  numpoints = 20000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, A], labelfont = [SYMBOL, 16],color="Green",tickmarks=[9,12],thickness=2,linestyle=dash):

``

with(plots,textplot):    with(plots,display):

``

ps1:=textplot([0.75, 0.65, "Unstable region"], 'align' = {'above', 'right'},rotation = 0.6, font=[Times,bold,12]):

``

pu1:=implicitplot(af_eq,sigma = -1.2 .. 2, A = 0 .. 2,  numpoints = 20000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, A], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=2):

pp1:=display({p1,ps1,pu1});

 

Like this picture.

 


 

Download how_to_draw_the_dashline_part.mw

First 769 770 771 772 773 774 775 Last Page 771 of 2219