tomleslie

13876 Reputation

20 Badges

15 years, 167 days

MaplePrimes Activity


These are answers submitted by tomleslie

the attached

  restart;

  c1 := 2.2:c2 := 2.3: c3 := 2.4:A := 1.6:
  EQ1:=diff(f(x),x$4)-c1*diff(g(x),x$2)+R*(diff(f(x),x)*diff(f(x),x$2)-f(x)*diff(f(x),x$3))=0;
  EQ2:=diff(g(x),x$2)+c2*(diff(f(x),x$2)-2*g(x))+c3*(-f(x)*diff(g(x),x)+diff(f(x),x)*g(x))=0;
  BC:=D(f)(-1)=0, D(f)(1)=0,f(-1)=1-A,f(1)=1,g(-1)=0,  g(1)=0;

diff(diff(diff(diff(f(x), x), x), x), x)-2.2*(diff(diff(g(x), x), x))+R*((diff(f(x), x))*(diff(diff(f(x), x), x))-f(x)*(diff(diff(diff(f(x), x), x), x))) = 0

 

diff(diff(g(x), x), x)+2.3*(diff(diff(f(x), x), x))-4.6*g(x)-2.4*f(x)*(diff(g(x), x))+2.4*(diff(f(x), x))*g(x) = 0

 

(D(f))(-1) = 0, (D(f))(1) = 0, f(-1) = -.6, f(1) = 1, g(-1) = 0, g(1) = 0

(1)

  interface(rtablesize=25):
  Rvals:= [0, -1, -5, -7,-50]:
  for j from 1 by 1 to numelems(Rvals) do
      sol:= dsolve
            ( [ eval(EQ1, R=Rvals[j]), EQ2, BC],
               numeric,
               output=listprocedure
            );
      p[j]:= plots:-odeplot
                    ( sol,
                      [ [ x, eval( f(x), sol)(x) ],
                        [ x, eval( diff(f(x),x), sol)(x)],
                        [ x, eval( g(x), sol)(x) ]
                      ],
                      x=-1..1,
                      color=[red, blue, green],
                      title=typeset(" R is ", Rvals[j]),
                      titlefont=[times, bold, 20],
                      legend=[ "f(x", "diff(f(x)", "g(x)"],
                      legendstyle=[font=[times, bold, 16]]
                    );
       M[j]:= Matrix( [ lhs~([sol[1], sol[2], sol[3], sol[6]]),
                      seq( [ eval(x, sol)(k),
                             eval(f(x), sol)(k),
                             eval(diff(f(x),x), sol)(k),
                             eval(g(x), sol)(k)
                           ],
                           k=-1..1, 0.1
                         )
            ]
          );
  od;
  interface(rtablesize=10):

"sol:=[x=proc(x) ... end proc,f(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) f(x)=proc(x) ... end proc,((ⅆ)^2)/(ⅆx^2) f(x)=proc(x) ... end proc,((ⅆ)^3)/(ⅆx^3) f(x)=proc(x) ... end proc,g(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) g(x)=proc(x) ... end proc]"

 

 

