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

@vs140580 I've read your proposal carefully, several times. My experience and knowledge tells me that this problem is very likely to be extremely intractable (and almost certainly NP-hard); so I'm not interested in devoting any time to it at this time.

Please don't mention it again unless you or someone else has made significant progress on it.

By the way, you never acknowledged my solution to the "all possible graph products" problem. 

@mehdibgh Yes, I've noticed that for many years. The amount reported by Task Manager is always twice the amount reported on the worksheet's status bar. For example, for a brand new worksheet, or following a restart and gc(), the status bar says 4.18M and Task Manager says 8.4 MB (8.4 = 2*4.18 to two significant digits). Since the computer obviously struggles profusely for memory when Task Manager says its usage is near 100%, the Task Manager number must be the accurate one.

I have no idea why this is. I hope that someone from Maplesoft can answer this.

@vs140580 The only reasonable starting point that I can see would use the command GraphTheory:-IsSubgraphIsomorphic, which was introduced in Maple 2021. And, it should be used with its isomorphism option (which returns the isomorphism rather than simply true or false), which was introduced in Maple 2022.

@Carl Love The disjunctions of the subsets of the 8 conditions usually produce boolean expressions that can be much simplified. Doing that simplification (with Logic:-BooleanSimplify) substituting the simplified form into the procedure passed to RelationGraph is more efficient.

RelationGraph:= proc(f, V::list({integer, symbol, string}))
local n:= {$1..nops(V)}, i, F:= i-> j-> f(V[i],V[j]);
    GraphTheory:-Graph(V, [seq](select(F(i), n, _rest), i= n))
end proc
:

GraphProducts:= proc(
    GG::Graph, HH::Graph, 
    Rel::{
        set(integer[1..8]), 
        identical(
            ("Cartesian", "box"), ("strong", "normal", "AND"), ("lexicographic"),
            ("modular"), ("homomorphic"), ("co-normal", "disjunctive", "OR"),
            ("tensor", "Kronecker", "categorical", "direct")
        )
    }:= "Cartesian",
    {
        vertex_format::{string, symbol}:= "%A:%A",
        labeltype::identical(string, symbol):= string
    }
)
uses GT= GraphTheory, L= Logic;
local
    i, j, G:= 1, H:= 2,
    V:= GT:-Vertices~([GG,HH]), 
    E:= convert~(op~(4, [GG,HH]), table), #the edges, effectively
    P:= [seq](seq([i,j], j= 1..nops(V[H])), i= 1..nops(V[G])), 
    Vgh:= (
        curry(`if`(labeltype=string, sprintf, nprintf), vertex_format)
        @ ((i,j)-> (V[G][i],V[H][j])) 
        @ op
    )~(P),
    J:= op~(table(Vgh=~ P)),
    Edge:= proc(u,v) local k:= op(procname); J[v][k] in E[k][J[u][k]] end proc,
    Eq:= proc(u,v) local k:= op(procname); J[v][k] = J[u][k] end proc,
    eG, eH, qG, qH, #symbolic boolean variables (Edge of G, eQual in H, etc.)
    PrimRels:= (And~@table)([  #the 8 primitive relations (or conditions):
        1= (eG, qH),      2= (Not(eG), qH),      3= (eG, eH), 4= (Not(eG), eH),
        5= (eG, Not(eH)), 6= (Not(eG), Not(eH)), 7= (qG, eH), 8= (qG, Not(eH))
    ]),
    NamedRels:= table([  #some subsets of the above, named for user convenience:
        ("Cartesian", "box")=~                             ``({1,7}), 
        ("strong", "normal", "AND")=~                      ``({1,3,7}),
        "lexicographic"=                                   ``({1,3,5,7}), 
        "modular"=                                         ``({3,6}), 
        "homomorphic"=                                     ``({5,7,8}), 
        ("co-normal", "disjunctive", "OR")=~               ``({1,3,4,5,7}),
        ("tensor", "Kronecker", "categorical", "direct")=~ ``({3})
    ])
;
    RelationGraph( 
        subs(
            _B= subs(
                {L:-`&not`= `not`, L:-`&and`= `and`, L:-`&or`= `or`},
                {(eG,qG, eH,qH)=~ (Edge[G],Eq[G], Edge[H],Eq[H])(_u,_v)},
                L:-BooleanSimplify(Or(map2(index, PrimRels, op(NamedRels[Rel]))[]))
            ),
            [_u= u, _v= v],
            proc(u,v) option remember;
                if u=v then false  #Disallow self-loops.
                elif J[u][G] > J[v][G] or Eq[G](u,v) and J[u][H] > J[v][H] then
                    thisproc(v,u)  #Assume symmetry (no directed edges) for efficiency.
                else evalb(_B)
                fi
            end proc
        ),
        Vgh
    )
end proc
:
GT:= GraphTheory: RG:= GT:-RandomGraphs: CT:= CodeTools:
G:= GT:-CycleGraph(5): H:= GT:-CycleGraph(4):
GH:= CT:-Usage(GraphProducts(G, H, "co-normal", labeltype= symbol));
memory used=0.64MiB, alloc change=0 bytes, cpu time=16.00ms, 
real time=16.00ms, gc time=0ns

GH := Graph 18: an undirected unweighted graph with 20 vertices and 140 edge(s)

 

@The function It's not exactly the same input. Here's the crucial difference: In both your Question and acer's Answer, look at the line where f(t) is defined. Look at the empty space immediately to the left of the central (or main) "+". In your Question, that blank space is wider than it is in acer's Answer. (It's easier to see this difference in MaplePrimes' rendering of the worksheet than to see it directly in Maple.) I don't know what character is actually in that space, but it's what's causing the incorrect interpretation of that line of input. The 1D-input equivalent to that line is

