acer

32303 Reputation

29 Badges

19 years, 309 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Here's how your stated target can be found using collect, as well as some alternative metrics.

I also show an alternative result, which scores better than your proposed target on all four metrics shown.

restart;

L := ee->[length(ee),`simplify/size/size`(ee),
          MmaTranslator:-Mma:-LeafCount(ee), codegen[':-cost'](ee)]:

 

expr := G1*P3 + G1*P5 + G1*P6 + G2*P3 + G2*P6 + G3*P2 + G3*P5 + G4*P2 + G4*P3 + G4*P5 + G4*P6 + G5*P2 + G5*P3 + G5*P5 + G5*P6 + G6*P3 + G6*P6 + G7*P2 + G7*P5 + G8*P2 + G8*P3 + G8*P5 + G8*P6;

G1*P3+G1*P5+G1*P6+G2*P3+G2*P6+G3*P2+G3*P5+G4*P2+G4*P3+G4*P5+G4*P6+G5*P2+G5*P3+G5*P5+G5*P6+G6*P3+G6*P6+G7*P2+G7*P5+G8*P2+G8*P3+G8*P5+G8*P6

L(expr);

[323, 138, 70, 22*additions+23*multiplications]

thaw(simplify(collect(expr,indets(expr,suffixed(P)),freeze)));

(P3+P6)*(G1+G2+G4+G5+G6+G8)+(G3+G4+G5+G7+G8)*P2+(G1+G3+G4+G5+G7+G8)*P5

L(%);

[134, 82, 29, 17*additions+3*multiplications]

thaw(simplify(collect(expr,[G1, P2, P5],freeze@simplify)));

(P2+P5)*(G3+G4+G5+G7+G8)+(P3+P5+P6)*G1+(P3+P6)*(G2+G4+G5+G6+G8)

L(%);

[123, 71, 27, 14*additions+3*multiplications]

Download crush_ex0b.mw

@zenterix 

If you keep/create your packages in the following pattern then the lib subdirectories get added to libname automatically upon relaunch.

  $(HOME)/maple/toolbox/mypackage/

where the .mla for that package is put in a subdirectory named lib.

You can also put the source under that directory.

And so all the source, along with the .mla, can be under that mypackage directory.

And similarly for mypackage2, mypackage3, etc.

In new Maple sessions the kernel will pick up the lib subdirectories for all such, and add them to libname.

The key here is putting them under this special location: whatever this returns,

  cat(kernelopts(homedir),"/maple/toolbox");

This approach removes the need to use any initialization file. Thus any tricky editing of an initialization file is wholly unnecessary.

And it lets you keep each package's source and .mla under its own directory. (Which you wanted, for github.)

The value of libname gets further augmented (in subsequent sessions) simply by adding another package in another such directory tree.

Side-note: You can also programatically create a self-installing file which unpacks any or all of .mla, .help, source, and build-scripts to the equivalent directory on someone else's machine. (This knows where to place these toolbox files regardless of operating system: Linux, MS-Windows, or OSX.)

This is the scheme Maple uses for its own add-on toolboxes. Why reinvent the wheel?

As documented on the procedure Help page, within a procedure a reference to a local gets only single level evaluation.

In contrast a declared global gets fully evaluated.

Here are a few notes:

restart;

gen := () -> 4.5:

p := proc()

  global g;
  local a,b,c;

  g := b;
  c := b;

  b := a;

  a := 'gen()';

  print( a, b, c, g );

end proc:


Inside the procedure p,
   a gets single level evaluation, obtaining its value,
      which is the unevaluated function call gen().
   b gets single level evaluation, obtaining just `a`
   c gets single level evaluation, obtaining just  `b`
   g gets fully evaluated, obtaining 4.5

p();

gen(), a, b, 4.5

restart;

gen := () -> 4.5:

g := b:
c := b:

b := a:

a := 'gen()':


At the top-level (ie. outside any procedure), these all
get fully evaluated.

a, b, c, g;

4.5, 4.5, 4.5, 4.5

The following mimics the kinds of evaluation that
occured within the call to procedure p. Compare
with the result above of calling p().

eval(a,1), eval(b,1), eval(c,1), g;

gen(), a, b, 4.5

Even at the top-level we can control the level of
evaluation, or perform full evaluation as usual.

eval(g,1), eval(g,2), eval(g,3), g;

