Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

There can only be one "plot" per file. I put "plot" in quotes because any number of plots can be combined into a single plot by passing an Array of plots (rather than a sequence of plots) to plots:-display. This can be done simply by enclosing the seq command in angle brackets: <seq(...)>.

Example:

plotsetup('png', 'plotoutput'= "ArrayOfPlots", 'plotoptions'= "width=1920,height=1080"):
cols1:= ["red", "green", "blue"]:
plots:-display(<seq(plot([$20], 'color'= cols1[j]), j= 1..3)>);
plotsetup('default');
#Reset output to normal screen

I don't know whether the above will be useful to you. If you need to afterwards separate the individual plots, then it may not be very useful. In that case, you can create essentially an "array of files", 1 plot per file, like this:

restart:
cols1:= ["red", "green", "blue"]:
Plots:= <seq(plot([$20], 'color'= cols1[j]), j= 1..3)>:
PlotToFile:= proc(P::specfunc(PLOT), j::posint)
    plotsetup(
        'png', 
        'plotoutput'= cat("ArrayOfPlots_", j), 
        'plotoptions'= "width=1920,height=1080"
    );
   
(* Threads:-Sleep(2); *) #Sometimes helps
    print(P)
end proc
:   
seq(PlotToFile(Plots[j], j), j= 1..numelems(Plots));
plotsetup('default'); 
#Reset output to normal screen

I didn't need to use the Threads:-Sleep. Sometimes it's needed to let a slow disk drive catch up with the faster output from Maple. The 2 means to pause seconds.

I appreciate and understand what you're advocating regarding a programming paradigm that avoids environment variables. In addition to what you said, they also hinder attempts at shared-memory parallel processing (as offered by the Threads package) when different values are used in different threads. Unfortunately, their use (as well as non-environment global variables) is endemic in the Maple library code, which is I guess the main reason why there are so few commands listed at ?threadsafe. Just to remove the usage of the single environment variable Digits would be a monumental undertaking I think. I'd guess, very roughly, that about a thousand library procedures use it.

I think that there are only two differences between environment variables and other globals:

  1. Environment variables don't need to be declared in procedures.
  2. When an environment variable's value is changed in a procedure, it reverts to its previous value when the procedure exits.

Any global variable whose name begins _Env can be used as an environment variable. And there are a few very common ones such as Digits and Order whose names don't follow any special pattern.

_EnvTry doesn't have an initially assigned value. That's why you don't see it listed by anames(...). Your procedure is correct. But note that when the procedure ends, it'll revert to not having an assigned value. That's not a problem. I just mention it so that it doesn't come as a surprise to you.

1. Rotation: The wobbly rotation that you want can be easily done with plottools:-rotate applied to the static plot3d that you already had. The [[.1,.1,-1], [.1,.1,1]] is the line segment parallel to the z-axis to rotate about.

plots:-animate(plottools:-rotate, [p, B*Pi/36, [[.1,.1,-1], [.1,.1,1]]], B= 1..72, frames= 72)

2. Field lines: I think they'd be better done with plots:-tubeplot because that makes them surfaces thus giving you a much larger set of options (shadingcolorglossinesstransparency, etc.).

3. Aesthetics: axes= none. Set thickness=0.2 to make the gridlines (on sphere) thinner. But if you remove them entirely, it makes the rotation more difficult to see IMO.

If you plug the solution (converted from series to polynom) back into the ODE and simplify:

simplify(eval(lhs(ode), convert(sol, polynom)))

then all that remains are terms with orders equal to or greater than the O(...) terms in sol. That's a reasonable indication that those "remainder" terms are approaching 0 as Order approaches infinity

