acer

32348 Reputation

29 Badges

19 years, 329 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Earl Mapleprimes won't let me download those last two attachments, in your Comment immediately above. Could you try uploading them again, without the ampersand in the file name?

@tomleslie I was going to mention this alternate command yesterday, but found it a bit brittle (and not quick). 

Of 800 files collected from Mapleprimes it failed with some error on about 70.

And in at least three cases it failed with an infinite recursion error, which is not catchable and thus stopped my script outright. Ie. it stopped the loop over all the files. I had to remove those filenames from the list and re-run.

Of course it may well work for all of the OP's files.

@tomleslie Does your approach detect the instance of

  with(plottools)

in that second attachment he gave?

I mean, his attachment as is, last saved in Maple 2016 (and running the detection script in Maple 2016 too, though I doubt that would affect it).

 

If you're inputs are in 1D Maple Notation then grep can work, as others have mentioned. That's because 1D input appears in the XML .mw file in plain text.

But if your worksheet contains 2D Input (in an Execution Group) then such input may not appear in plain text in the .mw file. Rather, it may appear encoded within an Equation element within an Input element in the XML .mw file. For example,

str:="LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbWlHRiQ2I1EhRictRiM2JS1GLDYlUSV3aXRoRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkobWZlbmNlZEdGJDYkLUYjNiQtRiw2JVE0VmFyaWF0aW9uYWxDYWxjdWx1c0YnRjRGNy9GOFEnbm9ybWFsRidGQkZCRisvJStleGVjdXRhYmxlR1EmZmFsc2VGJ0ZC":

op(2,Typesetting:-Parse(op(1,sscanf(StringTools:-Decode(str,base64),"%m")))):

lprint(eval(%,1));
  with(VariationalCalculus)

The above is slightly more complicated because the base64 encoding can differ entirely even if the 2D Input varies just a little. For example, if the 2D Input statement contains extra spaces, or terminates with colon, semicolon, or nothing.

In such a situtation it may be necessary to use a programmatic approach to pull out all such 2D Input pieces and decode, worksheet file by file. Maple could be used for this -- even the walking of the directory tree -- but it would be more work. (There's a possibility that one could programmatically extract all 2D Input from each .mw into separate .mpl plaintext files, perhaps even using a current command. But the set of .mw files is still needed.)

With newer "workbooks" (ie. .maple filename extension) the situation could be very difficult.

Did you intend to use Pi?

The lowercase name pi means  nothing special to Maple.

@Carl Love 

L := [sqrt(3), 3]:

subs(max(L)= 0, L);

                      [0, 0]

@tomleslie Right.

And it the same can be done using your (Tom's) earlier call to sol[animate] . That is, after computing the solution module assigned to sol,

A:=sol[animate]( u(x, t),
              t = 0 .. 20,
              frames = 100,
              scaling = constrained,
              labels = ["x", "u(x,t)"],
              labelfont = [Arial, 14]
            ):
plots:-display(A,size=[700,400],insequence=true);

@erik10 You can force the size by applying the plots:-display command to the result.

I think that it's likely just an oversight that the size option hasn't been coded into the plot export of the solution module returned by pdsolve/numeric . I will submit a bug report.

Eg,

restart;
v := 1: L := 12:
PDE := (D[2, 2](u))(x, t) = v^2*(D[1, 1](u))(x, t):
BC := u(0, t) = 0,
      u(L, t) = 0:
IC := u(x, 0) = 3*exp(-(x-6)^2)-3*exp(-36),
      (D[2](u))(x, 0) = sin(x):
sol := pdsolve( PDE, {BC, IC},
                numeric,
                spacestep = 1/200,
                timestep = 1/100
              ):
sol:-plot(u(x,t), t=10, x=0..10);
sol:-plot(u(x,t), t=10, x=0..10, size=[700,400]);  # bug
plots:-display(sol:-plot(u(x,t), t=10, x=0..10), size=[700,400]);

@Adam Ledger Neither of those first two sentences by Adam is true or close to true.

@Christopher2222 I'll try to find the time. But how about something more like Rouben's own solution, which I find satisfying on several levels.

@laupremmah The last Input part of your original attachment (which I deleted in my attachment) contained a large unterminated Image part which is where the corruption starts (many null characters). I don't see anything valid and recoverable after that, but perhaps someone else will.

Specifically, the original seems to be all null characters after the corrupted Image in Section "5)" of Section "MAT 6.1" of Section "Lektion 18 Tyngdepunkt af volumer" of Section "Matematik".

It's a shame that Maple's GUI doesn't recover even the valid portions: deleting the null characters and invalid .png Image, and also closing off the outstanding XML tags.

@laupremmah Joe's DeleteBadCharacters procedure is not going to be able to fix this (at least not by itself) since the problem is not (just) bad characters. The document also has unterminated XML tags. See my Answer below.

Do the Python examples work for you in your Maple 2018.0 without the Microsoft Visual C++ 2015 redistributable?

@mweisbr Using your second example with the P132.xlsx data file, that has purported erroneous values above 4000.

interp_ex2.mw

Are you trying to say that you want to see only the contour (level curve) at z=0.1 ?

First 253 254 255 256 257 258 259 Last Page 255 of 592