Carl Love

Carl Love

28015 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@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".

@dharr It took me a long time to figure out why you got 4 solutions, while I got 18. You added a[3] and b[3] as variables and removed a[0] and b[0].

@C_R Using printlevel is difficult because you get a huge amount of irrelvent information.

The following command lists all procedures and modules in the library whose names begin with `simplify`. Since you have often asked how to form complicated operators in prefix form, I'm also showing that.

(`&>`, `&<`):= (rcurry, curry):
Simps:= (select&<type&>{procedure, `module`} @ (cat&<`` @ index&>(..-3))~)(
    select(p-> p[..8]="simplify", index~(LibraryTools:-ShowContents(), 1))
);

In Maple 2023, that's 403 procedures and 5 modules. We can trace them all:

trace(%[]):

@C_R 

simplify is not a black box! The trace and showstat commands work fine on it.

@mmcdara I believe that the second parameter of the Normal distribution in Mathematica is sigma, not sigma^2, just as it is in Maple. If this is true, then you need to replace sqrt(var) with var in your definition of Distrib. The original code caused confusion on this point by using var to represent the not the variance but its square root.

Your first plot is an implicit plot, x vs. C. It is a plot of C = -2*x^3 - 4*x with C being the horizontal axis and x the vertical. So, it doesn't make sense to me in this context.

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