Matrix(22, 4, {(1, 1) = x, (1, 2) = f(x), (1, 3) = diff(f(x), x), (1, 4) = g(x), (2, 1) = -1, (2, 2) = -.5999999999999999, (2, 3) = 0., (2, 4) = 0., (3, 1) = -.9, (3, 2) = -.5921019363135331, (3, 3) = .16117644246579177, (3, 4) = .16278785222711661, (4, 1) = -.8, (4, 2) = -.5673179392294507, (4, 3) = .3358281006942344, (4, 4) = .27398222754004026, (5, 1) = -.7, (5, 2) = -.5248336859114118, (5, 3) = .5136175101475529, (5, 4) = .34249328997691325, (6, 1) = -.6, (6, 2) = -.46477687437327975, (6, 3) = .6859820206881927, (6, 4) = .37560385885019504, (7, 1) = -.5, (7, 2) = -.388056335140733, (7, 3) = .8458151726881442, (7, 4) = .379329359084838, (8, 1) = -.4, (8, 2) = -.29622905813442174, (8, 3) = .9872264166250676, (8, 4) = .3587619863302707, (9, 1) = -.3, (9, 2) = -.19138762111309063, (9, 3) = 1.1053715832210735, (9, 4) = .31836669317513355, (10, 1) = -.2, (10, 2) = -0.7606152260806107e-1, (10, 3) = 1.1963422280782419, (10, 4) = .2622203658496911, (11, 1) = -.1, (11, 2) = 0.4687285133905644e-1, (11, 3) = 1.257101695941537, (11, 4) = .19419882920716647, (12, 1) = 0., (12, 2) = .17427776167518302, (12, 3) = 1.285457587832346, (12, 4) = .11812298579942797, (13, 1) = .1, (13, 2) = .30283839441242316, (13, 3) = 1.2800631860819935, (13, 4) = 0.3787854100769596e-1, (14, 1) = .2, (14, 2) = .42914854495292715, (14, 3) = 1.2404437922191818, (14, 4) = -0.4247440931298191e-1, (15, 1) = .3, (15, 2) = .5498001552169361, (15, 3) = 1.1670477189686659, (15, 4) = -.11858357706073142, (16, 1) = .4, (16, 2) = .6614793307230553, (16, 3) = 1.0613260266593003, (16, 4) = -.1856569908506866, (17, 1) = .5, (17, 2) = .7610721351270342, (17, 3) = .9258503351415268, (17, 4) = -.23825953806119313, (18, 1) = .6, (18, 2) = .8457846937322854, (18, 3) = .7644844667704894, (18, 4) = -.2700210440598001, (19, 1) = .7, (19, 2) = .9132841022735299, (19, 3) = .5826335690125677, (19, 4) = -.2732168506711414, (20, 1) = .8, (20, 2) = .9618694469154144, (20, 3) = .38760346032463744, (20, 4) = -.23817813455209258, (21, 1) = .9, (21, 2) = .9906859783236445, (21, 3) = .18911198892620892, (21, 4) = -.1524947837179067, (22, 1) = 1.0, (22, 2) = 1.0000000000000002, (22, 3) = 0., (22, 4) = 0.})

 

"sol:=[x=proc(x) ... end proc,f(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) f(x)=proc(x) ... end proc,((ⅆ)^2)/(ⅆx^2) f(x)=proc(x) ... end proc,((ⅆ)^3)/(ⅆx^3) f(x)=proc(x) ... end proc,g(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) g(x)=proc(x) ... end proc]"

 

 

Matrix(22, 4, {(1, 1) = x, (1, 2) = f(x), (1, 3) = diff(f(x), x), (1, 4) = g(x), (2, 1) = -1, (2, 2) = -.6000000000000004, (2, 3) = 0., (2, 4) = 0., (3, 1) = -.9, (3, 2) = -.5910567233470129, (3, 3) = .18122537717864878, (3, 4) = .16396504088125943, (4, 1) = -.8, (4, 2) = -.5634797368629983, (4, 3) = .3707794844269797, (4, 4) = .27242971039204567, (5, 1) = -.7, (5, 2) = -.516969715671122, (5, 3) = .5583291678670692, (5, 4) = .3357102861727665, (6, 1) = -.6, (6, 2) = -.45216444180391374, (6, 3) = .7354160507956333, (6, 4) = .36217576157094034, (7, 1) = -.5, (7, 2) = -.3704651748474773, (7, 3) = .8951891646617371, (7, 4) = .35871202401791136, (8, 1) = -.4, (8, 2) = -.27388695993638196, (8, 3) = 1.032192599436718, (8, 4) = .33112662990623104, (9, 1) = -.3, (9, 2) = -.16492772308724132, (9, 3) = 1.1422006814980625, (9, 4) = .2844747844035093, (10, 1) = -.2, (10, 2) = -0.4645182729199544e-1, (10, 3) = 1.2220922378023178, (10, 4) = .22330926940407242, (11, 1) = -.1, (11, 2) = 0.784154458137712e-1, (11, 3) = 1.269756795732628, (11, 4) = .15186760332056226, (12, 1) = 0., (12, 2) = .20638541043083533, (12, 3) = 1.2840276312063286, (12, 4) = 0.7421358259764317e-1, (13, 1) = .1, (13, 2) = .33409800434183184, (13, 3) = 1.2646386645322474, (13, 4) = -0.5648866884394064e-2, (14, 1) = .2, (14, 2) = .4582106456522417, (14, 3) = 1.2122040908812248, (14, 4) = -0.836715744946918e-1, (15, 1) = .3, (15, 2) = .5754862092294035, (15, 3) = 1.128221393564483, (15, 4) = -.1556489493917709, (16, 1) = .4, (16, 2) = .6828825716240221, (16, 3) = 1.0151003650073218, (16, 4) = -.21707454720818847, (17, 1) = .5, (17, 2) = .7776465657105786, (17, 3) = .8762233928986827, (17, 4) = -.26294167827837045, (18, 1) = .6, (18, 2) = .8574158806153623, (18, 3) = .7160459677791091, (18, 4) = -.287455837843665, (19, 1) = .7, (19, 2) = .9203335847329029, (19, 3) = .5402514892963132, (19, 4) = -.28361907679236387, (20, 1) = .8, (20, 2) = .9651816746104471, (20, 3) = .35598103108785795, (20, 4) = -.24263993404105924, (21, 1) = .9, (21, 2) = .9915424895108919, (21, 3) = .17216620285365075, (21, 4) = -.15312216756590794, (22, 1) = 1.0, (22, 2) = .9999999999999999, (22, 3) = 0., (22, 4) = 0.})

 

