MaplePrimes Questions

Hi,

Is it possible to force Maple to simplify these Sum(s) ?
SimplifySum.mw
 

s := Sum(a*X[n]+b, n=1..N);
simplify(s);
value(s);  # part of the job done  but...


IWouldLikeToHave = a*Sum(X[n], n=1..N) + b*N; # or +N*b, it doesn't matter

Sum(a*X[n]+b, n = 1 .. N)

 

Sum(a*X[n]+b, n = 1 .. N)

 

N*b+sum(a*X[n], n = 1 .. N)

 

IWouldLikeToHave = a*(Sum(X[n], n = 1 .. N))+N*b

(1)

s := Sum(X[n]+Y[n], n=1..N);
(expand@value)(s);


IWouldLikeToHave = Sum(X[n], n=1..N) + Sum(Y[n], n=1..N);

Sum(X[n]+Y[n], n = 1 .. N)

 

sum(X[n]+Y[n], n = 1 .. N)

 

IWouldLikeToHave = Sum(X[n], n = 1 .. N)+Sum(Y[n], n = 1 .. N)

(2)

 

 

 

Thanks in advance

 

I performed an iteration of over 300 using for loop, how can I label each of the output? Please help... 

Hi ,

How to animate implicitplot?

Thanks 


 

NULL

 

NULL

 

plots:-animatecurve(1/x, x = 0 .. 5, thickness = 5, size = [150, 150], axes = none, color = red)

 

with(plots, implicitplot)

 

P1 := implicitplot(x^2+y^2 = 9, x = -3 .. 3, y = -9 .. 9, thickness = 5, size = [150, 150], axes = none, color = red)

 

``

``

plots:-animatecurve(2*abs(x), x = -.5 .. .5, thickness = 5, size = [150, 150], axes = none, color = red)

 

with(plots, implicitplot)

 

implicitplot(x = -3*abs(sin(y)), x = -3 .. 3, y = 0 .. 6, thickness = 5, size = [150, 150], axes = none, color = red)

 

NULL

 

 

NULL

 

NULL

with(plots)

P1 := plots:-animatecurve(sqrt(1-(abs(x)-1)^2), x = -2 .. 2, thickness = 5, axes = none)

P2 := plots:-animatecurve(arccos(1-abs(x))-Pi, x = -2 .. 2, thickness = 5, axes = none)

P := display(P1, P2, view = [-2 .. 2, -3 .. 1], size = [350, 350], axes = none)

 

NULL

 

 

 

 

``


 

Download LoveMaple1Anim.mws.mw
 

NULL

 

NULL

 

plots:-animatecurve(1/x, x = 0 .. 5, thickness = 5, size = [150, 150], axes = none, color = red)

 

with(plots, implicitplot)

 

P1 := implicitplot(x^2+y^2 = 9, x = -3 .. 3, y = -9 .. 9, thickness = 5, size = [150, 150], axes = none, color = red)

 

``

``

plots:-animatecurve(2*abs(x), x = -.5 .. .5, thickness = 5, size = [150, 150], axes = none, color = red)

 

with(plots, implicitplot)

 

implicitplot(x = -3*abs(sin(y)), x = -3 .. 3, y = 0 .. 6, thickness = 5, size = [150, 150], axes = none, color = red)

 

NULL

 

 

NULL

 

NULL

with(plots)

P1 := plots:-animatecurve(sqrt(1-(abs(x)-1)^2), x = -2 .. 2, thickness = 5, axes = none)

P2 := plots:-animatecurve(arccos(1-abs(x))-Pi, x = -2 .. 2, thickness = 5, axes = none)

P := display(P1, P2, view = [-2 .. 2, -3 .. 1], size = [350, 350], axes = none)

 

NULL

 

 

 

 

``


 

Download LoveMaple1Anim.mws.mw

 

Hello everyone.

I have a very simple question.  When I use maple to solve the following equations,  everything works as expected