Maple considers a RealRange to be a property rather than a set (in the Maple sense of set). The equivalent of union for properties is OrProp (always used in prefix functional form: OrProp(RealRange(......), ...). The boolean evaluator for this is is, for example,

is(1/2, OrProp(RealRange(0,1), RealRange(2,3)));
                              true

Assuming that you want to start the indices at 0:

add(add(a[i, j, 2 - i - j]*x^i*y^j*z^(2 - i - j), j= 0..2 - i), i= 0..2)

The reason why solve acts differently in this case: Since isolate only makes sense for a single equation, the square brackets on the first argument are never necessary; so they weren't included in the allowed syntax. On the other hand, solve can solve multiple equations, so square brackets are allowed.

@mmcdara You asked:

  • A question for more skilled Maple users: Is it true that dsolve/numeric is not capable to handle a Fourier boundary condition for a first order ode?

I don't know what "Fourier boundary condition" means, but I do understand what is happening here, and it's almost always easy to correct. It's not specific to first-order ODEs.

The issue is that dsolve(..., numeric) won't accept boundary conditions that use a derivative of the same order or higher order than the highest order of derivative of the corresponding function occuring in the ODEs.

Your example is

{diff(Phi(Y), Y)+f-Phi(Y) = 0, Phi(1)=1.5*D(Phi)(1)}

The boundary condition uses the first derivative of Phi, which is the highest-order derivative of Phi used in the ODE. Algebraically solving the ODE for that derivative yields diff(Phi(Y), Y) = Phi(Y) - f. So, in the BC, replace D(Phi)(1) with eval(Phi(Y) - f, Y= 1). The same thing can easily be done with the OP's system.

 

Here's a procedure for it:

RelErr:= proc(f::algebraic, V::list(name= `&+-`(realcons, realcons)))
local x;
    eval(add(abs(diff(f,lhs(x))*op(2, rhs(x))), x= V)/abs(f), lhs~(V)=~ op~(1, rhs~(V)))
end proc
:  
RelErr(R*i^2*t, [R= 1.5 &+- 0.5, i= 2.5 &+- 0.05, t= 10 &+- 0.5]);
                          0.4233333333

RelErr(G*M*m/r^2, [M= 7 &+- 0.05, m= 2 &+- 0.02, r= 5 &+- 0.05]);
                         0.03714285714

 

Use fsolve, not solve. Nothing else needs to be changed. The problem is that solve is trying to find all complex solutions.

Here is a much-more efficient version of my procedure IsoCovers.

First, taking the information from the PDF file that you attached to this thread, I'll define an isomorphism cover of a graph H. Let n be the number of vertices. By non-vertex-labelled form, I mean that the vertex labels are [1, 2, ..., n]. It's trivial to convert any graph to non-vertex-labelled form. So, without loss of generality, suppose that H is in that form. We represent automorphisms of as its edge set under a vertex permutation. An isomorphism cover of H is a set of n such edge-set automorphisms such that their pairwise intersections are all a single edge and the union of those intersections is the edge set of K[n], the complete graph on n vertices.

Here are two procedures. The 1st, Automorphs, finds all automorphisms of a graph. The 2nd, IsoCovers, finds all isomorphism covers.

Automorphs:= (G::Graph)->
local A:= op(4,G), n:= numelems(A), V:= [$n], p, E:= {seq}((op@`{}`~)~(V, A));
    {seq}(subs(V=~ p, E), p= combinat:-permute(n))
:
IsoCovers:= proc(H::Graph) 
local
    n:= nops(op(3,H)), E:= combinat:-choose({$n},2), J:= (`[]`@@2@op)~(E),  
    Ej:= {$nops(E)}, S:= subs(E=~ Ej, Automorphs(H)), R:= `{}`~(S), EJ:= `{}`~(Ej),
    P:= proc(s) option remember; local t:= s[1];
        if t::posint then return select(r-> nops(r intersect s) = 1, S) fi;
        `intersect`(thisproc(t), if nops(s)=1 then else thisproc(s[2..]) fi)
    end proc
;
    if nops(S[1]) < n-1 then return {} fi;
    to n-1 do R:= (r-> map(`{}`, P(r), r[])[])~(R) od;
    subs(Ej=~ E, select(r-> (p-> `intersect`(p[]))~(map2(`?[]`, r, J)) = EJ, R))
end proc
:
GT:= GraphTheory:
H:= GT:-Graph([$6], {{1,2}, {2,3}, {3,4}, {4,5}, {5,6}});
H := Graph 3: an undirected graph with 6 vertices and 5 edge(s)

S:= CodeTools:-Usage(IsoCovers(H)):
memory used=1.55GiB, alloc change=0.64GiB, 
cpu time=28.86s, real time=19.36s, gc time=11.50s

nops(%);
                             11640
S[1];
          {{{1, 2}, {1, 3}, {2, 4}, {3, 5}, {4, 6}}, 
            {{1, 2}, {1, 4}, {2, 3}, {3, 6}, {5, 6}}, 
            {{1, 3}, {2, 6}, {3, 4}, {4, 5}, {5, 6}}, 
            {{1, 4}, {1, 6}, {2, 5}, {2, 6}, {3, 5}}, 
            {{1, 5}, {1, 6}, {2, 4}, {3, 6}, {4, 5}}, 
            {{1, 5}, {2, 3}, {2, 5}, {3, 4}, {4, 6}}}

 

Like this

subsindets(t, 'suffixed'('x'), x-> y||(String(x)[2..]))

The above will work for x followed by anything (including nothing, i.e., x itself). If you only want to change x followed by a nonnegative integer, then modify that to

subsindets(t, 'suffixed'('x', nonnegint), x-> y||(String(x)[2..]))

Using subsindets works in situations far more general than the solutions given by @nm or @mmcdara. To handle one of the latter's obscure cases, replace nonnegint with {1, 4, 6, 10}.

If any method given in this thread is applied to an x... variable declared local, the resulting y... variable will not be local.

The command to solve it is

sol:= dsolve({diff(f(x), x) = a-a/((1+a*x)*(1/(1+a*x))^a)-a*f(x), f(0)=b});

The solution is expressed in terms of an unevaluated integral. This integral can be easily done for any nonnegative integer a, for example

value(eval(sol, a= 23));

If this Answer is sufficient, then so be it. If not, let me know, and we can get something by putting restrictions on x, such as x > -1/a for a > 0.

You have polygonplot inside the draw command.

Your follow-up Question regarding Categorize is quite interesting. Actually, it's much more efficient to do this with ListTools:-Classify. Here's how:

Classifying a set of sets of sets by pairwise intersections

2023-May-9

Author: Carl Love <carl.j.love@gmail.com>

 

Given a set of sets S, we want to find all 3-subsets S3 with these properties:

1. 

The intersection of S3 is empty;

2. 

All pairwise intersections of S3 are singletons;

3. 

The union of those pairwise intersections has three elements.

Then we want to Classify the 3-subsets that have those properties by the union mentioned in the 3rd property.

restart
:

Here is a set from MaplePrimes:

L:= {
    {{0, 1}, {0, 3}, {0, 5}, {0, 7}, {2, 9}}, {{0, 1}, {0, 3}, {0, 5}, {0, 7}, {4, 9}},
    {{0, 1}, {0, 3}, {0, 5}, {0, 7}, {6, 9}}, {{0, 1}, {0, 3}, {0, 5}, {0, 7}, {8, 9}},
    {{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 1}, {0, 3}, {0, 5}, {0, 9}, {4, 7}},
    {{0, 1}, {0, 3}, {0, 5}, {0, 9}, {6, 7}}, {{0, 1}, {0, 3}, {0, 5}, {0, 9}, {7, 8}},
    {{0, 1}, {0, 3}, {0, 7}, {0, 9}, {2, 5}}, {{0, 1}, {0, 3}, {0, 7}, {0, 9}, {4, 5}},
    {{0, 1}, {0, 3}, {0, 7}, {0, 9}, {5, 6}}, {{0, 1}, {0, 3}, {0, 7}, {0, 9}, {5, 8}},
    {{0, 1}, {0, 5}, {0, 7}, {0, 9}, {2, 3}}, {{0, 1}, {0, 5}, {0, 7}, {0, 9}, {3, 4}},
    {{0, 1}, {0, 5}, {0, 7}, {0, 9}, {3, 6}}, {{0, 1}, {0, 5}, {0, 7}, {0, 9}, {3, 8}},
    {{0, 1}, {1, 2}, {1, 4}, {1, 6}, {3, 8}}, {{0, 1}, {1, 2}, {1, 4}, {1, 6}, {5, 8}},
    {{0, 1}, {1, 2}, {1, 4}, {1, 6}, {7, 8}}, {{0, 1}, {1, 2}, {1, 4}, {1, 6}, {8, 9}},
    {{0, 1}, {1, 2}, {1, 4}, {1, 8}, {3, 6}}, {{0, 1}, {1, 2}, {1, 4}, {1, 8}, {5, 6}},
    {{0, 1}, {1, 2}, {1, 4}, {1, 8}, {6, 7}}, {{0, 1}, {1, 2}, {1, 4}, {1, 8}, {6, 9}},
    {{0, 1}, {1, 2}, {1, 6}, {1, 8}, {3, 4}}, {{0, 1}, {1, 2}, {1, 6}, {1, 8}, {4, 5}},
    {{0, 1}, {1, 2}, {1, 6}, {1, 8}, {4, 7}}, {{0, 1}, {1, 2}, {1, 6}, {1, 8}, {4, 9}},
    {{0, 1}, {1, 4}, {1, 6}, {1, 8}, {2, 3}}, {{0, 1}, {1, 4}, {1, 6}, {1, 8}, {2, 5}},
    {{0, 1}, {1, 4}, {1, 6}, {1, 8}, {2, 7}}, {{0, 1}, {1, 4}, {1, 6}, {1, 8}, {2, 9}},
    {{0, 1}, {2, 3}, {2, 5}, {2, 7}, {2, 9}}, {{0, 1}, {2, 3}, {3, 4}, {3, 6}, {3, 8}},
    {{0, 1}, {2, 5}, {4, 5}, {5, 6}, {5, 8}}, {{0, 1}, {2, 7}, {4, 7}, {6, 7}, {7, 8}},
    {{0, 1}, {2, 9}, {4, 9}, {6, 9}, {8, 9}}, {{0, 1}, {3, 4}, {4, 5}, {4, 7}, {4, 9}},
    {{0, 1}, {3, 6}, {5, 6}, {6, 7}, {6, 9}}, {{0, 1}, {3, 8}, {5, 8}, {7, 8}, {8, 9}},
    {{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 4}},
    {{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 6}}, {{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 8}},
    {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {1, 2}, {2, 5}, {2, 7}, {2, 9}},
    {{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {1, 4}, {2, 3}, {3, 6}, {3, 8}},
    {{0, 3}, {1, 4}, {4, 5}, {4, 7}, {4, 9}}, {{0, 3}, {1, 6}, {2, 3}, {3, 4}, {3, 8}},
    {{0, 3}, {1, 6}, {5, 6}, {6, 7}, {6, 9}}, {{0, 3}, {1, 8}, {2, 3}, {3, 4}, {3, 6}},
    {{0, 3}, {1, 8}, {5, 8}, {7, 8}, {8, 9}}, {{0, 3}, {2, 3}, {3, 4}, {3, 6}, {5, 8}},
    {{0, 3}, {2, 3}, {3, 4}, {3, 6}, {7, 8}}, {{0, 3}, {2, 3}, {3, 4}, {3, 6}, {8, 9}},
    {{0, 3}, {2, 3}, {3, 4}, {3, 8}, {5, 6}}, {{0, 3}, {2, 3}, {3, 4}, {3, 8}, {6, 7}},
    {{0, 3}, {2, 3}, {3, 4}, {3, 8}, {6, 9}}, {{0, 3}, {2, 3}, {3, 6}, {3, 8}, {4, 5}},
    {{0, 3}, {2, 3}, {3, 6}, {3, 8}, {4, 7}}, {{0, 3}, {2, 3}, {3, 6}, {3, 8}, {4, 9}},
    {{0, 3}, {2, 5}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 5}, {4, 5}, {5, 6}, {5, 8}},
    {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}},
    {{0, 3}, {2, 9}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 9}, {4, 9}, {6, 9}, {8, 9}},
    {{0, 5}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 5}, {1, 2}, {2, 3}, {2, 7}, {2, 9}},
    {{0, 5}, {1, 2}, {4, 5}, {5, 6}, {5, 8}}, {{0, 5}, {1, 4}, {2, 5}, {5, 6}, {5, 8}},
    {{0, 5}, {1, 4}, {3, 4}, {4, 7}, {4, 9}}, {{0, 5}, {1, 6}, {2, 5}, {4, 5}, {5, 8}},
    {{0, 5}, {1, 6}, {3, 6}, {6, 7}, {6, 9}}, {{0, 5}, {1, 8}, {2, 5}, {4, 5}, {5, 6}},
    {{0, 5}, {1, 8}, {3, 8}, {7, 8}, {8, 9}}, {{0, 5}, {2, 3}, {3, 4}, {3, 6}, {3, 8}},
    {{0, 5}, {2, 3}, {4, 5}, {5, 6}, {5, 8}}, {{0, 5}, {2, 5}, {3, 4}, {5, 6}, {5, 8}},
    {{0, 5}, {2, 5}, {3, 6}, {4, 5}, {5, 8}}, {{0, 5}, {2, 5}, {3, 8}, {4, 5}, {5, 6}},
    {{0, 5}, {2, 5}, {4, 5}, {5, 6}, {7, 8}}, {{0, 5}, {2, 5}, {4, 5}, {5, 6}, {8, 9}},
    {{0, 5}, {2, 5}, {4, 5}, {5, 8}, {6, 7}}, {{0, 5}, {2, 5}, {4, 5}, {5, 8}, {6, 9}},
    {{0, 5}, {2, 5}, {4, 7}, {5, 6}, {5, 8}}, {{0, 5}, {2, 5}, {4, 9}, {5, 6}, {5, 8}},
    {{0, 5}, {2, 7}, {4, 5}, {5, 6}, {5, 8}}, {{0, 5}, {2, 7}, {4, 7}, {6, 7}, {7, 8}},
    {{0, 5}, {2, 9}, {4, 5}, {5, 6}, {5, 8}}, {{0, 5}, {2, 9}, {4, 9}, {6, 9}, {8, 9}},
    {{0, 7}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 7}, {1, 2}, {2, 3}, {2, 5}, {2, 9}},
    {{0, 7}, {1, 2}, {4, 7}, {6, 7}, {7, 8}}, {{0, 7}, {1, 4}, {2, 7}, {6, 7}, {7, 8}},
    {{0, 7}, {1, 4}, {3, 4}, {4, 5}, {4, 9}}, {{0, 7}, {1, 6}, {2, 7}, {4, 7}, {7, 8}},
    {{0, 7}, {1, 6}, {3, 6}, {5, 6}, {6, 9}}, {{0, 7}, {1, 8}, {2, 7}, {4, 7}, {6, 7}},
    {{0, 7}, {1, 8}, {3, 8}, {5, 8}, {8, 9}}, {{0, 7}, {2, 3}, {3, 4}, {3, 6}, {3, 8}},
    {{0, 7}, {2, 3}, {4, 7}, {6, 7}, {7, 8}}, {{0, 7}, {2, 5}, {4, 5}, {5, 6}, {5, 8}},
    {{0, 7}, {2, 5}, {4, 7}, {6, 7}, {7, 8}}, {{0, 7}, {2, 7}, {3, 4}, {6, 7}, {7, 8}},
    {{0, 7}, {2, 7}, {3, 6}, {4, 7}, {7, 8}}, {{0, 7}, {2, 7}, {3, 8}, {4, 7}, {6, 7}},
    {{0, 7}, {2, 7}, {4, 5}, {6, 7}, {7, 8}}, {{0, 7}, {2, 7}, {4, 7}, {5, 6}, {7, 8}},
    {{0, 7}, {2, 7}, {4, 7}, {5, 8}, {6, 7}}, {{0, 7}, {2, 7}, {4, 7}, {6, 7}, {8, 9}},
    {{0, 7}, {2, 7}, {4, 7}, {6, 9}, {7, 8}}, {{0, 7}, {2, 7}, {4, 9}, {6, 7}, {7, 8}},
    {{0, 7}, {2, 9}, {4, 7}, {6, 7}, {7, 8}}, {{0, 7}, {2, 9}, {4, 9}, {6, 9}, {8, 9}},
    {{0, 9}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 9}, {1, 2}, {2, 3}, {2, 5}, {2, 7}},
    {{0, 9}, {1, 2}, {4, 9}, {6, 9}, {8, 9}}, {{0, 9}, {1, 4}, {2, 9}, {6, 9}, {8, 9}},
    {{0, 9}, {1, 4}, {3, 4}, {4, 5}, {4, 7}}, {{0, 9}, {1, 6}, {2, 9}, {4, 9}, {8, 9}},
    {{0, 9}, {1, 6}, {3, 6}, {5, 6}, {6, 7}}, {{0, 9}, {1, 8}, {2, 9}, {4, 9}, {6, 9}},
    {{0, 9}, {1, 8}, {3, 8}, {5, 8}, {7, 8}}, {{0, 9}, {2, 3}, {3, 4}, {3, 6}, {3, 8}},
    {{0, 9}, {2, 3}, {4, 9}, {6, 9}, {8, 9}}, {{0, 9}, {2, 5}, {4, 5}, {5, 6}, {5, 8}},
    {{0, 9}, {2, 5}, {4, 9}, {6, 9}, {8, 9}}, {{0, 9}, {2, 7}, {4, 7}, {6, 7}, {7, 8}},
    {{0, 9}, {2, 7}, {4, 9}, {6, 9}, {8, 9}}, {{0, 9}, {2, 9}, {3, 4}, {6, 9}, {8, 9}},
    {{0, 9}, {2, 9}, {3, 6}, {4, 9}, {8, 9}}, {{0, 9}, {2, 9}, {3, 8}, {4, 9}, {6, 9}},
    {{0, 9}, {2, 9}, {4, 5}, {6, 9}, {8, 9}}, {{0, 9}, {2, 9}, {4, 7}, {6, 9}, {8, 9}},
    {{0, 9}, {2, 9}, {4, 9}, {5, 6}, {8, 9}}, {{0, 9}, {2, 9}, {4, 9}, {5, 8}, {6, 9}},
    {{0, 9}, {2, 9}, {4, 9}, {6, 7}, {8, 9}}, {{0, 9}, {2, 9}, {4, 9}, {6, 9}, {7, 8}},
    {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {4, 9}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {6, 9}},
    {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {8, 9}}, {{1, 2}, {2, 3}, {2, 5}, {2, 9}, {4, 7}},
    {{1, 2}, {2, 3}, {2, 5}, {2, 9}, {6, 7}}, {{1, 2}, {2, 3}, {2, 5}, {2, 9}, {7, 8}},
    {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {4, 5}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 6}},
    {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 4}},
    {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 6}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 8}},
    {{1, 2}, {3, 4}, {4, 5}, {4, 7}, {4, 9}}, {{1, 2}, {3, 6}, {5, 6}, {6, 7}, {6, 9}},
    {{1, 2}, {3, 8}, {5, 8}, {7, 8}, {8, 9}}, {{1, 4}, {2, 3}, {2, 5}, {2, 7}, {2, 9}},
    {{1, 4}, {2, 3}, {4, 5}, {4, 7}, {4, 9}}, {{1, 4}, {2, 5}, {3, 4}, {4, 7}, {4, 9}},
    {{1, 4}, {2, 7}, {3, 4}, {4, 5}, {4, 9}}, {{1, 4}, {2, 9}, {3, 4}, {4, 5}, {4, 7}},
    {{1, 4}, {3, 4}, {4, 5}, {4, 7}, {6, 9}}, {{1, 4}, {3, 4}, {4, 5}, {4, 7}, {8, 9}},
    {{1, 4}, {3, 4}, {4, 5}, {4, 9}, {6, 7}}, {{1, 4}, {3, 4}, {4, 5}, {4, 9}, {7, 8}},
    {{1, 4}, {3, 4}, {4, 7}, {4, 9}, {5, 6}}, {{1, 4}, {3, 4}, {4, 7}, {4, 9}, {5, 8}},
    {{1, 4}, {3, 6}, {4, 5}, {4, 7}, {4, 9}}, {{1, 4}, {3, 6}, {5, 6}, {6, 7}, {6, 9}},
    {{1, 4}, {3, 8}, {4, 5}, {4, 7}, {4, 9}}, {{1, 4}, {3, 8}, {5, 8}, {7, 8}, {8, 9}},
    {{1, 6}, {2, 3}, {2, 5}, {2, 7}, {2, 9}}, {{1, 6}, {2, 3}, {5, 6}, {6, 7}, {6, 9}},
    {{1, 6}, {2, 5}, {3, 6}, {6, 7}, {6, 9}}, {{1, 6}, {2, 7}, {3, 6}, {5, 6}, {6, 9}},
    {{1, 6}, {2, 9}, {3, 6}, {5, 6}, {6, 7}}, {{1, 6}, {3, 4}, {4, 5}, {4, 7}, {4, 9}},
    {{1, 6}, {3, 4}, {5, 6}, {6, 7}, {6, 9}}, {{1, 6}, {3, 6}, {4, 5}, {6, 7}, {6, 9}},
    {{1, 6}, {3, 6}, {4, 7}, {5, 6}, {6, 9}}, {{1, 6}, {3, 6}, {4, 9}, {5, 6}, {6, 7}},
    {{1, 6}, {3, 6}, {5, 6}, {6, 7}, {8, 9}}, {{1, 6}, {3, 6}, {5, 6}, {6, 9}, {7, 8}},
    {{1, 6}, {3, 6}, {5, 8}, {6, 7}, {6, 9}}, {{1, 6}, {3, 8}, {5, 6}, {6, 7}, {6, 9}},
    {{1, 6}, {3, 8}, {5, 8}, {7, 8}, {8, 9}}, {{1, 8}, {2, 3}, {2, 5}, {2, 7}, {2, 9}},
    {{1, 8}, {2, 3}, {5, 8}, {7, 8}, {8, 9}}, {{1, 8}, {2, 5}, {3, 8}, {7, 8}, {8, 9}},
    {{1, 8}, {2, 7}, {3, 8}, {5, 8}, {8, 9}}, {{1, 8}, {2, 9}, {3, 8}, {5, 8}, {7, 8}},
    {{1, 8}, {3, 4}, {4, 5}, {4, 7}, {4, 9}}, {{1, 8}, {3, 4}, {5, 8}, {7, 8}, {8, 9}},
    {{1, 8}, {3, 6}, {5, 6}, {6, 7}, {6, 9}}, {{1, 8}, {3, 6}, {5, 8}, {7, 8}, {8, 9}},
    {{1, 8}, {3, 8}, {4, 5}, {7, 8}, {8, 9}}, {{1, 8}, {3, 8}, {4, 7}, {5, 8}, {8, 9}},
    {{1, 8}, {3, 8}, {4, 9}, {5, 8}, {7, 8}}, {{1, 8}, {3, 8}, {5, 6}, {7, 8}, {8, 9}},
    {{1, 8}, {3, 8}, {5, 8}, {6, 7}, {8, 9}}, {{1, 8}, {3, 8}, {5, 8}, {6, 9}, {7, 8}}
}:

