MaplePrimes Questions

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:

Would you tell me how to map or reorder the calculation result from Maple?

Thank you

question.mw

Hello,

One of the features I find most useful is the ability to use Explore and plot3d(in Worksheet mode) to visualize how an expression changes for given parameters.  Unfortunately, when I use Explore(plot3d...) the default output is a very narrow box with a small 3d plot and sliders underneath.  In other programs like matlab or mathematica, resizing a plot is simply a matter of resizing the plot box/window, but I do not understand why it seems almost like an impossibility in Maple, I must be missing something:

  • The resulting 3d plot in the Explore box does not have resize handles
  • Using the 'size' parameter does not work with plot3d, like it does with plot
  • If I under Tools->Options->Display I change Plot Display to 'Window', that seems to have no effect.  I expected it to open the plot in its own resizeable window but that does not seem to be the case.
  • There are resizeable 'handles' on only left and right side of the Explore bounding box, but that does not resize the plot
  • If I click on the plot there are is a 'table' and 'cell' tab that shows up in the right pane:
    • If I increase the cell width and height in pixels, the plot goes blank. I have to rerun the script to get the (small) plot to come back
  • What is even more strange, is that a few times I have stumbled across some 'magical' sequence of resizing the Explore box horizontally, changing table scale settings and the width/height of the plot which eventually does give me a bigger plot.
  • I haven't been able to nail down what the magical sequence is, and 90% of the times I can't get it to work.  Not to mention that the second I run the script again it all resets itself and at best I have to redo the complex 'magical' sequence of adjustments every time.

 

It can't be this difficult to resize a plot, can it?  I love Maple, I think there is nothing else like it, but this is a rather embarrasing state of things for such a simple, basic functionality.

 

I did search and found a script for doing it programmatically on a plot but it relies on having a handle(foo:=plot...) to the plot which doesn't seem to work for Explore.

 

Thanks for any help.

 

Hi everyone,

I'm a student studying pde's and I was trying to find a tool for me to understand it a lot better.

The heat equation is given by: Ut = a^2*Uxx

Take the example of a rod that is insulated at both ends (establishing BC's) of Ux(0,t) = 0 and Ux(L,t) = 0. Let's define the intial condition for any temperature at point x as x*(L-X).  We know that if we try to solve the steady-state solution, setting Ut = 0, we get Uxx = 0 which implies the general solution is U(x) = C1x + C2

From our boundary conditions we can see that a rod insulated at both ends -- and I should say laterally also -- should have a graph that turns from a quadratic to a horizontal line that is defined as the average of the initial conditon function from 0 to L.

 

In summary: Does maple have a feature to animate the function turning from a quadratic to a horizontal line? I think it would be beneficial in the long term for learning about BC's and visualizing them in my head after I play around with it.

restart:
N:=3:
for i from 1 to N do
x[i]:=evalf((2*i-1)/(N)) :
end do:
for i from 1 to N do
t[i]:=evalf((2*i-1)/(N)) :
end do:
f:=unapply(x*t,x,t);
g:=unapply(x^2*t,x,t);

Question 1: We have two functions f and g as above. How can we create a table which contains merged cells as follows by Maple? 

Question 2:  How to convert or export the table to LATEX?

First 596 597 598 599 600 601 602 Last Page 598 of 2427