acer

10 years, 238 days


These are answers submitted by acer

all I see

May 23 2016 acer 12485

Here is a link to a sheet (Document) with all that I can see as recoverable.

P3try1.mw

The sheet was prematurely curtailed with some XML tags unclosed. I've seen that kind of problem before. I don'tr know why the GUI is so poor at recovery in such situations.

The final bit, that was chopped, was an Image item. That did not seem recoverable. It was the only thing in a Group. So I excised the incomplate Image, its parent Group, and then closed its parent Section and the Worksheet.

Perhap someone else could see more..

acer

a? b?

May 18 2016 acer 12485

How do you expect anything to work if `a` and `b` are not numeric?

If they were then you could try it like so,

  Matrix([seq([seq(helper3(i,j),i=1..size_B)],j=1..size_B)],datatype=float);

acer

profile

May 18 2016 acer 12485

The more of your code you put within procedures the more you'd be able to profile. See the CodeTools:-Profile command. You could use it on your MyProc procedure, for example. There are also other older mechanisms for profiling (profile, exprofile, excallgraph, nprofile, etc).

Also, if your large expressions are assigned to locals within procedures (as much as possible) then you allow garbage collection to collect more of it automatically upon return -- as opposed to having to unassign names, say.

Calling forget(MyProc) probabaly won't do much for you, if that procedure itself does not have option remember or option cache.

I haven't used it in some time, but you might see whether Robert Israel's sniffmem procedure can reveal anything useful about which system procedures may be getting a lot of remember table clogging.

As a general rule, avoid as much assignment at the top level as possible. Try hard to not use use global names in your procedure.

Run `mint` against your code, as a general practice, which may provide some hints about use of globals but is otherwise not a bad idea in general. See here if you want to try running it in a worksheet instead of copying your MyProc code to a text file.

acer

icons

May 18 2016 acer 12485

Click on the thumbs-up or trophy icons on the right of the Answer's title bar.

acer

units simplification

May 17 2016 acer 12485

Loading the Units:-Standard package will rebind several commands (`+`, `*`, etc) so that they automatically simplify units when called from the top-level.

However you can still get unsimplified arithmetic expressions containing units as results from other commands, So units simplification is something you may have to do yourself, at some stage, anyway.

There is a right-click context-menu action for it.

There are also several ways to get it, with commands (some of which are not in the Units subpackage).


K := Unit('m')+Unit('mm')

Units:-Unit('m')+Units:-Unit('mm')

simplify(K)

(1001/1000)*Units:-Unit('m')

Units:-Standard:-simplify(K);

(1001/1000)*Units:-Unit('m')

combine(K, 'units')

(1001/1000)*Units:-Unit('m')


Download unitsimp.mw

acer

libname

May 13 2016 acer 12485

If you issue the Maple command

libname;

then what does it show? It should reveal one or more folders (locations) that Maple is using for so-called Library archives and help-databases. Tech Support is suggesting that you place the files in one of those (...the same one as holds the principle maple.mla archive).

There are two other ways to get it all to work. One is to place them all in a new subfolder like whatever this command returns,

cat(kernelopts(':-homedir'),"/maple/toolbox/directsearch/lib");

A third way is to place the three files in any new special folder of your choice, and then to augment your default for libname in Maple by augmenting libname with a command in a Maple initialization file. That works, but the location of the initialization file varies by platform.

For all three ways above, close Maple's GUI entirely, and relaunch when the steps are completed.

I prefer the second choice above, as it's a single solution that can make it work in one or more (or future) Maple versions you might have, and doesn't mess with your Maple installation. The first suggestion is also in the readme of the DirectSearch v2 download. The 3rd method above corrects an alternate, flawed suggestion in the DirectSearch v2 readme, so that it makes the Help-pages work as well as the commands.

 

acer

Quantile

May 13 2016 acer 12485

See Quantile.

with(Student:-Statistics):