"sol:=[x=proc(x) ... end proc,f(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) f(x)=proc(x) ... end proc,((ⅆ)^2)/(ⅆx^2) f(x)=proc(x) ... end proc,((ⅆ)^3)/(ⅆx^3) f(x)=proc(x) ... end proc,g(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) g(x)=proc(x) ... end proc]"

 

 

Matrix(22, 4, {(1, 1) = x, (1, 2) = f(x), (1, 3) = diff(f(x), x), (1, 4) = g(x), (2, 1) = -1, (2, 2) = -.6, (2, 3) = 0., (2, 4) = 0., (3, 1) = -.9, (3, 2) = -.5890460844879107, (3, 3) = .2198386517649569, (3, 4) = .16530323348490086, (4, 1) = -.8, (4, 2) = -.5560849074382147, (4, 3) = .43816895209915196, (4, 4) = .26764796070103164, (5, 1) = -.7, (5, 2) = -.501824746995504, (5, 3) = .6441967577731817, (5, 4) = .32004582147804334, (6, 1) = -.6, (6, 2) = -.4279468048318385, (6, 3) = .8292577622345304, (6, 4) = .3330538680096117, (7, 1) = -.5, (7, 2) = -.3368927457898107, (7, 3) = .9868006993649518, (7, 4) = .3154069928968666, (8, 1) = -.4, (8, 2) = -.23165630116353528, (8, 3) = 1.112318306576843, (8, 4) = .2744870694769592, (9, 1) = -.3, (9, 2) = -.11558534417415368, (9, 3) = 1.203204419426625, (9, 4) = .21664697219190648, (10, 1) = -.2, (10, 2) = 0.77977336536539064e-2, (10, 3) = 1.2585316312429464, (10, 4) = .14742694982025012, (11, 1) = -.1, (11, 2) = .13494998754599274, (11, 3) = 1.2787648296225842, (11, 4) = 0.71704794890426e-1, (12, 1) = 0., (12, 2) = .26243142352580456, (12, 3) = 1.2654452961155502, (12, 4) = -0.6183800085005834e-2, (13, 1) = .1, (13, 2) = .386997290300288, (13, 3) = 1.2208903045330994, (13, 4) = -0.8232737042872075e-1, (14, 1) = .2, (14, 2) = .5056628908234575, (14, 3) = 1.1479493670985939, (14, 4) = -.15310505557254883, (15, 1) = .3, (15, 2) = .6157479708522582, (15, 3) = 1.0498420667838475, (15, 4) = -.2150243987585282, (16, 1) = .4, (16, 2) = .7149092180250505, (16, 3) = .9300816061622831, (16, 4) = -.26451781233451827, (17, 1) = .5, (17, 2) = .8011689330506191, (17, 3) = .7924715996791256, (17, 4) = -.29767900145546017, (18, 1) = .6, (18, 2) = .8729462572046487, (18, 3) = .6411574655922088, (18, 4) = -.3099095345489387, (19, 1) = .7, (19, 2) = .9290956309406369, (19, 3) = .4807180162778606, (19, 4) = -.2954313672351693, (20, 1) = .8, (20, 2) = .9689562366716992, (20, 3) = .3162941876999236, (20, 4) = -.24660535105130912, (21, 1) = .9, (21, 2) = .9924165644781593, (21, 3) = .15376572531561677, (21, 4) = -.1529816079274428, (22, 1) = 1.0, (22, 2) = .9999999999999999, (22, 3) = 0., (22, 4) = 0.})

 

