Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi all

I have written the following code in maple to approximate arbitrary functions by hybrid of block-pulse and bernstein functions but it doesn't work properly especially for f(t)=1.0, so what is the matter?

bb1.mws

 


best wishes

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

In using the Maple 17 VectorCalculus package I was suprised to find that the Norm of a free vector is not the same as the Norm of a "corresponding" RootedVector, i.e.the same vector with a different root. Am I missing something ? Thanks for an explanation.

 

restart;
with(VectorCalculus):

P:=<1,2,3>; # free vector
PP:=RootedVector(root=[-1,2,-3],P)

Norm(P);
Norm(PP);

This seems such a simple/basic question I'm almost too embarassed to ask.

Anyway. this is causing me some headaches

 

> A := <0|0>;

         A:= [0 0 ]

> B := A:

> A(1,1) := 2 ;

         A:= [2 0 ]

> B;

         B:= [2 0 ]

What do I do to prevent the elements of B changing if A changes, after using the assignment B:=A (or should I not be using this assignment?)  I mean, I would like the same behaviour as 

> a := 0;

         a:=0

> b := a;

         b:=0

> a := 2;

         a:=2

> b;

         b:=0

which seems to work as I "expect"...

It puzzles me that some of the choices for Clickable Math don't return a result. The image below shows four choices for clickable math. I would like it to "factor" exactly as shown in the upper left choice, but nothing happens after clicking the choice. (No matter how many times I try.) The choices "2D Plot" and "Isolate" return results ("Complete the square", in this case, also does not work).

My guess is that I'm asking it to operate on only the denominator of the rhs of the equation, but then why is the choice displayed at all. I've noticed this for some time in certain cases (like since version 17 was release).

Is there a way to make the choice return a result ? In this case, I don't find an equivalent command (factor, the denominator) using a right click. (In this case, I'll use another command "covert" "parfrac" . . .)

I want Clickable Math to make it easy.

 

Thanks. Cheers !

 

 

I have used the command "op" in a code that I have written with Maple 17. When I restart the maple server and run the whole code again, the result of the "op" command changes! why is this happening?

Phil Yasskin (Texas A&M) has prepared a maplet for the Maplets for Calculus proiect. While this maplet works, in Malmem 18 it sometimes does NOT display the plot. We don't see this behavior in Maple 17, The maplet is attached for your convenience, if you are interested in seeing if it works for you.

HorAsymp-KD-ms-PY3.mw

The problem is difficult to describe. Basically, at the end of the problem, users can elect to see a plot of the function with(some) asymptotes. The code creates the plot when the problem is created, and displays this plot in the worksheet. But, when the plot is requested within the mapmlet, it sometimes does not show in the empty plot window.

Any explanations (or followup quesitons) will be greatly appreciated.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Hi
I am trying to define commutation rules between operators a1, a2, b1, b2.


restart;
with(Physics);
with(Library);
Setup(mathematicalnotation = true);

Setup(op = {a1, a2, b1, b2});
alias(A = %AntiCommutator);
algebra := [A(a1, a1) = 0, A(a2, a2) = 0, A(a1, a2) = 0, A(b2, a1) = 0, A(a1, b1) = 1,
A(a2, b2) = 1];
Se
tup(algebrarules = algebra);

However, the command Setup(algebrarules = algebra); causes an error. What is wrong? Noteworthy that if commutator is considered instead of anticommutator alias(A = %Commutator); then correct result follows.
Thank you.

Hello!

I would like to start with the following set of 9 elements,
A = { E11, E12, E21, E22, E11+E12, E11+E21, E12+E22, E21+E22, E11+E12+E21+E22 }.

I need a procedure that takes each of those elements and creates 3 new ones in the following way: Eij becomes Eij1, Eij2, Eij1+Eij2. So for example, E11 will become: E111, E112, and E111+E112. And for example the fifth element in A (i.e. E11+E12) will become the 3 new elements: E111+E121, E112+E122, and E111+E121 + E112+E122.

Since each of the 9 elements gets triplicated, there will be a new set, call it B, with 27 elements.

B = {E111, E112, E111+E112, E121, E122, E121+E122, ... }

Now I want to repeat this process of triplicating again so that, for example, E111 becomes: E1111, E1112, and E1111+E1112. And so on. This new set C will have 81 elements. Now I want to repeat this one last time. The final set, D, will have 243 (3^5) elements. 

Step 2: 

For every pair of elements x and y in D, I want to compute z:=(x+y)mod2. If z already belongs to D, discard it, otherwise, place z in the set D2. Do this until there are no more elements to add together (note that if x+y is computed then I don't want y+x to be computed also--that's inefficient). Maybe the most efficient way is to perform all possibly combinations of x+y mod 2 to create the set D2 and then just go: D2 setminus D.

Step 3: For x in D and y in D2 perform all possible combinations of z:=(x+y)mod2 and place these in D3 then perform set subtraction again: D3 minus D2 minus D.

Repeat this process again: x in D and y in D3 to create new elements in D4. Repeat again until Dm is empty (that is, D(m-1) will be the last set that contains new elements). I'm expecting around 12 sets... 

The issue with this whole algorithm is that I often run out of memory so I need a clever way to do this, since this algorithm is essentially classifying 2^32 elements into disjoint sets. Thank you! 

When the loop variable can be written as a unit step sequence, I never really distinguish between using

seq( f(i), i=m..n ), and

f(i) $ i=m..n

However I recent came across a case where the 'seq' construct ran about 2.5x faster. Is using 'seq' always faster? Does it depend on the function being evaluated? Why is there such a large difference in execution time

The original example which exhibited the problem is shown below, although after some experimentation, I have found other cases where 'seq' is faster (and plenty where it doesn't seem to make any difference!)

Example code for implementation using '$' is

restart:
ulim:=1000000:
t1:=time():
ans:= max
          ( { iquo(3*d, 7)/d $ d = 1..ulim }
             minus
            {3/7}
         ):
t2:= time()-t1;


Example code for for implementation using 'seq' is

restart:
ulim:=1000000:
t1:= time():
ans:= max
        ( { seq
            ( iquo(3*d, 7)/d, d=1..ulim )
          }
          minus
          {3/7}
        ):
t2:= time()-t1;

On my machine, the version using the 'seq' construct runs 2.5x faster

 

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.

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

 

int(x^-5/3*cos((x-1)*h), x = 0..infinity)

so I get two different results :

 

-(27/8)*h^2+3/2+(27/8)*h^(7/6)*LommelS2(11/6, 1/2, h)

 

or this:

 

-(27/8)*h^2+3/2+(27/8)*h^(7/6)*LommelS1(11/6, 1/2, h)

In the first integral A get Lommels2 and If I get the Integral by using Taylor of cos((x-1)*h) and after that I resum I get Lommels1.

 

Thank you.

 

 

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.

 

Thnx in advance!

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;

thank you in advance.

Here is my code & the error mesage.  What's wrong?

 

with(Statistics);
X := Vector*([0, 5, 10, 15, 20, 25, 30], datatype = float);
Y := Vector*([38.8, 53.8, 82.4, 107.6, 130.7, 152.4, 173.2], datatype = float);
NonlinearFit(av^2+bv+c, X, Y, v);
Error, (in Statistics:-NonlinearFit) invalid input: PostProcessData expects its 1st argument, x, to be of type {array, list, rtable}, but received w

let A be a matrix=

 

[  7        7      9    -17

   6        6      1    -2

 -12    -12    -27    1

   7       7      17   -15 ]

What is the reduced row echelon form of A?

What is the rank of A?

First 215 216 217 218 219 220 221 Last Page 217 of 2218