Joe Riel

8121 Reputation

22 Badges

15 years, 55 days

MaplePrimes Activity


These are replies submitted by Joe Riel

@nm Yes, the help pages should be improved.  I'll make that change, to better explain the operation of cancellation.  Will look into whether it is feasible and worthwhile to avoid the automatic cancellation with an expanded denominator.  Note that it would at best be limited; you wouldn't be able to create, say, (s+1)/(s+1) because Maple's simplifier automatically does the cancellation.

@nm You can enter as a transfer function using

tf := TransferFunction((s-1-delta)/(s-1)/(s-2)):

Not ideal but not unreasonable.  Note that the conversion from the ZeroPoleGain form to the StateSpace form does not cancel pole-zeroes, so you don't have to enter the delta for that.

@gkokovidis I'll add an example of that usage to the help page.

Because you are using Maple2019, there should be little reason to use evalm---use the Matrix (rather than matrix) consructor and the LinearAlegebra rather than linalg package.

Using map(eval, ROD) should work.

@janhardo I had no problem opening it in Maple 2020.1.  I've uploaded an mw version; see if that works for you.  Maybe it is missing stuff which I'm not aware?

Dynmod03.mw

Your example is not uploaded.  Use the green arrow.

@Carl Love Yes, I sure have made that clear.  Using a key function is fine provided it returns a suitable value (say a real).  As Carl states, setorder is used on the key values because the values are not otherwise comparable.

@Scot Gould Maple, apparently, compares strings.  I wasn't aware of that, or had forgotten it. For example,

evalb("aa" < "b");  # --> true

Hmm. But in your case it is comparing expressions of the form i1*str+i2.  Will look into that.

Later The sort function is sorting using 'setorder' on the list of key outputs.  So you can get the same permutation of indices by doing

sort([mykeys], 'setorder', 'output = permutation'); # --> [3,1,5,4,2]

 

@Scot Gould By cell I meant a battery. Let x[k] be a value in the k-th column.  A key expression that could be used to sort columns 1..n, with the precedence increasing with the column index, is add((x[j]-min(x[j])*mul(max(x[k])-min(x[k]),k=1..j-1), j=1..n), where min(x[j]) means the minimum value in column j.

@Bohdan You can write some code to parse.  The following assumes each row is on a separate line; it can be made more efficient. Following is the content of file data.csv

a[1,2], 0, 1, b[1,2]*c[2,3]
b[2,3], 0, 1, b[2,1]*d[2,3]

Here's code to convert to an Array

fd := FileTools:-Text:-Open("data.csv"):

A := Array(1..0):
cnt := 0;
do
    line := readline(fd);
    if line = 0 then break; end if;
    cnt := cnt + 1;
    A(cnt) := [parse(line)];
end do;

fclose(fd);

# A is a one-dimensional Array of lists.  Convert to a 2D Array
A := convert(A, 'compose', 'listlist', 'Array');

 

@Scot Gould It's not multipying a string by a number, it's multiplying the number of cells by the maximum cost, plus one.  A rather crude function that works in the unlikely case you want to first compare by number of cells, then by the cost. Simpler (though potentially less efficient) is to use a sort function

P := sort(Prows, proc(i,j) uses F = Flashlight; F[i,"Batteries"] < F[j,"Batteries"] or F[i,"Cost"] <= F[j,"Cost"] end);

 

@Carl Love No, the problem is that the csv format causes the index separator commas to be parsed as item separators. Consider
 

ImportMatrix("a[1,2],3,4",'direct','source=csv');
                            ["a[1"    "2]"    3    4]

@cloz54 I assume Triinears.maple assigns the procedure Trilinears.  A better approach would be to save it as a Maple archive (mla), then put the mla where Maple can find it, automatically.  Typically that would be in $HOME/maple/toolbox/Trilinears/lib/Trilinears.mla. I'm not sure the equivalent directory on a Windows install.

Try putting the file in c:\Program Files\Maple 2020\Users\maple.ini.  I haven't actually tried this, don't usually use Windows, but it makes some sense.  See the help page ?worksheet,reference,initialization for details of where the iniitalization file can go (I didn't see a match for that path).

@tomleslie It's a bug; I've submitted an SCR. If there is only one operand in the expression, the Grid mechanism is not used.  Alas, the code ignores the remaining arguments for that case.

1 2 3 4 5 6 7 Last Page 1 of 183