Dr. Patrick T

2108 Reputation

18 Badges

15 years, 177 days

MaplePrimes Activity

These are answers submitted by PatrickT

either you omit it entirely and dsolve will use the default value or you specify it, possibly together with abserr, but you need to read up on it, dsolve/numeric, because different numeric methods work with different specifications of abserr and relerr. You can also play around with values like relerr = 1e-6 or relerr = 1e-12 and see how it goes.

This should answer much:

does this work for you?

SOL := dsolve(...);


from what you write, it sounds like you might be able to achieve your calculations more simply by redefining your ode system. If your integral is not too messy, you might be able to differentiate it and write an ode for it, which together with some initial condition could be appended to your system.

here is an illustration of this by Joe Riel. I have seen other similar calculations within mapleprimes, but I couldn't locate them at this time. If you give more details (i.e. copy-paste your code), someone may be able to provide more explicit advice.

I'm no expert on this, but just reading the maple help files here:


Command-line Interface


The command-line interface produces a simple character plot.  Most plotting options are not supported in this interface.

I don't think you can position the legend within the plot, unless you tweak.

As far as I know there are 4 positions for the legend, top, bottom, left, right.


acer recently gave this example:




I don't know if this is feasible: create two plots, p1 and p2, and display them together plots:-display(p1,p2), where p1 has the plot without a legend and p2 the legend without the plot, not sure if that would work though, seems a little tricky.

The first line of the help/animate page suggests:

animate( plot, [A*sin(x), x=0..10], A=0..2 );

and this produces an empty plot here...

your example also produces an empty plot.

But it is 2:00am, so perhaps I'm just tired...

Maple 15 / Windows 7-64 / Standard GUI.

pagan, xi doesn't print as intended here. I'm assuming xi is the Greek letter, yes?

This may be related to recent discussions about broken plot functionalities in Standard GUI.

I found the following works:


This is just a problem of the sort of percentage you are looking at, there is no economic content to it.

The 1 percents you're looking at aren't the same thing because of a change in the base, so you shouldn't expect them to cancel out.

To see what I mean, consider the following artificial situation: the variable y(t) is equal to 200 at even values of t, and equal to 100 at odd values of t, with t a discrete variable denoting time periods, 1,2,3,4,5,...

Now compute growth rates.

+100% up

-50% down.

But clearly all that y(t) is doing is fluctuating between 200 and 100.

There would be no sense in saying that upturns are greater than the downturns, as these percentage calculations would seem to suggest.

It just shows that this is not a helpful sort of percentage calculation. Better would be to take the same base, e.g. 150, then you'd find +66.7% up and -66.7% down. Additivity holds, it's more useful.

or am I missing the point of your question?

if you enter "dsolve, events" into the search box, the top 2 or 3 hits link to recent discussions of how to use events, it's complementary to the Maple help page.

perhaps you mean the ini file in your system?

The location of this ini file will depend on your os and specifics. Under windows, this is often in


perhaps you can locate it by searching for Maple15.ini or Maple14.ini, etc..

Here is another approach, shown to me by Allan, based on eventfired, see below

This approach also relies on reinitializing the integrator, there seems to be no way to record event dates on the fly.

I am reporting about here for the record, for myself and (hopefully) someone else.

Here is the system on which I based my tests:

t0:=0: t1 := 25:
Sol := dsolve(
  [ diff(y(t),t) = -y(t), y(t0) = 1, p(t0) = 1/10 ]
  , 'type' = numeric
  , 'discrete_variables' = [ p(t)::float ]
  , 'events' = [ [ y(t) = p(t), [ p(t) = p(t)/10, 'halt' ] ]  ]
) ;

The main loop suggested by Allan goes as follows:

A := Array([0]):
while A[-1] < tf do
  A(ArrayNumElems(A)+1) := Sol(eventfired=[1])[1]:
end do;

A slightly more versatile loop may be written, to allow for integration forward and backward.
RecordEventDates := proc(dsol,range)
  local A,ts,tf;
  description "the first argument is the output of dsolve
    , the second argument is the range of integration
    , based on suggestions by Erik Postma, Joe Riel, Allan Wittkopf" ;
  ts:=lhs(range); tf:=rhs(range);
  A := Array([0]);
  if tf>ts then
    dsol(ts+1e-6); # may need tweaking
  elif tf<ts then
  else break;
  end if;
  while A[-1] < tf do
    A(ArrayNumElems(A)+1) := dsol(eventfired=[1])[1]:
    if dsol(eventstop)=1 then
    elif dsol(eventstop)=0 then
    end if;
  end do;
  if ArrayNumElems(A) < 3 then
    A := []; A;
    A := convert(A,list); A[2..-2];
  end if;
end proc:
A := RecordEventDates(Sol,t0 .. t1);

This works on a small number of examples I have tested. It probably needs tweaking, especially the part where the integration is reinitialized. If I've done it right, it will return an empty list if the event has not triggered. It caters only for one event right now, the bit eventfired=[1] would need to be changed to accommodate for more events. I bet there are some redundant lines of code, but at this time it's doing the job I need, I think. I hope.

In case you couldn't find an easy way, sharpkeys is a windows freeware with which you can remap your keyboard and create all sorts of convenient shortcuts, so an inconveniently located shortcuts can be remapped easily. With linux/ubuntu and others you can usually create shortcuts from the "settings".

Here, similar questions were asked and answered:

In standard gui, you can open/close a palette on the left-hand side of the worksheet, which lists the variables currently loaded. Is this helpful? For this list to be accessible, you need to have executed the worksheet beforehand.

For someone who has only recently started using standard gui and so much prefers the simplicity of classic gui, I must say that this palette with the list of variables is the one feature of standard that I actually use.

I typically keep the palettes minimized, but once in a while I open them to search through the variable list, looking for those that potentially use up a lot of memory and with a right-click I "unassign" them, thus freeing up memory and delaying "lost kernel" issues for a little longer.

By the way, a very useful feature of the "variables" palette would be to have information about the memory they actually occupy. I don't know how feasible it would be to add this feature. Thus you could easily identify the memory hogs and unassign them before running a memory-intensive job (that doesn't need them, obviously).

This reminds me of an exchange at mapleprimes. You may find useful ideas there:

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