# MaplePrimes Questions

Search Questions:

## Latest Questions Latest Questions Feed

### the use of seq() vs. map, general guidelines when ...

August 22 2014
1 7

I am learning a bit of Maple. I noticed I can use map and seq to obtain the same result I want. So I was wondering when to use each, or if it just a style issue or if there is more to it.

I am sure there are cases when map can only be used, and cases when seq() only can be used. But are there general rules of thumb to look for when deciding which to use? Here is an example of what I mean

restart;
plot( map(i->i*sin(t),[seq(i,i=.1..1,.2)]),t=-2*Pi..2*Pi);   #1
plot( [seq(i*sin(t),i=.1..1,.2)],t=-2*Pi..2*Pi);  #2

Both give the same result

I kind'a like map more myself, but seq is a little shorter in this case. Just looking for thoughts and hints from the experts.

### why F3 (split execution group) not smart enough to...

August 21 2014
0 3

One would expect that hitting F3 will split from _end_ of the current line (where the cursor is at).

But what Maple does is actually split everything from the current cursor location. Which means if the cursor happened not to be exactly at the end of the line, the current line itself will also be split and broken.

It is much more logical to split starting from end of current _line_ (where the cursor is at), not current character, because that is what normally one would want to do. One will have large block of code, and want to split it from one line down to the end.  It is a simple usability issue, which Maple UI seems to suffer allot from.

Is there a way to modify this behavior? I keep hitting F3 and forget to move the cursor to the end of the line before, and end up wasting time having to fix things afterwords since the line itself is split.

### How to plot response of more than one system in sa...

August 21 2014
0 3

This is a typical problem of what I find when learning DynamicSystems. Basically, I create number of systems by changing one paramter (the damping ratio in this case) and want to plot the unit step of all of them on the same plot to compare the effect of the damping ratio.

I setup the TransferFunction, used Simulate to obtain the response of each to the same input. The problem comes when I want to plot the respones.  I have to use plot[odeplot] it seems. But this only like to take one response at a time.

I can't use plot() since I do not have the actual function of the response in time. Unless I try to extract the differential equation from the sytem object, solve that and get a solution then use plot(). But if I do all of this, what do I need DynamicSystems in first place?

I will show what I tried. I am sure there is some way to do this in Maple I just do not know yet the correct function or setup.

restart;
alias(DS=DynamicSystems);
H:=(w,zeta)->w^2/(s^2+2*zeta*w*s+w^2);
sys:= (w,zeta)->DS:-TransferFunction(H(w,zeta)):
sol:=seq(DS:-Simulate(sys(1,zeta),Heaviside(t)),zeta=0.1..1.2,.2):

Now I want to plot all the solutions in sol. I wanted to use plot(...) only to be able to obtain the automatic coloring of each solution.

If I try to use plots[odeplot], it works, but only on one at a time:

plots[odeplot](sol[1],t=0..10);

If I try this, it fails:

plots[odeplot]([sol],t=0..10);

I can get each plot separatly and then use display() but then lose the automatic coloring of the lines:

plots:-display(seq(plots[odeplot](sol[i],t=0..10),i=1..nops([sol])));

I am looking for the above plot, but have the lines each colors differently. I also need to figure how to add legend later. But one step at a time. I can't hard code the color in the plots[odeplot] call itself, since I do not know what color to give each line. plot([....],t=0..) allready does this automatically. But I can't use it!

Just to give an idea of the kind of plot I am trying to obtain, here it is in Mathematica:

sys = TransferFunctionModel[w^2/(s^2 + 2 z*w*s + w^2), s];
zValues = Range[.2, 1.2, .2];
fun = OutputResponse[sys /. {w -> 1, z -> #}, UnitStep[t], {t, 0, 12}] & /@ zValues;
Plot[Evaluate@Flatten@Table[fun[[i]], {i, 1, Length[fun]}], {t, 0, 12}, Frame -> True, PlotRange -> {{0, 12}, {-.1, 1.7}}]

### How to calculate this hard integral?...

August 21 2014
0 6

How to calculate the integral of (z-z0)*z/sqrt((x-x0)^2+(y-y0)^2+(z-z0)^2)
over the unit sphere {(x,y,z):x^2+y^2+z^2<=1}
under the assumtion x0^2+y0^2+z0^2<=1 (x0^2+y0^2+z0^2>1)?
Its physical interpretation suggests the integral can be expressed through  elementary functions of the parameters.

My tries are
VectorCalculus:-int((z-z0)*z/sqrt((x-x0)^2+(y-y0)^2+(z-z0)^2),[x,y,z]=Sphere(<0,0,0>,1)) assuming x0^2+y0^2+z0^2<=1;

and

VectorCalculus:-int(eval((z-z0)*z/sqrt((x-x0)^2+(y-y0)^2+(z-z0)^2),
[x=r*sin(psi)*cos(theta),y=r*cos(psi)*sin(theta),z=r*cos(psi)])*r^2*sin(psi),
[r,psi,theta]=Parallelepiped(0..1,0..Pi,0..2*Pi)) assuming x0^2+y0^2+z0^2<=1;

The both are spinning on my comp. Also

VectorCalculus:-int((z-1/4)*z/sqrt((x-1/2)^2+(y-1/3)^2+(z-1/4)^2),[x,y,z]=Sphere(<0,0,0>,1),numeric);

is spinning.
Edt. The omitted part of the code assuming x0^2+y0^2+z0^2<=1 is added.

### Integral problem with maple...

August 21 2014
1 9

I have a great problem with this integral and Maple gives two answers completely different:

so I get two different results :

or this:

In the first integral A get Lommels2 and If I get the Integral by using Taylor of  and after that I resum I get Lommels1.

Thank you.

### Partial Differential...

August 21 2014
1 2

Hi All,

I have a problem with regard to partial differential equations. I am using Lagrangian dynamics for a problem. First i have a function First i defined a function with two speeds of angles (first derivatives):

ODE := 5*(diff(theta1(t), t))+diff(theta2(t), t). This gives:

Now this gives an output. Lagrange (just a simple example now) demands that i now derive the obtained function with regard to the first derivative of theta1. In this case, the answer i want is 5. Now, if i give the command:

diff(ODE, diff(theta1(t),t)), maple says go home. Does anybody know how to solve this? I have been searching for a solution all afternoon.

### Reordering the columns of a 2 by n matrix by angle...

August 21 2014
1 15

I'm trying to write an algorithm that arranges the columns of an arbitrary 2xn matrix counter-clockwise starting at the point closest to (1,0). For example, when I input the matrix

Q := Matrix([

[ -1 ,  0 ,   0 , -1 ]
, [  0 ,  1 ,  -1 ,  0 ]

]);

into the algorithm, I would like the output to be

R := Matrix([

[  0 , -1 , -1 ,   0 ]
, [  1 ,  0 ,  0 ,  -1 ]

]);

Is there any package that could help me with this?

### nonlinear equations can't be solved by fsolve...

August 21 2014
0 4

three equations,

f1=(256*((256*(-24610976415716501050652227*x+256*(-10153609683556422184100+374519398571124540883*y-4145573659500944095488*z))*(29427736469514379027531261659072347+58899562724319710108573382000184640*y-1732944474195510410991057714955859184*z))/((5042560366642267*x-256*(2446745837411900+4901398098088043*y-144207654645973248*z))^3)-(256*(-308518681989548429992935348850261+41445095210006425938788783390458*y-1638970396838251453451269879637336*z)*(-801790542801929135637671-732048260009923946735424*x+56975701334774517040256*y-187552638032246240630656*z))/((-3075770275504817+198931044892562752*x+14199788245258112*y-1122852841901814912*z)^3)+(5*(-89303793175477833893354121208000+6533090911353242906294143748495*y-32276910383172707359896832089932*z)*(-61468981380127448102256-5328427636421850183140*x+4647710007810227520885*y-13344414478836548348450*z))/((-46366672189358032-18896234711237580*x+3927118781169095*y+14705346416259850*z)^3)-(3*(9101665097092871812176+3063507166600182944940*x+6945927557350563805665*y+1052001549322007294950*z)*(19493858980629008651267653094056+93282964805436900100617577630195*y+42271355681070699741325611572830*z))/((46366672189358032+18896234711237580*x-3927118781169095*y-14705346416259850*z)^3)-(4*(39553725461800043367392+17203831108841472538824*x+45483386678520344593037*y+2703260049547565568088*z)*(52830583937680669669892057655944+303023948138837354463602341532495*y+134962043561465977901954677856080*z))/((92856945980914656+51329763147513032*x-8586501277743859*y-56199770659759016*z)^3)-((22670037111266004087968+12461845278544574559640*x+39219302812923818032157*y-46563087562792926056*z)*(95973949246309465842551069546976+723429769797021053206211106031819*y+317530466286898645427564085427048*z))/((50159316775994592+36243094308305160*x-4827156544231217*y-52318895858217464*z)^3)-(80*(4157117722725769078952+4534359335248895646832*x+26193979470458655189977*y-2382852476120229696128*z)*(205429639975670471114284923188348+2095815907391732802212116237430935*y+883539023887333564964405237094400*z))/((45070329471431608+130124049256651728*x-5583613021604317*y-387630670566282112*z)^3)-(16*(9439334964924689507817+17499514376929345709248*x+187907876794815451253888*y-21704870055089718153088*z)*(943164674716649969807523653958385+18130967224506023673179633045358720*y+7486136216172114262568716503454336*z))/((-3075770275504817+198931044892562752*x+14199788245258112*y-1122852841901814912*z)^3)+(80*(2304705299858575630109*x-256*(204828849006588248100+19508530860149228990861*y-2445924471668591306496*z))*(-179928369646271075844345534739549+3401432279430696137250330740801392*y+12500875943051297916024009205116096*z))/((5042560366642267*x-256*(2446745837411900+4901398098088043*y-144207654645973248*z))^3)+(80*(-805507884940017483975376678503744+52529278437993151034132605337909*y-620040027953848498781390188900552*z)*(-716026618045942942760*x+243780804476456624597*y-8*(408351630952413337484+89777022692195474597*z)))/((-50159316775994592-36243094308305160*x+4827156544231217*y+52318895858217464*z)^3)+(768*(61889933231497708820968+30294916915069669525488*x-4484037822343607626207*y+13934625423713945278848*z)*(16858970779944867265671037333379*y-176*(1546216290476124632111328928258+3134171189636832381705249359145*z)))/((45070329471431608+130124049256651728*x-5583613021604317*y-387630670566282112*z)^3)-(40*(1717566388539311579248*x+7025931019459451548321*y+48*(46537098413809906919-8301700878138964680*z))*(3434616943638241443585000648954199*y+320*(1107265969195848092307625165761+4643932844541992753284837619195*z)))/((85141430232132048+97951351741329392*x-8855616621991191*y-199920422688690560*z)^3)+(12*(88457226224862447127008+13504083955712971035976*x-6622138801690554356387*y+19322683651036147287512*z)*(36451820000039413375829754767131*y-8*(66864837166560711793644210325852+35619205657210451197984743698883*z)))/((92856945980914656+51329763147513032*x-8586501277743859*y-56199770659759016*z)^3)+(512*(45619694076424722199344+14936846773318822792976*x-3365788117861218576473*y+10130491989577935272320*z)*(12048859085295019197936041733505*y-6*(32519187452933223586671104614156+40471151781636260063426632487709*z)))/((85141430232132048+97951351741329392*x-8855616621991191*y-199920422688690560*z)^3)))/125;
f2=(128*((32768*(24610976415716501050652227*x-256*(-10153609683556422184100+374519398571124540883*y-4145573659500944095488*z))*(98990697209366584150952278657452+920305667567495470446459093752885*x-65799721166407263195366683527104*z))/((5042560366642267*x-256*(2446745837411900+4901398098088043*y-144207654645973248*z))^3)+(1024*(-10864227594859409007678067839115+566592725765813239786863532667460*x-3214793226869529893757297514562848*z)*(9439334964924689507817+17499514376929345709248*x+187907876794815451253888*y-21704870055089718153088*z))/((-3075770275504817+198931044892562752*x+14199788245258112*y-1122852841901814912*z)^3)+(40*(2938923392457131154149055759247753+8383263629566931208848464949723740*x-24821520393182477390523323699174560*z)*(4157117722725769078952+4534359335248895646832*x+26193979470458655189977*y-2382852476120229696128*z))/((45070329471431608+130124049256651728*x-5583613021604317*y-387630670566282112*z)^3)+(80*(1717566388539311579248*x+7025931019459451548321*y+48*(46537098413809906919-8301700878138964680*z))*(3017477155357435955713408172820441+3434616943638241443585000648954199*x-6875761229715351344214913955270620*z))/((85141430232132048+97951351741329392*x-8855616621991191*y-199920422688690560*z)^3)+(2*(1013986939222028224203834326214704+723429769797021053206211106031819*x-1002019231842824621894736024449560*z)*(22670037111266004087968+12461845278544574559640*x+39219302812923818032157*y-46563087562792926056*z))/((50159316775994592+36243094308305160*x-4827156544231217*y-52318895858217464*z)^3)+(2*(698833722744934775627393528218146+279848894416310700301852732890585*x-191427609122898840477329914007915*z)*(9101665097092871812176+3063507166600182944940*x+6945927557350563805665*y+1052001549322007294950*z))/((46366672189358032+18896234711237580*x-3927118781169095*y-14705346416259850*z)^3)+(8*(557016173590538671691101855964863+303023948138837354463602341532495*x-309197308873592242001670976702725*z)*(39553725461800043367392+17203831108841472538824*x+45483386678520344593037*y+2703260049547565568088*z))/((92856945980914656+51329763147513032*x-8586501277743859*y-56199770659759016*z)^3)-(128*(-57335208466953058729715954197164+96390872682360153583488333868040*x-372364031472286149332017066304111*z)*(45619694076424722199344+14936846773318822792976*x-3365788117861218576473*y+10130491989577935272320*z))/((85141430232132048+97951351741329392*x-8855616621991191*y-199920422688690560*z)^3)-(5*(-5058036108182894712997605343704+13066181822706485812588287496990*x-23584235630998237996607750176151*z)*(61468981380127448102256+5328427636421850183140*x-4647710007810227520885*y+13344414478836548348450*z))/((46366672189358032+18896234711237580*x-3927118781169095*y-14705346416259850*z)^3)-(256*(-35027435322808897803896166913833+101153824679669203594026224000274*x-443348667941077090029000877418626*z)*(61889933231497708820968+30294916915069669525488*x-4484037822343607626207*y+13934625423713945278848*z))/((45070329471431608+130124049256651728*x-5583613021604317*y-387630670566282112*z)^3)-(24*(-23539469566855513950637813409344+36451820000039413375829754767131*x-87577625291530403453057402554096*z)*(88457226224862447127008+13504083955712971035976*x-6622138801690554356387*y+19322683651036147287512*z))/((92856945980914656+51329763147513032*x-8586501277743859*y-56199770659759016*z)^3)-(112*(97743545586690977941666831119873+189463292388600804291605866927808*x-534599264249120709692835475330432*z)*(801790542801929135637671+732048260009923946735424*x-56975701334774517040256*y+187552638032246240630656*z))/((-3075770275504817+198931044892562752*x+14199788245258112*y-1122852841901814912*z)^3)-(2560*(2304705299858575630109*x-256*(204828849006588248100+19508530860149228990861*y-2445924471668591306496*z))*(-29205293090710790323990469408790736+212589517464418508578145671300087*x+1750806894610755007047140949242022912*z))/((5042560366642267*x-256*(2446745837411900+4901398098088043*y-144207654645973248*z))^3)-(160*(3266813047619306699872+716026618045942942760*x-243780804476456624597*y+718216181537563796776*z)*(52529278437993151034132605337909*x-4*(8646336391489439377118003754263+39602745269819371968458588313429*z)))/((50159316775994592+36243094308305160*x-4827156544231217*y-52318895858217464*z)^3)))/125;
f3=(128*((-24576*(3839508863935892182987929073642496+36103009879073133562313702394913733*x-87732961555209684260488911369472*y)*(24610976415716501050652227*x-256*(-10153609683556422184100+374519398571124540883*y-4145573659500944095488*z)))/((5042560366642267*x-256*(2446745837411900+4901398098088043*y-144207654645973248*z))^3)-(30720*(65108728870058843312625047943313*x-256*(4791937744017588738333042319232+569924119339438478856491194414721*y))*(2304705299858575630109*x-256*(204828849006588248100+19508530860149228990861*y-2445924471668591306496*z)))/((5042560366642267*x-256*(2446745837411900+4901398098088043*y-144207654645973248*z))^3)+(256*(650985307933227267490679218098413+935767027021514282821089562931792*x+12859172907478119575029190058251392*y)*(9439334964924689507817+17499514376929345709248*x+187907876794815451253888*y-21704870055089718153088*z))/((-3075770275504817+198931044892562752*x+14199788245258112*y-1122852841901814912*z)^3)+(1280*(114748411888321695540849692963124+110442377985916695620550654636800*x+775672512286952418453853865599205*y)*(4157117722725769078952+4534359335248895646832*x+26193979470458655189977*y-2382852476120229696128*z))/((45070329471431608+130124049256651728*x-5583613021604317*y-387630670566282112*z)^3)+(1600*(100744894915663705876272277122960+74302925512671884052557401907120*x+343788061485767567210745697763531*y)*(1717566388539311579248*x+7025931019459451548321*y+48*(46537098413809906919-8301700878138964680*z)))/((85141430232132048+97951351741329392*x-8855616621991191*y-199920422688690560*z)^3)+(16*(72249495731635781189477972681776+39691308285862330678445510678381*x+125252403980353077736842003056195*y)*(22670037111266004087968+12461845278544574559640*x+39219302812923818032157*y-46563087562792926056*z))/((50159316775994592+36243094308305160*x-4827156544231217*y-52318895858217464*z)^3)+(640*(505227745581172894057712966825000+155010006988462124695347547225138*x-39602745269819371968458588313429*y)*(3266813047619306699872+716026618045942942760*x-243780804476456624597*y+718216181537563796776*z))/((50159316775994592+36243094308305160*x-4827156544231217*y-52318895858217464*z)^3)+(2*(356681541401645116923690413208956+126814067043212099223976834718490*x+191427609122898840477329914007915*y)*(9101665097092871812176+3063507166600182944940*x+6945927557350563805665*y+1052001549322007294950*z))/((46366672189358032+18896234711237580*x-3927118781169095*y-14705346416259850*z)^3)+(8*(301993014170585471859024964195112+134962043561465977901954677856080*x+309197308873592242001670976702725*y)*(39553725461800043367392+17203831108841472538824*x+45483386678520344593037*y+2703260049547565568088*z))/((92856945980914656+51329763147513032*x-8586501277743859*y-56199770659759016*z)^3)+(128*(4874430224431350455160317539284048+1942615285518540483044478359410032*x-372364031472286149332017066304111*y)*(45619694076424722199344+14936846773318822792976*x-3365788117861218576473*y+10130491989577935272320*z))/((85141430232132048+97951351741329392*x-8855616621991191*y-199920422688690560*z)^3)+((1486971442137244004077030949061728+322769103831727073598968320899320*x-117921178154991189983038750880755*y)*(61468981380127448102256+5328427636421850183140*x-4647710007810227520885*y+13344414478836548348450*z))/((46366672189358032+18896234711237580*x-3927118781169095*y-14705346416259850*z)^3)+(512*(3005184872892536482128059816733656+1654842388128247497540371661628560*x-221674333970538545014500438709313*y)*(61889933231497708820968+30294916915069669525488*x-4484037822343607626207*y+13934625423713945278848*z))/((45070329471431608+130124049256651728*x-5583613021604317*y-387630670566282112*z)^3)+(192*(137644881571986015841084811827840+35619205657210451197984743698883*x-10947203161441300431632175319262*y)*(88457226224862447127008+13504083955712971035976*x-6622138801690554356387*y+19322683651036147287512*z))/((92856945980914656+51329763147513032*x-8586501277743859*y-56199770659759016*z)^3)+(64*(13728575451141247570683309821008705+13111763174706011627610159037098688*x-935548712435961241962462081828256*y)*(801790542801929135637671+732048260009923946735424*x-56975701334774517040256*y+187552638032246240630656*z))/((-3075770275504817+198931044892562752*x+14199788245258112*y-1122852841901814912*z)^3)))/125;

### How to count the same random sequence as one...

August 21 2014
0 6

RandomCompositions:= proc(n::posint, k::posint)
local
C,
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))],
Rand:= rand(1..nops(Compositions))
;
()-> Compositions[Rand()]
end proc:

R:= RandomCompositions(9,6):
n:= 10:
S:= 'R()' \$ n;

S := [4, 1, 1, 1, 2, 0], [3, 2, 1, 1, 0, 2], [0, 1, 1, 0, 0, 7], [0, 1, 1, 5, 0, 2], [1, 0, 3, 1, 3, 1],

[1, 3, 1, 1, 0, 3], [1, 4, 2, 0, 2, 0], [5, 0, 0, 3, 1, 0], [1, 1, 1, 4, 0, 2], [0, 1, 2, 1, 0, 5]

[4, 1, 1, 1, 2, 0] , [1, 1, 1, 4, 0, 2]  and [0, 1, 1, 5, 0, 2] , [0, 1, 2, 1, 0, 5]  are same number

but different order.

There are two same sequence. I want to  count  as one, and compile statistics the summation, and

divide by 8.

the result

0=14/8

1=17/8

2=6/8

...

4=2/8

5=2/8

...

### interface(showassumed=0); has no effect on removin...

August 21 2014
1 12

according to

http://www.maplesoft.com/support/faqs/detail.aspx?sid=32658

But the above does not work in Maple 18, windows: (I use worksheet)

restart;
assume(z>0):
interface(showassumed=0):
z;

Only the other solution works, which is using options->display->turnoff assumed variables tilda.