nops(L), nops~(L), (nops~)~(L), nops(`union`(L[]));

200, {5}, {{2}}, 25

So, we have a total of 25 2-element sets---edges---which we'll consider to be the fundamental elements for the rest of this process. From this 25-set, 200 5-subsets have been given as L, which for comvenience I've converted from a list to a set.

 

Just to help to put this into context and to encourage visual thinking, let's look at the graph formed by those 25 edges. However, this graph is not used computationally in what follows.

Edges:= `union`(L[]):
GT:= GraphTheory:
GT:-DrawGraph((G:= GT:-Graph(Edges)));

So, it's the complete bipartite graph K(5,5).

Classify3:= (S::{list, set}(set))->
local S3, C3_2:= `[]`~({combinat:-choose(3,2)[]}), P;
    ListTools:-Classify(
        S3,
        select(
            t-> `intersect`(t[]) = {} and
                nops~((P:= (p-> `intersect`(p[]))~(map2(`?[]`, t, C3_2)))) = {1} and
                nops((S3(t):= `union`(P[]))) = 3,
            combinat:-choose(S,3)
        )
     )
:

T3:= CodeTools:-Usage(Classify3(L)):

memory used=3.79GiB, alloc change=11.28MiB, cpu time=66.39s, real time=37.62s, gc time=33.44s

