John Fredsted

2238 Reputation

15 Badges

20 years, 167 days

MaplePrimes Activity


These are replies submitted by John Fredsted

@taro: You are welcome.

Happy to hear that I am not alone in feeling that the new look is definitely not an improvement over the old one, at least not visually. For one thing, the line spacing is too large, making text much harder to read; I can almost feel my visual cortex doing overtime.

Another, perhaps smaller, issue of spacing, this time of the missing kind, is that the profile images float in front of any text, hiding the latter, if there is not enough horizontal space to render the page properly.

@Ronan: Happy to hear that.

@Ronan: Following Acer's warning above of not storing in the Maple installation lib folder, you could create a folder of your own somewhere else (in this way it is also easier to keep track of your own modules/packages), and then use the following code:

savelibname := the_path_of_your_new_folder;
savelib(RTest);

@Ronan: There is something mysterious going on in your attached document. Even though the line "the Library folder should be C:\Program Files\Maple 2016\lib" is a text line, it is seemingly the one that triggers the error. If it, and some other stuff, is removed by placing the cursor at the very end of the document, and then pressing Ctrl+Del six times (my count), so that only the restart line and the module itself remain, then the worksheet seems to execute ok.

If so, then save it in that new state, and simply augment it by the following lines, see the end of the help page module[package]:

savelib('RTest');
restart:
with('RTest');

This should save the package to the repository specified by savelibname, and reload it for checking. Please check that the path is the one that you want, by executing savelibname; in your document.

@acer: You are quite right, of course, thanks. Although I have made quite a few modules/packages, it is some time ago now, so I had forgotten about that option. This error of omission has now been fixed.

@acer: Quite right. That was what I meant, I guess.

@Carl Love: Thanks for that fix. I call it a 'fix' only, because I am truly surprised that one has to explicitly change the prompt that way. If there is really no other way, then personally I would consider it a 'bug' of the user interface. Does this behaviour persist in Maple 17+?

@nm: I had gotten the impression that the powers of a and b were explicit positive integers. Therefore, my previous suggestion will not work for powers like a^m*b^n. But the following slightly modified procedure will:

removeProducts := proc(x)
   local expr := expand(x);
   if type(expr,Or(`&*`(
      anything,
      Or(identical(a),identical(a)^anything),
      Or(identical(b),identical(b)^anything)
   ),`&*`(
      Or(identical(a),identical(a)^anything),
      Or(identical(b),identical(b)^anything)
   ))) then 0
   elif type(expr,Not(atomic)) then map(removeProducts,expr)
   else expr
   end if
end proc:

@emendes: Happy to hear that I finally hit the target :-).

@emendes: Then I have the following suggestion (hope I now understand want you want):

f := (l::list) -> eval([y,y*z-x,-15*x*y-x*z-x],[x,y,z] =~ l):
(f@@4)([x,y,z]);

Or if you have a predilection for subs (personally I prefer using eval, as it is my experience that eval is generally safer to use than subs):

f := (l::list) -> subs([x,y,z] =~ l,[y,y*z-x,-15*x*y-x*z-x]):
(f@@4)([x,y,z]);

@emendes: If you want composition of f with itself 4 times, say, then you could do like follows:

f := (l::list) -> [l[2],l[2]*l[3]-l[1],-15*l[1]*l[2]-l[1]*l[3]-l[1]]:
(f@@4)([x,y,z]);

This does not use unapply, but constructs the function f itself by hand, somewhat along the lines previously suggested by Kitonum.

@firmaulana: Ok. Now, at least I can do the first sum as follows (a variation of the suggestion below by tomleslie, using minus instead of `if`):

local D:   # If you really want to use the protected D (*)
TB := {1,2,3,4,7,8,15,18}:
D  := {5,7,11,12,14,15,17}:
add(add(add(x[i,j,k] + x[j,i,k],j in TB minus {i}),i in TB),k in D);

Concerning the second sum, I have just realized that I need further clarification: Is the sum really a triple sum, or what? As it now stands, it seems to be a single sum, the left-hand side thus being something like a 2D array with indices 2*e - 1 and k.

@Kitonum: I am afraid that my Maple skills are insufficient to really be able to appreciate the nuances contained in your examples.

As to the quote of mine you give, I just meant something along the following lines: If, as previously written, the arguments and the function are given ones, then one can, of course, immediately use -> to write down the desired associated function. But if these quantities are not known or fixed, or can take on very many forms, then it seems to me that writing down for each case a new code line using -> is not the way to go.

@emendes: Could you please elaborate a bit on what you want to achieve? I am unable to decipher that from your code.

First 16 17 18 19 20 21 22 Last Page 18 of 68