acer

29759 Reputation

29 Badges

19 years, 317 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

If you do it as,

  B := A[1..4, 2..2];

instead of your,

  B := A(1..4, 2);

then you get B as a 4x1 Matrix instead of your 4x1 Column Vector.

restart

A := Matrix(4, 4, {(1, 1) = m[1, 1], (1, 2) = m[1, 2], (1, 3) = m[1, 3], (1, 4) = m[1, 4], (2, 1) = m[2, 1], (2, 2) = m[2, 2], (2, 3) = m[2, 3], (2, 4) = m[2, 4], (3, 1) = m[3, 1], (3, 2) = m[3, 2], (3, 3) = m[3, 3], (3, 4) = m[3, 4], (4, 1) = m[4, 1], (4, 2) = m[4, 2], (4, 3) = m[4, 3], (4, 4) = m[4, 4]})

A := Matrix(4, 4, {(1, 1) = 0, (1, 2) = m[1, 2], (1, 3) = m[1, 3], (1, 4) = m[1, 4], (2, 1) = 0, (2, 2) = m[2, 2], (2, 3) = m[2, 3], (2, 4) = m[2, 4], (3, 1) = 0, (3, 2) = m[3, 2], (3, 3) = m[3, 3], (3, 4) = m[3, 4], (4, 1) = 0, (4, 2) = m[4, 2], (4, 3) = m[4, 3], (4, 4) = m[4, 4]})

A(1 .. 4, 1) := Matrix(4, 1):

A

Matrix([[0, m[1, 2], m[1, 3], m[1, 4]], [0, m[2, 2], m[2, 3], m[2, 4]], [0, m[3, 2], m[3, 3], m[3, 4]], [0, m[4, 2], m[4, 3], m[4, 4]]])

B := A[1 .. 4, 2 .. 2]

B := Matrix(4, 1, {(1, 1) = m[1, 2], (2, 1) = m[2, 2], (3, 1) = m[3, 2], (4, 1) = m[4, 2]})

A.B

4

F := Matrix(4, 1, {(1, 1) = 0.4279668887e-7, (2, 1) = -0.3901148183e-7, (3, 1) = 0.3900685346e-7, (4, 1) = 0.})

A.B-F

Matrix(4, 1, {(1, 1) = m[1, 2]*m[2, 2]+m[1, 3]*m[3, 2]+m[1, 4]*m[4, 2]-0.4279668887e-7, (2, 1) = m[2, 2]^2+m[2, 3]*m[3, 2]+m[2, 4]*m[4, 2]+0.3901148183e-7, (3, 1) = m[3, 2]*m[2, 2]+m[3, 3]*m[3, 2]+m[3, 4]*m[4, 2]-0.3900685346e-7, (4, 1) = m[2, 2]*m[4, 2]+m[3, 2]*m[4, 3]+m[4, 2]*m[4, 4]})

NULL

Download soalzarb_ac.mw

Hopefully I have coded "King's" method as you intend. (You can check that.)

The first worksheet's way is simpler, but more expensive. It uses plots:-densityplot. It colors (hue) the points by the iteration count. But it does not illustrate to which root each input point converges. It's not very fast, even at a relatively small maximal-iteration limit.  King_iter.mw

The second worksheet colors by the root to which the input point converges.
King_vs_Newt_basin.mw

restart;


This is not a fast approach, for modest resolution.

It consists of creating a density plot of the iteration count
to achieve a given forward-error.

The color shading is by iteration count.

__FF := proc(z) option inline; z^3-1 end proc:

 

KingCount := subs(g=3, F=__FF, dF=D(__FF),
  proc(x0,y0) local u,i,v,A;
  u[1] := evalf(x0+y0*I);
  for i from 1 to 25 do
    v[i] := u[i] - F(u[i])/dF(u[i]);
    A[i] := F(u[i])+(g-2)*F(v[i]);
    u[i+1] := v[i] - 1/A[i]*(F(u[i])+g*F(v[i]))*F(v[i])/dF(u[i]);
    if abs(F(u[i+1]))<1e-3 then return i; end if;
  end do:
  return i-1;
end proc):

