acer

32343 Reputation

29 Badges

19 years, 327 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@tomleslie I really like the way your procedure F accepts just a single parameter (which will become the animating parameter when F gets used in the animate call.) I vote up.

I think that's an important improvement because it makes the later animate call much simpler. Thus the programming difficulties (for those less proficient than you) are split more usefully. Producing any single frame is one programming subtask. And the animating subtask (which can challenge beginners, say) is now more straightforward.

@romanrieme

Perhaps you could have each frame contain a plotted circle (with some coloring or pattern), or a polygonal shape. Then you could have construction of that frame rotate that accordingly.

I suggest creating a procedure that will accept the two position values along with a rotation value, and construct the plot of a desired shape with its rotation visually apparent. In other words, that procedure would accept some three values and return a plot, which could be a frame of your animation. Then you could call animate on that procedure.

Did you somehow expect the pointplot command to know that the data you're passing it come from a system of differential equations in which the computed functions happen to represent a rotating ball? Otherwise I don't see how having a third component in the list for the pointplot command would be a natural way to specify the quite esoteric property of some rotation of the symbol.

@brian bovril Ok, so now we have the key detail that you want to copy&paste directly from the Maple interface. Before I suggested ExportMatrix in case you wanted to export to a file.

So here's a way, using printf, to produce plaintext output in the Maple interface that can be directly copy&pasted.

I had alluded to that in my Answer, but now that I know that's the effect that you're after I'll give it explicitly.

restart:
with(combinat):with(StringTools,DeleteSpace):
abil:=[1407,1408,1409,1411]:
DBL:=choose(abil,2):
score:=[2,0]:
ans:=seq([DBL[j][],score[1],DBL[numelems(DBL)-j+1][],score[2]],
         j=1..numelems(DBL)/2),
     seq([DBL[numelems(DBL)-j+1][],score[1],DBL[j][],score[2]],
         j=1..numelems(DBL)/2):

seq(printf("%s\n",
           DeleteSpace(sprintf("%a",
                               ans[i]))[2..-2]),
    i=1..nops([ans]));

1407,1408,2,1409,1411,0
1407,1409,2,1408,1411,0
1407,1411,2,1408,1409,0
1409,1411,2,1407,1408,0
1408,1411,2,1407,1409,0
1408,1409,2,1407,1411,0

There are other printf incantations which could get the same kind of result.

Which version of Maple?

Which version of Linux? Which JRE?

You might try changing the JRE.

I changed your Post into a Question.

Please try to be careful about submitting your queries as Question threads.

Are you using the stock Physics package that comes with your Maple version, or an update from the Maple cloud?

@Joe Riel I agree very much with the approach of using external text files (Maple source). I prefer having separate files for each part (eg. procedures, submodules, etc), using Maple's $include directive within the text source for the body of the module.

One of the important reasons for my preferring text source files is that common version control tools can be used.

@mmcdara Thanks, maybe you'll come across it later.

I don't really understand the purpose or advantage of defining the procedures P1,P2,P3 outside of the module body. Perhaps there is more going on in your actual examples.

I changed your Post into a Question.

A := exp(I*x):                                
simplify(conjugate(A),power) assuming x::real;

              exp(-I x)

@Carl Love It seems likely that \134n is intended there as the octal (ASCII) escape sequence in which \134 encodes backslash and \134n encodes \n (eventually interpreted as new line).

@ianmccr First, the Help page I cited earlier is about using 2D Input (and not any Typesetting package or extra facilities.) It's stock stuff, and probably ought to be perused by anyone using Maple's 2D Input mode.

Second, I don't know what your rfloor and lfloor commands are supposed to do. Do you know that you can use the special name `&lfoor;` as an infix operator? Do you know that it will pretty-print? (With a bit of work it could be made to render in upright Roman instead of italics when used thusly, I suspect.)

You seem to now be asking about something very different from your original query in this thread. If you have some scenario involving using that symbol (as input, or to get it as desired output) in a pretty-printed way then you could ask that in a separate Question.

@tomleslie [edited] After taking a second look (thanks) I don't know how he managed to get that result of 4. (Perhaps that was the result of some accidental editing of the code after execution...) His issue seems resolved now.

@AmirHosein Sadeghimanesh The colon-dash makes it be a reference to the global name b, instead of the parameter name b of the test1 procedure.

In your example the uneval quotes are not strictly necessary, since you didn't also assign to the global name b. I put in those single-quotes to make it work if you happened to also assign to the global name b (eg. at the top-level). Below, the first example works as you'd intended, but the second does not.

restart;

b := 17:

test1:=proc(a::posint, {b::posint:=1})::posint:
        return a + b:
end proc:

test2:=proc(a::posint, {b::posint:=1} )::posint:
        return a*test1(a, ':-b' = b);
end proc:

test2(2, 'b'=3);

10

restart;

b := 17:

test1:=proc(a::posint, {b::posint:=1})::posint:
        return a + b:
end proc:

test2:=proc(a::posint, {b::posint:=1} )::posint:
        return a*test1(a, :-b = b);
end proc:

test2(2, 'b'=3);

6

Download colondash.mw

ps. The second bullet point on the Help page for topic colondash describes this meaning. Unfortunately that page's Examples section doesn't include a terse but easily understandable example of this situation. Yours is a common question.

@Joe Riel I suppose that you are referring to this entry on the mint Help page:

13

"These local variables were used but

 

never assigned a value:"

 

 

 

Indicates that a local variable's value was used,

 

but that no value was ever assigned to it,

 

suggesting a coding error.

 

Note that if a variable is intended to be used only

 

as a symbol in a procedure, and is not to be assigned,

 

declaring it as type nothing will avoid this error.

First 94 95 96 97 98 99 100 Last Page 96 of 592