Joe Riel

7864 Reputation

22 Badges

14 years, 257 days

MaplePrimes Activity

These are replies submitted by Joe Riel

@Rim Hard to say without seeing the expressions---and if they are really large or unwieldy it might still be hard to say. What happens if you eliminate the call to simplify?  Sometimes what you really want is a simpler transformation, say collect terms.

@Rim I'll guess that whatever you are passing to simplify is a large expression, so repeated calls will take a lot of time.  Generally I try to avoid calling simplify in an algorithm and instead use a more specific procedure.  Is there a particular type of simplification you are trying to achieve at that point?

@Rim Interesting. The 32 indicates that line was executed 32 times.  The 56393,345 is the total number of seconds required; that is approximately 16 hours, does that seem right?  I'm assuming your locale is using the comma for the radix. The negative sign for the words usage suggests that the 8 byte word (I'm guessing) used to store the value has exceeded its range, or possibly the printing mechanism doesn't know that it is supposed to print it as an unsigned integer. 

Does that line call a procedure?  If so, then the usual thing to do is to profile it.  If you do so, and also profile this procedure (you can profile more than one, just use a separate call to debugopts('traceproc' = some_func), the reported time in the line of the calling procedure will be apparently greatly reduced because of the way Maple's profiler reports the time (i.e. it doesn't show cumulatives at the calling procedure if the called procedure is profiled).

@acer Could you give a simple concrete example of something that might be hard to accomplish with objects? Am toying with a few crude ideas.

@Carl Love I didn't notice that in the title.  Wow, that's old.  I still have my MapleV boxed set. The hardbound books are nice. That might explain why I got a different result, one that required using evalf rather than simplify to evaluate the RootOf expression.

@djmotion Your usage Y(s) := 100/s is a bit strange in that it can be interpreted in two ways.  Presumably you are using 2D math input, so Y is assigned the function s -> 100/s.  However, when using Maple input, this assigns to the remember table of the otherwise undefined procedure Y.  So Y(s) will return 100/s, but Y(t) will return Y(t). That's probably not what you want.  I'd avoid the issue by using the arrow notation to assign the procedure,  Y := s -> 100/s.   The same issue exists with X2(s) and x2(t). For x2(t) you certainly want to use x2 := unapply(...).  Modify the references to x2 to omit the unneeded t argument.

@Ramakrishnan As acer pointed out, ChangeE must be an export, not a local, to the module. The other issue, minor in comparison, is that a radio button really isn't the right component type for a single press button.  It will work, but looks wrong and doesn't make sense (it always appears to be selected). Radio buttons are used to select one of several options.  Replace it with a regular button. It would also be a good idea to label your components, either by adding external text or a label component.  Doing so makes it easier on the user and helps with the debugging. 

@Carl Love By way of explanation, the call to sort with the 'output = permutation' option returns a permutation of the indices of the list.  That permutation is then applied to S by using S[ permutation_of_indices ].  For example


Note that using a list of indices as the index to a list is a rather general operation that has other uses. It isn't restricted to being a permutation.

             [b, b, a, c, c]

@vv For this application you are probably correct.  There is a difference in that your method produces the Matrix directly, while with Carl's method an existing Matrix is modified (this may not be clear to the beginner in that Carl wrote a one-liner). The choice may then depend on whether one is producing a new matrix or modifying a given matrix.

@Carl Love This makes me think that 

V := Vector([a,b,c]):

should produce a Vector of function calls of t, rather than raising the error, unsupported type of index, t. I can understand why the error is raised in that apply(f,t) is equivalent to f(t) and, with the introduction of programming indices (quite a few releases ago) f(t), with f an rtable, is interpreted as an indexing operation. However, given that apply is supposed to create functions (function calls), it makes more sense to distribute the application over the content of the rtable.

As a counterexample to the current operation, consider

L := [[f,g],<f,g>]:
        [[f(1),g(1)], f]

I doubt anyone would ever want that.

@dharr That isn't clear to me; at best I'd say the help page is confusing.  For an rtable, the number of elements seq returns equals the rectangular size of the rtable, regardless the actual storage.

@tomleslie Because the desired result, apparently, is merely a side-effect (printed output), I'd probably want to use a for loop rather than a sequence; no sense producing any real Maple expressions if they won't be used.  The annoying part is handling the last term so there is no dangling comma.  With that in mind, it might be simpler to do 

printf("%Q\n", seq(sprintf("op(S[%d])", i), i=1..5)):

Alternatively, and shorter

printf("%q\n", seq('op'('S'[i]), i=1..5)):

@tomleslie The error comes from a call to iratrecon with the fourth argument, D, equal to zero, which is not valid.  Haven't looked at why that occurs.

@aaeerr The model you uploaded doesn't run here (System in underdetermined).  Regardless, one way to lock a rotational joint, but to allow it to be freely initialized, is to connect a constant speed source (1D Mechanical > Rotational > Speed Drivers > Constant Speed) with the velocity set to zero, to the b-flange of the joint.  Attached is an example using the Double Pendulum. LockedJoint.msim

What do you mean by lock links?  Prevent the rotational joint from turning?  If so, at what angle do you want it fixed?

4 5 6 7 8 9 10 Last Page 6 of 180