Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello,

     I'm trying to simplify an expression involving signum and sqrt using assumptions:

assumptions := { A>0,psi::real,1+A*cos(psi)<sqrt(1+sin(psi)),1+sin(psi)>0 }:
signum(1+A*cos(psi)-sqrt(1+sin(psi))):
simplify(%) assuming op(assumptions);

It seems to me that, given these assumptions, we can safely conclude that the result should be -1. However, I can't get Maple to show this. Interestingly, setting A=1 does allow maple to simplify the result to -1. Is there something I'm missing?


Thanks!

I recently corresponded with maplesoft on whether the program Groebner:-Basis always produces reduced Groebner bases or not. They say it does. This mw appears to show it producing a non reduced Groebner Basis for a set of polynomials.

More specifically, the coefficient of the lead term of the first polynomial generated is not 1.

I'd like to be shown wrong here, but I am struggling to see what i could be doing wrong.


 

restart:

alias(epsilon = e, omega = w, omega[0] = w0, t[1] = t1, t[2] = t2, alpha[1] = a1, alpha[2] = a2, alpha[3] = a3); e := proc (t1, t2) options operator, arrow; e end proc; w0 := proc (t1, t2) options operator, arrow; w0 end proc; f := proc (t1, t2) options operator, arrow; f end proc; mu := proc (t1, t2) options operator, arrow; mu end proc

ode := (D@@2)(u)+u+e*a1*D(u)+e*a2*u^3-f0*cos(omega*t) = 0

(D@@2)(u)+u+epsilon*alpha[1]*D(u)+epsilon*alpha[2]*u^3-f0*cos(omega*t) = 0

(1)

e_oredr := 1:

ode := subs(D = sum('e^(i-1)*D[i]', 'i' = 1 .. e_oredr+1), ode);

((epsilon*D[2]+D[1])@@2)(u)+u+epsilon*alpha[1]*(epsilon*D[2]+D[1])(u)+epsilon*alpha[2]*u^3-f0*cos(omega*t) = 0

(2)

u := sum('q[i]*e^i', 'i' = 0 .. e_oredr);

q[1]*epsilon+q[0]

(3)

ode := collect(ode, e):

 

 

ode:=simplify(%,{e^3=0,e^2=0});

-f0*cos(omega*t)+D[1, 1](q[1])*epsilon+D[1, 1](q[0])+2*D[1, 2](q[0])*epsilon+D[1](q[0])*alpha[1]*epsilon+(alpha[2]*q[0]^3+q[1])*epsilon+q[0] = 0

(4)

 

 

 

for i from 0 to e_oredr do eq[i] := coeff(lhs(ode), e, i) = 0 end do;

-f0*cos(omega*t)+D[1, 1](q[0])+q[0] = 0

 

alpha[2]*q[0]^3+alpha[1]*D[1](q[0])+2*D[1, 2](q[0])+D[1, 1](q[1])+q[1] = 0

(5)

 

eq[1]:=convert(eq[1](t1, t2), diff);

alpha[2](t[1], t[2])*q[0](t[1], t[2])^3+alpha[1](t[1], t[2])*(diff(q[0](t[1], t[2]), t[1]))+2*(diff(diff(q[0](t[1], t[2]), t[1]), t[2]))+diff(diff(q[1](t[1], t[2]), t[1]), t[1])+q[1](t[1], t[2]) = 0

(6)

 

q[0] :=A(t2)*exp(I*t1)+b*exp(I*w*t1)+conjugate(A)(t2)*exp(-I*t1)+b*exp(-I*w*t1); convert(%, 'exp'); q[0] := unapply(%, (t1, t2)):  # Chage the value 

A(t[2])*exp(I*t[1])+b*exp(I*omega*t[1])+(conjugate(A))(t[2])*exp(-I*t[1])+b*exp(-I*omega*t[1])

 

A(t[2])*exp(I*t[1])+b*exp(I*omega*t[1])+(conjugate(A))(t[2])*exp(-I*t[1])+b*exp(-I*omega*t[1])

(7)

 

expand(lhs(eq[1])):

eq:=combine(%, exp):

eq:=simplify(%, power):  

eq:=combine(subs(w=1/3+e*sigma,%),exp):   ## substituting the detuning parameter

expand(%):

