acer

32358 Reputation

29 Badges

19 years, 331 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@nMaple In Maple 2015 you can programmatically embed an inlined plot with a given width, height, scale (zoom), and pan (x- or y-offset).

But you cannot subsequently adjust those qualities programmatically, after it gets embedded.

I have previously submitted a Software Change Request that the scale and pan (as well as the rotation angles and projection for 3D plots) become new properties of the PlotComponent.

@nMaple Using Embedded Components you can programmatically change the delay (in millisec) between frames.

There is no facility in Maple 17 to programmatically change the plot "scale" or "pan".

Attached is a worksheet that uses a command to set an animation playing in an Embedded Component. There are commands shown to change whether it loops, and to change the frame delay mentioned above.

There is also a Slider, the "action" code for which also sets the Plot component's animation delay value.

See the relevan help pages for more information on Embedded Components.

animobj.mw

Are you trying to export from a 3D plot with only orientation=[-90,0,0], or do you need some other orientation?

acer

@nMaple Yes, you could use N individual procedures P[i], as there are lots of ways to accomplish your task. I don't understand why you really want that, though.

But somehow you'll get to the value of i into the procedure(s).

You could burn the values of R1, R2, Z2, and Z2 into N different procedures. objvar1.mw

Or you could keep their references unresolved until the procedures are called. objvar2.mw

I can think of several other ways, as well. For example you could have a single procedure P that examing its own procname and pulled on whatever index value (for you, i) had been passed. I won't bother to code that up.

All of these seem more awkward to program, to me, or harder to explain to you, or wasteful of resources.

This isn't all about programming graphics in Maple. It's about programming in general. So you could try learning from the Programming Manual.

 

That reply I just made above, objnew.mw, will work. But it could be more efficient since the definition of procedure P can be outside the loop. And it needs to be, if the earlier remember table assignments are not to be clobbered.

This should be faster,

objnewer.mw

Notice also the I used the smaller `grid` values, as in my original Answer.

 

@bacalfa You have specified that Maple use those versions of `+`, etc, by loading that package.

And it does make a difference. With it loaded then expressions with mixed units will have them combined automatically when they are added together, etc.

If you did not discover this aspect of the behaviour then why do you insist on loading that package?

@nMaple I forgot that you were running Maple 17, sorry.

Change the appropriate line to,

h := Z->plots:-display(`if`(Z>10,fB(min(Z,20)),NULL),
                       `if`(Z>5,fC(min(Z,10)),NULL),
                       `if`(Z>0,fA(min(Z,5)),plot3d([[0,0,0]],h=0..1,phi=0..Pi)),
                       axes = normal, scaling = constrained):

@want to be a permanent vegan Use Comments on the original Question to add additional information, or else if the question point has not significantly changed then a new, duplicate Question may get flagged for removal (as a Duplicate).

Reposting because nobody's answered the original is just spamming.

@want to be a permanent vegan Why are you spamming this site with multiple posts on the same question?

@nMaple Maple will export such animations as animated .gif files. You can do that by right-clicking on the plot, or with some programmatic commands.

Here is leaner code. It executes faster, saves to a much smaller file, and is a bit less hard on the poor Java GUI. The idea is that each of the three pieces is a surface which is linear in z. So the plot3d calls only need to use a value of 3 for the grid, in that dimension.

restart;

fA := Z->plot3d([2*cos(phi), 2*sin(phi), z], z = 0 .. Z, phi = 0 .. 2*Pi,
                style=surface, orientation=[-180,70,30], grid=[3,41]):

# Now force the highest value that matters into fA and store that in
# fA's remember table. This makes `h` not have to compute fA when Z>5.

fA(5) := fA(5):

fB := Z->plot3d([8*cos(phi), 8*sin(phi), z], z = 10 .. Z, phi = 0 .. 2*Pi,
                style=surface, orientation=[-180,70,30], grid=[3,41]):

# Now force the highest value that matters into fB and store that in
# fB's remember table. This makes `h` not have to compute fC when Z>20.

fB(20) := fB(20):

fC := Z->plot3d([(2+6*((z-5)*(1/5)))*cos(phi),
                 (2+6*((z-5)*(1/5)))*sin(phi), z],
                 z = 5 .. Z, phi = 0 .. 2*Pi,
                 style=surface, orientation=[-180,70,30], grid=[3,41]):

# Now force the highest value that matters into fC and store that in
# fC's remember table. This makes `h` not have to compute fC when Z>10.

fC(10) := fC(10):

