acer

29759 Reputation

29 Badges

19 years, 316 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

restart;

with(InertForm):

 

The following automatic simplification occurs even before evaluation (which is why it cannot be prevented by single right-tick unevaluation quotes).

 

'3*(a-1)';

3*a-3

expr := 3*(a-1);

3*a-3

 

We can separate the numeric factor, and then use %* for inert multiplication.

 

f := content(expr) %* primpart(expr);

`%*`(3, a-1)

Display(f, inert=false);

0, "%1 is not a command in the %2 package", _Hold, Typesetting

value(f);

3*a-3

Download auto_simp_ex.mw

note: A little bit more on automatic simplification can be had in Section 3.4 "Unevaluated Expressions" of Chapter 3 of the Programming Guide, in the subsection "Evaluation and Automatic Simplification".

This question pops up now and then. This old Reply contains a couple of other approaches, including using MakeInert instead of %*.

Another alternative is to wrap one of the factors in a call to ``(...). For example,
   content(expr) %* ``(primpart(expr))
as shown also in that very same linked old Reply of mine. I don't generally prefer that approach over using InertForm. I also dislike how its results can sometimes get display with extra brackets in output, even though that doesn't occur for this particular example. I generally prefer how InertForm works, over the ``(...) approach.

With so many floating-point evaluations of those special functions the internal memory management system (gc) may collect some of the computed results from evalf's remember table.

But your expressions have two pairs of repeated special-function calls, ie. to WeierstrassZeta and to WeierstrassPPrime.

By forcing the computed values to be remembered (even when gc occurs) I get about another factor of two speed up here.

restart;

plots:-setoptions(size=[350,350]);

g := evalf((Beta(1/4, 1/4)/2)^4):

WZ := proc(a,b,c) option remember;
  if not [a,b,c]::list(complexcons) then return 'procname'(args);
  else evalf(WeierstrassZeta(a,b,c)); end if;
end proc:

WPP := proc(a,b,c) option remember;
  if not [a,b,c]::list(complexcons) then return 'procname'(args);
  else evalf(WeierstrassPPrime(a,b,c)); end if;
end proc:

AA := Pi*r*cos(theta) - Re(WZ(r*exp(theta*I), g, 0) + Pi*WPP(r*exp(theta*I), g, 0)/g);
BB := Pi*r*sin(theta) + Im(WZ(r*exp(theta*I), g, 0) - Pi*WPP(r*exp(theta*I), g, 0)/g);
C := sqrt(6*Pi/g)*Re(WeierstrassP(r*exp(theta*I), g, 0));

Pi*r*cos(theta)-Re(WZ(r*exp(I*theta), 189.0727201, 0)+0.1661579022e-1*WPP(r*exp(I*theta), 189.0727201, 0))

Pi*r*sin(theta)+Im(WZ(r*exp(I*theta), 189.0727201, 0)-0.1661579022e-1*WPP(r*exp(I*theta), 189.0727201, 0))

.3157447408*Re(WeierstrassP(r*exp(I*theta), 189.0727201, 0))

CodeTools:-Usage(plot3d([AA, BB, C], r = 1/5 .. 4/5, theta = -Pi .. Pi,
                        view = [-8 .. 8, -8 .. 8, -8 .. 8], shading = zhue,
                        style = surface, grid = [33, 129]));

memory used=3.61GiB, alloc change=142.00MiB, cpu time=33.23s, real time=30.42s, gc time=4.48s

 

Download WZ.mw

An alternative way to speed it up would be to parallelize the population of the float[8] Array inside the resulting MESH plotting structure. [see below]

Here is the most that I am able to recover.

Basismat_2_noter_acc.mw

I suspect that it is missing just two inputs, which I'd guess are 2D Math Matrices that occurred here:
1) just after "Løsning er da:"
2) just before "Bytter række 2 og 3:"

I suggest that you try to use Maple 2023 instead of your current Maple 2022. This kind of worksheet corruption appears (so far) to be much less common in 2023.

