Joe Riel

7637 Reputation

20 Badges

13 years, 299 days

MaplePrimes Activity

These are replies submitted by Joe Riel

@Carl Love Alas, that doesn't give a solution, at least not with the defining boundary and initial conditions:

eq1 := diff(u1(x, t), x, x) = k1*(diff(u1(x, t), t));
eq2 := diff(u2(x, t), x, x) = k2*(diff(u2(x, t), t));
bc1 := u1(0, t) = v1;
bc12 := u1(L,t) = u2(L,t), k1*D[1](u1)(L,t) = k2*D[1](u2)(L,t);
bc2 := u2(2*L, t) = v2;
ic1 := u1(x,0) = 0;
ic2 := u2(x,0) = 0;

sys := {eq1,eq2,bc1,bc2,bc12,ic1,ic2}:
sysnum := subs({L = 10, v1 = 20, v2 = 10, k1 = 10, k2 = 20}, sys);
sol := pdsolve(sysnum, [u1,u2](x,t) );

I don't use pdsolve enough to know whether that should work, but it can handle the simpler


Note that bc1 and bc2 conflict with ic1 and ic2 at x=0 and x=2*L, however, I assume that isn't a problem; it wasn't for the simpler case.

@Christopher2222 The Maple macro command isn't all that useful for its intended purpose, which, as mentioned in the first sentence of the help page, is to be "a simple abbreviation facility to be used when writing Maple functions and library code."  While it may have been used for that many releases ago, when Maple library procedures were table-based and hence globally assigned, the transition to modules makes it almost pointless.  The reason is that the call to macro must be at the global level; that doesn't work well when the source for a procedure in which you want to define and use a macro is located in a separate file that is at a lower part of module hierarchy. Maple's preprocessor macros are better suited for this purpose as they can be locally defined and undefined. 

@Christopher2222 Converting to a string and parsing is going to ensure the names are globals.


While you should first try with the correct format, it is possible that the Maple server has been configured to restrict the ability to write to external files.

@acer If the assignment operator could be overloaded (it currently cannot---a good thing) it could be made to do something, though without some other mechanism it isn't clear what. There are a few assignments that use a special syntax on the lhs: directly assigning to a remember table and assigning content of an rtable are two examples.

@acer Nice options.  The third can be slightly simplified by dropping the i in the seq: [seq(4..1,-1)].

@Carl Love The answer is that I wasn't thinking about thread-safety. It's good that you brought that up.

Be sure to define and check the corner cases.  Specifically, what do you want for, say, [1,1,2,2].  Is 1 or 2 the second-highest element?  What about [1,1,1,1]?  Or for the empty list (Maple's max returns -infinity).

@Carl Love Nice explanation and example. A nit---probably best ignored---is that Maple error messages generally start with a lower case letter, they look better that way as the usual output is "Error, <the error message>".

You could use two prismatic joints to enforce a planar motion.  The planar joint could also be used.  A different approach would be to use the sphere-rectangle contact, though that would allow motion off the surface (bouncing).

@a_simsim It helps to know why two backslashes are required, in a Maple string, to represent a Windows directory separator. The backslash is used as an escape character, to permit entering special characters (new-lines, tabs, arbitrary ascii). As such, to enter the escape character itself, you need two of them, the first "escapes" the second.

Have someone do it for you. Snarky answer aside, what are you trying to make efficient?  The execution of the procedure, or the creation of the procedure? The usual concern is the former. 

@Ramakrishnan On line 95 there is a call to SetProperty that is missing its package name (should be DT:-SetProperty); without the package name it returns unevaluated.

In the embedded component code sections, the "use DocumentTools in ... end use;" wrappers are no longer needed as there are no exports of DocumentTools being used in the code.  It probably isn't worthwhile to remove the wrappers, but it is something to consider for the next worksheet.


@Carl Love Nice extension, particulary the use of an operator for a positional argument. Hmm. Is there a type 'operator'? There should be.  Probably there should be a check for the number of dimensions of an rtable; it seems unlikely anyone would want to sort a 2 or higher dimensioned rtable by the linear order.

@Kitonum The OP should be aware that this method is horrendously inefficient.  The issue is that every swap generates an entirely new list.  Such manipulations should be done on a mutable structure; here an Array or Vector would be appropriate. The changes to the code are easy:

BubbleSort := proc(L::list(numeric))
local A, n, k, m;
    A := Array(L);
    n := upperbound(A,1);
    for k from 0 to n-2 do
        for m from 1 to n-k-1 do
            if A[m] > A[m+1] then
                # swap elements at indices m, m+1
                (A[m],A[m+1]) := (A[m+1],A[m]);
            end if;
    convert(A, list);
end proc:
1 2 3 4 5 6 7 Last Page 1 of 176