Items tagged with interface interface Tagged Items Feed

I've recently updated to Maple 12 (on Mac OS X.4.11) and am still learning how to use it. A search on Maple FAQs didn't turn up any answers to the following questions.


I am a relatively new user of Maple, and I try to solve numerically the following PDE system :

> pde01 := diff(c(z, t), t) = (diff(c(z, t), z, z))-(diff(c(z, t), z))+k*(a-c(z, t));

> pde02 := diff(b(z, t), t) = (diff(b(z, t), z, z))-(diff(b(z, t), z))+k*(a-b(z, t));

> cl1 := c(0, t) = piecewise(t <= 0.3, 100, 0.3 < t and t <=0 .5, 200, 0.5 < t, 100);

> cl2 := c(l, t) = b(l, t);

> cl3 := (D[1](c))(l, t) = (D[1](b))(l, t);

> cl4 := b(L, t) = a;

  I been trying to run a maple loop recently where maple computes the values of r,theta,phi for spherical coordinates from some fsolve statements. However I have found this to take an extremely long time (days). What I want is for it to make rows of these and then output them to a file so that I have rows of r,theta and phi for several hundred thousand of them atleast. Currently I simply create a n by 3 array with however many entries my loop has and then fill each position in the array using for loops then I use writedata to write the entire array into a file.

I wonder what virtue there would be in an "assistant" in the Standard GUI to show and allow control of the interface settings.

In the absence of a built-in assistant (or tab in the Tools->Options panels) I wonder whether a simple Maplet would serve.


In a previous post I described how to call OpenMaple from a C# application (see: Using OpenMaple with C#) Now, I'd like to tackle the reverse problem: how do I call a C# .dll from within Maple? The way to do this involves using Component Object Model (COM) interoperability in the Microsoft .NET Framework. Because Maple's kernel is written in an "unmanaged" language, a wrapper is needed in order to bridge to your managed C# code. This article will outline the steps needed to create this bridge and get Maple talking to C#.

A while ago, I tried to understand the dynamics of a tricky 3-D system. Back then I received great help from Robert Israel and Doug Meade. After leaving the problem aside for a while, I'm giving it another shot.

I have a 3-D system of ODEs in the variables (x,c,q) defined on an infinite time range. The initial value of x is given, x(0), but the other values c(0) and q(0) are free. The question is whether it is possible to find values of c(0) and q(0) such that the system will converge towards a critical point.

The first difficulty is in locating critical points, i.e. stationary states. Because the system below contains a singularity at a stationary state, the "critical" points must be understood as a limit that may or may not be approached as time goes to infinity. I have reduced the set of candidate critical points to one element (that for which q=b, where b is a parameter of the system, see below). Denote this critical/stationary point by (xs,cs,qs). The second difficulty is in establishing whether the critical point is reached by a stable (or center) manifold, i.e. whether it is possible to find values of c(0) and q(0) such that, given x(0), it is true that as T goes to infinity x(T)->xs, c(T)->cs, and q(T)=qs. My current assessment, based on the calculations below, is that the critical point may be approached if the initial value of x is below the stationary value but not if it is above it, i.e. x(0)<xs, but not if x(0)>xs. And, if I'm correct, the approach is along a one-dimensional manifold. I'm not 100 percent sure of myself, hence my message on mapleprimes.

The transformed system (u,v,r) appears to exhibit a stable manifold converging to the stationary state u=v=0 and r=b, for r(0) given. Does this indicate that, likewise, the system (x,c,q) has a stable manifold?

many thanks for your help.

My worksheet with comments follows. Unfortunately, today I do not seem to be able to insert figures into the code below.

> restart: with(plots): plotsetup(default): with(plottools): with(DEtools): with(LinearAlgebra):

> Digits:=100: interface(displayprecision=5):

Parameter Assignment:

> A:=1: d:=1/10: s:=1:

> b1:=2/100: b2:=3/100: w2:=1/2: w1:=1-w2: b:=w1*b1+w2*b2: b;

The dynamic system of interest:

