acer

32323 Reputation

29 Badges

19 years, 316 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Thanks for catching that. Joe.

Of course, `x[0]` won't be nicely typeset as a subscripted variable.

The request was very simple, and it's disappointing that it cannot be done. One wishes to define an operator and use a subscripted name as the parameter. But it cannot be done anywhere near easily because typed-in (!) subscripted names are table references by default and can only be toggled to symbols via hard to find context-menus. And the palettes are often more trouble than they are worth, when one is typing. And there is no visual cue in 2D Math as to whether a subscripted name is a table reference or an atomic symbol.

Having subscripted names be table references (underneath the hood) is the wrong default behaviour. This is another example corroborating that.

acer

Thanks for catching that. Joe.

Of course, `x[0]` won't be nicely typeset as a subscripted variable.

The request was very simple, and it's disappointing that it cannot be done. One wishes to define an operator and use a subscripted name as the parameter. But it cannot be done anywhere near easily because typed-in (!) subscripted names are table references by default and can only be toggled to symbols via hard to find context-menus. And the palettes are often more trouble than they are worth, when one is typing. And there is no visual cue in 2D Math as to whether a subscripted name is a table reference or an atomic symbol.

Having subscripted names be table references (underneath the hood) is the wrong default behaviour. This is another example corroborating that.

acer

Having TROUBLE with `for` or `do`? Then READ the HELP-PAGE for `for` or `do`.

The HELP-PAGE for `do` is accessible by entering ?do or ?for

It says that the printing from nested loops is controlled via printlevel, in the bullet point titled "Note about Nested Loops". It has a cross-reference to ?printlevel

acer

Array(0..2,0..1,0..3,0..2, (i,j,k,l)->_a[i,j,k,l]);

A[1,0,3,2];
You might be able to create such an Array with a clever indexing-function to help with your problem. See ?rtable_indexfcn

acer

You can end the line with a colon (not the usual semicolon) and it will suppress printing all those pages of output.

evals := LinearAlgebra:-Eigenvalues(M):

If your resulting Vector has been assigned to a variable (above, evals) then you can access its elements as evals[1], evals[2], etc. Or, you can assign those to new variables.

a := evals[1]:

If you got the Vector of eigenvalues by using the context-menus (ie. by right-clicking on a Matrix and using the popup menus) then you can immediately refer to that Vector by using the % symbol. In Maple, % means the "last thing evaluated". See the help-page on topic ditto. For example, you could do as follows.

evals := %:
evals[1];

Your question is not a bad one. It's quite normal to want to simply enter a command like Eigenvalues(M) without assigning it to anything. And then, when it's finished, you want to assign it to some variable without having to wait while recomputing the whole thing. The %, %%, and %%% constructs let you do just that.