b, a, gen(), 4.5

eval(c,1), eval(c,2), eval(c,3), c;

b, a, gen(), 4.5

Here's a tip for top-level programming:
Suppose we want to test whether sol gets assigned a
solution, or whether fsolve has returned unevaluated,
(since no solution is found).

sol := fsolve({x+y=0, sin(x)+sin(y)=3}, {x,y});

fsolve({x+y = 0, sin(x)+sin(y) = 3}, {x, y})

The following appears reasonable, but in fact this
top-level reference to sol induces a full evaluation of sol.
This makes fsolve get needlessly called again, which
is inefficient.

if op(0,sol) = fsolve then
  print("it returned unevaluated");
end if;

"it returned unevaluated"

The following gets the same test, but doesn't make
fsolve get called again. (You could trace(fsolve), or
run in the debugger, to see that this is so.)

if op(0,eval(sol,1)) = fsolve then
  print("it returned unevaluated");
end if;

"it returned unevaluated"

In contrast, the following code -- within a
procedure, with sol declared local -- makes
only the initial call to fsolve. There is no repeated,
(inefficient) attempt by fsolve during the if...then
test since the local named sol gets only single level
evaluation.

restart;
##trace(fsolve):
h := proc()
  local sol;
  sol := fsolve({x+y=0, sin(x)+sin(y)=3}, {x,y});
  if op(0,sol) = fsolve then
     print("it returned unevaluated");
   end if;
end proc:

h();

"it returned unevaluated"

 

Download local_eval_notes.mw

The problem is caused by the algorithm behind the (new to Maple 2022) default adaptive=geometric option.

You can get around this by supplying the option adaptive=true (or its shorter equivalent, merely the keyword option name, adaptive).

(I have submitted a bug report against this example.)

plots:-setoptions(size = [500, 300])

f := x -> arcsin(2*x/(1 + x^2))

proc (x) options operator, arrow; arcsin(2*x/(1+x^2)) end proc

plot(f(x), x, view = [-10 .. 10, -10 .. 10], adaptive = true)

plot(f(x), x, view = [-10 .. 10, -10 .. 10], adaptive)

Your original attempt:

plot(f(x), x, view = [-10 .. 10, -10 .. 10])

The same as what you got:

plot(f(x), x, view = [-10 .. 10, -10 .. 10], adaptive = geometric)

Download arcsin_ac1.mw

Yes, providing a .mla file (Maple Library Archive) and a .help file (Maple Help database) is a relatively common way to share one's data/procedues/modules/help-worksheets with other people.

It's up to you whether you also wish to provide the source code for your procedures/modules, or any special script that might read such into a session.

I suggest that you keep the .mla archive libirary files all in one common directory, and use the subdirectory structure for the various source files.

As for how to manage the subdirectories, I sometimes do it as follows:

I have my various packages' module (parent) definition files in a common location, eg.
    src/pack1.mpl
    src/pack2.mpl

The src/pack1.mpl file looks like this,

pack1 := module()
   export f1,f2;
   local f3;
$include "../pack1/src/f1.mm"
$include "../pack1/src/f2.mm"
$include "../pack1/src/f3.mm"
   end module;

And similarly for the src/pack2.mpl file.

All in all, I get the following

   lib/pack1.mla
   lib/pack2.mla
   src/pack1.mpl       # module defn
   src/pack2.mpl       # module defn
   pack1/src/f1.mm   # module member, eg. proc defn or submodule defn
   pack1/src/f2.mm   # proc defn
   pack2/src/g1.mm   # proc defn
   pack2/src/g1.mm   # proc defn

This way I only have to have that single top "src" directory in the include-path. The other files are picked up when I read either of the two parent .mpl files because I used relative names in the $include directives. I don't ever have to concern myself with "searching" for parent source files, or adding multiple locations to the include path.

And I only have a single location added to libname.