"sol:=[x=proc(x) ... end proc,f(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) f(x)=proc(x) ... end proc,((ⅆ)^2)/(ⅆx^2) f(x)=proc(x) ... end proc,((ⅆ)^3)/(ⅆx^3) f(x)=proc(x) ... end proc,g(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) g(x)=proc(x) ... end proc]"

 

 

Matrix(22, 4, {(1, 1) = x, (1, 2) = f(x), (1, 3) = diff(f(x), x), (1, 4) = g(x), (2, 1) = -1, (2, 2) = -.5999999999999999, (2, 3) = 0., (2, 4) = 0., (3, 1) = -.9, (3, 2) = -.5885947382746329, (3, 3) = .22852431650651223, (3, 4) = .16534633634381243, (4, 1) = -.8, (4, 2) = -.5544189692150393, (4, 3) = .4534004612340051, (4, 4) = .26607037116078464, (5, 1) = -.7, (5, 2) = -.4984062412869411, (5, 3) = .6636006972241313, (5, 4) = .31577530763651607, (6, 1) = -.6, (6, 2) = -.42248634612463787, (6, 3) = .8502514742975177, (6, 4) = .32553203705865047, (7, 1) = -.5, (7, 2) = -.3293636263128513, (7, 3) = 1.0067491067162901, (7, 4) = .3045467975331385, (8, 1) = -.4, (8, 2) = -.2222875527101816, (8, 3) = 1.1287898465496373, (8, 4) = .2606288613379166, (9, 1) = -.3, (9, 2) = -.10482663479017114, (9, 3) = 1.2142664538412669, (9, 4) = .2004888707748643, (10, 1) = -.2, (10, 2) = 0.19339481440825857e-1, (10, 3) = 1.2630068824565952, (10, 4) = .12992062935643178, (11, 1) = -.1, (11, 2) = .1465944440231568, (11, 3) = 1.2763736197655813, (11, 4) = 0.5392364168942554e-1, (12, 1) = 0., (12, 2) = .27351521671490775, (12, 3) = 1.2567904467527107, (12, 4) = -0.23185142823880983e-1, (13, 1) = .1, (13, 2) = .3969550901628668, (13, 3) = 1.20729208284578, (13, 4) = -0.9763876092339403e-1, (14, 1) = .2, (14, 2) = .5140865520874546, (14, 3) = 1.131183212788941, (14, 4) = -.16605314300138765, (15, 1) = .3, (15, 2) = .6224175618994571, (15, 3) = 1.031849974160649, (15, 4) = -.2252230606412318, (16, 1) = .4, (16, 2) = .7197963959791739, (16, 3) = .91271505526074, (16, 4) = -.2718789569092242, (17, 1) = .5, (17, 2) = .8044174392211924, (17, 3) = .777292644204684, (17, 4) = -.3023924171455772, (18, 1) = .6, (18, 2) = .8748353664675236, (18, 3) = .6292941394600428, (18, 4) = -.3124010160557897, (19, 1) = .7, (19, 2) = .929990976635027, (19, 3) = .4727519716440513, (19, 4) = -.29630392257166593, (20, 1) = .8, (20, 2) = .969249872312222, (20, 3) = .3121533153501387, (20, 4) = -.2465605862461447, (21, 1) = .9, (21, 2) = .992455479290909, (21, 3) = .15259678595166132, (21, 4) = -.15270793902808713, (22, 1) = 1.0, (22, 2) = .9999999999999999, (22, 3) = 0., (22, 4) = 0.})

 

"sol:=[x=proc(x) ... end proc,f(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) f(x)=proc(x) ... end proc,((ⅆ)^2)/(ⅆx^2) f(x)=proc(x) ... end proc,((ⅆ)^3)/(ⅆx^3) f(x)=proc(x) ... end proc,g(x)=proc(x) ... end proc,(ⅆ)/(ⅆx) g(x)=proc(x) ... end proc]"

 

 

Matrix(%id = 18446744074593872102)

(2)

 

``

Download plotODEs.mw


 