The help-page is named "ditto", because many releases ago the symbols for this were double-quotes (") rather than percent (%).

acer

You can end the line with a colon (not the usual semicolon) and it will suppress printing all those pages of output.

evals := LinearAlgebra:-Eigenvalues(M):

If your resulting Vector has been assigned to a variable (above, evals) then you can access its elements as evals[1], evals[2], etc. Or, you can assign those to new variables.

a := evals[1]:

If you got the Vector of eigenvalues by using the context-menus (ie. by right-clicking on a Matrix and using the popup menus) then you can immediately refer to that Vector by using the % symbol. In Maple, % means the "last thing evaluated". See the help-page on topic ditto. For example, you could do as follows.

evals := %:
evals[1];

Your question is not a bad one. It's quite normal to want to simply enter a command like Eigenvalues(M) without assigning it to anything. And then, when it's finished, you want to assign it to some variable without having to wait while recomputing the whole thing. The %, %%, and %%% constructs let you do just that.

The help-page is named "ditto", because many releases ago the symbols for this were double-quotes (") rather than percent (%).

acer

Have you looked at the DynamicSystems:-BodePlot routine, in Maple 12? It has an option linearmag to control whether the vertical axis has logarithmic scale. Its frequency scale is logarithmic by default (and controllable with its linearfreq option.)

acer

Have you looked at the DynamicSystems:-BodePlot routine, in Maple 12? It has an option linearmag to control whether the vertical axis has logarithmic scale. Its frequency scale is logarithmic by default (and controllable with its linearfreq option.)

acer

I'm not sure whether Joe meant "going that route, with eventual use of unapply" as opposed to "use of unapply". I suspect that he meant the former, because he knows Maple very well. But it can be made explicitly clear, for the benefit of other readers.

It is not the application of unapply, in itself, which causes the conversion of sqrt to an exponent of 1/2. Running these examples above, in the Standard GUI, with 2D output makes output containing either sqrt or ^(1/2) appear with the mathematical surd symbol. But underneath, they are different.

For symbolic `a` the input sqrt(a^2) will result in output of the form a^(1/2). This symbolic evaluation is the point at which conversion from sqrt to power 1/2 takes place. Subsequent unapply w.r.t. symbol `a` isn't where that conversion happens. Although, clearly, going the route of symbolic-evaluation followed by unapply together entail the conversion.

> restart:
>
> z := sqrt(a^2); # the "loss" is here
                                        2 1/2
                                 z := (a )

> lprint(%);
(a^2)^(1/2)
>
> f := unapply(z,a);
                                           2 1/2
                               f := a -> (a )

> lprint(%);
a -> (a^2)^(1/2)
>
> f(4);
                                       1/2
                                     16

The above may be contrasted with what happens when the sqrt() is embedded within a procedure. In that case, sqrt() is not preempted by the evaluation at nonnumeric symbol `a`.

> g := a -> sqrt(a);
                               g := a -> sqrt(a)

> lprint(%);
a -> sqrt(a)
>
> g(4);
                                       2

None of this is anything new, of course. It's old news. And it's what underlies the problem of the original example. (I recall trying to explain once before, on here.)

Now, what could be done about this state of affairs? Could `^` expressions be simplified at uniquification time? Could the eval() routine substitute calls of the form `^`(...,1/integer) with calls to sqrt() or root(), in the case that the evaluation point is numeric?

acer

Thanks Joe, but I was not surprised that it worked OK for `&*`.

I'm wondering why it doesn't work for `^`, `*`, and `+`. As I believe that I showed, op(0,..) of such things can be accessed.

acer

The return directive isn't required, for the last statement in the procedure.

acer

The return directive isn't required, for the last statement in the procedure.

acer

The implied multiplication (without a space) makes many of the Definitions look poor.

So does use of "pi" and "i" in help Definitions, in a product like Maple which otherwise uses Pi and I.

The overall effect, producing output like "piit" in the commandline and Classic interfaces, is very poor. It's only slightly mitigated by the 2D typesetting of pi with its greek symbol, in such Definitions viewed in the Standard GUI.

acer

You created your procedure f36() outside of the use of RealDomain. So the `^` bound within f36 is the usual global :-`^` and not the RealDomain:-`^` export. The procedure f36 is getting its binding of `^` when it is created, not when it is used (plotted).

Compare,

restart:
use RealDomain in
  f36 := x -> x^(2/5);
  plot(f36(x), x = -1..1,y = -1..1);
end use;
plot(f36(x), x = -1..1,y = -1..1);
lprint(eval(f36));

restart:
f36 := x -> x^(2/5);
use RealDomain in
  plot(f36(x), x = -1..1,y = -1..1);
end use;
lprint(eval(f36));

restart:
use RealDomain in
  plot(:-`^`(x,2/5), x = -1..1,y = -1..1);
end use;

acer

Ok, but without any detail on how the output is being produced (and then, somehow, converted to strings) then how can one be sure that it is Maple itself that is producing the unwanted scientific notation? I can think of ways in which it would be, and ways in which it would not be.

Can you look at the raw output from Maple, before any Perl processing? Are you lprinting the Maple output, or using printf, or redirecting it at the shell level?

Consider, using commandline Maple 12,

> Z := 0.00056:
> Z;
                                    0.00056
 
> printf("%a\n",Z);
.56e-3
> printf("%f\n",Z);
0.000560
> printf("%g\n",Z);
0.00056
> lprint(Z);
.56e-3
> interface(prettyprint=0):
> Z;
.56e-3
Without more detail, it's difficult to guess how your stuff is working.

acer

First 525 526 527 528 529 530 531 Last Page 527 of 591