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 replies submitted by Carl Love

@nm The ambiguity of VV's example is that if one wanted a string containing an embedded string whose first and last characters were commas, then it would be impossible to represent that under the supposed rules that you've shown so far.

Maple has different "formats" (the %-codes) for printing out "ordinary" strings, strings that are appropriately escaped to be reread as strings, and strings that are appropriately escaped to be reread as strings in the context of CSV. Here are four examples:

data:= [1, 2, 3, "x+y, algorithm=[\",123,\"]", "OK", 5];
     data := [1, 2, 3, "x+y, algorithm=[",123,"]", "OK", 5]

sprintf("%a", data); parse(%);
       "[1, 2, 3, "x+y, algorithm=[\",123,\"]", "OK", 5]"
         [1, 2, 3, "x+y, algorithm=[",123,"]", "OK", 5]

sprintf("%A", data); parse(%);
          "[1, 2, 3, x+y, algorithm=[",123,"], OK, 5]"
         [1, 2, 3, x + y, algorithm = [",123,"], OK, 5]

sprintf("%v", data); parse;
        ""[1, 2, 3, x+y, algorithm=[\",123,\"], OK, 5]""
          "[1, 2, 3, x+y, algorithm=[",123,"], OK, 5]"

sprintf("%V", data); parse(%);
        ""[1, 2, 3, x+y, algorithm=["",123,""], OK, 5]""
          "[1, 2, 3, x+y, algorithm=[",123,"], OK, 5]"

It seems that only the %a worked here in a way that would be useful for your case. So you should see if Mathematica has a way to print out appropriately escaped strings.

For the existing files, we might need to write a conversion utility and do them all. The fact that there are thousands of them is not a big issue.

@Christopher2222 Yes, and if you're happy with those tickmarks on the y-axis, then great, that's all there is to it! Personally, I prefer "rounder" numbers for tickmarks.

You're absolutely right that the index -1 represents the last character of a string, -2 represents the second-to-last character, etc. What you show is an outright bug in UpperCase, etc., that's been glaring from that help page since at least Maple 2016 (the oldest that I have on this computer).

Joe is totally correct that the situation at hand requires sequential rather than simultaneous subs. I'm merely writing this Reply because I don't want people to get the wrong idea that sequential is somehow generally better than simultaneous. The simultaneous should be used when possible because it's much faster. Note that the subs syntax allows for sequential processing of sets of simultaneous substitutions all in one command.

Moving the data points is easy with plottools:-transform. The hard part is deciding what the tickmarks should be. Once you've decided on the numbers for the ticks, placing them on the axis is easy.

I speak from experience: Back in Maple V or Maple 6, I was so dissastified with the ticks in plots[logplot]plots[loglogplot]plots[semilogplot], and their 3D counterparts that I rewrote the whole lot. And I also invented the equivalent of today's mode= log, which didn't exist at that time. All-in-all, it was about 600 lines of code, with about 2/3 of that for tickmarks. Unfortunately, that code won't run anymore. If it did run, it would be easy to replace the logarithm with any symbolically invertible strictly increasing function, such as your x^3 or x^(1/3).

@tomleslie I was just making a practical suggestion in case you wanted your plots to appear the same (or close) when posted here as they appear in Maple. I know that that's not the way that things should be; that's just the way that they are. Getting MaplePrimes bugs fixed seems much more difficult than Maple bugs.

@tomleslie If you specifically include gridlines= false in the code, then the gridlines won't appear when the worksheet is uploaded here.

@Thomas Richard More to the point is is's existential partner coulditbe:

coulditbe(f=0) assuming x<0, y<0;
      false

@Thomas Dean What Kitonum did wasn't factoring the polynomial in the usual sense, but rather factoring additive subparts. I don't think that there's any reasonable algorithm for it---it involves a lot of educated guesswork. I call it "subfactoring". 

@Thomas Dean For irreducible real polynomials in two variables, this is usually the best way to plot:

algcurves:-plot_real_curve(f, x, y);

One great thing about this is that you don't need to specify ranges for the variables---the command figures out appropriate ranges.

@nm The "main" for Maple is what is executing at the level where you type commands. No proc is equivalent to a "main".

@Joe Riel I didn't mean to imply that it was the same string. I'm just saying that &eacute; is a much-more-convenient way to enter e with an (acute) accent directly from the keyboard, rather than creating the string externally and copy-and-pasting or programming the bit-level manipulations of Unicode.

@lplex Maple understands most (perhaps all?) HTML &-codes directly typed into strings. So:

"d&eacute;cembre";

So copy-and-paste is not needed. This is much more user-friendly than Unicode (for direct keyboard input), even if it takes a few more bytes of memory. All such codes begin with &, are followed by some descriptive letters, and end with ;.

@Samir Khan You can easily directly compute the Katz centrality as below. This can be done in the worksheet anyplace after the graph G has been defined.


GT:= GraphTheory:  LA:= LinearAlgebra:
A:= Matrix(
    GT:-AdjacencyMatrix(G), shape= symmetric, datatype= hfloat
):
ME:= max(abs~(LA:-Eigenvalues(A)));
n:= upperbound(A,1):
CF:= 1.1: #Convergence factor: Can be any number > 1.
I__n:= Matrix(n, shape= identity, datatype= hfloat):
Ones:= Vector(n, 1, datatype= hfloat):
katz_centrality:= LA:-LinearSolve(I__n - A/CF/ME, Ones) -~ 1:

Then proceed with the sorting and plotting exactly as before.

@Adam Ledger CygWin is not a Linux virtual machine, it's just a Linux-like command-window environment. You can still run all your Windows programs from it, including Maple.

First 213 214 215 216 217 218 219 Last Page 215 of 708