You can supply an option to the call to the plot command, for specifying the relative location of the first axis.

And you can change the size option below, to get dimensions more to your liking.

restart

k := 0.1e-1:

Pinit := 100:

V := 25:

rho := 1:

eq := diff(P(t), t) = -k*P(t)+rho*Cp*(int(V*sin(alpha), t));

diff(P(t), t) = -0.1e-1*P(t)+12.5*sin(5)*t

solution := dsolve({eq, P(0) = Pinit}, P(t));

P(t) = 1250*sin(5)*t-125000*sin(5)+exp(-(1/100)*t)*(100+125000*sin(5))

plot(rhs(solution), t = 0 .. 600, axis[1] = [location = low], size = [500, 400])

Download time-dependent_aerodynamic_pressure_ac.mw

See the Help page for topic  plot,options  for more details on 2D plotting choices.

The following reuable procedure P produces an expression (which is intended as pretty-printing in Maple's GUI similarly as does the the unevaluated ContinuedFraction function call).

Are you able to utilize the following expression assigned to res (either by copying its pretty-printed 2D output as special, rich-text, etc, or as generated MathML?)

restart

f := NumberTheory:-ContinuedFraction((3+sqrt(7))*(1/2)); lprint(%)

_m139948790579680

NumberTheory:-ContinuedFraction(3/2+1/2*7^(1/2))

P := proc (ee, N::posint) local f, H, i, T; H := Term(NumberTheory:-ContinuedFraction(ee), 0 .. N-1); T := `..`; for i from N by -1 to 2 do if (H[i])::list then T := H[i, 1]/(H[i, 2]+T) else T := 1/(H[i]+T) end if end do; H[1]+T end proc

res := P((3 + sqrt(7))/2, 10);

2+1/(1+1/(4+1/(1+1/(1+1/(1+1/(4+1/(1+1/(1+1/(1+`..`)))))))))

lprint(MathML:-ExportPresentation(res));

"<math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mn>2</mn><mo>+</mo><mf\
rac><mn>1</mn><mrow><mn>1</mn><mo>+</mo><mfrac><mn>1</mn><mrow><mn>4</mn><mo>+<\
/mo><mfrac><mn>1</mn><mrow><mn>1</mn><mo>+</mo><mfrac><mn>1</mn><mrow><mn>1</mn\
><mo>+</mo><mfrac><mn>1</mn><mrow><mn>1</mn><mo>+</mo><mfrac><mn>1</mn><mrow><m\
n>4</mn><mo>+</mo><mfrac><mn>1</mn><mrow><mn>1</mn><mo>+</mo><mfrac><mn>1</mn><\
mrow><mn>1</mn><mo>+</mo><mfrac><mn>1</mn><mrow><mn>1</mn><mo>+</mo><mi>..</mi>\
</mrow></mfrac></mrow></mfrac></mrow></mfrac></mrow></mfrac></mrow></mfrac></mr\
ow></mfrac></mrow></mfrac></mrow></mfrac></mrow></mfrac></mrow></math>"

#res := P(cos(x), 12);

#ContinuedFraction(cos(x), x);

#MathML:-ExportPresentation(res);

 

Download ContFrac_MathML.mw

Your worksheet has some coding mistakes.

1) The definition of prof1 has some function calls where multiplcation was likely intended. Eg,
   (...)(ps - s)
is is a function call, and not a product of two brackets terms. For multiplication you'd need either an explicit multiplication symbol, or (in 2D Input) a space, between the adjacent closing&opening brackets )( .  This occurs a few times.

2) The attempted multiple assignments like,
   [p,q] := solve(...)
is invalid. This occurs a few times.

It's often useful to test your procedure with some actual float arguments, before trying to plot it. That would reveal to you that WhyNot3 wasn't working at all.

I've corrected those aspects, in this attachment.  HmaxProc_ac.mw

Here's another approach.

If you'd prefer the result as just a list of two numbers then you could leave off the [a,b]=~ bit at the start.