the simple coeff() command. As in the attached

restart;
eq:=p*(diff(F1(zeta), zeta, zeta))-b^2*p*F1(zeta)+2*G0(zeta)*p*G1(zeta)+p^2*G1(zeta)^2-p*H0(zeta)*(diff(F0(zeta), zeta))-H0(zeta)*p^2*(diff(F1(zeta), zeta))-p^2*H1(zeta)*(diff(F0(zeta), zeta))-p^3*H1(zeta)*(diff(F1(zeta), zeta))-p*F0(zeta)^2-2*F0(zeta)*p^2*F1(zeta)-p^3*F1(zeta)^2+p*b^2*F0(zeta)+b^2*p^2*F1(zeta);

p*(diff(diff(F1(zeta), zeta), zeta))-b^2*p*F1(zeta)+2*G0(zeta)*p*G1(zeta)+p^2*G1(zeta)^2-p*H0(zeta)*(diff(F0(zeta), zeta))-H0(zeta)*p^2*(diff(F1(zeta), zeta))-p^2*H1(zeta)*(diff(F0(zeta), zeta))-p^3*H1(zeta)*(diff(F1(zeta), zeta))-p*F0(zeta)^2-2*F0(zeta)*p^2*F1(zeta)-p^3*F1(zeta)^2+p*b^2*F0(zeta)+b^2*p^2*F1(zeta)

(1)

coeff(eq, p, 1);

diff(diff(F1(zeta), zeta), zeta)-b^2*F1(zeta)+2*G0(zeta)*G1(zeta)-H0(zeta)*(diff(F0(zeta), zeta))-F0(zeta)^2+b^2*F0(zeta)

(2)

 

Download getC.mw

 

the attached.

For reasons I do not understand the "solidcircles" at the vertices do not appear when the animation is "rendered" on this site - however they do exist when this worksheet is executed within Maple - honest!!

restart; r, theta := (abs, argument)(1+I); Explore(plot(`~`[`~`[`*`](r^(1/a), [cos, sin])](([seq])((2*Pi*k+theta)/a, k = 0 .. a)), style = pointline, symbol = solidcircle, symbolsize = 25, gridlines, thickness = 3, scaling = constrained, color = blue, labels = [Re, Im], labelfont = [Helvetica, bolditalic, 20]), parameters = [[a = 1 .. 20, shown = false, animate]])

plots:-animate(plot, ['`~`[`~`[`*`](r^(1/a), [cos, sin])](([seq])((2*Pi*k+theta)/a, k = 0 .. a))', style = pointline, symbol = solidcircle, symbolsize = 25, gridlines, thickness = 3, scaling = constrained, color = blue, labels = [Re, Im], labelfont = [Helvetica, bolditalic, 20]], a = 1 .. 20, frames = 20)

 

``

 

NULL


 

Download pltAnim.mw

what you are getting - seem to be a lot of random subscripts, repetitive loops etc, etc

If I tidy things up a little and make a few wild guesses about your intent then I get the attached, which

  • runs
  • is a lot "shorter"

  restart;

  N := 4:
#
# Change lhs of the assignment from f(x) to F(x)
# to avoid potential conflict arising from using
# the same name in both indexed and unindexed
# contexts
#
# Also changed sum() to add()
#
  F(x) :=  add(p^i*f[i](x), i = 0..N);
#
# Changed dependent variable throughout from f(x)
# to F(x)
#
  HPMEq := (1 - p)*diff(F(x), x $ 3) + p*(diff(F(x), x $ 3) + 1/2*diff(F(x), x, x)*F(x));
#
# Initialise sol as an empty list
#
  sol:=[]:
  for i from 0 to N do
      sol:= [ sol[],
              dsolve
              ( [ eval
                  ( coeff(HPMEq, p, i) = 0,
                    sol
                  ),
                  f[i](0) = 0,
                  D(f[i])(0) = 0,
                  D(f[i])(5) = 1
                ]
              )
            ];
  end do:
  sol;

 

f[0](x)+p*f[1](x)+p^2*f[2](x)+p^3*f[3](x)+p^4*f[4](x)

 