(Eventually I move the .mla files over to a ($HOME)/maple/toolbox subdirectory  on my machine, so that libname gets augmented automagically.  I seldom bundle them up as a package redistributable via the Maple Cloud or someone else's Maple GUI, but if I did I would never use a Maple workbook as the only copy of my sources.)

[edit] You might wonder why I bother at all with having the files in a "src" subdirectory. It's because I also have "doc" and "tst" subdirectories at those same levels, for documention&notes and for unit test files.

You can alter various aspects of this, to suit your taste.

plot(0, sample=[$1..10], adaptive=false, color=blue,
     style=point, symbolsize=25, symbol=solidcircle,
     axis[1]=[tickmarks=[$1..10], color=black],
     axis[2]=[tickmarks=[], color=white],
     view=[0..10,default], size=[600,75]);
 

Download 1d_numberline.mw

It's not the only way to get such an effect.

If you already have some existing, computed list of points (which does not simply include all the naturals up to some number), then the above code can be adjusted to get a few alternate appearances. [Thanks, dharr, for referencing this case.]

For example,

pts := [1, 3, 5, 9]:

plot(0, sample=pts, adaptive=false, color=blue,
     style=point, symbolsize=25, symbol=solidcircle,
     axis[1]=[tickmarks=[$1..10], color=black],
     axis[2]=[tickmarks=[], color=white],
     view=[0..10,default], size=[600,75]);
 

plot(0, sample=pts, adaptive=false, color=blue,
     style=point, symbolsize=25, symbol=solidcircle,
     axis[1]=[tickmarks=pts, color=black],
     axis[2]=[tickmarks=[], color=white],
     view=[0..10,default], size=[600,75]);

Download 1d_numberline2.mw

Your syntax for creation of Arrays for A and B is faulty. Your code creates them as lists, not Arrays.

Also the approach of using of a loop to repeatedly augment a list is inefficient. And you ended up with name t being assigned a numeric value, which then makes using the F formula awkward.

Here is one (of several) ways get it:

restart;

with(SignalProcessing):with(plots):

omega:=10*2*Pi:

F:=add(n/5*cos(n*omega*t),n=1..5);

(1/5)*cos(20*Pi*t)+(2/5)*cos(40*Pi*t)+(3/5)*cos(60*Pi*t)+(4/5)*cos(80*Pi*t)+cos(100*Pi*t)

X:=0.01;Y:=0.5

0.1e-1

.5

A:=Array([seq(0..Y,X)]);

A := Array(1..51, {(1) = 0, (2) = 0.1e-1, (3) = 0.2e-1, (4) = 0.3e-1, (5) = 0.4e-1, (6) = 0.5e-1, (7) = 0.6e-1, (8) = 0.7e-1, (9) = 0.8e-1, (10) = 0.9e-1, (11) = .10, (12) = .11, (13) = .12, (14) = .13, (15) = .14, (16) = .15, (17) = .16, (18) = .17, (19) = .18, (20) = .19, (21) = .20, (22) = .21, (23) = .22, (24) = .23, (25) = .24, (26) = .25, (27) = .26, (28) = .27, (29) = .28, (30) = .29, (31) = .30, (32) = .31, (33) = .32, (34) = .33, (35) = .34, (36) = .35, (37) = .36, (38) = .37, (39) = .38, (40) = .39, (41) = .40, (42) = .41, (43) = .42, (44) = .43, (45) = .44, (46) = .45, (47) = .46, (48) = .47, (49) = .48, (50) = .49, (51) = .50})

B:=Array([seq(F,t=0..Y,X)]);

B := Array(1..51, {(1) = 3, (2) = -1.547213596, (3) = .5000000003, (4) = -.6527864051, (5) = .5000000028, (6) = -.6000000000, (7) = .4999999973, (8) = -.6527864066, (9) = .5000000010, (10) = -1.547213590, (11) = 3.000000000, (12) = -1.547213594, (13) = .5000000048, (14) = -.6527864056, (15) = .4999999987, (16) = -.6000000000, (17) = .5000000023, (18) = -.6527863990, (19) = .4999999936, (20) = -1.547213586, (21) = 3.000000000, (22) = -1.547213599, (23) = .5000000034, (24) = -.6527864063, (25) = .5000000022, (26) = -.6000000000, (27) = .4999999989, (28) = -.6527863994, (29) = .4999999892, (30) = -1.547213580, (31) = 3.000000000, (32) = -1.547213604, (33) = .4999999897, (34) = -.6527864153, (35) = .4999999964, (36) = -.6000000000, (37) = .5000000047, (38) = -.6527863987, (39) = .4999999562, (40) = -1.547213587, (41) = 3.000000000, (42) = -1.547213579, (43) = .5000000338, (44) = -.6527864182, (45) = .4999999880, (46) = -.6000000000, (47) = .4999999849, (48) = -.6527863804, (49) = .4999999960, (50) = -1.547213619, (51) = 3.000000000})

pointplot(<A,B>,connect=true);

DD := DFT(B);

DD := Array(1..51, {(1) = .42008402179171944+.0*I, (2) = .42175153453166814+0.260127386732813e-1*I, (3) = .4273854433108563+0.529217918211225e-1*I, (4) = .439904132785008+0.8223233375459758e-1*I, (5) = .47323108886278337+.11902238832572307*I, (6) = 1.0877924551184714+.3460516889265493*I, (7) = .3569320370031822+.1382762050895581*I, (8) = .4148338889065726+.1908538823428024*I, (9) = .4619399099671241+.2480565000272187*I, (10) = .5560941614839366+.3443189070181002*I, (11) = 1.4698363115945032+1.0404755675645527*I, (12) = .1354050516836275+.10896003639239854*I, (13) = .3109084304533812+.28343048302699486*I, (14) = .3994997970246128+.4119978120383033*I, (15) = .532233172411374+.6212251967601387*I, (16) = 1.3813301699553153+1.8291767721959242*I, (17) = -.14619781495367054-.22063465161597345*I, (18) = .14702941821882043+.254662412254526*I, (19) = .251510503173138+.5051011909405684*I, (20) = .3632279493696535+.8581599783585913*I, (21) = .8576247440707302+2.433762362192655*I, (22) = -.24629996741195287-.8656546262097845*I, (23) = 0.3677142408705413e-1+.1679034515700907*I, (24) = .10208684041263871+.6576543746261295*I, (25) = .12844054276315037+1.3860942388899873*I, (26) = .13882940709643427+4.50603323174799*I, (27) = .13882940709643493-4.50603323174799*I, (28) = .12844054276315028-1.3860942388899873*I, (29) = .10208684041263884-.6576543746261296*I, (30) = 0.36771424087054055e-1-.16790345157009076*I, (31) = -.2462999674119529+.8656546262097844*I, (32) = .8576247440707302-2.433762362192655*I, (33) = .36322794936965364-.858159978358591*I, (34) = .25151050317313806-.5051011909405685*I, (35) = .14702941821882043-.254662412254526*I, (36) = -.1461978149536705+.22063465161597343*I, (37) = 1.3813301699553155-1.829176772195924*I, (38) = .532233172411374-.6212251967601383*I, (39) = .3994997970246128-.41199781203830343*I, (40) = .3109084304533811-.2834304830269948*I, (41) = .13540505168362754-.10896003639239851*I, (42) = 1.4698363115945032-1.0404755675645527*I, (43) = .5560941614839372-.34431890701810014*I, (44) = .46193990996712386-.24805650002721866*I, (45) = .41483388890657275-.1908538823428024*I, (46) = .35693203700318216-.13827620508955804*I, (47) = 1.0877924551184714-.3460516889265493*I, (48) = .47323108886278337-.11902238832572289*I, (49) = .43990413278500806-0.8223233375459792e-1*I, (50) = .4273854433108562-0.52921791821123e-1*I, (51) = .42175153453166814-0.2601273867328127e-1*I}, datatype = complex[8])

 

Download DFT_Test_ac.mw

The following might get you started, at least for steps 1-3.

Step 4 does not seem to allow for the fact that the names R__ct,R__s,R__w,C__dl, and omega can be expressed in terms of the a[i] and b[i] in more than one way. Below is a solution (with a check on it), but it may not be the same choice of representation by a[i] and b[i] that you want(?).

restart

with(numapprox)

Y := 1/(R__s+1/(s*C__dl+1/(R__ct+1/(sqrt(s)/sigma+1/R__w))))

1/(R__s+1/(s*C__dl+1/(R__ct+1/(s^(1/2)/sigma+1/R__w))))

padey := pade(Y, x = sqrt(s), [1, 1])

(C__dl*s^(3/2)*R__ct*R__w+C__dl*R__ct*s*sigma+C__dl*R__w*s*sigma+s^(1/2)*R__w+sigma)/(C__dl*s^(3/2)*R__ct*R__s*R__w+C__dl*R__ct*R__s*s*sigma+C__dl*R__s*R__w*s*sigma+s^(1/2)*R__ct*R__w+s^(1/2)*R__s*R__w+R__ct*sigma+R__s*sigma+sigma*R__w)

The padey2 term isn't really needed. I include it to match the given document.

padey2 := sort(collect(padey, s, factor), order = plex(s), ascending)

(sigma+R__w*s^(1/2)+C__dl*sigma*(R__ct+R__w)*s+C__dl*R__ct*R__w*s^(3/2))/(sigma*(R__ct+R__s+R__w)+R__w*(R__ct+R__s)*s^(1/2)+C__dl*R__s*sigma*(R__ct+R__w)*s+C__dl*R__ct*R__s*R__w*s^(3/2))

padey3 := sort(collect(padey, s, proc (u) options operator, arrow; simplify(u/(sigma*(R__ct+R__s+R__w))) end proc), order = plex(C__dl, s), ascending)

(1/(R__ct+R__s+R__w)+R__w*s^(1/2)/(sigma*(R__ct+R__s+R__w))+(R__ct+R__w)*C__dl*s/(R__ct+R__s+R__w)+R__ct*R__w*C__dl*s^(3/2)/(sigma*(R__ct+R__s+R__w)))/(1+R__w*(R__ct+R__s)*s^(1/2)/(sigma*(R__ct+R__s+R__w))+R__s*(R__ct+R__w)*C__dl*s/(R__ct+R__s+R__w)+R__ct*R__s*R__w*C__dl*s^(3/2)/(sigma*(R__ct+R__s+R__w)))

N, M := op(padey3)

One way to get the equations from padey3:
eqs := {seq(a[i-1] = eval(op(i, N), s = 1), i = 1 .. nops(N)), seq(b[i-1] = eval(op(i, 1/M), s = 1), i = 1 .. nops(1/M))}

{a[0] = 1/(R__ct+R__s+R__w), a[1] = R__w/(sigma*(R__ct+R__s+R__w)), a[2] = (R__ct+R__w)*C__dl/(R__ct+R__s+R__w), a[3] = R__ct*R__w*C__dl/(sigma*(R__ct+R__s+R__w)), b[0] = 1, b[1] = R__w*(R__ct+R__s)/(sigma*(R__ct+R__s+R__w)), b[2] = R__s*(R__ct+R__w)*C__dl/(R__ct+R__s+R__w), b[3] = R__ct*R__s*R__w*C__dl/(sigma*(R__ct+R__s+R__w))}

Another way to get the equations from padey3:
temp1 := `assuming`([map(evala, eval(N, s = s^2))], [s > 0]); temp2 := `assuming`([map(evala, eval(1/M, s = s^2))], [s > 0]); eqs := {seq(a[i] = coeff(temp1, s, i), i = 0 .. 3), seq(b[i] = coeff(temp2, s, i), i = 0 .. 3)}

{a[0] = 1/(R__ct+R__s+R__w), a[1] = R__w/(sigma*(R__ct+R__s+R__w)), a[2] = (R__ct+R__w)*C__dl/(R__ct+R__s+R__w), a[3] = R__ct*R__w*C__dl/(sigma*(R__ct+R__s+R__w)), b[0] = 1, b[1] = R__w*(R__ct+R__s)/(sigma*(R__ct+R__s+R__w)), b[2] = R__s*(R__ct+R__w)*C__dl/(R__ct+R__s+R__w), b[3] = R__ct*R__s*R__w*C__dl/(sigma*(R__ct+R__s+R__w))}

U := simplify(eliminate(eqs, [R__s, C__dl, R__ct, sigma, R__w, a[3], b[3]]))

ans := Equate([R__s, C__dl, R__ct, sigma, R__w], eval([R__s, C__dl, R__ct, sigma, R__w], U[1]))

[R__s = b[2]/a[2], C__dl = -a[2]^2/(a[0]*b[2]-a[2]), R__ct = (-a[1]*b[2]+a[2]*b[1])/(a[2]*a[1]), sigma = (-a[0]*b[1]+a[1])/a[1]^2, R__w = (-a[0]*b[1]+a[1])/(a[1]*a[0])]

W := Equate(simplify(eval([a[3], b[3]], U[1])), [a[3], b[3]])

[a[2]*(a[1]*b[2]-a[2]*b[1])/(a[0]*b[2]-a[2]) = a[3], b[2]*(a[1]*b[2]-a[2]*b[1])/(a[0]*b[2]-a[2]) = b[3]]

Z := sort(collect(simplify(eval(N, ans), W), s), order = plex(s), ascending)/sort(collect(simplify(eval(1/M, ans), W), s), order = plex(s), ascending)

(a[0]+a[1]*s^(1/2)+a[2]*s+a[3]*s^(3/2))/(1+b[1]*s^(1/2)+b[2]*s+b[3]*s^(3/2))

Download maple_attempt_ac.mw

The six periodic values have two sets of three, negations of each other.

The two sets of three can be alternately obtained by setting the parameter in the solve(...,allsolutions) result to either an odd or even integer.

Below I set that parameter (eg. _Z1) to 1, though I also have merged both sets of three from using both 1 and 0.

We can sort the roots of the derivative by the values that would attain by substitution into the original expression. This allows us to pick off a value of t which attains the maximal value.

There doesn't seem to be any simplification benefit to conversion to exp&ln, with a larger form as well as the presence of I the imaginary unit.

The optimal symbolic values below for both t and the expression seem reasonably compact.

restart;

expr:=sin(sqrt(3)*t)*cos(sqrt(3)*t)*(sqrt(3)*cos(sqrt(3)*t) - sin(sqrt(3)*t))/3;

(1/3)*sin(3^(1/2)*t)*cos(3^(1/2)*t)*(3^(1/2)*cos(3^(1/2)*t)-sin(3^(1/2)*t))

S:=[solve(diff(expr,t),t,allsolutions)]:
v:=indets(S,suffixed(_Z))[1];

_Z1

plots:-display(
  plots:-pointplot([seq(Re~(evalf([s,eval(expr,[t=s])])),s=simplify(S,{v=1}))],
                   symbol=solidcircle,symbolsize=15,color=blue),
  plot(expr,t=-2*Pi..2*Pi), size=[600,300])

H:=simplify(evalc(simplify(S,{v=1}))):

HH := sort(H, (a,b)->is(eval(expr,t=a)>eval(expr,t=b))):

t_opt := HH[1];

-(1/3)*3^(1/2)*(arctan(2^(1/2)*cos((1/3)*arctan((1/19)*503^(1/2)))+3^(1/2)*2^(1/2)*sin((1/3)*arctan((1/19)*503^(1/2)))-(2/3)*3^(1/2))-Pi)

evalf( eval(expr, t=t_opt) );

.3242632442

expr_opt := combine(expand(eval(expr, t=t_opt)));

-(1/9)*(-6*3^(1/2)*sin((2/3)*arctan((1/19)*503^(1/2)))+3*2^(1/2)*sin((1/3)*arctan((1/19)*503^(1/2)))+cos((1/3)*arctan((1/19)*503^(1/2)))*6^(1/2)+6*cos((2/3)*arctan((1/19)*503^(1/2)))-10)/(-(4/3)*cos((1/3)*arctan((1/19)*503^(1/2)))*6^(1/2)+2*3^(1/2)*sin((2/3)*arctan((1/19)*503^(1/2)))-4*2^(1/2)*sin((1/3)*arctan((1/19)*503^(1/2)))-2*cos((2/3)*arctan((1/19)*503^(1/2)))+19/3)^(3/2)

 

Download some_trig_opt.mw

The following sorts, in ascending order of exponents, by the indexed `&Delta;y` names taken in descending order of index.

I used `collect` to first factor the coefficients of those names.

The result seems to match what you gave as target form.

(I used Maple 2015.)

restart;

expr := ((1/2)*r*(r-1)+(1/6)*r*(r-1)*(r-2))*`&Delta;y`[-1]^3+(1/2)*r*(r-1)*`&Delta;y`[-1]^2+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`&Delta;y`[-2]^7+((1/6)*r*(r-1)*(r-2)+(1/12)*r*(r-1)*(r-2)*(r-3)+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-2]^5+((1/6)*r*(r-1)*(r-2)+(1/24)*r*(r-1)*(r-2)*(r-3))*`&Delta;y`[-2]^4+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-3]^7+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-3]^6+r*`&Delta;y`[0]+y[0];