L := [a,b]=~applyrule(a::numeric*f^b::numeric=[a,-b],X1);

          L := [a = 1.234, b = 6.789]

A couple of other examples,

[a,b]=~applyrule(a::numeric*f^b::numeric=[a,-b],-1/(f^6.789));
                      [a = -1, b = 6.789]

[a,b]=~applyrule(a::numeric*f^b::numeric=[a,-b],f^6.789);
                      [a = 1, b = -6.789]

Here's your original example, round-tripped,

X := a/f^b;

a/f^b

X1 := 1.234/(f^6.789);

1.234/f^6.789

L := [a,b]=~applyrule(a::numeric*f^b::numeric=[a,-b],X1);

[a = 1.234, b = 6.789]

eval(X, L);

1.234/f^6.789

Download rt.mw

ps. The order of terms in the result is forced by us, here, since the order of terms in the returned list is specified in the code.

pps. You could also tweak the specified types, eg. only looking for negative b, etc. You could also wrap it up in a reusable procedure. You could also use indets (and a structured type) to yank out multiple such subexpressions from a larger expression. Hard to say more because we don't yet know exactly how you intend to utilize this.

@Samuel Hesselberg Any new document will have its own Startup code region (which is empty, at first). The Startup code is not automatically inherited from any other already opened sheet.

Your original .mw file is a document with its own, separate Startup code.

So if you copy&paste the main body of that older document then you'll also have to provide access to the code in the older document's Startup region as well. The embedded components you're pasting in rely upon and call that code.

You can add it to the Startup code region of your newly opened document, or you can add in somewhere else in your new document's body (any document block, or even a code-edit-region).

First, find the Startup code in your original. Then figure out how you want your new document to be able to also use it. The easiest way is also to copy the older document's Startup code to the new document's Startup code region.

I am not sure about a good approach for Maple 2015.

In Maple 2018 and later you could use plots:-textplot with its rotation option.

An example is given below.

Note that I did not have the lines extend down to y=0, since your image didn't either. I also didn't make it handle the lines if f(x) becomes negative. I figure that if you want such a more general example or different behaviour you would provide it -- and all your requirements -- explicitly and clearly.

restart;

with(plots):

f := x -> exp(cos(x)+sin(x));

proc (x) options operator, arrow; exp(cos(x)+sin(x)) end proc

(a,b) := 0,3:

n := 12:

h := (b-a)/n:

L := [seq([x,evalf(f(x))],x=a..b,h)]:

plots:-display(
  plot(f,a..b),
  pointplot(L[2..-2],symbolsize=10,symbol=solidcircle),
  seq(textplot([L[i][],
                typeset(" ",eval('Typesetting:-Typeset'('f'(evalf[3](L[i][1]))))
                            =evalf[5](L[i][2])),
                rotation=Pi/2],align=above,font=[DEFAULT,10]),i=2..nops(L)-1),
  seq(plottools:-line([L[i][1],min(L[..,2])],L[i],thickness=0),i=1..nops(L)-1),
  tickmarks=[L[..,1],[$ceil(min(L[..,2]))..floor(max(L[..,2]))]],
  font=[DEFAULT,9], size=[700,450]);

Download rotated_textplot_ex2.mw

Are you asking about codegen:-optimize? You haven't usefully provided an example of what exactly you're trying to accomplish.

If it's replacing generated names in results from codegen:-optimize then it's not clear to me whether you're dealing with Maple expressions of procedures. Also, while codegen:-optimize does have a documented mechanism to utilize a given list of preferred names, it's somewhat awkward IMO.

Perhaps something like the following might serve:

restart;

 

rep := (L::list(`=`),s::symbol)
  -> subs((nm->nm=parse(s||(String(nm)[2..])))~(lhs~(L)),
          L)[]:

 

repproc := (P::procedure,s::symbol)
  -> subs((nm->nm=parse(s||(String(nm)[2..])))~([op(2,eval(P))]),
          eval(P)):


We use rep to replace the temporary names in the optimized computation sequence.

