6814 Reputation

17 Badges

10 years, 226 days

MaplePrimes Activity

These are answers submitted by tomleslie

p1 := pds:-plot(x = .16, t = 0 .. 10, numpoints = 10000, color = red);
p2 := pds:-plot(x = .21, t = 0 .. 10, numpoints = 10000, color = blue);
plots:-display([p1, p2]);

Obviusly you may want a different range for t, or more/fewer point for "smoothness"

It seems that you have to define the foci option using 'points' rather than a simple list of values, as in

point(A, 0,1);
point(B, 4,1);
ellipse(e1,['foci'=[A,B], 'MajorAxis' = 8],[x,y]);

Manual does say (my emphasis)

foi is a list of two points which are the foci of the ellipse


  1. It is perfectly possible for a procedure to update 'global' values - although whether you regard this as 'acceptable' programmng practice will get you into deep "philosophical" discussion. There are people who regard the use of 'global' parameters as completely unacceptable - makes code difficult to 'comparementalise', 're-use' and debug, etc, etc, etc. Personally I prefer to avold the use of global variables, but I don't get too "fundamentatlist" over it. I do recommend using a 'global' statement within a procedure, whenever global values in the calling code are necessary. This is never strictly required but serves as a reminder, that the correct execution of the procedure may depend on the correct definition of variables outwith the procedure
  2. When returning values from a procedure, the default is to return the output of the last statement executed. However if you have multiple conditional statements (or other similar structures) it can be difficult to determine where the return points actually are (especially a week or so after you have written the code!). For this reason, I tend to use the explicit 'return' command. So far as I am aware this is never absolutely necessary. On the other hand if I look at a procedure with half a dozen 'return' statements then I know that there are exactly half a dozen way for this procedure to exit. This aids debug/reuse (at least for me)
  3. The argument(s) for a return statement can be pretty much anything - eg a single value (which may be a list of multiple values) or a sequence of multiple values. In the case of the latter, the only thing you have to ensure is that the calling statement contains enough arguments for the outputs to be assigned. For example consider the "toy" example

  powers:= proc(x)
                       return x, x^2, x^3:
                end proc;

          along with the calling sequence


          Then 'a' will be assigned to 2, 'b' to 4 and 'c' to 8.

          An alternative would be to write the procedure to return a single list, as in

          powers:= proc(x)
                               return [x, x^2, x^3]:
                        end proc;

          With the calling sequence


          In which case 'a' is the list [2, 4, 8] and you can subsequently access values as a[1], a[2] etc.

Determining the 'best' way to return multiple values from a procedure is never an 'absolute' - it depends on subjective criteria such as readability, debuggability, reusability etc

I think it is easier to see what is goiing on if you plot, B[1](t), B[2](t), and C(T) separately as functions of t. You can see that B[1]() asymtotes to about 0.29, B2() asymptotes to about 0.17 and C(T) asymptotes to about 100. This makes the output of your DEPlot3D command easier (for me at least to interpret).

In one of your equations you had B[1], rather than B[1](t) - I have corrected this. Check out the following