(1-p)*(diff(diff(diff(f[0](x), x), x), x)+p*(diff(diff(diff(f[1](x), x), x), x))+p^2*(diff(diff(diff(f[2](x), x), x), x))+p^3*(diff(diff(diff(f[3](x), x), x), x))+p^4*(diff(diff(diff(f[4](x), x), x), x)))+p*(diff(diff(diff(f[0](x), x), x), x)+p*(diff(diff(diff(f[1](x), x), x), x))+p^2*(diff(diff(diff(f[2](x), x), x), x))+p^3*(diff(diff(diff(f[3](x), x), x), x))+p^4*(diff(diff(diff(f[4](x), x), x), x))+(1/2)*(diff(diff(f[0](x), x), x)+p*(diff(diff(f[1](x), x), x))+p^2*(diff(diff(f[2](x), x), x))+p^3*(diff(diff(f[3](x), x), x))+p^4*(diff(diff(f[4](x), x), x)))*(f[0](x)+p*f[1](x)+p^2*f[2](x)+p^3*f[3](x)+p^4*f[4](x)))

 

[f[0](x) = (1/10)*x^2, f[1](x) = -(1/6000)*x^5+(73/480)*x^2, f[2](x) = (11/20160000)*x^8-(73/144000)*x^5+(18089/80640)*x^2, f[3](x) = -(1/532224000)*x^11+(803/322560000)*x^8-(36553/32256000)*x^5+(2467369/7741440)*x^2, f[4](x) = (9299/1452971520000000)*x^14-(73/6386688000)*x^11+(808291/108380160000)*x^8-(5108363/2322432000)*x^5+(80546766031/185980354560)*x^2]

(1)

#
# Idle curiosity - what do these functions
# look like
#
  plot( [ seq
          ( rhs(sol[j]),
            j=1..N+1
          )
        ],
        x = 0..5,
        legend = [ seq
                   ( lhs(sol[j]),
                     j=1..N+1
                   )
                 ]
      );

 

 


 

Download odeSols.mw

but there have been other reports of problems with Physics Updates in Maple 2020.1 - see this thread

https://www.mapleprimes.com/questions/229832-Phyysics-Updates-Installation

Only solution on that occasion was to go for a more-or-less "manual" update

the attached maybe?

  restart;
  approxL:= proc(f, a, b, N)
                 uses plots:
                 local xv:= Array( 0..N,
                                   [ seq
                                     ( a+(b-a)*i/N,
                                       i=0..N
                                     )
                                   ]
                                 ),
                       yv:=unapply( f, indets(f, 'name')[])~(xv);
                 return display
                        ( [ plot
                            ( f,
                              indets(f, 'name')[]=a..b,
                              color=red
                            ),
                            plot
                            ( convert(xv, Vector),
                              convert(yv, Vector),
                              style=pointline,
                              symbol=solidcircle,
                              symbolsize=20,
                              color=blue
                            )
                          ]
                        ),
                        evalf
                        ( add
                          ( sqrt
                            ( (xv[i]-xv[i-1])^2
                              +
                              (yv[i]-yv[i-1])^2
                            ),
                            i=1..N
                          )
                        );
            end proc:    
               

#
# Test expression, endpoints, and sub-intervals
#
  f:=x^3-x*sin(x): a:=-2: b:=2: N:=5:

  p,L:=approxL( f, a, b, N):
#
# Display function and "piecewsie approximation
# to function
#
  p;
  L;
#
# "Exact" curve length, for comparison
#
  evalf(Int( sqrt(1+diff(f,x)^2), x=a..b));

 

17.26675031

 

17.51864682

(1)

 

Download appLen.mw

something in the attached will help

If not, at least the plots are quite pretty

NULL

  restart;
#
# Parameters and procedure
#
  a := 4: b := 5: x0 := -3: y0 := -4:

  genEll:=proc( a, b, tau, theta, x0, y0)
                local #
                      # rotation matrix
                      #
                      rot := Matrix( 2,
                                     2, [ [cos(theta), -sin(theta)],
                                          [sin(theta),  cos(theta)]
                                        ]
                                   ),
                      #
                      # Parameterised ellipse
                      #
                      p := Vector( 2,
                                   [a*cos(tau), b*sin(tau)]
                                 ),
                      #
                      # Translation
                      #
                      shift:=Vector(2, [x0, y0] );
               return #
                      # Return entries in rotated, shifted vector
                      #
                        entries(rot.p+shift, 'nolist');
         end proc:

                      