f := x*ln(x)+2*x^2*ln(x)+3*x^3*ln(x);

x*ln(x)+2*x^2*ln(x)+3*x^3*ln(x)

temp := codegen:-optimize(f);

t1 = ln(x), t3 = x^2, t9 = 3*t1*t3*x+2*t1*t3+t1*x

rep([temp], b);

b1 = ln(x), b3 = x^2, b9 = 3*b1*b3*x+2*b1*b3+b1*x

 

We use repproc to replace the locals in the optimized procedure.

 

p := proc(x) x*ln(x)+2*x^2*ln(x)+3*x^3*ln(x); end proc;

proc (x) x*ln(x)+2*x^2*ln(x)+3*x^3*ln(x) end proc

temp2 := codegen:-optimize(p);

proc (x) local t1, t3; t1 := ln(x); t3 := x^2; 3*t1*t3*x+2*t3*t1+t1*x end proc

repproc(temp2, b);

proc (x) local b1, b3; b1 := ln(x); b3 := x^2; 3*b1*b3*x+2*b3*b1+b1*x end proc

Download cg_rep.mw

You have p(lambda__1 + p) which is a function call (to p), and not a multiplication. Perhaps you intended that as p*(lambda__1 + p) instead.

restart

psi = Pi^2*n^2+p; q := diff(theta(y), y, y) = psi^2*theta(y)

bc := theta(0) = 0, theta(1) = `&lambda;__1`*(cos(n*Pi)-1)/(p*(`&lambda;__1`+p)*n)

q := dsolve({bc, q})

theta(y) = lambda__1*(cos(n*Pi)-1)*exp(psi*y)/(n*p*(exp(psi)*p+exp(psi)*lambda__1-p*exp(-psi)-lambda__1*exp(-psi)))-lambda__1*(cos(n*Pi)-1)*exp(-psi*y)/(n*p*(exp(psi)*p+exp(psi)*lambda__1-p*exp(-psi)-lambda__1*exp(-psi)))

simplify(convert(q, trigh))

theta(y) = lambda__1*(cos(n*Pi)-1)*sinh(psi*y)/(p*(lambda__1+p)*n*sinh(psi))

Download nima_ac.mw

To prevent  -2*x-3*x from automatically simplifying to -5*x, etc, you can use an inert form.

Here, the inert form only needs to retain inert `%+`.

You can also force the visual display to have + in the usual black, instead of the gray that denotes the inert operator.

restart;

with(InertForm):

p := x^2 - a*x - b*x +a*b ;

a*b-a*x-b*x+x^2

L := [[2,3],[-3,7],[9,10]];

[[2, 3], [-3, 7], [9, 10]]

inexpr := eval(MakeInert(sort(p,x)),[`%^`=`^`,`%*`=`*`]);

`%+`(x^2, -a*x, -b*x, a*b)

temp := eval~(inexpr,map[2](Equate,[a,b],L))

[`%+`(x^2, -2*x, -3*x, 6), `%+`(x^2, 3*x, -7*x, -21), `%+`(x^2, -9*x, -10*x, 90)]

Display~(temp, inert=false);

0, "%1 is not a command in the %2 package", _Hold, Typesetting

value(temp);

[x^2-5*x+6, x^2-4*x-21, x^2-19*x+90]

Download inert_ex2.mw

If you add
   option remember;
to FirmModelFC and FirmModelPP then it won't waste as much time in duplicate computations, generating both the 3rd and 4th items of their returned expression sequences.

Also, you can guard against premature evaluation by having diffr1 and diffr2 return unevaluated when passed mere symbolic names (not yet numbers) as its arguments. That allows you to use the expression form calling sequence of plots:-inequal, as opposed to operator form calling sequence.

I removed the commented stuff, just to make it more legible to me.

I changed the range for delta to 0..1/2, since I myself didn't see too much of great interest for delta>1/2. Change that back if wanted, of course.

restart

with(plots)

``