solve({
a + b + c + d = 0,
d * (480-471.1) + b * (484.3-471.1) + c * (547.2-471.1) + m4 = 0,
a * (471.1-484.3) + d * (480-484.3) + c * (547.2-484.3)  + m4 = 0,
a * (471.1-547.2) + d * (480-547.2) + b * (484.3-547.2) + m4 = 0,
a * (471.1-477) + d * (480-477) + b * (484.3-477) + c * (547.2-477) + m4 = 0,
a * (471.1-494) + d * (480-494) + b * (484.3 - 494) + c * (547.2 - 494) + m4 = 0,
a * (471.1-540) + d * (480-540) + b * (484.3 - 540) + c * (547.2-540) + m4 = 0,
a * (471.1-477) + m1 = 0,
a * (471.1-494) + d * (480-494) + b * (484.3 - 494) + m2 = 0,
a * (471.1-540) + d * (480-540) + b * (484.3 - 540) + m3 = 0},{a,b,c,d,m4})

Now if I add one more equation to it then maple won't solve

solve({
a + b + c + d = 0,
d * (480-471.1) + b * (484.3-471.1) + c * (547.2-471.1) + m4 = 0,
a * (471.1-484.3) + d * (480-484.3) + c * (547.2-484.3)  + m4 = 0,
a * (471.1-547.2) + d * (480-547.2) + b * (484.3-547.2) + m4 = 0,
a * (471.1-477) + d * (480-477) + b * (484.3-477) + c * (547.2-477) + m4 = 0,
a * (471.1-494) + d * (480-494) + b * (484.3 - 494) + c * (547.2 - 494) + m4 = 0,
a * (471.1-540) + d * (480-540) + b * (484.3 - 540) + c * (547.2-540) + m4 = 0,
a * (471.1-477) + m1 = 0,
a * (471.1-494) + d * (480-494) + b * (484.3 - 494) + m2 = 0,
a * (471.1-540) + d * (480-540) + b * (484.3 - 540) + m3 = 0
a * (471.1-481) + d * (480-481) + mx = 0},{a,b,c,d,m4,mx})

Obviously,  using the first solve command,  I can solve for a and d.  I can substitude that into the last equation and solve for mx.  But for some reason, maple just won't do that for me directly from the second solve command.

Can someone help?  thanks

 

 

When I tried to copy any of the expression among (1) and (4), the only MathML string appearing at the target application is this:

<math xmlns='http://www.w3.org/1998/Math/MathML'></math>

 


 

restart:

n:= 2:

X:= Vector(n, symbol= x);

Vector(2, {(1) = x[1], (2) = x[2]})

(1)

W:= Matrix(3,2, symbol= w);

Matrix(3, 2, {(1, 1) = w[1, 1], (1, 2) = w[1, 2], (2, 1) = w[2, 1], (2, 2) = w[2, 2], (3, 1) = w[3, 1], (3, 2) = w[3, 2]})

(2)

V:= W.X;

Vector(3, {(1) = w[1, 1]*x[1]+w[1, 2]*x[2], (2) = w[2, 1]*x[1]+w[2, 2]*x[2], (3) = w[3, 1]*x[1]+w[3, 2]*x[2]})

(3)

answer:=seq(diff~(v,W), v= V);

answer := Matrix(3, 2, {(1, 1) = x[1], (1, 2) = x[2], (2, 1) = 0, (2, 2) = 0, (3, 1) = 0, (3, 2) = 0}), Matrix(3, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = x[1], (2, 2) = x[2], (3, 1) = 0, (3, 2) = 0}), Matrix(3, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0, (3, 1) = x[1], (3, 2) = x[2]})

(4)

 


Can you tel me how to fix this error?

Download question1a.mw

Refers to yMaple 2019.1

The command alias(X(s)=laplace(x(t),s,t)) will not be executed in the  code following it. It seems that the 'funny font' L used instead of the word 'laplace' ist not recognized. Maple 2018.2.1 works fine, since it doesn't use the 'L" but works with 'laplace'. Is there a fix ?