> xdot:=diff(x(t),t)=A*(x(t))^(1/2)-d*x(t)-c(t);

> cdot:=diff(c(t),t)=s*(A/2*(x(t))^(-1/2)-d-q(t))

> qdot:=diff(q(t),t)=-(q(t)-b1)*(q(t)-b2)+(q(t)-b)*rhs(cdot)/rhs(xdot);

Computing the "stationary" state (xs,cs,qs):

> xd:=eval(rhs(xdot),x(t)=x, c(t)=c, q(t)=q):

> cd:=eval(rhs(cdot),x(t)=x, c(t)=c, q(t)=q):

> qd:=eval(rhs(qdot),x(t)=x, c(t)=c, q(t)=q):

> qs:=b: xs:=fsolve(eval(cd,q=qs),x): cs:=fsolve(eval(xd,x=xs),c): ss:=evalf([xs,cs,qs]);

 > R:=b;

 The Transformed Dynamic System

> sys := convert([xdot,cdot,qdot],rational):

> PDEtools[dchange](x(t)=A^2/4/(r(t)+d)^(2),c(t)=A^2/2/(r(t)+d)-d*A^2/4/(r(t)+d)^2-u(t),q(t)=r(t)-v(t)/s,sys,[u(t),v(t),r(t)]):
simplify(%) assuming u(t)>0 and v(t)>0 and r(t)>0:
newsys:= expand(solve(%,diff(u(t),t),diff(v(t),t),diff(r(t),t)));

 > eval(newsys, r(t) = R):
sys2D:= select(has,%, diff);

 Eigenvalues of the System

