Carl Love

Carl Love

25319 Reputation

25 Badges

10 years, 237 days
Natick, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity

These are replies submitted by Carl Love

@Carl Love By implementing a large number of small efficiencies, I've made IsoCovers twice as fast as the version that I posted yesterday. The new code is in the Answer immediately above.

@acer Thanks. I agree, and I edited my Answer accordingly. And I know that the job can be done with a single pair of quotes. Stylistically, I prefer separate pairs for the suffixed and x.

@Carl Love Here is an example of the set sizes involved in my IsoCovers procedure. The large sets are processed with Iterators, so memory is not an issue, only time.

Suppose that H is a simple 3-cycle and 4 isolated vertices. So n |V| = 7 and m = 3K[7] has binomial(7,2) = 21 edges. This set of edges is called E. So, there are binomial(21,3) = 1330 candidate subsets of E to check for isomorphism with H. Clearly, the number of 3-cycles in K[7] is binomial(7,3) = 35, so this is the size of S, the set of isomorphs of H. So the number of candidates for the final set is binomial(35, 7) = 6,724,520. For each of those, we need to check the 21 pairwise intersections.

@vs140580 Here is that program, for what it's worth. The sizes of the sets involved are enormous, so this is only practical for very small n.

IsoCovers:= proc(H::Graph) 
uses GT= GraphTheory, It= Iterator, C= combinat;
    n:= GT:-NumberOfVertices(H), V:= [$n], m:= GT:-NumberOfEdges(H),
    E:= GT:-Edges(GT:-CompleteGraph(n)), s, S, J, P
    S:= {
        for J in It:-Combination(binomial(n,2), m) do
            s:= E[[seq](J+~1)];
            if GT:-IsIsomorphic(H, GT:-Graph(V, s)) then s else fi
        for J in It:-Combination(nops(S), n) do
            s:= S[[seq](J+~1)];
            P:= (p-> `intersect`(p[]))~(C:-choose(s,2));
            if nops~(P) = {1} and `union`(P[]) = E then s else fi
end proc
GT:= GraphTheory:
H:= GT:-Graph([$4], {{1,2}, {1,3}, {2,3}});
H := Graph 7: an undirected graph with 4 vertices and 3 edge(s)

     {{{{1, 2}, {1, 3}, {2, 3}}, {{1, 2}, {1, 4}, {2, 4}}, 
       {{1, 3}, {1, 4}, {3, 4}}, {{2, 3}, {2, 4}, {3, 4}}}}


@vs140580 A correction for your line

ListTools:-Categorize((x, y) ->(( x[1] = y[1]) and numelems(select(member,x,y))=1), L)


ListTools:-Categorize((x,y)-> x[1] = y[1] and nops(x intersect y) = 1, L)

You may consider the returned singleton sublists as irrelevant; if so, they can be removed by

remove(x-> nops(x)=1, [%])

@vs140580 Yes, it can be done with an easy modification of the above code if and m are not too large. But I don't understand your usage of n-1 instead of nK[n] by definition has n vertices, not n-1.

Your list is a list of SETS of sets. I emphasized the first "SETS" because I think that your Question doesn't quite make sense if sets are used at that level (although sets are fine to represent edges). And it doesn't quite make sense because you've emphasized the sequential aspect of those sets, but the order of those sets is completely determined by Maple's automatic simpification of sets and it has nothing to do with any graph-related property. Indeed, if one of your sets contains {0, 1} as an element, then that's guaranteed to be the first element (unless perchance you allow self-loops). There's no way that you can use sets in Maple and impose upon them some order that is useful for your purpose.

Why do you ask "Is this a bug?" so often? Why do you constantly make comparisons with Mathematica? I'm extremely suspicious about your motivation for posting to MaplePrimes. You seem to have a sufficiently high level of programming skill that you could determine whether something is a bug, and you can read the code of MatrixPower to figure out why it is slow.

If you're so dissatisfied with Maple, then don't use it.

@Christopher2222 I agree absolutely that the default quality should be 100%; any other default is ridiculous. 

@mmcdara Here is what I think that the OP means by "suppressing function dependencies": If f is a Maple symbol or name---notprocedure[*1]---then f()f(0)f(x)f(x,y), etc., are all what Maple calls functions. I think that the OP would like all such instances to prettyprint display as simply f. By "prettyprint display", I mean that the way that they are displayed in a Standard worksheet (at default interface settings) is to be changed without altering Maple's internal (kernel) representation of the objects or its mathematical or computational understanding of them.

[*1] It's also possible (and indeed very common) for a procedure named f to return a function whose 0th operand is f via the syntax return 'procname'(args) or other closely related syntax.

Would you please attach a picture or PDF of a schematic diagram of the circuit? You could put it in the worksheet, but that's not essential at this point. A hand drawing would be sufficient. 

If I understand your worksheet correctly, then all resistors have 1 unit of resistance, all capacitors have one 1 unit of capacitance, and all inductors have 1 unit of inductance. Is that correct?

@Christopher2222 Add the option quality= 100 to the Write command. This indicates 100% of the original quality. The default is 75.

@nm If we can presume to know that the singularity (i.e., vertical-slope point) is at x= - exp(-1), then we can use the sample option to make sure that x-value is specifically used. Adding the adaptive option makes it plot extra points as the magnitude of the slope increases.

        [LambertW(x), LambertW(-1, x)], x= -1..4, sample= [-1, -exp(-1), 4],
        color=~ [red, blue], adaptive= 8, view= [-1..4, -3.5..1.5]

@mmcdara Was I wrong in saying that the system had derivatives with respect to bn?

It's so curious that there are a large number of both good and bad edges. I think that's a key piece of evidence. Let's look at the numeric plot structures of both types edges and try to figure out the key difference. 

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