To reduce the visual burden, we replace each element of L by its index in L:

T3view:= map(subsindets[2], T3, set(set(integer)), table([L[]] =~ [$nops(L)]), index):
        

Example: Pick a random set of 3 edges:

j:= combinat:-randcomb(Edges, 3);

{{0, 3}, {1, 2}, {2, 7}}

So all of the 3-subsets of L that have the desired 3 properties with respect to those edges are

T3view[j];

{{5, 45, 141}, {5, 45, 142}, {5, 45, 143}, {5, 45, 147}, {5, 45, 148}, {5, 45, 149}, {5, 45, 150}, {5, 45, 151}, {5, 45, 152}, {5, 47, 141}, {5, 47, 142}, {5, 47, 143}, {5, 47, 147}, {5, 47, 148}, {5, 47, 149}, {41, 65, 141}, {41, 65, 142}, {41, 65, 143}, {41, 65, 147}, {41, 65, 148}, {41, 65, 149}, {41, 66, 141}, {41, 66, 142}, {41, 66, 143}, {41, 66, 147}, {41, 66, 148}, {41, 66, 149}, {41, 66, 150}, {41, 66, 151}, {41, 66, 152}, {45, 65, 70}, {45, 65, 118}, {45, 65, 141}, {45, 65, 142}, {45, 65, 143}, {45, 65, 147}, {45, 65, 148}, {45, 65, 149}, {45, 66, 70}, {45, 66, 118}, {45, 66, 141}, {45, 66, 142}, {45, 66, 143}, {45, 66, 147}, {45, 66, 148}, {45, 66, 149}, {45, 66, 150}, {45, 66, 151}, {45, 66, 152}, {47, 66, 70}, {47, 66, 118}, {47, 66, 141}, {47, 66, 142}, {47, 66, 143}, {47, 66, 147}, {47, 66, 148}, {47, 66, 149}}