> M:= [eval(rhs(newsys[2]),u(t)=u,v(t)=v,r(t)=r),

> us:=1e-20: vs:=1e-20: rs:=R:
J:= eval(VectorCalculus[Jacobian](M,[u,v,r]),u=us, v=vs, r=rs);

 > LinearAlgebra[CharacteristicPolynomial](J,x):

> E,V:= LinearAlgebra[Eigenvectors](J):
Re(E); Re(V):

Gives one negative eigenvalue and two positive ones.

If I set the stationary value of r (and consequently q) to something other than b, I get one very large eigenvalue and one very small one. Analytically: one is zero, the other is infinite. This led me to rule out all candidate stationary states except r=b. When r=b, it is possible that the terms (r-b)/u and v/u in the jacobian, both of the form 0/0, might tend to something finite. It is this possibility that I investigate here.

A first look at the transformed system

> DEplot(sys2D,[u(t),v(t)], t=-1..1, u=-0.1..0.1, v=-0.1..0.1,arrows=medium);

Computing the nullclines (I learned these tricks from Robert Israel)

> up := subs(sys2D, u(t)=u, v(t)=v, diff(u(t),t));
   vp := subs(sys2D, u(t)=u, v(t)=v, diff(v(t),t));

> Uu := solve(up, v);

> Uv := solve(vp, v);

> u1 := fsolve(Uu=abs(Uv[1]),u,avoid=u=0); v1:=eval(Uu,u=u1);

Plotting the Phase Diagram with the NullClines

> p1 := DEplot(sys2D,[u(t),v(t)],t=-1..1,u=-0.1 .. 0.1,v=-0.002..0.002, arrows=medium):

> p2 := plot([Uu,Uv], u=-0.1 .. 0.1, colour=[brown,blue], thickness=3):

> display(p1,p2);

Zooming on the critical point

> p1 := DEplot(sys2D,[u(t),v(t)],t=-1..1, u=-0.015 .. 0.01, v = -0.001 .. 0.001, arrows=medium):

> p2 := plot([Uu,Uv], u=-0.015 .. 0.01, colour=[brown,blue], thickness=3):

> display(p1,p2);

 The critical point can be approached from the north-east quadrant only

 Simulating the 3-D Transformed system

> T := 100:

> INI := u(T)=1e-15, v(T)=1e-15, r(T)=b:

> SYS := udot, vdot, rdot:

> VAR := u(t), v(t), r(t):

> Digits:=100: interface(displayprecision=5):

> SOL := dsolve(SYS, INI, VAR, type=numeric, range=0..T, abserr=1e-25, output=listprocedure);

Reverting back from the transformed system (u,v,r) to the original system in (x,c,q)

> r0:=rhs(SOL[2](0)); u0:=rhs(SOL[3](0)); v0:=rhs(SOL[4](0));

> X := (u,v,r)-> A^2/4/(r+d)^(2):
   C := (u,v,r)-> A^2/2/(r+d)-d*A^2/4/(r+d)^2-u:
   Q := (u,v,r)-> r-v/s:

Plotting the original system

> x := t-> X(rhs(SOL[3](t)),rhs(SOL[4](t)),rhs(SOL[2](t))):

> c := t-> C(rhs(SOL[3](t)),rhs(SOL[4](t)),rhs(SOL[2](t))):

> q := t-> Q(rhs(SOL[3](t)),rhs(SOL[4](t)),rhs(SOL[2](t))):

> px := plot(x(t), t=0..T): display(px);

> pc := plot(c(t), t=0..T): display(pc);

> pq := plot(q(t), t=0..T): display(pq);


Unfortunately, couldn't plot the implicit relation among the variables. To be fixed.

> pxq := implicitplot(q(t),x(t), q=q(0)..q(T), x=x(0)..x(T)): display(pxq): #THIS IMPLICITPLOT FAILS
pxq := implicitplot3d(t,q(t),x(t), t=0..T, q=q(0)..q(T), x=x(0)..x(T)): display(pxq, axes=boxed): #ALSO FAILS

Error, (in plots/implicitplot) invalid input: the following extra unknowns were found in the input expression: t

Error, (in plots:-display) expecting plot structures but received: pxq

Plotting the transformed system

> pu := odeplot(SOL, [t,u(t)], 0..T): display(pu);

> pv := odeplot(SOL, [t,v(t)], 0..T): display(pv);

> pr := odeplot(SOL, [t,r(t)], 0..T): display(pr);

> puv := odeplot(SOL, [u(t),v(t)], 0..T): display(puv);

> pur := odeplot(SOL, [u(t),r(t)], 0..T): display(pur);

> pvr := odeplot(SOL, [v(t),r(t)], 0..T): display(pvr);

 A 3-D plot of the (u,v,r) stable path

> p3D := odeplot(SOL, [u(t),v(t),r(t)], 0..T, colour=black, thickness=3): display(p3D, axes=boxed);


This post was generated using the MaplePrimes File Manager

View on MapleNet or Download
View file details

I'm working with a PDE system, I want to bring it from the conservative(or divergent) to not-conservative form. So I have to do some derivatives. I'm working in vectorial form.

The Maplesoft office is currently in the process of being burried in snow and many of us are getting ready to head off for the holidays.  Before leaving, I wanted to share this great animated GIF created using 3d plots.  It was sent to me by Bruce Char at Drexel University. The greeting and the Maple script to generate it are after the break.

Hi there,

So my problem is to find the solution(s) of a 3-D system. I can get Maple to spit out a solution (at times), but I am looking for reassurance that this is indeed the solution (if unique, and if not what the other solutions may be). Increasing Digits makes Maple "lose" the solution and return a blank-- normal behavior? Looking at the 3-D plot of the system offers something to puzzle over.

I set up the system in  (x,c,q):

xd := x^.5-.1*x-c;
cd := (.5/x^.5-.1-q)*c;
qd := -(q-.2e-1)*(q-.3e-1)+(q-.25e-1)*(.5/x^.5-.1-q)*c/(x^.5-.1*x-c);

I look for a solution with fsolve:

Digits:=10: interface(displayprecision=10):
ss:= fsolve({xd,cd/c,qd}, {x,c,q}, avoid={x=0, c=0, q=0});
xs:=subs(ss,x): cs:=subs(ss,c): qs:=subs(ss,q):

Maple gives:

ss := {c = 2.399289639, q = .2511089584e-1, x = 15.97164840}

If I raise digits to 15, Maple can't solve it anymore. Perhaps this is normal behavior.

I'd like some reassurance that this solution is indeed a solution. Simply feeding the fsolve output back into the system will not work because of a division by zero:

eval(xd,{x=xs,c=cs,q=qs}); eval(cd,{x=xs,c=cs,q=qs}); eval(qd,{x=xs,c=cs,q=qs});



I decided to look at the 3-D plot. The plot of the system suggests that there may be several solutions.

The plot:

plotopts:=style=patchcontour, shading=none,lightmodel=light3,axes=boxed:
px:=implicitplot3d({xd}, x=0..25,c=0..5,q=0.02..0.05, numpoints=10000, plotopts, colour=brown): pc:=implicitplot3d({cd/c}, x=0..25,c=0..5,q=0.02..0.05, numpoints=10000, plotopts, colour=green):
pq:=implicitplot3d({qd}, x=0..25,c=0..5,q=0.02..0.05, numpoints=10000, plotopts, colour=blue):
display3d({pq}, orientation=[-25,70]);
display3d({px,pc,pq}, orientation=[95,90], projection=1);

plot of third equation
plot of 3-D system

The plot is not very clean, and no matter how hard I've tried, by turning it around and zooming near the Maple solution, it is not clear that there are no other solutions. (well perhaps it is clear from the equations themselves, but I couldn't work it out and resorted to the numerical approach)