Why does not the above command work?

August 21 2014
6 24

I do not like to load a package using with() and then use its commands and functions, since I then lose track knowing from which package a function or command being used in the code came from when I look at the code later on. So I like to write

pkg:-f() or pkg[f]() instead of with(pkg); f()

This seems to work most of the time, except I just found a case where I am forced to do with(pkg) at the top. Here is the example. I'd like to know if there is a workaround where I can avoid with(pkg) in this case as well:

restart;
f:=t->piecewise(t<0,0,t>=0 and t<z,t,t>z,z):
r:=convert(f(t),Heaviside):
r:=inttrans[laplace](r,t,s);

Now since Maple does not know what z is, it could not fully evaluate the result above (I can handle this with assumptions, but this is just an example). So now I replaced z by 0.5, but since laplace is not loaded, it still could not do it:

r:=subs(z=0.5,r);

So now I had to load the package, just to simply the above expression:

with(inttrans);
r;

This all becuase the expression earlier was left with only "laplace" in it, and not "inttrans[laplace]" as I typed. (why this happend, I do not know).

My question is: How would you do the above, without loading the package? I really do not like loading packages as I said, and like to keep the name of the package attached to each function to help me know where each function is coming from.

### how to adjust the aspect ratio of plots in Maple?...

August 20 2014
0 3