X:=NormalRandomVariable(0,1):

p:=Probability(X<=0.6);
                           p := 0.725746882249926

Quantile(X,p);
                              0.600000000000047

acer

tagged

May 11 2016 acer 12485

You can of course experiment with a procedure like F which computes the placement according to the adjacent points. For example you could even estimate the concavity so as to try and place the textplots on the "outside".

restart;
tp:=[0., 0.8e-1, .16, .24, .32, .4, .48, .56, .64, .72, .8,
     .88, .96, 1.04, 1.12, 1.2, 1.28, 1.36, 1.44, 1.52, 1.6,
     1.68, 1.76, 1.84, 1.92, 2.0]:
theta4:=[.7908689661, .3741753003, 1.649095014, 2.518788513,
         .7373585234, .4970414167, .5684031862, .4888977241,
         1.142477381, 1.810790643, .7854189206, .4992350790,
        .4145062614, .5655254887, .7238064921, .9972543194,
        .3994980275, -2.779042530, .6444066751, .9318149247,
        .8593318817, .2546628449, 3.096169222, 1.562607652,
        .5534976436, 1.097828390]:
with(plots):

F:=proc(n)
     option remember,system;
     if n=1 then "left";
     elif n=nops(tp) then "right";
     elif theta4[n-1]>=theta4[n] then
        if theta4[n+1]>=theta4[n] then "below";
        else "below","left";
        end if;
     elif theta4[n-1]<=theta4[n] then
        if theta4[n+1]<=theta4[n] then "above";
        else "above","left";
        end if;
     else NULL;
     end if;
   end proc:

hscal:=abs(max(theta4)-min(theta4)):
S:=proc(i)
  local f;
  f:={F(i)};
  if f={"above"} then 0.01*hscal;
  elif f={"below"} then -0.01*hscal;
  else 0.0; end if;
end proc:

display(pointplot(tp,theta4,style=line,color=red),
        pointplot(tp,theta4,style=point,symbolsize=6,color=red),
        seq(textplot([tp[i],S(i)+theta4[i],tp[i],
                      font=["helvetica",bold,10]],
                     color="Orange",align={F(i)}),i=1..nops(tp)),
        gridlines=false,size=[600,400]);

tag2.mw

acer

rtable_eval

May 09 2016 acer 12485

@Ronan Matrices (or Vectors or Arrays) behave differently than usual under `eval`, so that their entries are not undesirably evaluated when the Matrix is passed as the argument to a procedure.

The focus is instead shifted (somewhat) to evaluation upon element access.

There are a few ways to get a copy of the Matrix whose entries contain names which (due to later assignment) evaluate to something different later on (such as your `a`, later assigned to 5, in the order or operations that Carl suggested).

But you shouldn't need to reach for such a hammer as `simplify`, just to get the evaluation effect.


# First, let's see what went on with the original approach.
restart;

a:=5;

5

M:=Matrix([[a,2*a],[3*a,a^2]]);

M := Matrix(2, 2, {(1, 1) = 5, (1, 2) = 10, (2, 1) = 15, (2, 2) = 25})

M;

Matrix([[5, 10], [15, 25]])

# There is no instance of `a` within M, which is why unassignment to `a` does not affect M.
lprint(M);

