Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 104 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

Are the entries of A rational functions?

Can you provide a small example of A, say, with N=2?

@Carl Love In the above Answer, why does value(PDEtools:-dchange(...)) not work? It seems to return unevaluated.

You asked:

I'd like to know why did you use depends? Why not simply
B::And(list, satisfies(B-> nops(B)=nops(A)))

I wasn't aware that the depends isn't necessary. Now I see that it isn't. I thought that whenever the type check for one parameter referred to another parameter that depends was needed (see ?parameter_modifiers), but apparently that isn't true.

Is the newer satisfies more efficient than the classical if?

I don't think that satisfies is significantly newer than if. I'd guess that the if is slightly more efficient. The choice is stylistic: Maple is moving to have more and more of the error checking and argument processing done in the procedure headers. A great number of pages of the Maple Programming Guide are devoted to this.

In the previous Bij procedure, the variable b was not declared local.
It should be local but type(b,`local`) gives false and type(b,`global`) also false. Why?
Edit. Ok, it should be type('b',`local`) , type('b',`global`)  and ==> false and true
but even if global,  a global variable b at top level seems to be not affected.
(I.e. b seems to be still local, but type sees the global variable, since it is not declared explicitely. Is it so?)

The index variables of seq, add, and mul have a very special (and poorly documented) status in Maple. In the vast majority of cases, there's no need to declare them. I think that the only time that they need to be declared local is when the corresponding global has been protected.

@one man Did you use a GIF file? How many frames are in your animation? My color gradations are continuous.

@Axel Vogt I would modify your procedure so that it produces output which can always be parsed back to its original form and such that that output can be properly indented, which ending lines with backslashes doesn't allow.

split_for_print:=proc(expr, len::posint)
#expr = any Maple expression
#len = length to split with line breaks
     printf("parse(\n");
     map2(printf, "     %v\n", [StringTools:-LengthSplit(sprintf("%a", expr), len)]);
     printf(")\n");
end proc:

Here we see that it produces properly indented output that can be copy-and-pasted anywhere:

split_for_print(evalf[119](Pi), 40);

     parse(
          "3.14159265358979323846264338327950288419"
          "7169399375105820974944592307816406286208"
          "9986280348253421170679821480865132823066"
     )

And here we see that it behaves correctly when the input is a complicated expression that already contains quote marks and backslashes (that's the purpose of the %v format):

split_for_print(eval(split_for_print), 40);

     parse(
          "proc (expr, len::posint) printf(\"parse(\\n\"); "
          "map2(printf,\"     %v\\n\",[StringTools:-Le"
          "ngthSplit(sprintf(\"%a\",expr),len)]); printf(\""
          ")\\n\") end proc"
     )

Now copy-and-paste that to an external file and back to an input prompt to test its executability:

SplitForPrint:= parse(
     "proc (expr, len::posint) printf(\"parse(\\n\"); "
     "map2(printf,\"     %v\\n\",[StringTools:-Le"
     "ngthSplit(sprintf(\"%a\",expr),len)]); printf(\""
     ")\\n\") end proc"
):
showstat(SplitForPrint);

     SplitForPrint := proc(expr, len::posint)
        1   printf("parse(\n");
        2   map2(printf,"     %v\n",[StringTools:-LengthSplit(sprintf("%a",expr),len)]);
        3   printf(")\n")
    end proc

You can see that it's identical to the original procedure.

By the way, all of the above works in both the Standard (with 1D input) and Classic GUIs.

@Ronan For example, a row vector can be entered as <1 | 2 | 3> or `<|>`(1, 2, 3). The latter is called prefix form because the operator comes before the operands. Almost every operator in Maple has a prefix form. Some more examples:

1 + 2 + 3       or `+`(1,2,3)
[1,2,3]           or `[]`(1,2,3)
A[1,2]               or `?[]`(A, [1,2])
f(a,b)                or `?()`(f, [a,b])
a or b                
or `or`(a,b)
[1,2] +~ [3,4] or `~`[`+`]([1,2], [3,4])

@testht06 Would it useful to you to have a procedure for it so that you could enter simply

M &^ (1/k) mod 2;

?

@Ronan I see that you've extended my block-matrix ideas to the <...,...;...,...operator, which, oddly enough, has no prefix form. 

@adel-00 The line

DeltaE:=2*(j*(spin*neighbours)+B*spin:

still has unbalanced parentheses. There are several places the closing parenthesis can go. I can't tell where you want it. Also, if you mean standard matrix multiplication, then spin*neighbours should be spin.neighbours.

The line 

p=exp(-DeltaE):

should be

p:= LinearAlgebra:-MatrixExponential(-DeltaE)

(unless you mean for the exp to be applied elementwise).

There are other errors, but I need to go now. Please don't waste my time: I'm sure that you can find unbalanced parentheses on your own.

 

 

@adel-00 Now you have unbalanced parentheses in the line that begins DeltaE:=. There are numerous other errors after that. Ordinary Matrix-Matrix multiplication is done with . instead of *. To add all the elements of a Matrix M use (ArrayTools:-AddAlongDimension@@2)(M).

@adel-00 The above code is Doug's, not mine. Like I said before you skipped a line of his code. You need to insert:

spin:= Spin(N);

Or you can use my code.

Regarding seeing an image of the Matrix: Right-click on the Matrix in the worksheet output to bring up the context menu. Then select Browse. Then click on the Image tab.

@testht06 I'm just curious: What application do you have for finding fractional powers of matrices over prime-power fields? Is it coding theory? What will be the size of the matrices and the degree of the field when you're doing practical problems?

@testht06 I don't anticipate the degree of the characteristic polynomial or its splitting field to be any limitation. However, the program is not set up to deal with the following situations:

  1. The characteristic polynomial has multiple nonlinear irreducible factors.
  2. There are repeated eigenvalues.
  3. The nth root of an eigenvalue doesn't exist in the splitting field.

@Preben Alsholm I mean without the extra parentheses around CCnew, as in `<|>`(-CCnew||(0..dmax-1)). It generates a Matrix of Matrices rather than a "flat" Matrix.

I found that by declaring a parameter in the initial isolve, I could avoid the need for subs in the second isolve. I edited the Answer to refect this simplified technique.

First 417 418 419 420 421 422 423 Last Page 419 of 709