Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@lcz To just get the non-isomorphic graphs, use

op~(
    1,
    ({entries}@ListTools:-Classify)(
        g-> [seq](op(4, GraphTheory:-CanonicalGraph(g))), graph_list
    )
)

Although this generates the equivalence classes and then discards all but the first element of each, it is far, far more efficient than your loop. This method is O(n) and the loop is O(n^2), where n = nops(graph_list).

If is a Graph, then V:= op(4,G) is a compact (and far more efficient) representation of G's adjacency matrix A. Specifically, 

  • A = Matrix(numelems(V)$2, (i,j)-> `if`(j in V[i], 1, 0))

Let me know if you understand this.

This vector---which I call the neighbor array---is already computed and stored in every Graph object, whereas adjaceny matrices are generated as needed.

 

 

@Hullzie16 The two-variable-function approach can achieve something much closer to what the OP wants by separating the two variables like this:

F:= a-> x-> a*x:
f:= F(3);

                      
f := x -> 3*x

To use a shooting method in this case, you need known values at the right boundary (x=100), which you try to achieve by guessing initial conditions (D@@2)(f)(0), D(phi)(0), and D(theta)(0). You seem to be guessing values for x=100 rather than x=0.

Also, the differential order of this system is 7, so you need three guesses, not 4.

This Reply is not an attempt to correct the numerous other errors you've made. I just need to know 3 actual values at x=100 or x=infinity to proceed.

Just guessing here: Is it possible that your phone version is licensed and your iPad version is a free download?

@C_R Please let me know whether the issue that you had with my plotting command has been resolved.

@C_R The only change that I made to the OP's code is that display command. For it to work, you need to use it within that original code:

restart;
with(geometry);
with(plots);
_EnvHorizomtalName = 'x';
_EnvVerticalName = 'y';
_local(D);
line(delta, y = 1/3*x - 2, [x, y]);
line(deltap, y = (-1)/4*x + 1, [x, y]);
line(D, y = 3*x - 5, [x, y]);
point(S, 3, 0);
omega := Pi/3;
intersection(P, delta, D);
intersection(Pp, deltap, D);
projection(H, S, delta);
projection(K, S, deltap);
projection(M, S, D);
circle(c1, [H, K, M], 'centername' = O1);
display(
    textplot(
       [
           [coordinates(S)[], "S"], [coordinates(P)[], "P"], [coordinates(H)[], "H"], 
           [coordinates(K)[], "K"], [coordinates(M)[], "M"]
       ], font = [times, bold, 16], align = [above, right]
    ), 
    draw([
        delta(color = blue), deltap(color = blue), D(color = red), c1(color = black),
        S(color = black, symbol = solidcircle, symbolsize = 16),
        P(color = black, symbol = solidcircle, symbolsize = 16)
    ]), 
    scaling = constrained, axes = none, view = [-15 .. 15, -15 .. 15]
);

 

@vv Thank you. Yes, I noticed those separation anomalies. My goal was only to translate the given formulas into concise Maple with altering them mathematically.

@C_R You wrote:

  • In the context of simplify I thought by defining a special procedure the flow of simplification steps could be controlled this way

    simplify(expr,Maple_proc,My_proc,Maple_proc)

    and by doing so several code lines could be saved.  

Without loss of generality, I'll assume that your two Maple_procs represent different pre-defined `simplfiy/...` procedures, and I'll call them Maple_proc1 and Maple_proc2, respectively. Then what you want can be achieved in a single line of code as

`@`(`simplify/`||(Maple_proc2, My_proc, Maple_proc1))(expr)  

Note the reversed order of the Maple_procs.

This doesn't address the issue of getting these procedures to handle equations. 

Since you say "have a look", I assume that you intended either to attach a file or copy-and-paste some plaintext code. But it didn't get posted.

@C_R This was just a red herring in the OP's code: An if statement with an empty else clause (or empty then clause) is not a syntax error, even if there is a semicolon. NULL is a valid expression, expressions can be used as statements, and the complete absence of non-white-space characters after certain keywords (at the moment, I can think of thenelsereturn, do, try, and finally) is interpreted as NULL.

But I do think that your idea about abs(v[i] - 1) being not what the OP intended is on the right track. 

@Carl Love I improved the code above to use what I consider to be cleaner syntax, to use standard spherical coordinates, to narrow the color ranges, and to add an orientation.

@janhardo In statements that require a Boolean condition (such as an if statement), wrapping the condition with evalb is redundant. So, for example, these two statements do exactly the same thing:

  1. if A=B then 1 else 2 fi;
  2. if evalb(A=B) then 1 else 2 fi;

Therefore, evalb cannot take the place of is.

Is there a reason that you don't want to use is?

@janhardo The essential difference between Axel's code and yours is not that he used D instead of diff, but that he used the is command instead of plain `=`.

@Ronan Yes, I used `&D;` because is already used, and `&D;` prettyprints as (i.e,, italicized like a normal variable). Using local D doesn't give you the italics.

You wrote:

  • Before killing a whole Maple session and potentially losing the last state of a worksheet it can pay off to wait and repeatedly interrupt an operation.

There's no need to wait. You can kill individual kernels from Windows Task Manager. This is effectively the same as getting "Kernel connection has been lost", so you still have a chance to save the worksheet, and it has no effect on the rest of your session. To do it, right click on the mserver.exe shown and select "End Task".

First 17 18 19 20 21 22 23 Last Page 19 of 708