((1/2)*r*(r-1)+(1/6)*r*(r-1)*(r-2))*`&Delta;y`[-1]^3+(1/2)*r*(r-1)*`&Delta;y`[-1]^2+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`&Delta;y`[-2]^7+((1/6)*r*(r-1)*(r-2)+(1/12)*r*(r-1)*(r-2)*(r-3)+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-2]^5+((1/6)*r*(r-1)*(r-2)+(1/24)*r*(r-1)*(r-2)*(r-3))*`&Delta;y`[-2]^4+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-3]^7+((1/24)*r*(r-1)*(r-2)*(r-3)+(1/60)*r*(r-1)*(r-2)*(r-3)*(r-4))*`&Delta;y`[-3]^6+r*`&Delta;y`[0]+y[0]

S:=sort([indets(expr,specindex(`&Delta;y`))[]], (a,b)->op(1,a)<=op(1,b)):

sort(collect(expr,S,factor),
     order=plex(S[]), ascending);

y[0]+r*`&Delta;y`[0]+(1/2)*r*(r-1)*`&Delta;y`[-1]^2+(1/6)*r*(r-1)*(r+1)*`&Delta;y`[-1]^3+(1/24)*r*(r-1)*(r-2)*(r+1)*`&Delta;y`[-2]^4+(1/120)*r*(r-1)*(r-2)*(r+2)*(r+1)*`&Delta;y`[-2]^5+(1/120)*r*(r-1)*(r-2)*(r-3)*(r-4)*`&Delta;y`[-2]^7+(1/120)*r*(r-1)*(r-2)*(r-3)*(-3+2*r)*`&Delta;y`[-3]^6+(1/120)*r*(r-1)*(r-2)*(r-3)*(-3+2*r)*`&Delta;y`[-3]^7