eq:=algsubs(t1*e=t2,%):

 

eq:=collect(%, exp(I*t1)):

 

coeff(%, exp(I*t1),1):

simplify(combine(%,exp));

exp((3*I)*sigma*t[2])*alpha[2](t[1], t[2])*b^3+3*alpha[2](t[1], t[2])*A(t[2])^2*(conjugate(A))(t[2])+6*alpha[2](t[1], t[2])*b^2*A(t[2])+I*A(t[2])*alpha[1](t[1], t[2])+(2*I)*(diff(A(t[2]), t[2]))

(8)

subs({A(t2)=a(t2)*exp(I*beta(t2))/2,conjugate(A)(t2)=a(t2)*exp(-I*beta(t2))/2},%);

exp((3*I)*sigma*t[2])*alpha[2](t[1], t[2])*b^3+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3*(exp(I*beta(t[2])))^2*exp(-I*beta(t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])*exp(I*beta(t[2]))+((1/2)*I)*a(t[2])*exp(I*beta(t[2]))*alpha[1](t[1], t[2])+(2*I)*(diff((1/2)*a(t[2])*exp(I*beta(t[2])), t[2]))

(9)

combine(%,exp);

exp((3*I)*sigma*t[2])*alpha[2](t[1], t[2])*b^3+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3*exp(I*beta(t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])*exp(I*beta(t[2]))+((1/2)*I)*a(t[2])*exp(I*beta(t[2]))*alpha[1](t[1], t[2])+(2*I)*((1/2)*(diff(a(t[2]), t[2]))*exp(I*beta(t[2]))+((1/2)*I)*a(t[2])*(diff(beta(t[2]), t[2]))*exp(I*beta(t[2])))

(10)

map(x->x*exp(-I*beta(t2)),%);

exp((3*I)*sigma*t[2])*alpha[2](t[1], t[2])*b^3*exp(-I*beta(t[2]))+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3*exp(I*beta(t[2]))*exp(-I*beta(t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])*exp(I*beta(t[2]))*exp(-I*beta(t[2]))+((1/2)*I)*a(t[2])*exp(I*beta(t[2]))*alpha[1](t[1], t[2])*exp(-I*beta(t[2]))+(2*I)*((1/2)*(diff(a(t[2]), t[2]))*exp(I*beta(t[2]))+((1/2)*I)*a(t[2])*(diff(beta(t[2]), t[2]))*exp(I*beta(t[2])))*exp(-I*beta(t[2]))

(11)

simplify(%,exp);

alpha[2](t[1], t[2])*b^3*exp(-I*(-3*sigma*t[2]+beta(t[2])))+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3-a(t[2])*(diff(beta(t[2]), t[2]))+3*alpha[2](t[1], t[2])*b^2*a(t[2])+((1/2)*I)*a(t[2])*alpha[1](t[1], t[2])+I*(diff(a(t[2]), t[2]))

(12)

subs({3*sigma*t2-beta(t2)=C(t2),beta(t2)=3*sigma*t2-C(t2)},%);

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

(13)

convert(%,trig);

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

(14)

 

 

 

 

 

 

 

 

 

 

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

a(t[2])*(diff(C(t[2]), t[2]))+alpha[2](t[1], t[2])*b^3*cos(C(t[2]))+(3/8)*alpha[2](t[1], t[2])*a(t[2])^3-3*a(t[2])*sigma+3*alpha[2](t[1], t[2])*b^2*a(t[2])

(15)

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

alpha[2](t[1], t[2])*b^3*sin(C(t[2]))+(1/2)*a(t[2])*alpha[1](t[1], t[2])+diff(a(t[2]), t[2])

(16)

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

a

 

C

 

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

 

alpha[2](t[1], t[2])*b^3*sin(C)+(1/2)*a*alpha[1](t[1], t[2]) = 0

(17)

alpha[1]:=unapply(alpha[1],[t1,t2]);alpha[2]:=unapply(alpha[2],[t1,t2]);

proc (t1, t2) options operator, arrow; alpha[1] end proc

 

proc (t1, t2) options operator, arrow; alpha[2] end proc

(18)

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

((3/8)*alpha[2]*a^3-3*a*sigma+3*alpha[2]*b^2*a)^2+(1/4)*a^2*alpha[1]^2 = alpha[2]^2*b^6*cos(C)^2+alpha[2]^2*b^6*sin(C)^2