f := t -> A*cos(omega*t + varphi);+A*I*sin(omega*t+varphi); 

The output that you got is consistent with that 1D input. (The 1D-input equivalent of some 2D Input can be obtained by highlighting => right click for context menu => 2-D Math => Convert to => 1-D Math input.) I don't know what that extra character actually is. I don't think that it's actually a space or a semicolon. 

@acer Yes, there was a worksheet attached to original Question, which is now gone. It wasn't me who edited it.

@acer The OP's original equation is at the top of this worksheet, assigned to eq. I added a few computations under that.
 

"with(Student[ODEs]):"

eq := (u(t)^3+1)*(t^2+1)^(n-1) = (diff(u(t), t))*(sum(((a*binomial(2*n, 2*i)*(-1)^i+c*binomial(n, i))*u(t)+b*binomial(2*n, 2*i)*(-1)^i+d*binomial(n, i))*t^(2*i), i = 0 .. n))

(u(t)^3+1)*(t^2+1)^(n-1) = (diff(u(t), t))*((1/2)*(u(t)*a+b)*(-(-t+I)^2)^n+(1/2)*(u(t)*a+b)*(-(t+I)^2)^n+(u(t)*c+d)*(t^2+1)^n)

dsolve(eq);

eval(subs(c=a, d= b, eq), n=4);

(u(t)^3+1)*(t^2+1)^3 = (diff(u(t), t))*((1/2)*(u(t)*a+b)*(-t+I)^8+(1/2)*(u(t)*a+b)*(t+I)^8+(u(t)*a+b)*(t^2+1)^4)

simplify(%);

(u(t)^3+1)*(t^2+1)^3 = 2*(diff(u(t), t))*(u(t)*a+b)*(t^2+2*t-1)^2*(t^2-2*t-1)^2

dsolve(%);

u(t) = (1/2)*3^(1/2)*tan(RootOf(2*3^(1/2)*ln(3/2+(1/2)*3^(1/2)*tan(_Z))*a*t^4-2*3^(1/2)*ln(3/2+(1/2)*3^(1/2)*tan(_Z))*b*t^4-3^(1/2)*ln(3/4+(3/4)*tan(_Z)^2)*a*t^4+3^(1/2)*ln(3/4+(3/4)*tan(_Z)^2)*b*t^4+3*3^(1/2)*_C1*t^4-6*_Z*a*t^4-6*_Z*b*t^4-12*3^(1/2)*ln(3/2+(1/2)*3^(1/2)*tan(_Z))*a*t^2+12*3^(1/2)*ln(3/2+(1/2)*3^(1/2)*tan(_Z))*b*t^2+6*3^(1/2)*ln(3/4+(3/4)*tan(_Z)^2)*a*t^2-6*3^(1/2)*ln(3/4+(3/4)*tan(_Z)^2)*b*t^2-18*3^(1/2)*_C1*t^2-3*3^(1/2)*t^3+36*_Z*a*t^2+36*_Z*b*t^2+2*3^(1/2)*ln(3/2+(1/2)*3^(1/2)*tan(_Z))*a-2*3^(1/2)*ln(3/2+(1/2)*3^(1/2)*tan(_Z))*b-3^(1/2)*ln(3/4+(3/4)*tan(_Z)^2)*a+3^(1/2)*ln(3/4+(3/4)*tan(_Z)^2)*b+3*3^(1/2)*_C1+3*3^(1/2)*t-6*_Z*a-6*_Z*b))+1/2

 

Download Abel.mw

@Steven_Huang I think that some progress can be made on this problem if you reduce the number of parameters. Setting c= a and d= b and solving for specific values of n seems promising. 

@Steven_Huang Consider n=1 first. Letting ode be your equation, do 

dsolve(simplify(eval(ode, n=1)));

Considering the complexity of that solution, what's likely to happen for n > 1?

@dharr Suppose that we have a system that can be in any of n discrete states, each with probability p[k]. Under Shannon's definition, the (informational) entropy of the system is

H(X) = -sum(p[k]*log(p[k]), k= 1..n)

where could be infinity, k could start at 0 if that's more convenient, and the base of the logarithm doesn't really matter---both ln and log[2] are commonly used. The final result that you showed is thus the entropy of a system with two possible states, one of which has probability theta. In the language of probability distributions, it's Bernoulli(theta).

The sum that I showed is what the OP wants to calculate, where, presumably, there's some explicit formula for p[k], but n is arbitrary.

I suspect that "rectangle" is a bad translation into English of something that should've been translated to either right or right-angle. A rectangle is a planar polygon with 4 vertices and 4 right angles. Bisecting a rectangle along a diagonal produces 2 congruent right triangles.

Maple has quite substantial functionality for date and time arithmetic (DateTimeClock, Calendar, etc.) so I think it very likely that it has what you want. But I don't know what "JS" means. Perhaps Julian second?

I just shortened the code of ConormalProduct by 8 lines. Perhaps that'll make it easier to understand.

At this point, I suspect that this bug only happens when coercion is used with keyword parameters. I also suspect that there's nothing special here about modules or objects; the bug comes from mixing these three things: keyword parameters, coercion, and the debugger.

These are only guesses.

@ijuptilk Another option is to replace the for or seq with this single line:

w:= gamma__1*alpha/~(4*k__1*~qq^~2/d^2-~alpha__3*xi/eta__1);

This is called elementwise operation: acting on all the elements of a list (qq) in a single operation. Note that this also eliminates the need for m.

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