Carl Love

Carl Love

27579 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Carl Love I just updated the code above, making it significantly faster in the case that the number of desired small divisors is large, yet still a small fraction of the total number of divisors. This is shown in the last example in the worksheet.

@felixiao Obviously there is a pattern to all the matrices, T11 to T36. You need to discover the pattern, then abstract it and generalize it into a procedure. You should be able to make a procedure of about10 lines that constructs all the matrices.

Your code is extremely unwieldy. It needs to be divided into several execution groups, or procedures. Using 2D Input also makes it difficult.

@felixiao It can be done with seq loops like this:

HH||(0..2):= 
    seq(H||(1+(k mod 3)).H||(1+(k+1 mod 3))^(-1), k= 0..2)
;
TH:= proc(i) local k;
    `.`(seq(T||(i+2*k)^(-1).HH||k.T||(i+2*k+1), k= 0..2))
end proc
:
TH(11).TH(21).Y;

 

@felixiao I'm trying to understand the pattern of the new product that you want. I don't understand why there's no T17 to T21.

I'm using Windows 11. Axel is using Windows 7, so maybe the bug doesn't exist in Windows 7. I changed your 40 to 100 and I also got a hang.

I agree with you that this is one of the two worst bugs in Maple. The other contender is the disappearing menus and toolbars since Maple 2021. The timelimit bug makes it nearly impossible to effectively run things in "batch mode"; the menus and toolbars bug makes it very difficult to work in non-batch mode with worksheets and/or documents (the bug is active regardless of whether you use 1D or 2D input). I think that 1 top programmer (1 for each) should be assigned to work full time on these until they are fixed.

A reasonable alternative to the current timelimit command would be a timelimit[real] command. Perhaps that would be easier to implement.

@nm Thank you for testing. I'll say again that I don't intend for this SubsIndets to be used in practice. Rather, it's purpose is to teach how subsindets works.

@nm I just realized that there's a remote possibility that if f returns NULL, and this NULL is substituted into the future list entries, then some of those future entries might become NULL also. Since NULL can't be a list element, this could cause a problem. Thus, I change my SubsIndets to

SubsIndets:= proc(e, T::type, f)
local X:= [sort([indets(e,T)[]], key= length)[], e];
    while nops(X)>1 do X:= subs(X[1]= f(X[1]), X[2..]) od;
    X[-1..][]
end proc:

@nm I just edited my Reply above to clarify why I said "vast majority of cases" rather than "all cases". The only example was one posted by @Christian Wolinski years ago, and I can't remember it.

The only thing that matters for the sort key is that if x and y are two elements of indets(e,T) and x is an element of indets(y,T), then key(x) < key(y) (strict inequality).

I guess that you want to restrict the perimeter of each primary inner triangle to be integer. Do you also want to restrict each side of each triangle to be integer?

@mmcdara The help page ?subsindets doesn't give many details about the second argument because that argument can literally be any type, and types are documented on numerous other help pages.

Here is a procedure that does the same thing as subsindets (called with 3 arguments and no options in square brackets) for the vast majority of cases[*1]:

SubsIndets:= proc(e, T::type, f)
local X:= [sort([indets(e,T)[]], key= length)[], e];
    to nops(X)-1 do X:= subs(X[1]= f(X[1]), X[2..]) od;
    X[]
end proc:

I post this not so that it'll be used in practice, but because it might help you understand what exactly subsindets does. (It might be possible to make the above more efficient by making X a table or array. It doesn't matter because it only exists for its pedagogical value.) 

[*1] By "vast majority of cases" I mean that @Christian Wolinski once posted an example, which seemed contrived, where the above produced slightly different output than subsindets. I am not aware of any other examples. It may be that the actual key used is something other than length.

@nm 

For this Reply, let f be anything that can be a function[*1] name (formally, a function's 0th operand, which can be almost anything, not just a name), and let type1type2, etc., be any types. Then the following are also types:

  • f(type1) is a type that matches any function that has exactly 1 argument, that argument is type type1, and whose 0th operand is identically f.
  • f(type1, type2) is a type that matches any function that has exactly 2 arguments, the 1st of type type1 and the 2nd of type type2, and whose 0th operand is identically f.
  • f(type1, ..., type_n): The above pattern can be extended to any specific number of typed arguments.
  • f() is a type that matches only the identical expression f().
  • specfunc(type1, f) is a type that matches any function of any number (including 0) of arguments whose 0th operand is and all of whose arguments are type type1.
  • In modern Maple, specfunc(f) is equivalent to specfunc(anything, f).

Thus 'exp'(anything) is more precise than specfunc(exp) because the latter can have any number of arguments.

[*1] To learn the meaning of function in Maple, see the help page ?function. The help page ?type,function is nearly worthless and should be rewritten from scratch.

@Axel Vogt By "works for me", do you mean that the integral finishes, or that the timeout error was trapped (so, you got the output "waiting for timeout")? The point of this Question is to test the timelimit command, not to test int.

Changing 40 seconds to 5, I got it to hang. I do not have Physics Updates installed.

@Alfred_F The easiest way to get some information about what's going on is to set the infolevel. This gives a relatively small amount of info (compared to other ways in Maple), but it's high-quality info because it's formatted details put in the code by its author specifically for you to read. The following returns about 4 screenfuls of info for this problem.

 

restart:
infolevel[all]:= 5:
[y, s, x, a, b, c, d]=~ (simplify@eval)(
    [sqrt(a^2+b^2), d-b, sqrt(a^2+d^2), a, b, d, b],
    solve(
        {
            d-b = c-d, a/d = tan(45*Pi/180), a*(c-b)/2 = 60, a^2+c^2 = 19^2,
            (a,b,c,d ) >~ 0
        }, 
        {a,b,d,c},
        explicit
    )
);

The is the level of detail; it could be any positive integer. Usually 5 is the most detail, but that's up to the code's author. The all sets this for all Maple procedures. It could also be a specific command, such as solve.

If you run something, and then want to rerun it with infolevel turned on, make sure to do a restart first. This is to prevent Maple from simply remembering recently done computations and not actually redoing them.

As far as I can tell, the worksheet that you posted has no code, only components. I looked for hidden "startup code" and "component code" but didn't find any. However, I admit that I don't know much about finding component code.

@Thomas Richard 

plots:-spacecurve(
    [t*cos(t), t*sin(t), 2/3*sqrt(2)*t^(3/2)], t= 0..Pi,
    color= black, thickness= 5,
    axis[1]= [color= red, thickness= 3, tickmarks= [-2,2]],
    axis[2]= [color= green, thickness= 3, tickmarks= [-2,2,4]],
    axis[3]= [color= blue, thickness= 3, tickmarks= [2,4,6,8]],
    labels= ['x', 'y', 'z'], labelfont= [helvetica, bold, 14],
    axesfont= [helvetica, 12],
    view= [-3..3, -2..4, -1..8], scaling= constrained, axes= normal,
    projection= .7, orientation= [45, 85, 0]
);

2 3 4 5 6 7 8 Last Page 4 of 703