c := 1; cr := 0.3e-1*c; u := 1; sExp := 0.6e-1*c; s := .65*c; v := 3*c

``

FirmModelPP := proc (alpha, delta) local p0, xi0, q0, Firmpf0, G0, Recpf0, Unsold0, Environ0; option remember; xi0 := 1; p0 := min(s+sqrt((v-s)*(c-s)), delta*v+sExp); q0 := u*(v-p0)/(v-s); f(N) := 1/u; F(N) := N/u; G0 := int(F(N), N = 0 .. q0); Firmpf0 := (p0-c)*q0-(p0-s)*G0; Recpf0 := (sExp-cr)*xi0*q0; Environ0 := q0+G0; Unsold0 := G0; return p0, q0, Firmpf0, Recpf0, Unsold0, Environ0 end proc

``

FirmModelFC := proc (alpha, beta, delta) local p00, xi00, q00, Firmpf00, G00, Recpf00, Unsold00, Environ00, pr00; option remember; xi00 := 1; p00 := s+sqrt((v-s)*(c-s)); if p00 < delta*v+sExp then q00 := u*(v-p00)/(v-s); f(N) := 1/u; F(N) := N/u; G00 := int(F(N), N = 0 .. q00); Firmpf00 := (p00-c)*q00-(p00-s)*G00; Recpf00 := `&xi;00*q00*`(sExp-cr); Unsold00 := G00; Environ00 := q00+Unsold00 else q00 := alpha*u*(v-p00)/(v-s); f(N) := 1/u; F(N) := N/u; G00 := int(F(N), N = 0 .. q00/alpha); pr00 := p00-delta*v; Firmpf00 := (p00-c)*q00-alpha*(p00-s)*G00; Recpf00 := (beta*(pr00-sExp)+sExp-cr)*xi00*q00-(1/2)*(pr00-sExp)*beta^2*xi00^2*q00^2/(u*(1-alpha)); Unsold00 := G00; Environ00 := q00+Unsold00 end if; return p00, q00, Firmpf00, Recpf00, Unsold00, Environ00 end proc

``

diffr1 := proc (alpha, delta) if not [alpha, delta]::(list(numeric)) then return ('procname')(args) end if; FirmModelPP(alpha, delta)[3]-FirmModelFC(alpha, .2, delta)[3] end proc

diffr2 := proc (alpha, delta) if not [alpha, delta]::(list(numeric)) then return ('procname')(args) end if; FirmModelPP(alpha, delta)[4]-FirmModelFC(alpha, .2, delta)[4] end proc

 

P1 := implicitplot(diffr1, 0 .. 1, 0 .. 1/2, color = black, thickness = 2)

NULL

P2 := implicitplot(diffr2, 0 .. 1, 0 .. 1/2, color = black, thickness = 2)

P3 := inequal({diffr1(alpha, delta) < 0, diffr2(alpha, delta) < 0}, alpha = 0 .. 1, delta = 0 .. 1/2, color = red)

NULL

P4 := inequal({diffr2(alpha, delta) > 0, diffr1(alpha, delta) < 0}, alpha = 0 .. 1, delta = 0 .. 1/2, color = yellow)

NULL

P5 := inequal({diffr1(alpha, delta) > 0, diffr2(alpha, delta) < 0}, alpha = 0 .. 1, delta = 0 .. 1/2, color = green)

NULL

P6 := inequal({diffr1(alpha, delta) > 0, diffr2(alpha, delta) > 0}, alpha = 0 .. 1, delta = 0 .. 1/2, color = "LightBlue")

NULL

display(P1, P2, P3, P4, P5, P6, scaling = constrained)

NULL

Download Code_JN_major_ac.mw

I didn't bother rewriting FirmModelPP and FirmModelAC altogether (eg. making evalhf'able counterparts, resolving the integration steps, etc). I suspect it could be faster still...

You appear to have used Maple 2021, and in that version the above all executed in about 9 seconds on my machine.

Do you mean something like the following?

I also added some sorting of the terms in the generated results, which I think makes the effect clearer.

