acer

32617 Reputation

29 Badges

20 years, 42 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@taro 

restart;

r := theta*z;

lo_theta, hi_theta := 0.0, 2.0;
lo_z , hi_z := 0.0, 1.0;

m, n := 3, 2;

theta*z

 

0., 2.0

 

0., 1.0

 

3, 2

(1)


c := plot3d( r,
             theta = lo_theta .. hi_theta,
             z = lo_z .. hi_z,
             coords = cylindrical, grid = [m, n] ):
A:=op([1,1],c);

A := Vector(4, {(1) = ` 1..3 x 1..2 x 1..3 `*Array, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(2)

lprint(A);

Array(1 .. 3, 1 .. 2, 1 .. 3, {(1, 2, 3) = HFloat(1.), (2, 2, 1) = HFloat(.540302305868139765), (2, 2, 2) = HFloat(.841470984807896505), (2, 2, 3) = HFloat(1.), (3, 2, 1) = HFloat(-.832293673094284814), (3, 2, 2) = HFloat(1.81859485365136342), (3, 2, 3) = HFloat(1.)}, datatype = float[8])

 

i, j := 2, 2;
x = A[i,j,1];
y = A[i,j,2];
z = A[i,j,3];

2, 2

 

x = HFloat(0.5403023058681398)

 

y = HFloat(0.8414709848078965)

 

z = HFloat(1.0)

(3)

x = eval( r*cos(theta), [theta = lo_theta + (i-1)/(m-1)*(hi_theta - lo_theta),
                         z = lo_z + (j-1)/(n-1)*(hi_z - lo_z)] );

y = eval( r*sin(theta), [theta = lo_theta + (i-1)/(m-1)*(hi_theta - lo_theta),
                         z = lo_z + (j-1)/(n-1)*(hi_z - lo_z)] );

z = eval(z, [theta = lo_theta + (i-1)/(m-1)*(hi_theta - lo_theta),
             z = lo_z + (j-1)/(n-1)*(hi_z - lo_z)] );

x = .5403023059

 

y = .8414709848

 

z = 1.0

(4)

i, j := 3, 2;
x = A[i,j,1];
y = A[i,j,2];
z = A[i,j,3];

3, 2

 

x = HFloat(-0.8322936730942848)

 

y = HFloat(1.8185948536513634)

 

z = HFloat(1.0)

(5)

x = eval( r*cos(theta), [theta = lo_theta + (i-1)/(m-1)*(hi_theta - lo_theta),
                         z = lo_z + (j-1)/(n-1)*(hi_z - lo_z)] );

y = eval( r*sin(theta), [theta = lo_theta + (i-1)/(m-1)*(hi_theta - lo_theta),
                         z = lo_z + (j-1)/(n-1)*(hi_z - lo_z)] );

z = eval(z, [theta = lo_theta + (i-1)/(m-1)*(hi_theta - lo_theta),
             z = lo_z + (j-1)/(n-1)*(hi_z - lo_z)] );

x = -.8322936730

 

y = 1.818594854

 

z = 1.0

(6)

 


Download cyl.mw

@Carl Love Good idea. I think I got confused about the question, and was thinking of function calls instead of stored structures.

You might have a look at these profiling mechanisms.

I'm not sure offhand what special support -- if any -- there might be for records or static methods of objects. I find it mostly useful for profiling my "Library level" interpreted procedure calls/usage. The CodeTools functionality is newer.

https://www.maplesoft.com/support/help/Maple/view.aspx?path=CodeTools/Profiling

https://www.maplesoft.com/support/help/Maple/view.aspx?path=exprofile


 

Do you mean that the Matrix appears as 2D Output, or was it inserted as 2D Input by using the Matrix Palette?

If the problem is with the Matrix as typeset 2D Input then does it work if you hit Enter and then try it on the output?

Why not upload a Worksheet or Document that exhibits the problem?

@vv That's nice. Here are a few more ways to accomplish those things -- and a few comments if I may add them -- using that generated f .

These following operator form calls work as they ought to.

int(f, 0..Pi, numeric);
evalf(Int(f, 0..Pi));
int(f, 0..evalf(Pi));

It's clearly a bug that evalf(Int(f(x), x=0..Pi)) does not work, while something weird like evalf(Int(''f(x)'', x=0..Pi)) does produce the float result.

It's unfortunate that D(f) has not yet been taught to return unevaluated, since the hook from evalf(D(...)) into fdiff is a useful syntax. Hopefully someone will fix that in D.

The first of these ideally would work as just evalf(D(f)(2)) . And the third of these ideally would not need the uneval quotes.

evalf(D(t->f(t))(2));
fdiff(f(x), x=2);
evalf(eval(diff('f'(x), x), x = 2));

Similarly, these would look nicer working with just D(f) instead of D(t->f(t)) .

plot([f, D(t->f(t))], 0 .. 10);
plot([f(x), D(t->f(t))(x)], x = 0 .. 10);

As a side note, these both compute without an error message.

fsolve(f, Pi/2..3*Pi/2);
fsolve(f(x), x=Pi/2..3*Pi/2);

And these first two calls succeed, but unfortunately the third emits an error message.

Optimization:-Maximize(f(x), x=0..Pi);
Optimization:-Maximize(t->f(t), 0..Pi);
Optimization:-Maximize(f, 0..Pi);

I suspect that some of these problematic cases relate to appliable modules more generally, and not just to Interpolation objects.

@AliahNiu The image shows {sin(x)}^(d-2) as part of the integrand, which is not valid syntax since the curly braces denote a set. That should be sin(x)^(d-2) .

Christopher2222, please upload the actual .mw file from which you are trying to retrieve the value associated with the "L1" label.

Then tell us exactly which platform you're using, eg. Windows 7 32bit , or Windows 10 64bit , etc.

@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]);
First 257 258 259 260 261 262 263 Last Page 259 of 596