NewtCount := subs(g=3, F=__FF, dF=D(__FF),
  proc(x0,y0) local u,i,v,A;
  u[1] := evalf(x0+y0*I);
  for i from 1 to 25 do
    u[i+1] := u[i] - F(u[i])/dF(u[i]);
    if abs(F(u[i+1]))<1e-3 then return i; end if;
  end do:
  return i-1;
end proc):

 

PK := CodeTools:-Usage(
        plots:-densityplot(KingCount, -2..2, -2..2, grid=[201,201],
                           title="King's method", size=[300,300],
                           colorstyle=HUE, style=surface) ):

memory used=2.05GiB, alloc change=36.00MiB, cpu time=12.19s, real time=12.19s, gc time=1.48s

PN := CodeTools:-Usage(
        plots:-densityplot(NewtCount, -2..2, -2..2, grid=[201,201],
                           title="Newton's method", size=[300,300],
                           colorstyle=HUE, style=surface) ):

memory used=0.74GiB, alloc change=0 bytes, cpu time=4.74s, real time=4.75s, gc time=615.31ms

plots:-display(Array([PK, PN]));

 

 

 

 

 


An alternative way to get a similar image of the iteration count
(using Newton's method) is as follows. This is much faster.
The hue spread is slightly differently utilized.

M := CodeTools:-Usage(
       Fractals:-EscapeTime:-Newton(300, -2 - 2*I, 2 + 2*I, z^3-1,
                                    iterationlimit=50, tolerance=1e-3) ):
plot(-2..2,-2..2,background=M);

memory used=19.73MiB, alloc change=19.62MiB, cpu time=342.00ms, real time=248.00ms, gc time=25.96ms

 

King_iter.mw

And here is the second:

restart:


The following uses the Escape command from the IterativeMaps package.

It is reasonable fast (even with some relatively ineffient post-processing.

I have chosen to post-process the output data so that the coloring is
made according to the root to which the given x+y*I input point converges.

Optionally we can scale the saturation by the iteration count.

ee := z^3 - 1;

z^3-1

## For ee a polynomial we can compute all the roots.
## This is used to specify the colors, below.
rts:=[fsolve(ee,z,complex)]:
evalf[7](%);

[-.5000000-.8660254*I, -.5000000+.8660254*I, 1.]

#(minr,maxr) := (min,max)(Re~(rts)):
#(mini,maxi) := (min,max)(Im~(rts)):
(minr,maxr) := -1, 1;
(mini,maxi) := -1, 1;

-1, 1

-1, 1

# One iteration of Newton's method
dee := diff(ee, z):
Newt1 := eval( z - ee/dee, z=zr+zi*I);

zr+I*zi-(1/3)*((zr+I*zi)^3-1)/(zr+I*zi)^2

# One iteration of King's method
F := unapply(ee,z): dF:=D(F):
v := u - F(u)/dF(u):
A := F(u)+(g-2)*F(v):
uu := v - 1/A*(F(u)+g*F(v))*F(v)/dF(u):
King1 := eval(uu, [g=3, u=zr+zi*I]);

zr+I*zi-(1/3)*((zr+I*zi)^3-1)/(zr+I*zi)^2-(1/3)*((zr+I*zi)^3-4+3*(zr+I*zi-(1/3)*((zr+I*zi)^3-1)/(zr+I*zi)^2)^3)*((zr+I*zi-(1/3)*((zr+I*zi)^3-1)/(zr+I*zi)^2)^3-1)/(((zr+I*zi)^3-2+(zr+I*zi-(1/3)*((zr+I*zi)^3-1)/(zr+I*zi)^2)^3)*(zr+I*zi)^2)

H := proc(Z,N,maxiter,{scalesaturation::truefalse:=false})
  local final,G,h,w,img,temp,temp2,newt,fzi,fzr;
  uses IterativeMaps, ImageTools;
  fzi := evalc( Im( Z ) );
  fzi := convert(simplify(fzi),horner);
  fzr := evalc( Re( subs(zi=zit, Z) ) );
  fzr := convert(simplify(fzr),horner);
  h,w := N, floor(N*(maxr-minr)/(maxi-mini));
  newt := Escape( height=h, width=w,
                       [zi, zr, zit],
                       [fzi, fzr, zi],
                       [y, x, y], evalc(abs(eval(ee,[z=zr+zit*I])))^2<1e-10,
                       2*minr, 2*maxr, 2*mini, 2*maxi,
                       iterations = maxiter,
                       redexpression = zr, greenexpression = zit, blueexpression=i );
  img:=Array(1..h,1..w,1..3,(i,j,k)->1.0,datatype=float[8]);
  temp:=ln~(map[evalhf](max,copy(newt[..,..,3]),1.0));
  temp2:=Threshold(temp,0.0001,low=1);
  img[..,..,3]:=FitIntensity(zip(`*`,temp,temp2));
  ## Done inefficiently, set the hue by position in the list of
  ## all roots
  G:=Array(zip((a,b)->min[index](map[evalhf](abs,rts-~(a+b*I))),
               newt[..,..,1],newt[..,..,2]),datatype=float[8],order=C_order):
  img[..,..,1]:=240*FitIntensity(G):
  if scalesaturation then
    img[..,..,2]:=1-~img[..,..,3]:
  end if;
  final := HSVtoRGB(img):
end proc:

 

Newtimg := H(Newt1,400,200):

# scale down the saturation by the time to converge
NewtimgS := H(Newt1,400,200,scalesaturation):

ImageTools:-Embed([Newtimg,NewtimgS]);

    

Kingimg := H(King1,400,200):

# scale down the saturation by the time to converge
KingimgS := H(King1,400,200,scalesaturation):

ImageTools:-Embed([Kingimg,KingimgS]);

   

King_vs_Newt_basin.mw

The names Column and Row are also exports of the LinearAlgebra package.

So if you load LinearAlgebra after loading DocumentTools:-Layout then you rebind those two names to LinearAlgebra -- but your code was written earlier to utilize them from DocumentTools:-Layout, and so you've broken your code.

There are many ways to fix up this muddle. Too many for me to show them all.

Here's one way, with minor editing of your attempt: loop_Alger_ac.mw

Personally, I'd rather use procedures (and uses), instead of all those loose top-level with calls to begin your Document. But that might be too much of a change (to your preferred methodology) for you to accept.

You could try something like the following.

This would all be entered into the same Execution Group or Document Block.

P:='P':A:=plot():
for i to 12 do

  # Here could be some long calculation,
  # eg. an expensive plot, or other work.
  # You could simulate that by sleeping 0.5sec, etc.
  Threads:-Sleep(0.5);
  P[i] := plot([i], [i^.5], 'style' = ':-point'):

  A := plots:-display(P[i],A);
  # The following always replaces the content of the
  # sole Task region of this Exec.Group or Doc.Block.
  DocumentTools:-Tabulate([A],'exterior'=':-none');
end do:
DocumentTools:-Tabulate([[]]): # clear the Task region
A;

Is this what you're after?

restart;

kernelopts(version);

`Maple 2021.2, X86 64 LINUX, Nov 23 2021, Build ID 1576349`

A:=-epsilon^(3/2)*a2^3/4 - (5*epsilon^(3/2)*a4^3)/3 - (5*epsilon^(3/2)*a5^3)/3 + a3*sqrt(epsilon) - sqrt(epsilon)*a2/3 - (2*sqrt(epsilon)*a4)/3 - (2*sqrt(epsilon)*a5)/3 - (5*epsilon^(3/2)*a2)/36 + (5*epsilon^(3/2)*a4)/9 + (5*epsilon^(3/2)*a5)/9 + epsilon/12 + (4*epsilon^(3/2)*a2*a4*a5)/3 - (7*epsilon^(3/2)*a2*a3*a4)/12 - (7*epsilon^(3/2)*a2*a3*a5)/12 + 5*epsilon^(3/2)*a3*a4*a5 - (3*epsilon^(3/2)*a2^2*a4)/4 - (3*epsilon^(3/2)*a2^2*a5)/4 + (2*epsilon^(3/2)*a2*a4^2)/3 + (2*epsilon^(3/2)*a2*a5^2)/3 - 5*epsilon^(3/2)*a4^2*a5 - 5*epsilon^(3/2)*a4*a5^2 + epsilon^(3/2)*a2^2*a3/12 + (5*epsilon^(3/2)*a3*a4^2)/2 + (5*epsilon^(3/2)*a3*a5^2)/2;

-(1/4)*epsilon^(3/2)*a2^3-(5/3)*epsilon^(3/2)*a4^3-(5/3)*epsilon^(3/2)*a5^3+a3*epsilon^(1/2)-(1/3)*epsilon^(1/2)*a2-(2/3)*epsilon^(1/2)*a4-(2/3)*epsilon^(1/2)*a5-(5/36)*epsilon^(3/2)*a2+(5/9)*epsilon^(3/2)*a4+(5/9)*epsilon^(3/2)*a5+(1/12)*epsilon+(4/3)*epsilon^(3/2)*a2*a4*a5-(7/12)*epsilon^(3/2)*a2*a3*a4-(7/12)*epsilon^(3/2)*a2*a3*a5+5*epsilon^(3/2)*a3*a4*a5-(3/4)*epsilon^(3/2)*a2^2*a4-(3/4)*epsilon^(3/2)*a2^2*a5+(2/3)*epsilon^(3/2)*a2*a4^2+(2/3)*epsilon^(3/2)*a2*a5^2-5*epsilon^(3/2)*a4^2*a5-5*epsilon^(3/2)*a4*a5^2+(1/12)*epsilon^(3/2)*a2^2*a3+(5/2)*epsilon^(3/2)*a3*a4^2+(5/2)*epsilon^(3/2)*a3*a5^2

sort(collect(A,epsilon),order=plex(epsilon),ascending);

(a3-(1/3)*a2-(2/3)*a4-(2/3)*a5)*epsilon^(1/2)+(1/12)*epsilon+(-(1/4)*a2^3-(5/3)*a4^3-(5/3)*a5^3-(5/36)*a2+(5/9)*a4+(5/9)*a5+(4/3)*a2*a4*a5-(7/12)*a2*a3*a4-(7/12)*a2*a3*a5+5*a3*a4*a5-(3/4)*a2^2*a4-(3/4)*a2^2*a5+(2/3)*a2*a4^2+(2/3)*a2*a5^2-5*a4^2*a5-5*a4*a5^2+(1/12)*a2^2*a3+(5/2)*a3*a4^2+(5/2)*a3*a5^2)*epsilon^(3/2)

 

Download sort_epsilon.mw

Also,

coeff(subs(epsilon^(1/2)=__K,A),__K);

      a3-1/3*a2-2/3*a4-2/3*a5

You could do it like this:

cond1 := 2<phi^2:
expr1 := 1.4<phi:

is(expr1) assuming cond1;

          false

`assuming`([is(expr1)], [cond1]);

          false

is(expr1) assuming cond1, phi>0;

           true

`assuming`([is(expr1)], [cond1, phi>0]);

           true

Above I show two calls to assuming with its infix syntax, as well as their alternate prefix (operator) forms which is sometimes more programmatically useful.

The comma-separated sequence of conditions is treated like a logical conjunction (ie. like a call to And). You may also be able to utilize And(...) , Or(...), etc.

You appear to be using Maple 2016.

You might try using the following syntax for the nested symbolic integration. This allows it to utilize the bounds on both eta__2 and zeta__2 while computing the inner intergation, and perform the full computation much more quickly.

You might need to experiment, to trying and check the accuracy.

NULL

restart

kernelopts(version);

`Maple 2016.2, X86 64 LINUX, Jan 13 2017, Build ID 1194701`

A := -Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.1619291800251-3.018371923484*10^11*sqrt(4.000000000000*10^24-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.7243706106403+1.382194833711*10^11*sqrt(1.562500000000*10^24-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2-.4637698986762-2.327456686822*10^11*sqrt(2.777777777778*10^24-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.1619291800251+3.018371923484*10^11*sqrt(4.000000000000*10^24-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2-.4637698986762+2.327456686822*10^11*sqrt(2.777777777778*10^24-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2-.9031048925918-8.123652892875*10^10*sqrt(1.562500000000*10^24-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2-.9031048925918+8.123652892875*10^10*sqrt(1.562500000000*10^24-zeta__2^2))+Heaviside(zeta__2-.6429162216568)*Heaviside(eta__2+.5050000000000-10.98537767108*sqrt(492.5151416233-zeta__2^2))-Heaviside(zeta__2-.6429162216568)*Heaviside(eta__2+.5050000000000+10.98537767108*sqrt(492.5151416233-zeta__2^2))+Heaviside(zeta__2-1.000000000000)*Heaviside(eta__2+.9875792458758-3.881485663812*10^9*sqrt(9.765625000000*10^22-zeta__2^2))+Heaviside(zeta__2-.9999999999936)*Heaviside(eta__2+.9875792458758+3.881485663812*10^9*sqrt(9.765625000000*10^22-zeta__2^2))-Heaviside(zeta__2-.9999999999936)*Heaviside(eta__2+.9875792458758-3.881485663812*10^9*sqrt(9.765625000000*10^22-zeta__2^2))+Heaviside(zeta__2-.6466146460206)*Heaviside(eta__2-.5050000000000+8.127372424924*sqrt(269.5813999936-zeta__2^2))-Heaviside(zeta__2-.7684252323012)*Heaviside(eta__2-.5050000000000+8.127372424924*sqrt(269.5813999936-zeta__2^2))-Heaviside(zeta__2-.6466146460206)*Heaviside(eta__2-.5050000000000-8.127372424924*sqrt(269.5813999936-zeta__2^2))+Heaviside(zeta__2-.7684252323012)*Heaviside(eta__2-.5050000000000-8.127372424924*sqrt(269.5813999936-zeta__2^2))+Heaviside(zeta__2-.5527964251744)*Heaviside(eta__2+.5050000000000+10.98537767108*sqrt(492.5151416233-zeta__2^2))-Heaviside(zeta__2-.5527964251744)*Heaviside(eta__2+.5050000000000-10.98537767108*sqrt(492.5151416233-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.7243706106403-1.382194833711*10^11*sqrt(1.562500000000*10^24-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.9842650870048+1.085166413462*10^10*sqrt(4.756242568371*10^23-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.9842650870048-1.085166413462*10^10*sqrt(4.756242568371*10^23-zeta__2^2))-Heaviside(zeta__2+.9999999999984)*Heaviside(eta__2-.9031048925918+8.123652892875*10^10*sqrt(1.562500000000*10^24-zeta__2^2))+Heaviside(zeta__2+.9999999999984)*Heaviside(eta__2-.9031048925918-8.123652892875*10^10*sqrt(1.562500000000*10^24-zeta__2^2))-Heaviside(zeta__2+.9999999999984)*Heaviside(eta__2+.7243706106403+1.382194833711*10^11*sqrt(1.562500000000*10^24-zeta__2^2))+Heaviside(zeta__2+.9999999999984)*Heaviside(eta__2+.7243706106403-1.382194833711*10^11*sqrt(1.562500000000*10^24-zeta__2^2))-Heaviside(zeta__2+.9999999999988)*Heaviside(eta__2-.4637698986762+2.327456686822*10^11*sqrt(2.777777777778*10^24-zeta__2^2))+Heaviside(zeta__2+.9999999999988)*Heaviside(eta__2-.4637698986762-2.327456686822*10^11*sqrt(2.777777777778*10^24-zeta__2^2))-Heaviside(zeta__2+.9999999999990)*Heaviside(eta__2+.1619291800251+3.018371923484*10^11*sqrt(4.000000000000*10^24-zeta__2^2))+Heaviside(zeta__2+.9999999999990)*Heaviside(eta__2+.1619291800251-3.018371923484*10^11*sqrt(4.000000000000*10^24-zeta__2^2))-Heaviside(zeta__2+.9999999999972)*Heaviside(eta__2+.9842650870048+1.085166413462*10^10*sqrt(4.756242568371*10^23-zeta__2^2))+Heaviside(zeta__2+.9999999999972)*Heaviside(eta__2+.9842650870048-1.085166413462*10^10*sqrt(4.756242568371*10^23-zeta__2^2))+Heaviside(zeta__2-.9999999999796)*Heaviside(eta__2-.8341191288491+1.298592148442*10^10*sqrt(9.706617486471*10^21-zeta__2^2))-Heaviside(zeta__2-.9999999999796)*Heaviside(eta__2-.8341191288491-1.298592148442*10^10*sqrt(9.706617486471*10^21-zeta__2^2))-Heaviside(zeta__2-1.000000000000)*Heaviside(eta__2-.8341191288491+1.298592148442*10^10*sqrt(9.706617486471*10^21-zeta__2^2))+Heaviside(zeta__2-1.000000000000)*Heaviside(eta__2-.8341191288491-1.298592148442*10^10*sqrt(9.706617486471*10^21-zeta__2^2))-Heaviside(zeta__2-1.000000000000)*Heaviside(eta__2+.9875792458758+3.881485663812*10^9*sqrt(9.765625000000*10^22-zeta__2^2)):

Digits := 22:

forget(`evalf/int`);

memory used=75.03MiB, alloc change=36.05MiB, cpu time=662.00ms, real time=662.00ms, gc time=45.53ms

.4238607655960000000000

forget(`evalf/int`);

memory used=7.27MiB, alloc change=0 bytes, cpu time=4.41s, real time=4.41s, gc time=0ns

.4238

 

NULL

Download romberg_ac.mw

The file you posted became corrupt in a plot substructure, located within several nested Sections.

I tried to make the maximal recovery, by closing off all XML elements (and removing some errant duplication of preamble...). This recovered much more than did the Maple 2021.2 GUI itself.

EchoModel_V3_ac.zip

You may want to consider manually backing up copies of snapshots of your work on a regular basis, so as to reduce the amount that could be lost.

note. Btw, that routine DeleteBadCharacters isn't going solve this corruption example. The outstanding problem here is the poor job of recovery that the GUI does in salvaging the XML.

T := [[1, 2], [3, 4]]:

subsindets(T,list,convert,set);

        {{1, 2}, {3, 4}}

That single command should also work for deeper nesting.

The Help page for Topic convert,set explains that option nested=true/false is, "...only relevant if the input expr is an rtable (Matrix, Array, or Vector) or array, matrix, or vector." That's not your situation.

It works (for me) if re-executed, presumably because of some fortuitous memoization.

It also works (for me) if all methods are tried. That can then be sieved for successful results.

It also works in my Maple 2022.1 if only method=risch is forced. Naturally that approach may not be as generally useful for you.

The error seems to go back to Maple 2019, before which the integral may have returned unevaluated.

(I have submitted a bug report.)

restart;
int(x^5*(a+b*arctan(c*x^2))^2,x);
int(x^5*(a+b*arctan(c*x^2))^2,x);
 

Error, (in gcdex) invalid arguments

(1/6)*b*a*ln(c^2*x^4+1)/c^3-((1/6)*I)*b^2*dilog(1/2-((1/2)*I)*c*x^2)/c^3-((1/12)*I)*b^2*ln(1+I*c*x^2)*ln(1-I*c*x^2)/c^3-((1/24)*I)*b^2*ln(1+I*c*x^2)^2/c^3-((1/12)*I)*b^2*x^4*ln(1-I*c*x^2)/c+(1/12)*b^2*ln(1+I*c*x^2)*ln(1-I*c*x^2)*x^6-(1/6)*b*a*x^4/c-((17/108)*I)*b^2/c^3+((1/6)*I)*b*a*x^6*ln(1-I*c*x^2)-((1/6)*I)*b^2*ln(1/2+((1/2)*I)*c*x^2)*ln(1/2-((1/2)*I)*c*x^2)/c^3+((1/6)*I)*b^2*ln(1/2+((1/2)*I)*c*x^2)*ln(1-I*c*x^2)/c^3-((1/6)*I)*b*a*x^6*ln(1+I*c*x^2)+(1/6)*x^6*a^2-(1/24)*b^2*x^6*ln(1+I*c*x^2)^2+((1/24)*I)*b^2*ln(1-I*c*x^2)^2/c^3+((1/12)*I)*b^2*x^4*ln(1+I*c*x^2)/c-(1/24)*b^2*x^6*ln(1-I*c*x^2)^2+(1/6)*b^2*x^2/c^2-(1/6)*b^2*arctan(c*x^2)/c^3

restart;
rhs~(select(type,int(x^5*(a+b*arctan(c*x^2))^2,x,
                     'method'=':-_RETURNVERBOSE'),
            string=algebraic));

[(1/6)*b*a*ln(c^2*x^4+1)/c^3+(1/12)*b^2*ln(1+I*c*x^2)*ln(1-I*c*x^2)*x^6-(1/6)*b*a*x^4/c+((1/24)*I)*b^2*ln(1-I*c*x^2)^2/c^3-((17/108)*I)*b^2/c^3-((1/6)*I)*b^2*dilog(1/2-((1/2)*I)*c*x^2)/c^3-((1/12)*I)*b^2*x^4*ln(1-I*c*x^2)/c+((1/6)*I)*b*a*x^6*ln(1-I*c*x^2)-((1/6)*I)*b^2*ln(1/2+((1/2)*I)*c*x^2)*ln(1/2-((1/2)*I)*c*x^2)/c^3+((1/6)*I)*b^2*ln(1/2+((1/2)*I)*c*x^2)*ln(1-I*c*x^2)/c^3-((1/12)*I)*b^2*ln(1+I*c*x^2)*ln(1-I*c*x^2)/c^3+((1/12)*I)*b^2*x^4*ln(1+I*c*x^2)/c-(1/24)*b^2*x^6*ln(1+I*c*x^2)^2-((1/6)*I)*b*a*x^6*ln(1+I*c*x^2)-(1/24)*b^2*x^6*ln(1-I*c*x^2)^2+(1/6)*b^2*x^2/c^2-(1/6)*b^2*arctan(c*x^2)/c^3-((1/24)*I)*b^2*ln(1+I*c*x^2)^2/c^3+(1/6)*x^6*a^2]

Download int_gcdex_wk.mw

This is not suggested as better than vv's approach.

But you may be interested in a couple of nudges that can help fix up your result (using some missing bits and pieces...).

restart;

RaiseIndex := proc(S::specfunc({sum,Sum}),k::integer)
  local svar:=lhs(op(2,S));
  op(0,S)(eval(op(1,S),svar=svar-k),
          svar=map(`+`,rhs(op(2,S)),k));
end proc:

 

U := rsolve({u(1) = x[1], u(n + 1) = u(n) + (x[n + 1] - u(n))/(n + 1)}, u(n));

(Sum(x[n1+1], n1 = 1 .. n-1)+x[1])/n

U2 := subsindets(U, specfunc(Sum), S->RaiseIndex(S,1));

(Sum(x[n1], n1 = 2 .. n)+x[1])/n

extra := x[1] = Sum(x[n1], n1=1..1);

x[1] = Sum(x[n1], n1 = 1 .. 1)

simplify(simplify(U2, {extra}));

(Sum(x[n1], n1 = 1 .. n))/n

Download sumbitsandpieces.mw

[note: I had this worksheet completed before I saw vv's Answer. I'm not really surprised how similar they are, taking natural approaches.]

The eq4 below (for c[2]) is not strictly necessary. It's just a rewriting of the eq1, by substituting the obtained solution for Z. I figured you might want two equations that did not have any c[2] or Z on their RHSs.

restart

kernelopts(version);

`Maple 17.02, X86 64 LINUX, Sep 5 2013, Build ID 872941`

(1)

eq1 := c[2] = Z^2/(2*(m+2));

c[2] = Z^2/(2*m+4)

(2)

eq2 := int((m*(c[2]-x^2/(2*(m+2))))^(1/m), x = 0 .. Z) = alpha

int((m*(c[2]-x^2/(2*m+4)))^(1/m), x = 0 .. Z) = alpha

(3)

assume(m >= 1);

temp := IntegrationTools:-Change(eval(eq2, eq1), s = x/Z, s);

(1/2)*m^(1/m)*(m+2)^(-1/m)*Z*((1/2)*Z^2)^(1/m)*GAMMA(1/m+1)*Pi^(1/2)/GAMMA(1/m+3/2) = alpha

(4)

eq3 := `assuming`([isolate(combine(temp), Z)], [Z > 0]);

Z = (alpha*GAMMA((1/2)*(2+3*m)/m)/(2^(-(1+m)/m)*m^(1/m)*(m+2)^(-1/m)*Pi^(1/2)*GAMMA((1+m)/m)))^(m/(m+2))

 

c[2] = ((alpha*GAMMA((1/2)*(2+3*m)/m)/(2^(-(1+m)/m)*m^(1/m)*(m+2)^(-1/m)*Pi^(1/2)*GAMMA((1+m)/m)))^(m/(m+2)))^2/(2*m+4)

(5)

 

 

Now a simple sanity check (numeric, and exact).

evalf(eval(eval(subs(int = Int, eq2), [eq3, eq4]), [m = 2, alpha = 6]));

6.000000000 = 6.

(6)

simplify(eval([eq3, eq4], [m = 2, alpha = 6]));

[Z = 4*3^(1/2)/Pi^(1/2), c[2] = 6/Pi]

 

true

(7)

eval(eval(eq2, [eq3, eq4]), [m = 2, alpha = 6]);

6 = 6

(8)

``

Download system_eqs_ac.mw

PDEtools:-Solve tries to simplify the RootOf that solve returns (when passed the numerator of the trig-expanded form of result), and generates RootOf(0).

Unfortunatelty,

result:=1/2*(Dirac(1,-t+4+k)+Dirac(1,t-4+k)-Dirac(1,-t+4+k)*cos(-t+4+k)
             +2*Dirac(-t+4+k)*sin(-t+4+k)+2*sin(t-4+k)*Dirac(t-4+k)
             -Dirac(1,t-4+k)*cos(t-4+k))/k:

result:=simplify(result):

denom(result);

             2 k

lprint(numer(result));
Dirac(1,-t+4+k)+Dirac(1,t-4+k)-Dirac(1,-t+4+k)*cos(-t+4+k)+2*Dirac(-t+4+k)*sin
(-t+4+k)+2*sin(t-4+k)*Dirac(t-4+k)-Dirac(1,t-4+k)*cos(t-4+k)

simplify(numer(result));

              0

Avoiding a clash with the default value of statevariable,

restart;

kernelopts(version);

`Maple 2022.1, X86 64 LINUX, May 26 2022, Build ID 1619613`

DynamicSystems:-SystemOptions('statevariable'=sv,
                              'continuoustimevar'=x):

ode:=diff(y(x),x$2)+y(x) = 0;

diff(diff(y(x), x), x)+y(x) = 0

DynamicSystems:-DiffEquation(ode,'outputvariable'=[y(x)]);

"module() ... end module"

Download DS_problem_ac.mw

Otherwise, this error message attains,

  restart;
  DynamicSystems:-SystemOptions('continuoustimevar'=x):
  Error, (in DynamicSystems:-SystemOptions) cannot assign x to
  continuoustimevar, already assigned to statevariable

It's not difficult to make a prodecure that will color and join arbitrary v and k.

The results of printf are usually left-justified. Do you really need left-justified output? Left-justification is also possible. But I won't be around for the next 5 days.

restart;

F := proc(v,k,C) uses Typesetting;
      mrow(mn(sprintf("%s]",v),mathcolor=C),
           mn(sprintf(" is %g",k),mathcolor="Blue"));
end proc:

F("1:1", 4, "Green");

"1:1] is 4"

F("2:2", 1/3., "Red");

"2:2] is 0.333333"

Download color_string.mw

First 36 37 38 39 40 41 42 Last Page 38 of 309