Consider the following problem.

I'm looking for an implementation of the following approximation-method. Thanks to @Carl Love I already have a code for the exact solution. (It might be that my example using the given A,b,c does not have a solution but then I would just have to use different A, b, c.)

num211.pdf

I uploaded the question as a pdf so that it is nicer to read.

I know there are probably better ways which are already part of some packages but I want to use this method.

 

Edit:

A procedure that does the following is all I need:

num211_2.pdf

 

see below.  I am getting IC and BC errors.  The code is below/attached.  Can anyone help?

Melvin

 

This is a corrected version of pdeProb2.mw, in which we examine the 1-D classical burgers equation, and find an asymptotic steady state in the solution fields u, v which is not reached by a solution via numerical simulation.

 

NOTE:  When generating and displaying PLOTS AT HIGH RESOLUTION, do not use p1 := plot(bla, etc);  i.e. do not end with a semicolon.   Instead, end with a colon viz  p1 := plot(bla, etc): which sends the result to p1 instead of  generating an excess memory use message.  Then create the plot by executing p1; i.e. end the assigned p1 with a semicolon to display the graphics result.

restart

We load the MAPLE Physics package from the MapleCloud, in order to support solutions using pdsolve().

PackageTools:-Install*`\`("5137472255164416", version = 329, overwrite):`

PackageTools:-Install*`\`("5137472255164416", version = 329, overwrite):`

(1)

restart; Physics:-Version()

"C:\Users\Melvin Brown\maple\toolbox\2018\Physics Updates\lib\Physics Updates.maple", `2019, October 2, 14:20 hours, version in the MapleCloud: 597, version installed in this computer: 329.`

(2)

Start of definition of problem:

with(PDETools); with(CodeTools); with(plots)

[CanonicalCoordinates, ChangeSymmetry, CharacteristicQ, CharacteristicQInvariants, ConservedCurrentTest, ConservedCurrents, ConsistencyTest, D_Dx, DeterminingPDE, Eta_k, Euler, FromJet, FunctionFieldSolutions, InfinitesimalGenerator, Infinitesimals, IntegratingFactorTest, IntegratingFactors, InvariantEquation, InvariantSolutions, InvariantTransformation, Invariants, Laplace, Library, PDEplot, PolynomialSolutions, ReducedForm, SimilaritySolutions, SimilarityTransformation, Solve, SymmetryCommutator, SymmetryGauge, SymmetrySolutions, SymmetryTest, SymmetryTransformation, TWSolutions, ToJet, ToMissingDependentVariable, build, casesplit, charstrip, dchange, dcoeffs, declare, diff_table, difforder, dpolyform, dsubs, mapde, separability, splitstrip, splitsys, undeclare]

(3)

Start of definition of problem:

with(PDETools); with(CodeTools);with(plots);

[CanonicalCoordinates, ChangeSymmetry, CharacteristicQ, CharacteristicQInvariants, ConservedCurrentTest, ConservedCurrents, ConsistencyTest, D_Dx, DeterminingPDE, Eta_k, Euler, FromJet, FunctionFieldSolutions, InfinitesimalGenerator, Infinitesimals, IntegratingFactorTest, IntegratingFactors, InvariantEquation, InvariantSolutions, InvariantTransformation, Invariants, Laplace, Library, PDEplot, PolynomialSolutions, ReducedForm, SimilaritySolutions, SimilarityTransformation, Solve, SymmetryCommutator, SymmetryGauge, SymmetrySolutions, SymmetryTest, SymmetryTransformation, TWSolutions, ToJet, ToMissingDependentVariable, build, casesplit, charstrip, dchange, dcoeffs, declare, diff_table, difforder, dpolyform, dsubs, mapde, separability, splitstrip, splitsys, undeclare]

 

[CPUTime, DecodeName, EncodeName, GCTime, Profiling, ProgramAnalysis, RealTime, Test, ThreadSafetyCheck, Usage]

 

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(4)

``