In the volume Advanced Programming Guide of the Maple manual, the "clasical" picture of the Maple system architecture is depicted:

 A1: Internal Organization

Maple consists of three main components: a kernel, a library, and a user interface. The kernel and library together are known as the math engine.
Kernel The kernel is written in the C language and is responsible for low-level operations such as arbitrary precision arithmetic, file I/O, execution of the Maple language, and the performance of simple mathematical operations such as differentiation of polynomials.
Library Most of the Maple mathematical functionality is in the Maple library, which is written in the Maple language. The library is stored in an archive, and pieces of it are loaded and interpreted by the kernel on demand.
User Interface The user interface is the part of Maple that the user sees, and is conceptually separate from the math engine. The same math engine can be used with different user interfaces.

However, the architecture of the system has been moving away from this picture for several years already. Eg:

A second parser has been implemented in the Standard GUI, instead of the kernel.

<p>How do I render 3D plots from command line maple on Mac OS X? (My calculations are memory intensive and I can not spare the huge memory that the GUI requires.)</p>
<p>On my old Solaris box, I would use <br />
>interface(plotdevice = x11);<br />
but it appears Maple has not written a X11 driver for the Mac.</p>
<p>Presumably Maplesoft wants me to use an alternative plotdevice, such as "postscript" or "jpeg", but I can not find one which allows me to rotate the rendered plot.  What am I missing?</p>

I have a nasty expression that solves for eigenvalues of pressure & shear waves propagating along an interface between 2 elastic media.  There are many roots to this expression for eta, but many of them can be excluded because the material properties are both REAL & POSITIVE.  I am very new to MAPLE & I am attempting to get it to solve for the roots where all of the other parameters meet the conditions of REAL & POSITIVE but I am not sure I am doing this correctly because MAPLE runs off to evaluation mode & takes so much memory my computer slows to a crawl &

  restart; interface(version);

    Classic Worksheet Interface, Maple 12.00, Windows, Apr 10 2008 Build ID 347164

  Int(1/(u^2+1/4)*exp(I*u*k),u=-infinity...infinity); value(%);




Ever since upgrading to Ubuntu 8.04 I get Java debug messages when starting xmaple or when running maplets from the commandline maple. They look like this:

I'm running Ubuntu 8.04 on an AMD Athlon64-X2 (AMD64), and found that "xmaple" did not work right out-of-the-box when I first got Maple 12. There was a bunch of error messages in the terminal I started it from regarding lock assertions or libraries not found, printed by the X-Windows libraries. I also had the problem where it won't print via CUPS.

4 5 6 7 8 9 10 Last Page 6 of 14