Download sort_collect.mw

You could send an email to Maplesoft's Technical Support team, at,
     support@maplesoft.com

They'll want to know your Operating System and Maple version number.

Or you could fill out this form.

I'd suggest that using 1D (plaintext) Maple Notation would be one good alternative. If you do that then you can use the arrow notation in the input, to enter the operator, while also using the local declaration.

If you really need to use 2D Input then you could enter it using proc()...end, and optionally throw the procedure options arrow,operator on and get it nicely pretty-printed as output.

This illustrates the warning messages for these expressions.

Omega := proc (a::list) options operator, arrow; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc; `&Omega;__rev` := proc (a::list) options operator, arrow; (-1)^add(a[i]-i, i = 1 .. nops(a)) end proc

Warning, (in Omega) `i` is implicitly declared local

Warning, (in Omega__rev) `i` is implicitly declared local

proc (a::list) local i; options operator, arrow; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

proc (a::list) local i; options operator, arrow; (-1)^add(a[i]-i, i = 1 .. nops(a)) end proc

Omega := proc (a::list) local i; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

proc (a::list) local i; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

Omega := proc (a::list) local i; options arrow, operator; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

proc (a::list) local i; options operator, arrow; (-1)^add(a[i]-1, i = 1 .. nops(a)) end proc