Or, viewed in their original form:

subsindets[2](%, integer, L, index);

{{{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {4, 9}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {6, 9}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {8, 9}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {4, 5}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 6}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 4}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 6}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 8}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {4, 9}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {6, 9}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {8, 9}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {4, 5}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 6}}}, {{{0, 1}, {0, 3}, {0, 5}, {0, 9}, {2, 7}}, {{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {4, 9}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {6, 9}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {8, 9}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {4, 5}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 6}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {4, 9}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {6, 9}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {8, 9}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {4, 5}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 6}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 4}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 6}}}, {{{0, 3}, {0, 5}, {0, 7}, {0, 9}, {1, 2}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 8}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{0, 5}, {1, 2}, {2, 3}, {2, 7}, {2, 9}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{0, 9}, {1, 2}, {2, 3}, {2, 5}, {2, 7}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {4, 9}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {6, 9}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {8, 9}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {4, 5}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 6}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{0, 5}, {1, 2}, {2, 3}, {2, 7}, {2, 9}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{0, 9}, {1, 2}, {2, 3}, {2, 5}, {2, 7}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {4, 9}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {6, 9}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {8, 9}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {4, 5}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 6}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 4}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 6}}}, {{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 5}, {2, 7}, {2, 9}, {3, 8}}}, {{{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{0, 5}, {1, 2}, {2, 3}, {2, 7}, {2, 9}}}, {{{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{0, 9}, {1, 2}, {2, 3}, {2, 5}, {2, 7}}}, {{{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {4, 9}}}, {{{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {6, 9}}}, {{{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 5}, {2, 7}, {8, 9}}}, {{{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {4, 5}}}, {{{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 6}}}, {{{0, 3}, {1, 2}, {3, 4}, {3, 6}, {3, 8}}, {{0, 3}, {2, 7}, {4, 7}, {6, 7}, {7, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}}}

Pick one of those to visualize:

t:= combinat:-randcomb(%,1)[];

{{{0, 3}, {1, 2}, {1, 4}, {1, 6}, {1, 8}}, {{0, 3}, {2, 7}, {3, 4}, {3, 6}, {3, 8}}, {{1, 2}, {2, 3}, {2, 7}, {2, 9}, {5, 8}}}

GT:-HighlightEdges~(
    G,
    [j, map(`minus`, t, j)[]],
    stylesheet=~ `[]`~(color=~ [black, red, green, blue], thickness= 4)
):

GT:-DrawGraph(G);

 

Download Classify3.mw

First 25 26 27 28 29 30 31 Last Page 27 of 395