Joe Riel

9660 Reputation

23 Badges

20 years, 6 days

MaplePrimes Activity


These are replies submitted by Joe Riel

That works fine for me.  Possibly you have assigned one of the variables in the input?

While it shouldn't matter in this particular usage, note that gamma is a symbolic constant in Maple, akin to Pi.  Thus

evalf(gamma);
                       0.5772156649

@Markiyan Hirnyk Yes, I should have noted that charfcn is not terribly efficient.  More efficient than using remove/select, because it avoids creating a list, is

add(`if`(x<0,1,0), x = L);

@Markiyan Hirnyk Yes, I should have noted that charfcn is not terribly efficient.  More efficient than using remove/select, because it avoids creating a list, is

add(`if`(x<0,1,0), x = L);

Could you give a simple example with, say, a two-dimensional vector?

@Axel Vogt In this case the Maple code is a property of the figure(s). I was able to retrieve it by right-clicking on the figure(s) and selecting properties, then copying the Alternate Text field.

@ytyyutianyun By default, Maple use the greater-than sign (>) on the left-margin as a prompt.  When copying Maple code, these prompts must be removed.  The GUI's copy/paste commands generally do the right thing, the problem arises when you copy stuff to/from a different application.  Then you may have to delete the prompt characters.

One way to avoid this is to change the prompt.  I do this with

interface(prompt = "(**) "):

The result is that the prompt now corresponds to a delimited comment, so it will be ignored if copied into a Maple region.

@ytyyutianyun By default, Maple use the greater-than sign (>) on the left-margin as a prompt.  When copying Maple code, these prompts must be removed.  The GUI's copy/paste commands generally do the right thing, the problem arises when you copy stuff to/from a different application.  Then you may have to delete the prompt characters.

One way to avoid this is to change the prompt.  I do this with

interface(prompt = "(**) "):

The result is that the prompt now corresponds to a delimited comment, so it will be ignored if copied into a Maple region.

You left something out of your post, it only contains numerical assignments.

@pvrbik The help page could have a better example, one that demonstrates that, when successful, timelimit acts as a pass-through.  Tweaking the existing example (from ?timelimit):

f := proc(n) global i; for i to n do 2^i end do; return i; end proc:
n := timelimit(1, f(10^3));
                                   n := 1001
n := timelimit(1, f(10^6));
Error, (in f) time expired

Including the use of try wouldn't hurt:

try
   n := timelimit(1, f(10^6));
catch "time expired":
   n := i;
end try;
               n := 94313

I'll submit an SCR.



@pvrbik The help page could have a better example, one that demonstrates that, when successful, timelimit acts as a pass-through.  Tweaking the existing example (from ?timelimit):

f := proc(n) global i; for i to n do 2^i end do; return i; end proc:
n := timelimit(1, f(10^3));
                                   n := 1001
n := timelimit(1, f(10^6));
Error, (in f) time expired

Including the use of try wouldn't hurt:

try
   n := timelimit(1, f(10^6));
catch "time expired":
   n := i;
end try;
               n := 94313

I'll submit an SCR.



@yanin I won't be able to look at this for a couple days, but will respond then.

Yes, piecewise is more general (than `if`), but it is also more expensive.  Note that ?add has special evaluation rules so can deal with the `if` function.  For a discrete sum, I'd use add with `if`. 

Yes, piecewise is more general (than `if`), but it is also more expensive.  Note that ?add has special evaluation rules so can deal with the `if` function.  For a discrete sum, I'd use add with `if`. 

Consider profiling the code so that you can accurately determine where the bottlenecks lie.  The way to do this is to convert the code to a Maple procedure, use the ?CodeTools[Profiling] package to profile it, execute it, then print the profile results.

Starting with a worksheet I'd use File -> Export As to export the worksheet to a Maple script (*.mpl file), then edit the resulting file with a text editor to convert it to a procedure.  I took the liberty of doing so, Monte_Carlo_Slow_Do.mpl. Included in the file, after the assignment to the procedure Simulate, is the code to profile it, execute it, and print the results.  I haven't done so because I don't have the required spreadsheets, so there could be some issues with the code.

The first two bugs have been fixed in Maple 15.

First 64 65 66 67 68 69 70 Last Page 66 of 195