h := Z->plots:-display(`if`(Z>10,fB(min(Z,20)),NULL),
                       `if`(Z>5,fC(min(Z,10)),NULL),
                       `if`(Z>0,fA(min(Z,5)),plot3d([[0,0,0]])),
                       axes = normal, scaling = constrained):

# A first way: produce a sequence of plots and display with insequence option.

S := CodeTools:-Usage( seq( h(t), t=0..20, 0.5 ) ):

memory used=8.20MiB, alloc change=32.00MiB, cpu time=577.00ms, real time=707.00ms, gc time=31.20ms

# This forms an animation structure. We could display it right away,
# or we could assign it to a name (such as K) and display that later.

K := plots:-display( S, insequence ):
op([1,0],K);

ANIMATE

K;

# A second way: Let the plots:-animate command do both steps above.
# And, again, we could assign it to a name (such as A) and display that later.

A := CodeTools:-Usage( plots:-animate( h, [t], t=0..20, frames=41 ) ):
op([1,0], A);

memory used=10.62MiB, alloc change=0 bytes, cpu time=437.00ms, real time=891.00ms, gc time=0ns

ANIMATE

A;

 


Download athing2.mw

 

@nMaple Please let me know or not, whether this is the kind of thing you want to do.

(This file is 25MB, since it has the 40 frame animation saved from two methods.)


restart;

fA := Z->plot3d([2*cos(phi), 2*sin(phi), z], z = 0 .. Z, phi = 0 .. 2*Pi,
                style=surface, orientation=[-180,70,30]):

# Now force the highest value that matters into fA and store that in
# fA's remember table. This makes `h` not have to compute fA when Z>5.

fA(5) := fA(5):

fB := Z->plot3d([8*cos(phi), 8*sin(phi), z], z = 10 .. Z, phi = 0 .. 2*Pi,
                style=surface, orientation=[-180,70,30]):

# Now force the highest value that matters into fB and store that in
# fB's remember table. This makes `h` not have to compute fC when Z>20.

fB(20) := fB(20):

fC := Z->plot3d([(2+6*((z-5)*(1/5)))*cos(phi),
                 (2+6*((z-5)*(1/5)))*sin(phi), z],
                 z = 5 .. Z, phi = 0 .. 2*Pi,
                 style=surface, orientation=[-180,70,30]):

# Now force the highest value that matters into fC and store that in
# fC's remember table. This makes `h` not have to compute fC when Z>10.

fC(10) := fC(10):

h := Z->plots:-display(`if`(Z>10,fB(min(Z,20)),NULL),
                       `if`(Z>5,fC(min(Z,10)),NULL),
                       `if`(Z>0,fA(min(Z,5)),plot3d([[0,0,0]])),
                       axes = normal, scaling = constrained):

# A first way: produce a sequence of plots and display with insequence option.

S := CodeTools:-Usage( seq( h(t), t=0..20, 0.5 ) ):

memory used=10.28MiB, alloc change=32.00MiB, cpu time=952.00ms, real time=1.15s, gc time=31.20ms

# This forms an animation structure. We could display it right away,
# or we could assign it to a name (such as K) and display that later.

K := plots:-display( S, insequence ):
op([1,0],K);

ANIMATE

K;

# A second way: Let the plots:-animate command do both steps above.
# And, again, we could assign it to a name (such as A) and display that later.

A := CodeTools:-Usage( plots:-animate( h, [t], t=0..20, frames=41 ) ):
op([1,0], A);

memory used=12.70MiB, alloc change=2.64MiB, cpu time=1.09s, real time=1.32s, gc time=0ns

ANIMATE

A;

 


Download athing1.mw

@nMaple I'm pretty sure that you misunderstood my meaning, or at best misapplied the idea I was trying to convey.

That name is a bit unusual. It seems to be `Νu` rather than just Nu, so I assigned it to `var` to avoid cut&paste issues, etc.

@nMaple In Maple 17 you could try it as, say,

A := plot3d([2*cos(phi), 2*sin(phi), z], z = 0 .. 5, phi = 0 .. 2*Pi):

B := plot3d([8*cos(phi), 8*sin(phi), z], z = 10 .. 20, phi = 0 .. 2*Pi):

C := plot3d([(2+6*((z-5)*(1/5)))*cos(phi), (2+6*((z-5)*(1/5)))*sin(phi), z],
             z = 5 .. 10, phi = 0 .. 2*Pi):

plots[display](A, B, C, axes = normal, scaling = constrained,
               style=surface, glossiness=1.0, lightmodel=Light4);
First 316 317 318 319 320 321 322 Last Page 318 of 592