MaplePrimes Questions


 

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

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)

How do I simulate the mathematical model of infectious disease using MapleSm? Is it possible? because I had search through the tool in MapleSim is full of engineering tools. 

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.

I am trying to solve system of differential equation as shown in file attached. The differentail eqaution has peicewise function for t=8*n and t not equal to 8*n where n is a positive integer. but i am getting error. please help.

 

 

problem30.mw

Thanks to Mr. Joe Riel, my previous problem is the port's name and the input signal's name was the same name was solved. It worked well in the new model but when I try to do exactly the same thing in my current model, the custom component can't be generated even if the "Check dimension" button shown that "no issues found". 

This time error is:
(in SetComponent) flattening error: Errors: Input length = 1
Error in Component btnGenComponent with the caption "Generate MapleSim Component"

Does anyone know from what this error "Input length = 1" happens? 

I am very appreciated for your help.

This started as calculating the location of a machine tool bit that is tangent to a line and a circle.  I watched the part being made.  The machinist moved the tool bit manually until it touched straight and circular markings on a aluminum blank.  Repeating this two times, recording the x-y values, the g-code was altered and the CNC machine started to make the part.  Should be a simple calculation, right?

Well, not for me:

restart; with(geometry):
## Find the (x, y) location of a machine mill path such that the tool is
## tangent to a line and a circle.
##
## Given a line, L1, and a circle, C1, find a circle, C4 tangent to
## both L1 and C1.  Choose the X value of C4 to be such that the
## center of C4 is between the intersection of L1 with the X axis and
## origin.
x0 := (3+1/2)/2;
x1 := x0; y1 := x0 + (1+1/4);
point('P1', x1, y1); ## center of the circle

circle('C2', [P1, x0]);

## X value for line L1
x3 := (3+1/2)/2-(3/4+20/1000)/2-1/2; y3 := 1+1/4; evalf([x3, y3]);
## points P2 and P3 lie on the line
point('P2', x3, 0); point('P3', x3, y3);
line('L1', [P2, P3]);

intersection('I1', L1, C2);
for s in I1 do print(evalf(coordinates(s))) end do;

tr := 1/8;  ## tool radius, radius of C4
## find P4 such that C4 is tangent to L1
x4 := x3 - tr;
## P4 moves parallel to L1
point('P4', x4, 'y4');
circle('C4', [P4, tr]);
Equation(C4); Equation(C2);
intersection('I2', C2, C4);
## fails

## The centerline of the part is at x = (3+1/2)/2 Another dimension of
## the part, is (3/4+20/1000), centered on the centerline.  A second
## dimension of the part is 1/2.  From the physical layout of the
## part, observe that
x_value := (3+1/2)/2 - (3/4+20/1000)/2 - 1/2 - tr: evalf(%);
eq1 := subs(x = x_value, Equation(C4)); eq2 := subs(x = x_value, Equation(C2));
sol := solve([eq1, eq2]); evalf(%);
evalf(sol);

## want the solution with the least y value for point P4
res1 := subs(sol[1], coordinates(P4));
res2 := subs(sol[2], coordinates(P4));

if evalf(res1[2]) < evalf(res2[2]) then
    soln := res1;
else
    soln := res2;
end if;
evalf(soln);

point('P8', soln); evalf(coordinates(P8));
circle('C8', [P8, 1/8]); evalf(Equation(C8)); evalf(Equation(C2));
## the intersect fails  Why?

intersection('I8', C2, C8);

evalf(coordinates(I8[1])); evalf(coordinates(I8[2]));

solve([Equation(C2), Equation(C8)]); evalf(%);
print("The location is", evalf(soln));

 

First 780 781 782 783 784 785 786 Last Page 782 of 2428