Model := [diff(B[1](t), t) = k[a1]*C(t)*(R-B[1](t)-B[2](t))-k[d1]*B[1](t),
          diff(B[2](t), t) = k[a2]*C(t)*(R-B[1](t)-B[2](t))-k[d2]*B[2](t),
          diff(C(t), t) = (-(k[a1]+k[a2])*C(t)*(R-B[1](t)-B[2](t))+k[d1]*B[1](t)+k[d2]*B[2](t)+k[m]*((I)(t)-C(t)))/h
DissMod := subs((I)(t) = 0, Model);
AssMod := subs((I)(t) = C[T], Model);

Pars := [k[a1] = 6*10^(-4), k[d1] = 7*10^(-3), k[a2] = 5*10^(-4), k[d2] = 10^(-2), R = .5, k[m] = 10^(-4), C[T] = 100, h = 10^(-6)];

DETools:-DEplot3d(subs(Pars, AssMod), [B[1](t), B[2](t), C(t)], t = 0 .. 1000, number = 3, B[1] = 0 .. .5, B[2] = 0 .. .5, [[B[1](0) = 0, B[2](0) = 0, C(0) = 0]], scene = [B[1](t), B[2](t), C(t)], maxstep = .1, maxfun = 0);
desys:=[subs(Pars, AssMod)[],B[1](0) = 0, B[2](0) = 0, C(0) = 0];
sols:=dsolve( desys, numeric, maxfun=0)
plots:-odeplot(sols,[t, B[1](t)], t=1..1000);
plots:-odeplot(sols,[t, B[2](t)], t=1..1000);
plots:-odeplot(sols,[t, C(t)], t=1..1000);

Try this

Pars := [k[a1] = 6*10^(-4), k[d1] = 7*10^(-3), k[a2] = 5*10^(-4), k[d2] = 10^(-2), R = .5, k[m] = 10^(-4), C[T] = 100, h = 10^(-6)];
eqns:=[C = -(k[d2]*B[2]+C[T]*k[m]+k[d1]*B[1])/((B[1]+B[2]-R)*k[a1]+(B[1]+B[2]-R)*k[a2]-k[m]),

       C = k[d1]*B[1]/(k[a1]*(R-B[1]-B[2]))
eqns2:=eval(eqns, Pars);
p1:=plots:-implicitplot3d(eqns2[1], B[1]=0..0.5, B[2]=0..0.5, C=0..100, style=patchnogrid, color=red, grid=[50,50,50], transparency=0.5):
p2:=plots:-implicitplot3d(eqns2[2], B[1]=0..0.5, B[2]=0..0.5, C=0..100, style=patchnogrid, color=blue, grid=[50,50,50], transparency=0.5):
p3:=plots:-intersectplot(eqns2[1],eqns2[2], B[1]=0..0.5, B[2]=0..0.5, C=0..100, thickness=6,color=black):

The following code provides a partial answer

Pars := [k[a1] = 6*10^(-4), k[d1] = 7*10^(-3), k[a2] = 5*10^(-4), k[d2] = 10^(-2), R = .5, k[m] = 10^(-4), C[T] = 100, h = 10^(-6)];
eqns:=[C = -(k[d2]*B[2]+I*k[m]+k[d1]*B[1])/((B[1]+B[2]-R)*k[a1]+(B[1]+B[2]-R)*k[a2]-k[m]),

       C = k[d1]*B[1]/(k[a1]*(R-B[1]-B[2]))
eqns2:=eval(eqns, Pars);
plots:-implicitplot3d(eqns2[1], B[1]=0..0.5, B[2]=0..0.5, C=0..100);
plots:-implicitplot3d(eqns2[2], B[1]=0..0.5, B[2]=0..0.5, C=0..100);

The reason that nothing is plotted for eqns2[1] is that your first equation contains 'I' which will be interpreted as the square root of -1. Is that intentional?

then try

add( add( add( `if`( j=i, 0, x[i,j,k]+x[j,i,k] ), i in TB), j in TB), k in DD);
add( add( add( `if`( i=2*j-1, 0, x[2*j-1,i,k] ), i in T), j in e), k in K);

You have two dependent variables - U(r,t) and eta(r,t)

You have one PDE.

Which part of

"Error,   (in pdsolve/numeric/process_PDEs)  number of dependent variables and number of PDE must be the same"

don't you understand?

I don't really see much wrong with the 2d-output, once you learn to recognise the script capital 'I' which Maple uses for imaginary part.

One thing you can do is just select (a portion of the) output  - standard mouse click-and-drag. then copy it (ctrl-c, ctrl-v) to a Maple prompt. This will 'magically' convert it to a form which looks very like the output of lprint.

One 'advantage' of this method is that you can select a small piece of a more complex expression

Just becuase there's always more than one way to it!

# The expression form is
#  k*(A+B)
# where 'k' is a ratio, A is a sum of terms
# and B is a fourth root, these can be extracted
# as
  k:= op(1,f1)*op(3,f1);
  A:= add(op([2,1..-2],f1));
  B:= op([2,-1],f1);

Well if I fix syntax errors and typos using more-or-less guesswork (some of which) may be wrong, I can come with the attached worksheet

Suggest you read the comments in this to determine whether or not my guesses were correct.

This takes about a minute to execute on my machine, and the final plots are not really very interesting :-(

I didn't really understand your question, but luckily the Wikipedai page at

seems to have a pretty clear description.

The attached worksheet implements the 'Classification' section of that Wikipedia entry. I suggest you check it very carefully, becuase with this many conditions, it would be very easy for typos to occur

Maple can only numerically solve PDEs with two (or fewer) independent variables. You have three.

The attached will compute the solution over the range of time specified by tRange, and steps of tStep. Since I have no idea what these values are I just used



You can change these settings in the attached to anything you want and everything should still work.

You will also have to adjust the fileName in the


command to something appropriate for your machine

If you change the colon at the end of the line


to a semicolon, you will see that each entry in Eff, has three components - you should only have two! See below

Eff := [[-1.566422551*10^20, 1.566422551*10^20, 30[1]], [-1.566422551*10^20, 1.566422551*10^20, 30[2]], [-1.566422551*10^20, 1.566422551*10^20, 30[3]], [-1.566422551*10^20, 1.566422551*10^20, 30[4]], [-1.566422551*10^20, 1.566422551*10^20, 30[5]], [-1.566422551*10^20, 1.566422551*10^20, 30[6]]]

No idea what you mean by 30[1], 30[2], 30[3] etc

First 116 117 118 119 120 121 122 Last Page 118 of 140