(19)

simplify(%,'trig');   

(9/64)*a^2*(a^2*alpha[2]+8*alpha[2]*b^2-8*sigma)^2+(1/4)*a^2*alpha[1]^2 = alpha[2]^2*b^6

(20)

 

af_eq:=%;

(9/64)*a^2*(a^2*alpha[2]+8*alpha[2]*b^2-8*sigma)^2+(1/4)*a^2*alpha[1]^2 = alpha[2]^2*b^6

(21)

##

 

 

##

b:=0.5*f0/(1-(1/3)^2);

.5625000000*f0

(22)

with(plots, implicitplot):

 f0 :=1; alpha[1]:=0.0087;alpha[2]:=2.5871;   b:=0.5*f0/(1-(1/3)^2);#change the value 

1

 

0.87e-2

 

2.5871

 

.5625000000

(23)

af_eq;
curve1,curve2:=solve(af_eq, sigma):

A0:=2:

(9/64)*a^2*(2.5871*a^2-8*sigma+6.548596875)^2+0.1892250000e-4*a^2 = .2120125612

(24)

``

 

 

``

 

``

pu1:=implicitplot([sigma=curve2,sigma=curve1],sigma =-5..20, a = 0 .. A0,  numpoints = 200000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, a], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=3,'view' = [-5 .. 20, 0 .. 6]):
pu2:=implicitplot([sigma=curve2,sigma=curve1],sigma =-5..20, a = A0 .. 10,linestyle=[1,3],  numpoints = 20000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, a], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=3,'view' = [-5 .. 20, 0 .. 6]):

A0:=-2:

pu3:=implicitplot([sigma=curve2,sigma=curve1],sigma =-5..20, a = -10 .. A0, linestyle=[3,1], numpoints = 200000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, a], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=3,'view' = [-5 .. 20, -6 .. 0]):
pu4:=implicitplot([sigma=curve2,sigma=curve1],sigma =-5..20, a = A0 .. 0,  numpoints = 20000, axes = box, axesfont=[SYMBOL, 14],labels = [sigma, a], labelfont = [SYMBOL, 16],color="red",tickmarks=[9,12],thickness=3,'view' = [-5 .. 20, -6 .. 0]):

pp1:=display([pu1,pu2,pu3,pu4]);

(25)

How can I merge these pictures into one

 

 

 

 

 


Like this one

Download merege_two_diagram.mw

I was wondering how Maple cope with piecewise functions during forward integration and if it's preferable to use dsolve events option in place of defining a piecewise discontinuos function.

As far as I understood dsolve/events halts the integration each time an event is triggered and subsequently restarts the integration using the pre-trigger outputs as new initial conditions. I suppose that by using a piecewise, if a discontinuity is detected, dsolve proceeds exactly in the same way halting and restarting the integration.

Here a toy example of a 2D rolling dice (idea of a rolling dice from the rolling cube by @one man :P ) in which the reaction forces of the floor can be seen as function of the compenetration dice/ground

Both the appraches (events and piecewise) give the same results

falling_dice.mw

First, I want to say thank you to all who contributed to previous questions. God bless you.

I need Maple code in solving first order differential equation using Langrange and Newton's Interpolation Method.

The aim is to compare these two numerical result with the exact in tabular form and also to plot the graph.

Some questions are attached.

ODE_Questions.pdf

I have to take limit of the HeunG function at infinity.

Here is what I tried

This is clearly not working. I have to take limit of a function which consist multiple HeunG functions at infinities.

Hi,

how do I make second power of integers in a list?

e. g.: L1:=[-3,-2,-1,0,1,2,3]

and i want

L2:=[9,4,1,0,1,4,9]

Thanks

I am trying to solve a second order differential equation but getting error. The differential equation valid for r>0.

 

Vr.mw

Hi, I'm quite a beginner in Maple.

Currently, I'm solving several complex ODE using maple. When I run the code, it gives me some results. However, when I re-run the code using exactly the same equations and parameter, I somehow got completely different results. Using the same input sometimes it gives float(undefined), complex number, or real number.

Could anyone explain what's happening here? Does it mean that my set of ODE is not independent of each other?

Any helps would be greatly appreciated.

Thanks!

