Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Ronan Not true; a^b is positive for any positive a and real ba^b is a uniquely defined complex number for any complex numbers a and b other than a and both 0. Finally, it is not the primary purpose of the sign command to determine whether something is positive or negative.

Yes, of course it's true that x^2 = 3 has two roots, one positive and one negative, but only the positive one is called "the square root of 3".

It's especially weird that sign has no problem with the I; it's the square root that it objects to:

sign(I);
             1
sign(3^(1/2));
Error, unable to evaluate sign

@lcz Here's a one-liner for all k-cliques:

AllCliquesFixedSize:= (G::Graph, k::And(posint, Not(1)))->
    select(nops=k, (op~)~(combinat:-choose(GraphTheory:-Edges(G), k*(k-1)/2)))
:
AllCliquesFixedSize(K4, 3);
          {{1, 2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4}}

The complexity is, of course, O(binomial(n, k*(k-1)/2)), where n is the number of edges (rather than vertices).

@jalal Like this:

df:= DataFrame(
    subsindets[flat](
        Matrix(`~`[Vector@F](C)),
        {undefined, And(complexcons, Not(realcons))},
        ()-> dne
    ), 
    columns = C, rows = F(x)
);

 

This is the other set operation that I mentioned: 

FixedSizeBlocks2:= (S::set, L::nonnegint)-> local p, r, q:= iquo(nops(S), L, r), k;
    {seq}(
        {seq}(S[[seq](p[(k-1)*L+1..k*L])], k= 1..q),
        p= Iterator:-SetPartitionFixedSize([L$q, r])
    )
:
GT:= GraphTheory:
K4:= GT:-CompleteGraph(4):
FixedSizeBlocks2(GT:-Edges(K4), 3);
    {{{{1, 2}, {1, 3}, {1, 4}}, {{2, 3}, {2, 4}, {3, 4}}}, 
      {{{1, 2}, {1, 3}, {2, 3}}, {{1, 4}, {2, 4}, {3, 4}}}, 
      {{{1, 2}, {1, 3}, {2, 4}}, {{1, 4}, {2, 3}, {3, 4}}}, 
      {{{1, 2}, {1, 3}, {3, 4}}, {{1, 4}, {2, 3}, {2, 4}}}, 
      {{{1, 2}, {1, 4}, {2, 3}}, {{1, 3}, {2, 4}, {3, 4}}}, 
      {{{1, 2}, {1, 4}, {2, 4}}, {{1, 3}, {2, 3}, {3, 4}}}, 
      {{{1, 2}, {1, 4}, {3, 4}}, {{1, 3}, {2, 3}, {2, 4}}}, 
      {{{1, 2}, {2, 3}, {2, 4}}, {{1, 3}, {1, 4}, {3, 4}}}, 
      {{{1, 2}, {2, 3}, {3, 4}}, {{1, 3}, {1, 4}, {2, 4}}}, 
      {{{1, 2}, {2, 4}, {3, 4}}, {{1, 3}, {1, 4}, {2, 3}}}}

The number of partitions produced by the procedure is n!/(L!^q * q! * (n-L*q)!), where n = nops(S) and q = floor(n/L).

The n1 is the summation index variable. Note the n1 = 1 under the summation sign. You could change it to any otherwise-unused variable, provided that you change all 4 occurrences.

@Carl Love Even after setting all parameters to 1 and examining some subsets of size 6 that contain the 6 decision variables, I can make no progress with either solve or even fsolve. They're too large or complicated. I give up.

If someone else wants to look at this: At least all the equations are algebraic functions (rational functions & fractional exponents) with the highest exponent being 4 and the only fractional exponent being 1/2.

@vs140580 Okay, how about this?

IsLabeledIsomorphicSubgraph:= proc(
    G1::Graph, G2::Graph, Labels::{set, list}({string, symbol, integer})
)
uses GT= GraphTheory;
local R:= GT:-IsSubgraphIsomorphic(G1, GT:-InducedSubgraph(G2, Labels), 'isomorphism');
    if [R][1] then subs(R[2], GT:-Edges(G1)) else false fi    
end proc
:

 

@MaPal93 Sorry, I made a mistake in the command  EqP:= eval(Eq, indets(EqN, name)=~ 1): That sets all variables to 1, including the decision variables V. Change it to

EqP:= eval(Eq, (indets(EqN, name) minus V)=~ 1):

@MaPal93 Why do you think that there's a solution? 

@mehdibgh There are two different variables t here: a global t in the matrices, and a local t in the procedure. Easiest way to fix it (but not the most-robust way): Change for t from to for :-t from. The :- prefix always refers to a global variable.

There are some possibilities of ambiguity for the 2nd case. What do you want returned for

SublistSubs([a,a]= x, [a,a,a], type2) ?

Both [x, a, a] and [x, x, a] seem reasonable. 

@Stretto An inert operator expression is type function in Maple, with the function name being the operator in backquotes, such as `%/`. (That doesn't generalize to non-inert operator expressions.) If f is a function, then op(k, f) is its kth argument, and op(0, f) is the function name. So, 3 %/ 6 is stored internally as `%/`(3, 6).

I think that this procedure will handle all cases (even when there's no inert operators in the expression):

NumerDenom:= (e::algebraic)-> local f;
    eval([numer,denom](evalindets[2](e, specfunc(`%/`), f, value@map)), f= (x-> x))
:
NumerDenom(x*3 %/ 6/y);

             [3 x, 6 y]

Since I think that that handles all cases, using an overload isn't necessary; but since you asked, the command is overload, it has a help page, and, yes, it filters through a list of procedures until finding the first one whose parameters are a type match for the arguments.

@jalal The code for a "does not exist" symbol is

dne:= `#mo("∄");`;

Then you could do subs(undefined= dne, whatever ).

@Stretto I don't think that there's anything simpler; if there was, it'd be in ListTools, and one can check that it isn't. Three consecutive list elements has no more "structural identity" in Maple than do three elements in random, disconnected locations. In other, it's not a single object in memory that can be "pointed to".

First 77 78 79 80 81 82 83 Last Page 79 of 708