Two 1-D coupled Burgers equations - semiclassical case O(1), O( `&hbar;`) : retain O(1) only for u(x,t) and O(1), O( `&hbar;`) for v(x,t):

In the quantum case, there are two coupled quantum Burgers equations, which each include the quantum potential terms.  As in the classical case above, we apply constant external forces Fuand Fv.  Our aim is to display the profiles of u(x, t) and v(x, t) as strings on x, t space.

#hBar := 'hBar': m := 'm':Fu := 'Fu': Fv := 'Fv': # define constants

hBar:= 1:m:= 1:Fu:= 0.2:Fv:= 0.1: # set constant values - same as above ...consider reducing

Notice that we set `&hbar;` = 1

At O( `&hbar;`^2) the real quantum potential term is zero, leaving the classical expression:

pdeu := diff(u(x,t),t)+u(x,t)/m*(diff(u(x,t),x)) = Fu;

diff(u(x, t), t)+u(x, t)*(diff(u(x, t), x)) = .2

(5)

As in the classical case above, the temporal and spatial derivative are each of order 1; so only one initial condition and one boundary condition are required for this part of the semiclassical equations.

On the otherhand, the imaginary quantum potential equation for v(x,t) has only O( `&hbar;`)  terms so together the pair of equations for u, v are semiclassical:

pdev := diff(v(x,t),t)+u(x,t)/m*(diff(v(x,t),x))-hBar*(diff(u(x,t),x$2))/(2*m)+v(x,t)*(diff(u(x,t),x))/m = Fv;

diff(v(x, t), t)+u(x, t)*(diff(v(x, t), x))-(1/2)*(diff(diff(u(x, t), x), x))+v(x, t)*(diff(u(x, t), x)) = .1

(6)

By inspection of the derivatives in above two equations we now set up the ICs and BCs for u(x, t) and "v(x,t). "Note that the above second order spatial derivative requires a 1st order derivative boundary condition as defined below.

The quantum initial and boundary conditions are similar to the classical case, but also comprise additional boundary condition terms for v and for u, notably a 1st derivative reflective BC term for u.

ICu:={u(x,0) = 0.1*sin(2*Pi*x)};# initial conditions for PDE pdeu

{u(x, 0) = .1*sin(2*Pi*x)}

(7)

ICv:={v(x,0) = 0.2*sin(Pi*x)};# initial conditions for PDE pdev

{v(x, 0) = .2*sin(Pi*x)}

(8)

IC := ICu union ICv;

{u(x, 0) = .1*sin(2*Pi*x), v(x, 0) = .2*sin(Pi*x)}

(9)

BCu := {u(0,t) = 0.5*(1-cos(2*Pi*t)),D[1](u)(1,t) = 0}; # boundary conditions for PDE pdeu: note the reflective derivative term D[1](u)

{u(0, t) = .5-.5*cos(2*Pi*t), (D[1](u))(1, t) = 0}

(10)

BCv := {v(0,t) = 0.5*sin(2*Pi*t), v(1,t)=-0.5*sin(2*Pi*t)}; # boundary conditions for PDE pdev

{v(0, t) = .5*sin(2*Pi*t), v(1, t) = -.5*sin(2*Pi*t)}

(11)

BC := BCu union BCv;

{u(0, t) = .5-.5*cos(2*Pi*t), v(0, t) = .5*sin(2*Pi*t), v(1, t) = -.5*sin(2*Pi*t), (D[1](u))(1, t) = 0}

(12)

This set of equations and conditions can now be solved numerically.

The above IC and BC are both 0 at 0, 0 and thus consistent.

pdu := pdsolve({pdeu,pdev},{IC,BC},numeric, time = t,range = 0..1,spacestep = 1/66,timestep = .1);

Error, (in pdsolve/numeric/process_IBCs) invalid initial/boundary condition: {u(x, 0) = .1*sin(2*Pi*x), v(x, 0) = .2*sin(Pi*x)}

 

Here is the 3D plot of u(x,t):

