Carl Love

Carl Love

26488 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@acer What about controllers other than sliders (for example, dials)? Is any customization possible for those?

@emendes You need to pass in the index i, because it's not local. Like this:

buildAllPossibleModels:= proc(model::list, M::list, i::name)
description "This function returns all models generated from a given model and set of monomials.";
local k,m;
    [for k,m in model do
        map(subs, m=~ m+~ subs(i= k, {`if`}(m::`+`, op(m), m)=~ (), M), model)[]
    od]
end proc:

buildAllPossibleModels(model, M, i);

Note that I made a list, as in your original Question.

Yes, this code is threadsafe. Here is a threaded version:

buildAllPossibleModels:= module()
description "This function returns all models generated from a given model and set of monomials.";
local 
    m::thread_local,
    ModuleApply:= (model::list, M::list, i::name)-> local k;
        [Threads:-Seq](
            map(subs, (m:= model[k])=~ m+~ subs(i= k, {`if`}(m::`+`, op(m), m)=~ (), M), model)[],
            k= 1..nops(model)
        );
end module
:
buildAllPossibleModels(L1, L2, i);

@mmcdara Due to idiosyncracies of Maple, building a set, list, or sequence in a loop by appending to an existing set, list, or sequence is extremely inefficient: The execution time of each iteration is proportional to the current length of the set, list, or sequence.  Thus the time for the whole loop is proportional to the square of the final length.

That's not to say that it's always inefficient to build sets, lists, or sequences in loops; the inefficiency comes from building them by appending to an existing set, list, or sequence; it's not something inherently inefficient about loops.

This code of yours:

L1L2 := NULL:
while not T[finished] do 
  L1L2 := L1L2, T[nextvalue]() 
end do:
L1L2 := [L1L2]:

can be replaced by the far more efficient single line:

L1L2:= [seq](T[nextvalue](), 1..nops(L1)*nops(L2));

@mmcdara The original model is a list with 3 entries and 4 monomials. Each of the 56 new models is obtained by adding exactly one monomial to exactly one entry in the original model. Thus each new model has 3 entries and 5 monomials.

Please don't check off all the Product boxes in your Question headers. I changed your Products to just Maple, which is the only product that this Question is about.

@Preben Alsholm The quote from help page names that you show also has an error: "keyword" should be "reserved word".

@nm I wasn't saying that you were doing something wrong. Yes, this is a bug in Maple. The purpose of my Reply is to show that the bug can be isolated to the Physics Updates add-on package (not the core Physics package that's prepackaged with Maple). The Updates include numerous changes outside the Physics package.

Display the contents of the global variable libname. It'll be a sequence of file-directory names. One of them is for the Updates; it should be obvious which one. If you remove it from libname, it won't be used. This can be done temporarily.

There is a problem now that there are divergent versions of Maple with different bugs: with Updates and without.

@JAMET There is no difficulty with diff. But you shouldn't have quotes in the line with the solve command.

@Art Kalb It can be done without freeze thaw by temporarily changing the processed xis to something else, like this:

subs(
    xi= H(1)*xi, %xi= xi, 
    subsindets(expr, identical(xi)^integer, u-> subs(xi= %xi, H(op(2,u))*u))
);

@acer I think that your double subsindets can be replaced with

thaw(subs(xi= H(1)*xi, subsindets(expr, identical(xi)^integer, u-> freeze(H(op(2,u))*u))))

Is there any reason to not do this?

@C_R You can also use subs[eval](int= 1, expr). The 'eval' in this context is a keyword index-placed parameter for subs. It doesn't literally mean the eval command, although the effect is quite simiar.

@C_R This is not a feature or any special syntax of eval; rather, it's a feature of explicit numbers. When they are used as function symbols, they are their corresponding constant functions, and all arguments are ignored.

This is said in this somewhat awkwardly placed paragraph on help page ?function:

  • If, in this case, an expression such as 2(x) is a function application, it represents the constant function 2 (the function that is 2 everywhere). The result of evaluating it is the number 2.

The awkward part is that its previous paragraph, which is strictly about the corresponding 1-D- vs. 2-D-Input difference, could lead one to think that the 2nd paragraph is also about an input-mode nuance. The first words of the paragraph---"If, in this case, ..."---imply a logical link to the previous paragraph; yet, the 2nd paragraph is actually about something more general than input mode.

@Ronan Are the square roots of integers only? rational numbers only? Or might they be square roots involving the parameter t? Is there always only a single variable, such as t?

@sursumCorda If you want a larger default screenwidth, why not just change it yourself? Just put

interface(screenwidth= 200);  #example

in your initialization file.

@Ronan To generalize my (GCD of numerators)/(LCM of denominators) technique, I think some restrictions need to be put on the field of the entries. Something like the field of quotients of a Euclidean domain. An example would be the field of rational functions with rational coefficients. Are your projective-geometry examples of that form?

3 4 5 6 7 8 9 Last Page 5 of 688