Matrix(2, 2, {(1, 1) = 5, (1, 2) = 10, (2, 1) = 15, (2, 2) = 25}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

# Now let's see what happens with the reverse approach.
restart;

M:=Matrix([[a,2*a],[3*a,a^2]]);

M := Matrix(2, 2, {(1, 1) = 5, (1, 2) = 10, (2, 1) = 15, (2, 2) = 25})

a:=5;

5

# You see the 5, not 'a', but this is just an artefact of evaluation during printing.
M;

Matrix([[5, 10], [15, 25]])

# Entries are evaluated upon access. Together with the printing, as above, this is often adequate.
M[2,2];

25

lprint(M); # Indeed the 'a' is still there.

Matrix(2, 2, {(1, 1) = a, (1, 2) = 2*a, (2, 1) = 3*a, (2, 2) = a^2}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

C:=copy(M);

C := Matrix(2, 2, {(1, 1) = 5, (1, 2) = 10, (2, 1) = 15, (2, 2) = 25})

# This copy of M contains the 5, not the 'a', as entries were evaluated upon access during copying.
lprint(C);

Matrix(2, 2, {(1, 1) = 5, (1, 2) = 10, (2, 1) = 15, (2, 2) = 25}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

# This new version of M also contains 5, not 'a'.
K:=rtable_eval(M);

K := Matrix(2, 2, {(1, 1) = 5, (1, 2) = 10, (2, 1) = 15, (2, 2) = 25})

# And here is proof of that.
lprint(K);

Matrix(2, 2, {(1, 1) = 5, (1, 2) = 10, (2, 1) = 15, (2, 2) = 25}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

# M still contains 'a', though elementwise access will get the 5.
lprint(M);

Matrix(2, 2, {(1, 1) = a, (1, 2) = 2*a, (2, 1) = 3*a, (2, 2) = a^2}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

# This causes the entries of M to be evaluated in-situ, without copying the whole structure.
rtable_eval(M, inplace);

Matrix([[5, 10], [15, 25]])

lprint(M);

Matrix(2, 2, {(1, 1) = 5, (1, 2) = 10, (2, 1) = 15, (2, 2) = 25}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

 


Download rtable_eval.mw

 

add

May 05 2016 acer 12485

Use add for adding up a finite number of items, not sum.

L(1):=[1,2,3]:         
L(2):=[A,B,C]:         

add(nops(L(i)),i=1..2);
                                                             6

If you insist on using sum for this then notice that it does not have special evaluations rules. The first argument is evaluated before it adds things up.

sum('nops'(L(i)),i=1..2); 
                                                             6

You original mistaken use was just adding this value twice.

nops(L(i));
                                                             1

acer

tool

May 03 2016 acer 12485

RootFinding:-Isolate may be considered as a lower-level tool. It is also in use by fsolve for the univariate case.

acer

ctrl-r

May 03 2016 acer 12485

It is ctrl-r .

See the help, for more.

acer

map

April 30 2016 acer 12485
A := [ [2,3], [4,5] ,[6,7]]:

map( `/`@op, A );
                                  [2  4  6]
                                  [-, -, -]
                                  [3  5  7]

In current Maple this can be shortened to,

(`/`@op)~(A);

acer

verticalasymptoteoptions

April 30 2016 acer 12485

Just change the verticalasymptoteoptions option to be,

'verticalasymptoteoptions' = ['color' = "Black", 'linestyle' = 'spacedash']

acer

characteristic matrix

April 28 2016 acer 12485

For floating-point Matrices the LinearAlgebra:-Eigenvectors command computes the eigenvectors using something like the qr/qz algorithm implemented in compiled external libraries.

For symbolic Matrices the LinearAlgebra:-Eigenvectors command calls LinearAlgebra:-NullSpace on the characteristic matrix for lambda as each of the computed eigenvalues. Note that in this case the initial solving for the eigenvalues explicitly can itself be difficult since the characteristic polynomial (in unknown lambda) may be difficult or impossible to fully factor.

And the coefficient domain can also throw a wrench in the works, in the symbolic case. For example the special case of Matrices with entries being algebaric expressions with floating-point coefficients may be problematic. It's not difficult to come up with such a Matrix, for which manual eigenvector computation (via NullSpace of the the Characteristic Matrix instantiated at each computed explicit eigenvalue) is achievable even though LinearAlgebra:-Eigenvectors baulks... (should it refuse to attempt a problem from a class for which it may miscompute?).

acer

1 2 3 4 5 6 7 Last Page 1 of 127