acer

32592 Reputation

29 Badges

20 years, 39 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

kernelopts(opaquemodules=false):
eval(HTTP:-SendRequest);

acer

"Man is the measure of all things: of those which are, that they are, and of those which are not, that they are not"            -- Tag the mag'

That's a interesting view, Doug. (I realize that it's a suggestion for a possible interpretation, and may not be what you yourself hold fast to.) But doesn't it describe the opposite state of affairs from what Maple does now?

I might make another suggestion on how to interpret such problems: in both cases the integrand (or antiderivative) must be evaluated at floating-point values. So numeric stability is desired. Numeric quadrature routines are often designed with that goal in mind. (Simple example: spurious nonzero imaginary artefacts seem to quite often occur when evaluating exact antiderivatives at approximate values under fixed precision, while numeric quadrature might produce strictly real evaluations.) So maybe Maple should do numeric quadrature in both situations originally posted above.

acer

What happens if you split the integral, making assumptions a>0,a<2 for one part and a>2 for the other? And then use eval() instead of subs()?

acer

Here's an experiment. Open a new Worksheet (not Document). Toggle to 1-D Maple Notation input (not 2D Math input) using either the keyboard shortcut or with the menubar's Tools -> Options -> Display(tab) -> Input display . I realize that those might be different on OSX. You'll know it's right if you can get the red cursor and red input.

Now, enter this,

eval(plot);

Did that print out the body of the plot() procedure? Can you issue the command

plot(2*x-9, x = -10 .. 10);

from that same worksheet, by typing it in and not using context-menus and the mouse?

I'm just trying to see whether all plotting is not working, or just the plot command, or context-menu results, or...

Do other typed commands work OK, like int(sin(x),x) ?

acer

Here's an experiment. Open a new Worksheet (not Document). Toggle to 1-D Maple Notation input (not 2D Math input) using either the keyboard shortcut or with the menubar's Tools -> Options -> Display(tab) -> Input display . I realize that those might be different on OSX. You'll know it's right if you can get the red cursor and red input.

Now, enter this,

eval(plot);

Did that print out the body of the plot() procedure? Can you issue the command

plot(2*x-9, x = -10 .. 10);

from that same worksheet, by typing it in and not using context-menus and the mouse?

I'm just trying to see whether all plotting is not working, or just the plot command, or context-menu results, or...

Do other typed commands work OK, like int(sin(x),x) ?

acer

This is the so-called 2-D Math parser in action.

You can set a new default using the top-menubar's Options -> Display -> "Input display". You can set that drop-down choice to the old 1-D "Maple Notation" value. I also have set the default  Options -> Interface -> "Default format for new worksheets" to be Worksheet rather than Document. Together those two changes should make the Standard GUI act more like you are used to. You can choose "Apply Globally" if you want to set it thus for all future sessions.

I'm curious, when you entered 5/7*3 did you see it represented as a fraction, 5 over 7 dot 3 ?

acer

I forgot about that. Brilliant. Thanks, Robert.

It does pretty much exactly what my code above does. (Like my code, it too overwrites the orginal Matrix with the superimposed L and U factors.) And so determinant of a 6000x6000 nonsparse float[8] takes 280MB -- pretty much the memory only to hold the Matrix itself.

So the original poster could just ensure that the Matrix is created with datatype=float[8], and not with storage=sparse, and then do your LUDecomposition call above.

acer

I forgot about that. Brilliant. Thanks, Robert.

It does pretty much exactly what my code above does. (Like my code, it too overwrites the orginal Matrix with the superimposed L and U factors.) And so determinant of a 6000x6000 nonsparse float[8] takes 280MB -- pretty much the memory only to hold the Matrix itself.

So the original poster could just ensure that the Matrix is created with datatype=float[8], and not with storage=sparse, and then do your LUDecomposition call above.

acer

I do not know why there may be a memory restriction on your machine. What operating system is it?

acer

I do not know why there may be a memory restriction on your machine. What operating system is it?

acer

I wish that all Maple manuals could be written as well as this was.

acer

The code fragment like,

try
  # stuff
catch:
  error;
end try;

will rethrow the error. And so, yes, unless that fragment is within the scope of some other try..catch or traperror (possibly at a higher level) then the computation will stop (as usual) and the error message will be emitted.

Sometimes code is written that way so that errors do not appear to come from mysterious inner routines deep in the bowels of Maple. I wasn't sure whether that was what you might have been after.

I'm sorry but I don't know why the error form is different when emitted by parameter-processing.

acer

At first it seemed that you were just interested in knowing how to manipulate the last "error" results, and perhaps control how they got reprinted.

But if all you need to to is catch something, insert a command, and then rethrow the very same error, then that too can be done.

> F:=proc(LL::{set(list(integer)), list(list(integer))})
>     LL;
>  end proc:
>
> for B in [{[1,2]},{[1,1/2]}] do
>    try
>       print(F(B));
>   catch:
>   V := 9:
>   error;
> end try:
> od:
                                   {[1, 2]}
 
Error, invalid input: F expects its 1st argument, LL, to be of type
{list(list(integer)), set(list(integer))}, but received {[1, 1/2]}
> V;
                                       9

And just for fun, instead of printing your could use WARNING(),

> WARNING(StringTools:-FormatMessage(lastexception[2..-1]));
Warning, invalid input: F expects its 1st argument, LL, to be of type
{list(list(integer)), set(list(integer))}, but received {[1, 1/2]}

acer

In Maple 11 the help-page ?lasterror (or ?traperror) says that the functionality is obsolete, and that try..catch should be used instead.

In Maple 12 the help-page ?lasterror (or ?traperror) shows that it has gone from "obsolete" to "deprecated".

There is an Example on the ?try help-page which illustrates the use of lastexception. And lastexception is mentioned on the ?error help-page. But lastexception should be described in the main body of the ?try help-page, instead of just occuring in an Example on that page.

Another way to look at it is that the replacement of traperror by try..catch mirrors the replacement of lasterror by lastexception. The pair of replacements could be documented together more clearly.

The help-page ?deprecated could mention it too. It has a double-column list that shows try..catch as replacing traperror but has no line indicating that lastexception replaces lasterror.

acer

Use lastexception instead.

acer

First 539 540 541 542 543 544 545 Last Page 541 of 596