I have two lists, A and B, with the same number of elements and I want A to be on the Y-axis and B on the X-axes and do a point plot

In this app you can visualize the location of the points in the different quadrants, also calculate the distance between two points. Finally the calculation of the coordinates of the midpoint. With these applications can be combined to study different cases between distance between two points and midpoint. Generated in Maple for students of secondary education and pre-calculation. In Spanish

Distance_between_two_points_and_midpoint.mw

Lenin Araujo Castillo

Ambassador of Maple

 

I am making calculations on a block matrix of the form Matrix([[A,B],[-B,-A]])

with A real and symmetric and B real and antisymmetric. (For the physics savvy, this is the Bogoliubov-de Gennes form of the coefficient matrix for doing calculations.)

But this says if I have an eigenvector of the form (u,v) with eigenvalue E, then there is another eigenvector (v,u) with eigenvalue -E.

Now, my problem.. I have a problem that has two zero eigenvalues, but the numerical solver is giving one as zero and one as just very small. This is problematic because my eigenvectors don't have the symmetry that they should. For the non-zero eigenvectors, the error is small and doesn't matter so much. But the eigenvector corresponding to the zero eigenvalues are not guaranteed to be close.

Is there a way to demand my eigenvalues come in pairs for my matrices? Something that dependings on A,B being even or odd dimensional is fine. I care more about the symmetry than even/oddness.

When I use the Groebner package I normally use it something like this:

with(Groebner):
F≔[x3−3xy,x2y−2y2+x]
Basis(F,plex(x,y))

Does this calculate a reduced Groebner basis or just a Groebner basis? The output looks reduced to me, and I'm sure that I've seen people treat it is as a reduced GB; but the help page doesn't confirm this. Interestingly i can't seem to find any other mention of reduced bases in the help documentation - which makes me think that this method does it (because otherwise people would want a seperate algorithm specifically for getting reduced GBs)

We know that Grid:-Map(x->f(x),[x1..xn]) is for parallel computing f(xi)'s but when some xi's are equal I think Maple copies one result for the others. But maybe my function f has some random sampling inside and so will have different output for same inputs. So I need to do parallel computations for same inputs without cheating of copying the result of one for the rest. For a very simple case that Maple copies while it is wrong to copy, see the following.

I will be happy if someone tells me how to solve this issue. Thanks.

More surprising to me is that if I try to use different xi's and then typing same xi's, I will see some new patterns of copying. 

For example in output (3) and (4), first random point of one parallel computation is the second random point of another computation. Or in output (6) only the two last computations are copy of each other!

 

I may need to add that I did this computations on a computer with 4 core processor. Is Maple producing random numbers using something like processor's time? Or something like this?
I can't report Maple computations if they don't really produce random points independently in seperate parallel computations.

Hello,

At the moment there is no support on GitHub for language recognition and syntax highlighting for Maple. I think better support for Maple on GitHub would be a good thing:

  1. It makes Maple more recognizable, for example in language searches such as this one for one of its competitors.
     
  2. The list of currently supported languages is long and even contains many obscure entries. Maple is not obscure and deserves to be there.

So, why am I posting this here, as it concerns GitHub more than Maple? The reason is that adding support for new languages is often done by GitHub users themselves, using the Linguist library mentioned on this help page. The process does not seem very difficult to me, but it requires a few careful steps.

Referring to those steps:

  1. I think it would be nice to add support for the extensions , and .
     
  2. Perhaps this project by @Daniel Skoog could be used for syntax highlighting? However, currently it does not have a license.
     
  3. Does anybody know of a body of Maple source code that is representative of the modern Maple language as a whole? Probably it should be available under a permissive open source license such as MIT or BSD. (I am not sure whether GPLed work would qualify.)
     
  4. I know of a few Maple projects by others that are maintained on GitHub, such as the ParametricMatrixTools package and some packages by Daniel Skoog. If there are other Maple projects being maintained on GitHub, it would be good to know about them in the comments.

So, in summary, could you perhaps help me with the above Steps 2, 3 and 5 or, if you prefer, could you take care of them yourself and open a pull request, so Maple on GitHub can literally get the recognition it deserves?

My best wishes,

Sebastiaan Janssens.

 

First 788 789 790 791 792 793 794 Last Page 790 of 2239