Carl Love

Carl Love

28025 Reputation

25 Badges

12 years, 313 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

I totally understand why you'd want to come up with contrived examples such as you have been as a means of experimentation. I do the same thing myself. So, don't take my Answers too harshly; I encourage you to experiment.

Pedagogic advice: You'll learn a lot if you try to remove from your examples everything that doesn't cause the anomaly. In all intellectual pursuits, there is an art to creating good examples.

@Carl Love In the future, I'll say implicitLY local rather than implicit local because the latter may be more likely to give the false impression that there are two types of locals with different semantics. (But note that English grammar requires that local be used as an adjective to use implicitly local; cases where local is used as a noun need to be reworded.)

@radaar In the example that you just posted, a is still local.

@radaar As I told you in another thread, there's no semantic difference between implicit and explicit locals, and there never has been. So I don't know how you acquired that "understanding". There's no good reason to ever ignore the warning about implicit locals. 

In the second procedure, a is local for the entire procedure. It does not suddenly become local at the point that the "compiler" realizes that it should be flagged as implicit local. If you look at the "compiled" procedure with showstat, you'll see local a at the top.

@mmcdara Yes, you could use define. Personally, I've never encountered a situation where I preferred using define.

@mmcdara put 

I mean that you can write e mod m; there's no need to put the operator first. If you do put the operator first, then it must be in quotes.

@mmcdara The first, or left, argument to mod can be almost anything, including a container. There's no need for you to use mod in prefix form, i.e., as `mod`.

@stefanv Thank you, Stefan. If something akin to what you wrote above were included in the help pages of seqadd, and mul, I'd consider the matter to be fully documented.

@radaar Thanks. I have read this book, and in my opinion it is by far the best book about Maple. Although most of this book is already incorporated into the Maple help pages (see ?ProgrammingGuide), it's much more convenient in PDF form.

@radaar What don't you understand about Kitonum's example? The f and are considered "equal" at this point, although it's difficult to say precisely what "equal" means in a Maple context. From a mathematical viewpoint, they are unquestionably equal. From Maple's viewpoint, we have

evalb(eval(f) = eval(g));
             true

But

evalb(addressof(eval(f)) = addressof(eval(g)))
             false

That shows that they are "currently" equal, but they could become unequal if they acquire different remember tables. For example, this would make them unequal:

f(3):= 7;

All of this has nothing to do with the global assignments to x and t; indeed it would all be the same even if there had been no assignments to x and t.

@radaar Yes, all that you just said is correct.

@radaar In your latest example, the first x is global (as you noted), all of the xs in ff are still a formal parameter (this time with a default value), and the x in ff(x) is an argument as well as a global. There is no connection between the formal parameter x and the other xs other than that they have names that are just coincidentally spelled the name. 

I don't know if you had any question about this example. There's not much subtlety involved here, and none of this is adequate to describe PLBVs.

@radaar The first x, in x:= 10, is a global variable (assuming that this code occurs at the top level). Any xs in procedure f are called formal parameters (because the declaration of x is in the procedure's header). This distinction between global variables and formal parameters is similar to the distinction between free and bound variables, although the latter distinction is far more subtle. The former distinction has no "gray areas".

The terms "place holder" and "dummy variable" are often used in the same contexts as local variableformal parameter, and bound variable. I prefer to not use the former terms because they're not as precisely defined. And, referring back to your original Question, none of these terms, nor any combination of them, is adequate to precisely descibe the special status of the bound variable of seqadd, or mul.

@radaar See my Answer below. There are only three commands that have this exception---seqadd, and mul---and the exception works exactly the same way in all three.

@Kitonum In most ways, but not all ways, ii can be thought of as local. A case where its status is somewhere between local and global is 

a:= ii^2; seq(a, ii= 1..5);
             1, 4, 9, 16, 25

 

@janhardo No, there is no benefit to having the inner loop. Indeed, it's very wasteful. Each statement in the inner loop is being executed 3 times for each value of i.

First 194 195 196 197 198 199 200 Last Page 196 of 708