Download warningmessage_ac.mw

As you noticed, the local declation is not yet fully supported for the arrow notation in 2D Input.

The name x is a parameter of your procedure IPM.

But there is a statement in IPM which attempts to perform,
   x := x/ix;
which is an assignment that is not allowed when x has been passed in with a value (here, a Vector).

You could change the name of the procedural parameter to, say xin, and have the procedure assign xin to a new local named x at its beginning. The rest of IPM would then be able to assign to that local x or use its running value.

IOMMcode_ac.mw

I will submit a bug report against the original result you obtained from int, which throws an error even under a call to normal.

However, forcing a particular method, in Maple 2022.2,

restart;

f:=1/(3*u^(2/3)+3*((-4*u^(1/3)+1)*u^(4/3))^(1/2)-12*u);

1/(3*u^(2/3)+3*((-4*u^(1/3)+1)*u^(4/3))^(1/2)-12*u)

anti := int(f,u,method=derivativedivides)

(1/4)*ln((4*u-u^(2/3)+(-(4*u^(1/3)-1)*u^(4/3))^(1/2))/(u^(2/3)*(-4*u^(1/3)+1)^(1/2)))-(1/4)*ln((-4*u+u^(2/3)+(-(4*u^(1/3)-1)*u^(4/3))^(1/2))/(u^(2/3)*(-4*u^(1/3)+1)^(1/2)))-(1/4)*ln(4*u^(1/3))

MmaTranslator:-Mma:-LeafCount(anti);

85

simplify( f - diff(anti,u) );

0

Download indef_int_ex05.mw

First 57 58 59 60 61 62 63 Last Page 59 of 336