#
# Plot all rotations from 0->Pi in steps Pi/8
#
  plot( [ seq
          ( [ genEll( a, b, t, theta, x0, y0),
              t=0..2*Pi
            ],
            theta=0..evalf(Pi), evalf(Pi/8)
          )
        ],
        scaling=constrained
     );

 

#
# Animate all rotations from 0->Pi in nine frames
#
  plots:-animate( plot,
                  [ [ genEll( a, b, t, theta, x0, y0),
                      t=0..2*Pi
                    ]
                  ],
                  theta=0..Pi,
                  frames=9,
                  trace=9,
                  scaling=constrained
                );

 

``

Download ellRot.mw

 

 

When you supply odetest() with an ODE and a solution, the "ideal" answer is 0 - which means the solution satisfies the ODE.

Alternatively, odetest() wii return expressions (implicitly set these equal to zero) which have to be met in order for the proposed solution to satisfy the ODE. A general approach is to use solve(), on these returned expressions in order to determine the value of any "free" variables (usually the constants of integration), which are required in order for he proposed solution to satisfy the ODE

For your particular problem (see the attached), this results in values for the integration constant which are expressed in terms of the independent variable - which, I admit, is interesting,and I'll conttinue to think about.

But it is way past my bedtime, so you might want to contemplate the attached (which for some reason won't display inline on this site)


testode.mw
 

various stuff ( most/all(?) of which has been accurately decrsibed by RoubenRostamian, I came up with the following

  restart;
#
# Assorted parameters
#
  T:= 0.1: beta:= 0.6: k:= 3.5:
  A1:= (2*k-1)/(2*k-3):
  A2:= 8*sqrt(2/Pi)*(beta-1)*k*GAMMA(k)/(3*GAMMA(k-0.5)*(2*k-3)**(3/2)):
  A3:= (4*k**2-1)/(2*(2*k-3)**2):
  M1:= 0.1+sqrt(T+(1/A1)):
#
# define ODES and ICs
#
  odes:= diff(U1(x),x)=-diff(phi(x),x)/(U1(x)-T/U1(x)),
         diff(phi(x),x$2)=(1+A1*phi(x)+A2*phi(x)**(3/2)+A3*phi(x)**2)-(M1/U1(x)):
  bcs:= U1(0)=M1, phi(0)=0, D(phi)(0)=0.001:
#
# Solution and plots
#
  sol:= dsolve( [odes, bcs], numeric):
  plots:-odeplot( sol,
                  [ [x, U1(x)],
                    [x, phi(x)],
                    [x, diff(phi(x),x)]
                  ],
                  x=0..20,
                  color= [red ,blue, green]
                );

 

 

Download odeSol.mw

  1. You are using Maple 7. This was superseded in 2002 - so it is eighteen years old - somewhat surprising that it runs at all!
  2. From memory: in 2002, the "default" MS operating system was (probably?) 32-bit Windows XP
  3. You are now using Windows 10, with a software package (ie Maple) designed to run 32-bit Windows XP and you hope that when you use a read() or save() command, everything will just work - because obviously (in the last eighteen years) Micorsoft hasn't changed anything at all in directory/file structures. FFS - get real
  4. If you want to avoid issues like this, then
    1. Decide on a folder where you want to keep Maple I/O
    2. In all save()/read() type commands, get used to entering the full pathname to the folder selected in (1) above

 

In Maple 'currency' is treated as a 'Unit' (like metre, kilogram etc). By default Maple uses USD as currency unit and leaves others undefined - mainly because the conversion rate between currencies keeps changing (unlike the conversions between units of say length).

However it is pretty simple to setup your own curency, define the conversion with respect to USD, and specify which currency will be used as default - see the attached for a simple set-up with examples

  restart;
  with(Units):
  AddUnit('krona', 'plural' = 'kronor', 'context' = 'currency', 'symbol' = 'kr', 'prefix' = 'SI', 'conversion' = 0.11*'USD');
#
# Check the conversion
#
  c1:=convert(20*Unit('USD'), units,'kr');
  c2:=convert(c1, units, 'USD');

Automatically loading the Units[Simple] subpackage
 

 

181.8181818*Units:-Unit(kr)

 

20.00000000*Units:-Unit(USD)

(1)

#
# At this stage the *default* unit for currency
# is still the USD, so if one is buying wood at
# a certain price per metre, say 15*kr/m, then
# the result wil be dsplayed in USD/m
#
  priceOfWood:=15*Unit('kr')/(1*Unit('m'));
#
# So for 20m of wood
#
  totalPrice:= 20*Unit('m')*priceOfWood;

1.65*Units:-Unit(USD/m)

 

33.00*Units:-Unit(USD)

(2)

#
# In order to avoid automatic conversion to USD
# one has to specify the *default* unit with the
# UseUnit() command so if one is buying wood at
# a certain price per metre, say 15*kr/m, then
# the result wil be dsplayed in kr/m
#
#
  UseUnit('kr');
  priceOfWood:=15*Unit('kr')/(1*Unit('m'));
#
# So for 20m of wood
#
  totalPrice:= 20*Unit('m')*priceOfWood;

false

 

15.00000000*Units:-Unit(kr/m)

 

300.0000000*Units:-Unit(kr)

(3)

#
# Since the default currency unit was set to 'kr'
# above, anything entered in USD, will be automatically
# converted to 'kr'
#
  priceOfWood:=15*Unit('USD')/(1*Unit('m'));
#
# So for 20m of wood
#
  totalPrice:= 20*Unit('m')*priceOfWood;

136.3636364*Units:-Unit(kr/m)

 

2727.272728*Units:-Unit(kr)

(4)

 


 

Download currUnit.mw

of the conditional() wrapper? It appears to be completely superfluous in all of your examples - see the attached

Maybe if you presnted an example where the conditioonal() command was vaguely meaningful (and necessary - then failed), I'd get interested??

restart;
patmatch(3*g(x),A::nonunit(realcons)*B::function,'la');
la;

true

 

[A = 3, B = g(x)]

(1)

restart;
patmatch(3*g(x),A::nonunit(algebraic)*B::function,'la');
la;

true

 

[A = 3, B = g(x)]

(2)

restart;
patmatch(3*g(x), A::anything*B::function,'la');
la;

true

 

[A = 3, B = g(x)]

(3)

 

Download matpat.mw

but before giving an answer, one has to consider questions such as - has the original expression been appropriately "expanded", simplified", "collected" etc etc - becuase I regard using the patmatch() command a bit of an 'experimental science'.\One tries it on "simple" expressions and it works, then on slightly more complicatd expressions - it doesn't quite work, so modify and as they say "rinse and repeat"

Having said that, the attached *may* give you a starting point (and something to thnk about!!)

  restart;
  expr:=(3+k)*(1+t+t^2):
  patmatch(expr, a::freeof(t)*f::dependent(t), 'p'):
  p;

[a = 3+k, f = t^2+t+1]

(1)

  expr:=expand(expr);
  patmatch(expr, a::freeof(t)*f::dependent(t), 'p'):
  p;

k*t^2+k*t+3*t^2+k+3*t+3

 

[a = 1, f = k*t^2+k*t+3*t^2+k+3*t+3]

(2)

  expr:=collect( expr,t);
  patmatch(expr, a::freeof(t)*f::dependent(t), 'p'):
  p;

(3+k)*t^2+(3+k)*t+3+k

 

[a = 1, f = (3+k)*t^2+(3+k)*t+3+k]

(3)

 


 

Download patMat2.mw

First of all, let me state that I can thnk of a couple of reasons why you shoudn't do this

  1. Each "export" command has to open/close the Excel file - doing this mutiple times is going to get really slow. So why
  2. You will have to encode the start cell for each "export" command - not difficult, but again why bother?

Having said that, the attached

  restart:
#
# OP will need to change output fileName
# to something appropriate for his/her
# system
#
  fname:="C:/Users/TomLeslie/Desktop/test.xlsx":
  for k from 1 by 1 to 10 do
      L:=Vector[row]([seq(j*k, j=1..10)]);
      ExcelTools:-Export(L, fname, "sheet1", cat("A", k));
  od:

 

Download XLbadexp.mw

will produce the attached

test.xlsx

with emphasis added

  • Maple internal format files are created using the save statement with a filename parameter (see save) ending in .m. Note: Because "." is a special character, the filename must be enclosed in quotes, either double quotes or left single quotes (backquotes).
  • Maple internal format files are read using the read statement. The fact that the specified filename ends in ".m" tells Maple that the file is in internal format
First 72 73 74 75 76 77 78 Last Page 74 of 207