Carl Love

Carl Love

18378 Reputation

24 Badges

7 years, 301 days
Mt Laurel, New Jersey, United States
My name was formerly Carl Devore.

MaplePrimes Activity

These are replies submitted by Carl Love

From your writing, it seems that you have some Maple code that you want to modify. Please post that code.

@vv You need to reinitialize Pab in ModuleApply. If you don't, then your code will only work on its first run.

@janhardo Your problem is that a white surface is still opaque. Try this: Change the command defining the grid to

rooster:= plot3d(
      0, x= 0..2, y= 0..2, grid= [3,3], style= wireframe, 
      color= COLOR(RGB, .15$3), thickness= 0

The color option in my command specifies the color of the gridlines. The spaces in between are transparent and uncolored.

I think in another Question you said that you're using Maple 13. Is that correct? I don't know if Maple 13 has events. Is there a help page for it?

@Axel Vogt Perhaps. But it's well known and documented that (1) remember tables don't work with mutable containers, and (2) more importantly, that sum shouldn't be used with indexable structures. At ?sum, we read

  • [I]t is strongly recommended that the add command be used in programs if an explicit sum is needed, in particular, when summing over all elements of a list, Array, Matrix, or similar data structure.

@janhardo Okay, if you want an arrow procedure without piecewise, you can do this:

h:= x-> `if`(x::numeric, sin(`if`(x > 0, 1/3, 3)*x), 'procname'(x)):

This, as well as the other examples in this thread, will work in older Maple, such as Maple 6.

@johnksellers The command kernelopts(wordsize) will tell you which type you have.

Your Question has no attached files.

@nm Sorry, you're right about the evaluation order. My Answer is nonsense.

@janhardo I'm not sure what you're asking, but a procedure can return any number of values:

Simple:= proc() return 1, 2, 3 end proc;
a, b, c:= Simple():

If this is what you mean by "split", then yes, when a procedure returns multiple values, they can be split. But the number of variables on the left side of := needs to be either 1 or exactly the same number of values as the procedure returns.

I always put multiple return values in parentheses for clarity:

Simple:= proc() (1,2,3) end proc: #"return" is optional.
(a, b, c):= Simple();

@jalal I realize that this is problematic because of the variation of scaling, but it does allow exportation as a GIF:

    seq(PlotExample(LSKoch, a), a= 1..5),
    insequence, axes= boxed, tickmarks= [0,0]


It would be possible to fix the scaling, but it may be easier to reprogram it from scratch, akin to this Koch snowflake animation that I wrote a while ago:


N:= 6: #number of iterations

#Rotate point P by angle theta around point Q:
Rot:= theta-> (P,Q)->
    local s:= sin(theta), c:= cos(theta):
    (P-Q).<c, s; -s, c> + Q

Rot120:= Rot(2*Pi/3): #the only rotation angle that we need

#Select a point on line segment PQ:
BetweenPt:= (P,Q,r)-> P*(1-r) + Q*r:

#Replace line segment __ with _/\, i.e., put a notch in the middle:
Notch:= (P,Q)->
    local P1:= BetweenPt(P,Q,1/3);
    (P, P1, Rot120(P,P1), BetweenPt(P,Q,2/3))

Pts[1]:= <seq(<cos(2*Pi/3*k) | sin(2*Pi/3*k)>, k= 0..3)>:

for k to N do
        <seq(Notch(Pts[k][j], Pts[k][j+1]), j= 1..3*4^(k-1)), <1|0>>

   seq(plot(Pts[k])$9, k= 1..N+1), insequence,
   thickness= 0, scaling= constrained, axes= none

SegmentLength:= n-> 3^(3/2-n):

SegmentCount:= n-> 3*4^(n-1):

Perimeter:= n-> 3^(5/2-n)*4^(n-1):

Area:= n-> 3^(1/2)*(6-(4/9)^(n-2))/5;






@janhardo When the returned value of a procedure appears immediately before (or on the line immediately before) the end proc, then it's not necessary to explicitly use the word return; it's optional, and a great many Maple programmers omit it. However, some believe in always using it for clarity.

@jalal I meant

Explore(PlotExample(LSKoch, a), a= 1..5, animate);

@nm Yes, certainly a mess can be made from this, and my procedure doesn't check for numerous invalid forms. The only benefit that I see from this is that it allows many problems to be entered in a form somewhat equivalent to how they appear in source materials, to wit:

F(x,y)dx + G(x,y)dy = 0


F(x,y(x))*D(x) + G(x,y(x))*D(y(x)).

It's a purely syntactic transformation---no algebra required.

And note that D(x), D(y(x)), etc., is already valid Maple syntax, even though it doesn't really mean anything to Maple. 

@nm Surely I could write a little procedure (I'm thinking 10 lines or less) that converted from the OP's form to Maple's standard form. The form 

F(x,y)dx + G(x,y)dy = 0 

is standard for some textbook problems, so it's quite reasonable for CAS to support it.

5 6 7 8 9 10 11 Last Page 7 of 533