How does one adjust the aspect ratio for Maple plot? I actually searched for aspect ratio for Maple on google and not able to find much of anything. Help does not have such phrase. May be it called something else in Maple? The reason I ask, is that when I change the size of bode plot, the aspect ratio become bad. So I need a way to adjust that. Here is an example

restart:
alias(DS=DynamicSystems):
sys:=DS:-TransferFunction(5*s/(s^2+4*s+25)):
DS:-BodePlot(sys,range=0.1..100);

Now if I do

DS:-BodePlot(sys,range=0.1..100,size=[300,"default"]);

I am finding so many problems with Bodeplot in Maple, but this is for another time. I think it needs much more polishing

Maple 18, windows 7

### how to make bodeplot small without having the oute...

August 20 2014
0 2

When I do

restart:
alias(DS=DynamicSystems):
sys:=DS:-TransferFunction(5*s/(s^2+4*s+25)):
DS:-BodePlot(sys,output=dualaxis);

I get nice small plot.  with no outer frame filling the whole window

But if I just do

DS:-BodePlot(sys);

The plot is too large. So I tried the size option, but all what this did is reduce the plot size, but left the outer frame filling the whole window:

DS:-BodePlot(sys,size=[400,300]);

Is there a way to get the above plot, but either without the outer frame, or have the outerframe fit correctly around the plots?

Maple 18 on window 7

### Constructing special matrix...

August 20 2014
1 12

Hi all.

Assume that we have:

where

and assume we  want to construct a special Vector as

and from the above vector construct following matrix

how can we do it?

Best wishes

Ph.D Candidate

Applied Mathematics Department

### how to plot the random statistics ...

August 20 2014
1 5

RandomCompositions:= module()
local
Compositions, Rand,
ModuleApply:= proc(n::posint, k::posint)
local C;
Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))];
Rand:= rand(1..nops(Compositions));
()-> Compositions[Rand()]
end proc
;
end module:
R:= RandomCompositions(8,6):
n:= 3:
S:= 'R()' \$ n;
map(lhs=rhs/n, Statistics:-Tally(op~([S])));

[0 = 7/3, 1 = 5/3, 2 = 4/3, 5 = 1/3, 6 = 1/3]

plot([S],x=0..8,style=point);

I have  plot problem .

I want to plot the statistics result,but it runs error.

 3 4 5 6 7 8 9 Last Page 5 of 1045
﻿