Carl Love

Carl Love

26488 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Preben Alsholm I assume that you wanted to use the smallest possible thickness for the horizontal line. The smallest is not 1. The smallest integer thickness is 0. Floating-point values between 0 and 1 will produce lines even thinner than thickness= 0. On my current screen, the smallest practical value seems to be 0.05; smaller positive values give me visible lines that appear the same as using 0.05.

Formally speaking, the period is the number of digits in the fundamental repeating part, not the repeating part itself. So, the base-10 period of 1/12 is 1.

@Ronan Meta-parameters (most of whose names begin with underscore: _params, _nparams_options_noptions_rest_nrest_passed_npassed) are described in section "Special Sequences" of help page ?using_parameters. You must use the specific name _rest, but you could have assign it to a local variable so that the _rest can be isolated at the top of the procedure. For example,

MyPlot:= proc(MainArgs::list)
local
    default_opts:= (color= red, thickness= 0, linestyle= dash),
    ad_hoc_opts:= _rest
;
    plot(MainArgs[], default_opts, ad_hoc_opts
)
end proc;

 

@nm Your example -- a procedure with local n::integer -- is not giving a type to n. Rather, it's enforcing (when kernel(assertlevel) = 2) a type check of the things that will be assigned to n, not itself. (Note that the type command in my procedure below explicitly says that x is not type integer.) Here's an example using a declared type on a variable vs. assuming an analogous property.

restart:
kernelopts(assertlevel= 2):
#Compare type integer...: 
proc() local x::integer, y::integer; 
    print([type(x, integer), is(x+1, integer)] assuming x::integer); 
    y:= x+1
end proc();
                             [false, true]
Error, (in anonymous procedure) assertion failed in assignment to y, expected integer, got x+1

#...versus property integer:
assume(x::integer); y:= x+1: [type, is](y, integer);
                             [false, true]

Also, I should point out that Maple's type system is much more complicated and much more important than its property system.

Another example: Maple has a pre-defined type nothing, which always returns false. You can put ::nothing in a variable's local declaration. The reason one may want to do this is that it protects (under kernelopts(assertlevel) = 2) against the variable being assigned to. But you can still use the variable symbolically.

 

And here's the imaginary part:

@dharr Okay, I understand, and I withdraw my comment about it being incorrect. And I put a more-formal withdrawal at the top of the Reply.

[Edit: I understand dharr's followup explanation, and I withdraw my comment about the work being incorrect. I didn't realize that it was just solving (correctly) a different problem than the OP intended, specifically one where certain edges are forbidden.]

@dharr Your algorithm for reducing the Hamiltonian cycle to a Hamiltonian path is incorrect. In particular, I don't understand how you chose your edges. If I apply my dummy-vertex algorithm (from my Answer below) to your points, I get a significantly shorter minimal path, 7.3 vs. 9.8. You can easily verify from the plots that my path is Hamiltonian and my edge weights are the same as yours.

restart:
pts:= [[0,0], [1,2], [4,2], [3,1], [5,1]]:  
n:= nops(pts):
GT:= GraphTheory: LA:= LinearAlgebra:
G:= (GT:-Graph@Matrix)(
   n+1, 
   (i,j)-> `if`(i=j, 0, `if`(i>n or j>n, 1, LA:-Norm(<pts[i]-pts[j]>, 2))), 
   shape= symmetric, datatype= hfloat
):
(MinDist, HamPath):= GT:-TravelingSalesman(G, startvertex= n+1):
MinDist-= 2; HamPath:= HamPath[2..-2];
                  MinDist := 7.30056307974577
                   HamPath := [1, 2, 4, 3, 5]
#Plot:
H:= GT:-InducedSubgraph(G, [$1..n]):  #Discard dummy
GT:-SetVertexPositions(H, pts);
GT:-HighlightTrail(H, HamPath);
GT:-DrawGraph(H, axes= frame, scaling= constrained);

I think you're posting in the wrong forum. As far as I know, no Meplesoft product has a subpart named "Workday".

I wonder how ChatGPT came up with the non-existent command Optimization:-LinearSumAssignment. It had to have read that somewhere; it doesn't just make up fake Maple command names on a whim.

@C_R The command that you're thinking of is called unames.

@Scot Gould I've also noticed a speed improvement the past day or two 

@nm The counter can be reset, without using restart, by

`tools/genglobal`[1](_C, 1, reset);

That form of the command just does the reset without returning a name. So, the next call to `tools/genglobal`(_C) will return _C1.

@Scot Gould I've experienced the same thing as you: The norification flag used to do something (not something that I find useful---but that's beside the point) and now it just says Loading.

See the help page ?simplify,size.

@mmcdara Those two things are not necessary for your example, but might be needed for some generalization that you have in mind. What I can't figure out is why assigning invfunc[phi] doesn't require the unprotect, but assigning both invfunc[phi] and invfunc[invphi] does require it.

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