note: Your given example might be handled by dealing merely with the second index j of the y[i,j] names. And the highest index accepted happens to match your example N values. But I deliberately put in the test of the first index, as well as sorting by the second index, so that it'd also handle a more general example (as you described it in words).

restart;

expr := r*y[0, 1]+y[0, 0]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/2)*r*(r-1)*y[-1, 2]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/720)*r*(r-1)*(r-2)*(r-3)*(r-4)*(1+r)*y[-3, 8]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6];

r*y[0, 1]+y[0, 0]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/2)*r*(r-1)*y[-1, 2]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/720)*r*(r-1)*(r-2)*(r-3)*(r-4)*(1+r)*y[-3, 8]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6]

 

T := proc(a,b)
       local anm:=indets(a,specindex(integer,y))[1],
             bnm:=indets(b,specindex(integer,y))[1];
       if op(1,anm)>op(1,bnm) then true;
       elif op(2,anm)<op(2,bnm) then true;
       else false; end if;
     end proc:

L := sort([op(expr)],T):

U := sort([indets(expr,specindex(integer,y))[]],T):

P := proc(n::nonnegint) local i;
       sort(add(L[i],i=1..n+1),order=plex(U[]));
     end proc:

 

P(0);

y[0, 0]

P(1);

y[0, 0]+r*y[0, 1]

P(2);

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]

P(3);

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]

P(4);

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]

P(5);

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]

P(6);

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6]

P(7);

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]

P(8);

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]+(1/720)*r*(r-1)*(r-2)*(r-3)*(r-4)*(1+r)*y[-3, 8]

 

Download sorty_thing.mw


Your given example could also be handled by the following simpler approach. But I think that the sorted effect is nicer. And if this is run in a separate session from the above code then the addends are not necessarily sorted so nicely (IMO), in each result.

expr := r*y[0, 1]+y[0, 0]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/2)*r*(r-1)*y[-1, 2]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/720)*r*(r-1)*(r-2)*(r-3)*(r-4)*(1+r)*y[-3, 8]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6];

r*y[0, 1]+y[0, 0]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/2)*r*(r-1)*y[-1, 2]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/720)*r*(r-1)*(r-2)*(r-3)*(r-4)*(1+r)*y[-3, 8]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6]

q := (n::nonnegint)->select(u->op(2,indets(u,indexed)[1])<=n,expr):

q(2);

r*y[0, 1]+y[0, 0]+(1/2)*r*(r-1)*y[-1, 2]

q(4);

r*y[0, 1]+y[0, 0]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/2)*r*(r-1)*y[-1, 2]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]

q(7);

r*y[0, 1]+y[0, 0]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/2)*r*(r-1)*y[-1, 2]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6]

Download sorty_thing2.mw

You could get it with calls to GAMMA instead of WhittakerM.

f := exp(-beta*x)*x^(5-alpha):

simplify(convert(int(f,x),GAMMA));

((beta*x)^alpha*x^(-alpha)*(alpha-5)*(alpha-1)*(alpha-2)*(alpha-3)*(alpha-4)*GAMMA(-alpha+1, beta*x)-exp(-beta*x)*beta*(alpha-5)*(alpha-2)*(alpha-3)*(alpha-4)*x^(-alpha+1)+exp(-beta*x)*beta^2*(alpha-5)*(alpha-3)*(alpha-4)*x^(-alpha+2)-exp(-beta*x)*beta^3*(alpha-4)*(alpha-5)*x^(-alpha+3)+exp(-beta*x)*beta^4*(alpha-5)*x^(-alpha+4)-x^(5-alpha)*exp(-beta*x)*beta^5+x^(-alpha)*(beta*x)^alpha*GAMMA(-alpha+6))/beta^6

Download Wh_ex.mw

You could further collect on, say, exp, GAMMA, beta, etc. But mostly that just rearranges those terms. You haven't said what exactly you mean by less "complicated".

First 11 12 13 14 15 16 17 Last Page 13 of 309