T := 3; p1 := pdu:-plot3d(u,t=0..T,numpoints = 2000,x=0.0..2, shading = zhue,orientation=[-146,54,0],scaling = constrained, title = print("Figure 1",u(x, t), numeric));

3

 

Error, `pdu` does not evaluate to a module

 

``


 

Download Semiclassical_Burgers_Eqns_-_MRB.mw

 

 

I want to calculate (partialH/partialq). But I encountered an error when I evaluate it.

restart;
with(PDEtools);
with(linalg);
alias(q = q(x, t), p = p(x, t));
                              q, p
H := lambda*p*q+conjugate(lambda)*conjugate(p)*conjugate(q)+(1/2*(p^2+conjugate(q)^2))*(conjugate(p)^2+q^2);
                                      
diff(H, q(x, t));

maple shows error:

Error, invalid input: diff received q(x, t), which is not valid for its 2nd argument
How to fix this issue?

 

Cl := x->max(-1,min(1, x)):

M := 25:
#-sqrt(1-x^2)..sqrt(1-x^2)
f := (x,y)->Re(sqrt(x+_i*y)):
P1 := plot3d([seq([x, y, k*f(x,y)], k=[-1,1])
], x=-1..1, y=-1..1, labels=[x,y,Rew],style=surface, grid=[200,200], thickness=2, colorscheme=["xyzcoloring", [(x,y,z)->y^2,(x,y,z)->x*y,(x,y,z)->x^2]]):
P2 := seq(spacecurve([seq([Cl(t*cos(2*Pi/M*j)), Cl(t*sin(2*Pi/M*j)), sign(k)*(abs(k) - 1.5)/140 + sign(k)*f(Cl(t*cos(2*Pi/M*j)),Cl(t*sin(2*Pi/M*j))),color=[RGB(1,t^2*sin(2*Pi/M*j)^2,1)]], k=[-2,-1,1,2])], t=0..13, thickness=4, transparency=0.7, numpoints=1500),j=1..M):

display(P1, P2);
display(P2);

 

The above draws a Riemann surface for sqrt(z).

 

The problem is that maple doesn't seem to make grid lines nicely project from the function. I added the lines myself but I cannot color them in a way that uses t. the parameter t is completely ignored in the graphing of the lines.

Also, the first graph cannot have transparency set and give meaningful results.

 

adding transparency=0.001 it looks like it is 10% transparent.... and going below that it just turns off all transparency. I want to barely see through the surface.

 

It's really hard to get a nice graph for maple. The lighting, lines, and coloring are always off to reduce the visual impact.

 

Imagine a brachistochrone shaped path made of a frictionless flexible metal strip which reacts to the force of a weighty sliding object.

Depending on its flexibility and the object's mass, what would be the strip's initial shape for fastest descent between its top and bottom? How would its shape change during the object's descent?

Perhaps an aircraft emergency escape slide or the fastest path for a slalom skier exemplify this kind of situation.

I want to solve x'(t)=A(t)x(t)+b(t) for given A, b, and intital conditions x(0).

I want to use matrixDE from the package DEtools. (I know there are probably other ways but this would be the most convenient way for further tasks).

My question is: How can I specify the initial values using matrixDE?

 

A:=Matrix(2,2,[1,-2,4,-5])

b:=Matrix(2,1,[3,7])

sol:=matrixDE(A,b,t)

 

 

For dsolve we have

dsolve({ode,ics})

 

But what about matrixDE?

 

Hello, I have a problem with solving this DE:

 

y'' - y = -4sin^3x + 9sinx where y(0)=y(2pi). I have solved it but i dont know how to do it in Maple. Thanks in advace.

Dear all, 

I did these commands in Maple:

restart:
x:=Matrix([[x1],[x2]])

W:=<<w11 | w12>, <w21 | w22>>

v:= (W.x)

<seq(diff(v,t),t=W)>;

Then, the answer was this:

Vector[column](8, [x1, 0, 0, x1, x2, 0, 0, x2])

What I expected was this: