acer

17333 Reputation

29 Badges

14 years, 119 days

On google groups. (comp.soft-sys.math.maple and sci.math.symbolic)

On stackoverflow.

On math.stackexchange.com.

MaplePrimes Activity


These are answers submitted by acer

Several of the images and drawing canvases were corrupted. And there was a point past which the file contents became corrupted altogether.

I was able to recover this much. (It's possible that one or two more images near the end of this might be salvaged as well, I'm not sure.)

Eksamensopgaver_samlet_ac1.mw

At present there is no released full version of Maple which supports the Arm CPU chipset.

Yes, all Maple versions are architecture dependent. (For some years now [2019] the only supported architectures of Maple have been x86-64 and x86.)

There are a number of plotting qualities that the GUI treats specially, by design, in a mechanism cometimes called "plot inheritance" or "plot persistence". The special qualities are mostly the kinds of plotting attributes that one changes manually (axis labels, inline plotting window size, rotation, etc).

Have you ever noticed that when you manually rotate a 3D plot, and re-execute to get different plotted values say, the manually chosen orientation magically stays the same? That's plot inheritance by the GUI.

It looks like your example may have confused the GUI about utilizing the labels of the second plot within that whole Execution Group. My guess is that it has something to do with either plot inheritance, or the fact that you are printing a plot that is also an assignment, or a combination of both of those.

(note: Plot inheritance is tricky because it's intended to add convenience without anyone ever noticing... Combine that with "relatively new" functionality to actually display plots on the rhs of assignment statements, and newer functionality to display plot thumbnails within mixed expression sequences, and I wouldn't be surprised if it's difficult to keep the code sparkly clean.)

Since implicitplot3d can require a costly larger grid to produce a smoother surface with clear edges to the region, an explicit solution can be nice.

restart;
ee := 1/16*(3*x^2+10*x*z-16*y^2+3*z^2):
S := [solve(ee,x)]:
SS := [solve(eval(ee,z=0),y)]:
SSS := [solve(eval(ee,x=0),y)]:
plots:-display(
 plot3d(S[1], z = 0 .. 15, y = -15 .. 15),
 plot3d([0,y,x], y = SS[2] .. SS[1], x = 0 .. 15),
 plot3d([z,y,0], y = SSS[2] .. SSS[1], z = 0 .. 15),
 view=0..15, orientation=[-170,-15,-40],
 labels=[z,y,x], style=surface
);

[edit] I've revised, and now below BoxMuller_ac2N(N) will return with at most N entries.

Summary:

CodeTools:-Usage(Statistics:-Sample(Normal(0,1), 10^5, method=envelope), iterations=200):
memory used=3.00MiB, alloc change=-146.02MiB, cpu time=38.58ms, real time=36.63ms, gc time=4.61ms

CodeTools:-Usage(BoxMuller_ac2N(10^5), iterations=200):
memory used=1.78MiB, alloc change=21.41MiB, cpu time=11.97ms, real time=9.20ms, gc time=4.83ms

CodeTools:-Usage(Statistics:-Sample(Normal(0,1), 10^5), iterations=200):
memory used=0.78MiB, alloc change=-20.39MiB, cpu time=9.24ms, real time=6.46ms, gc time=5.20ms

If I replace the call to create the initial uniform sample with this call to rtable then I can shave off about 6% of the timing of BoxMuller_ac2N for N=10^5.
          V := rtable(1..n,1..2,frandom(-1..1),datatype=float[8]);

The OP's BoxMuller_2 procedure seems reasonably quick on a few runs, but produces more collectible garbage. This costs, if repeated more times, it seems:

CodeTools:-Usage(BoxMuller_2(10^5), iterations=200):
memory used=14.84MiB, alloc change=-30.42MiB, cpu time=172.98ms, real time=102.70ms, gc time=124.26ms

I see no reason why BoxMuller_ac2 or similar could not be multi-threaded.
 

restart;

interface(rtablesize=30):

kernelopts(version);

`Maple 2019.1, X86 64 LINUX, May 21 2019, Build ID 1399874`

BoxMuller_1 := proc(N)

  local V, S, T, L, X1, X2:

  V  := Statistics:-Sample(Uniform(-1, 1), [ceil(2*N/3), 2]):

  S  := V[..,1]^~2 +~ V[..,2]^~2;

  T  := < subs(NULL=infinity, select(`<`, S, 1)) | V >;

  T[.., 1]  := (-2 *~ log~(T[.., 1]) /~ T[.., 1])^~(0.5);

  X1 := select[flatten](type, T[.., 1] *~  T[..,2], 'float');

  X2 := select[flatten](type, T[.., 1] *~  T[..,3], 'float');

  return <X1 , X2>:

end proc:

 

Bout1:=CodeTools:-Usage(BoxMuller_1(10^5), iterations=10):

memory used=73.09MiB, alloc change=82.01MiB, cpu time=723.70ms, real time=587.70ms, gc time=306.11ms

 

BoxMuller_2 := proc(N)
  local V1, V2, S, W, u, r, T, X1, X2:
  V1 := Statistics:-Sample(Uniform(-1, 1), ceil(2*N/3)):
  V2 := Statistics:-Sample(Uniform(-1, 1), ceil(2*N/3)):
  S  := V1^~2 +~ V2^~2;
  W  := sort(S, output = [sorted, permutation]):
  u  := ListTools:-BinaryPlace(W[1], 1);
  r  := [$1..u]:
  T  := (-2 *~ log~(W[1][r]) /~ W[1][r])^~(0.5);
  X1 := T *~ V1[W[2][r]];
  X2 := T *~ V2[W[2][r]];
  return <X1 | X2>^+:
end proc:

 

Bout2 := CodeTools:-Usage(BoxMuller_2(10^5), iterations=10):

memory used=14.85MiB, alloc change=10.02MiB, cpu time=87.80ms, real time=108.90ms, gc time=38.77ms

 

BoxMuller_ac2N := module()
  local helper, ModuleApply, ModuleLoad, compiled;
  ModuleApply:=proc(N)
    local c, n, R, V, X1, X2, aaa, bbb, ccc:
    n := ceil(2*N/3);
    #V := Statistics:-Sample(Uniform(-1, 1), [n,2]):
    V := rtable(1..n,1..2,frandom(-1..1),datatype=float[8]);
    R := Vector(N,datatype=float[8]);
    if compiled then
      c := helper(V,R,n,N);
    else
      c := evalhf(helper(V,R,n,N));
    end if;
    if 2*trunc(c) < N then
      return R[1..min(N,2*trunc(c))];
    else
      return R;
    end if;
  end proc:
  helper:=proc(VV,R,n,N)
    local c, i, SSi;
    c := 0;
    for i from 1 to n do
      SSi := VV[i,1]^2 + VV[i,2]^2;
      if SSi <= 1.0 then
        c := c+1;
        SSi := sqrt(-2*log(SSi)/SSi);
        R[2*c-1] := SSi*VV[i,1];
        R[2*c] := SSi*VV[i,2];
        if 2*c >= N then
          i := n; next;
        end if;
      end if;
    end do;
    return c;
  end proc;
  ModuleLoad := proc()
    try
      helper := Compiler:-Compile(helper);
      compiled := true;
    catch:
      compiled := false;
      WARNING("will use evalhf mode, not compiled");
    end try;
  end proc:
  ModuleLoad();
end module:
BoxMuller_ac2N(10^1):

 

Boutac2:=CodeTools:-Usage(BoxMuller_ac2N(10^5), iterations=10):

memory used=1.78MiB, alloc change=10.20MiB, cpu time=9.60ms, real time=9.60ms, gc time=0ns

 

Boutac2:=CodeTools:-Usage(BoxMuller_ac2N(10^6), iterations=10):

memory used=17.81MiB, alloc change=178.09MiB, cpu time=74.60ms, real time=74.60ms, gc time=0ns

 

# Carl Love's procedure with slight modifications t
SampleCheck := proc(X, f, N::posint)
uses St= Statistics;
  local S, M, O, E:
  S:= f(N):
  M:= numelems(S):
  O:= <St:-TallyInto(S, <[$(floor@min-1..ceil@max)(S)]>)>:
  E:= St:-Probability~(X <~ (rhs@lhs)~(O), 'numeric') * M:
  <rhs~(O)[2..] | E[2..] - E[..-2]>
end proc:

 

SampleCheck(Statistics:-RandomVariable(Normal(0,1)), 'BoxMuller_1', 10^5),
SampleCheck(Statistics:-RandomVariable(Normal(0,1)), 'BoxMuller_2', 10^5),
SampleCheck(Statistics:-RandomVariable(Normal(0,1)), 'BoxMuller_ac2N', 10^5);
 

Matrix(10, 2, {(1, 1) = 7, (1, 2) = 3.28596660035190, (2, 1) = 123, (2, 2) = 138.018344891743, (3, 1) = 2221, (3, 2) = 2240.60449106269, (4, 1) = 14280, (4, 2) = 14229.2662716492, (5, 1) = 35652, (5, 2) = 35738.7949133765, (6, 1) = 35714, (6, 2) = 35738.7949133765, (7, 1) = 14316, (7, 2) = 14229.2662716492, (8, 1) = 2239, (8, 2) = 2240.60449106270, (9, 1) = 139, (9, 2) = 138.018344891738, (10, 1) = 9, (10, 2) = 3.28596660034964}), Matrix(10, 2, {(1, 1) = 7, (1, 2) = 3.28276537214525, (2, 1) = 126, (2, 2) = 137.883885759184, (3, 1) = 2223, (3, 2) = 2238.42166720320, (4, 1) = 14387, (4, 2) = 14215.4039492069, (5, 1) = 35617, (5, 2) = 35703.9777492775, (6, 1) = 35605, (6, 2) = 35703.9777492775, (7, 1) = 14242, (7, 2) = 14215.4039492069, (8, 1) = 2257, (8, 2) = 2238.42166720319, (9, 1) = 132, (9, 2) = 137.883885759191, (10, 1) = 2, (10, 2) = 3.28276537214697}), Matrix(10, 2, {(1, 1) = 4, (1, 2) = 3.13845902612407, (2, 1) = 144, (2, 2) = 131.822678979697, (3, 1) = 2162, (3, 2) = 2140.02339165491, (4, 1) = 13448, (4, 2) = 13590.5121983278, (5, 1) = 34302, (5, 2) = 34134.4746068543, (6, 1) = 33800, (6, 2) = 34134.4746068543, (7, 1) = 13839, (7, 2) = 13590.5121983278, (8, 1) = 2144, (8, 2) = 2140.02339165490, (9, 1) = 152, (9, 2) = 131.822678979705, (10, 1) = 5, (10, 2) = 3.13845902611502})

SampleCheck(Statistics:-RandomVariable(Normal(0,1)), 'BoxMuller_ac2N', 10^7);

Matrix(12, 2, {(1, 1) = 4, (1, 2) = 2.856649842341556, (2, 1) = 344, (2, 2) = 313.84590261240675, (3, 1) = 13333, (3, 2) = 13182.26789796973, (4, 1) = 213622, (4, 2) = 214002.3392, (5, 1) = 1358216, (5, 2) = 1359051.220, (6, 1) = 3412442, (6, 2) = 3413447.461, (7, 1) = 3415688, (7, 2) = 3413447.461, (8, 1) = 1358519, (8, 2) = 1359051.220, (9, 1) = 214250, (9, 2) = 214002.3392, (10, 1) = 13270, (10, 2) = 13182.267897970974, (11, 1) = 305, (11, 2) = 313.84590261243284, (12, 1) = 7, (12, 2) = 2.8566498421132565})

(*
DocumentTools:-Tabulate(
  [
    plots:-display(
      Statistics:-Histogram(Bout2),
      plot(Statistics:-PDF(Normal(0, 1), x), x=-4..4, color=red,thickness=3)
    ),
    plots:-display(
      Statistics:-Histogram(Boutac2),
      plot(Statistics:-PDF(Normal(0, 1), x), x=-4..4, color=red,thickness=3)
    )
  ], width=60
):
*)

CodeTools:-Usage(Statistics:-Sample(Normal(0,1), 10^5, method=envelope), iterations=200):

memory used=3.00MiB, alloc change=-146.02MiB, cpu time=38.58ms, real time=36.63ms, gc time=4.61ms

CodeTools:-Usage(BoxMuller_ac2N(10^5), iterations=200):

memory used=1.78MiB, alloc change=21.41MiB, cpu time=11.97ms, real time=9.20ms, gc time=4.83ms

CodeTools:-Usage(Statistics:-Sample(Normal(0,1), 10^5), iterations=200):

memory used=0.78MiB, alloc change=-20.39MiB, cpu time=9.24ms, real time=6.46ms, gc time=5.20ms

CodeTools:-Usage(BoxMuller_2(10^5), iterations=200):

memory used=14.84MiB, alloc change=-1.02MiB, cpu time=134.48ms, real time=82.25ms, gc time=95.72ms

 

Download BMacrevN.mw

Your code falls into the well-known mistake sometimes called premature evaluation. The problem is that you need to guard against the evaluation of T before c gets any numeric value.

The seq command has special evaluation rules, and that's why it works when you use that as your "trick". The normal evaluation rules for Maple is that procedure calls evaluate their arguments up front.

A simple approach is to delay evaluation using single right-quotes (a.k.a. unevaluation quotes) around the calls to X,Y in the second argument passed to the animate command.   cardioidfamily_ac.mw

There are other ways to deal with this issue.

Another way is to construct the procedures so that they return unevaluated if the relevant arguments are not numeric.   cardioidfamily_ac2.mw

Yet another way to construct the animations is to use two procedures which each make a whole frame.   cardioidfamily_ac3.mw

I'll add that the collection of point-plots (for all c values) could also be constructed in a single call to pointplot. (I haven't done that.) I also didn't change the over all approaches, or put in any efficiency improvements to re-use previously computed values.

You might also see this page.

I added the missing with(plots) to all the worksheets.

[edit] Since it is only procedure T which requires any guard against unwanted evaluation at non-numeric argument, here are revised versions which do only that. I've also added option remember to T, so as to gain efficiency by avoiding duplicate fsolve work.
cardioidfamily_ac_rev.mw
cardioidfamily_ac2_rev.mw
cardioidfamily_ac3_rev.mw

So this is a followup (duplicate topic) of your earlier Question here? (If so then please, next time add your followup query to the original Question thread. That keeps the whole topic together, which helps all the readership.)

Is this what you want? This is one of the least graceful ways of doing it:  both_of_them_ac_huh.mw

If that's not what you want then please add more complete and explicit details of your query.

I tagged this Question as Maple 17, since you didn't make the effort to do that.

It is a bug that plottools:-extrude produces a VIEW substructure in its result.

A simple way to deal with it is to immediately clobber any VIEW substructure that extrude produces. Ie, something like,

    plots:-shadebetween(x^2, 2-x^2, x=-1..1, color=red, transparency=0):
    p1 := eval(plottools:-extrude(%, 0..0.3),VIEW=NULL):

Or you could use subsindets to get the same effect. It's also wrong that extrude generates any axis lablels.

restart;

plots:-shadebetween(x^2, 2-x^2, x=-1..1, color=red, transparency=0):
p1 := subsindets(plottools:-extrude(%, 0..0.3),
                 specfunc({VIEW,AXESLABELS}),()->NULL):

plottools:-sphere([1.5,0,0], 1, color="Green"):
p2 := plots:-display(%):

plots:-display([p1,p2], scaling=constrained, style=surface);

 

Download bug-in-3D-view_ac.mw

I'll submit a bug report.

sum(sin(Pi*n/2)*sin(n*Pi*(x + 1)/2)*cos(n*Pi*t/2),n=1..infinity,formal);

                0

Have you tried giving parameter t a default value which is an integer?

Eg,        t::{integer,name}:=0

This kind of optional parameter is called a positional parameter (as opposed to a keyword parameter).

restart;

graph := proc(fn::anything, t::{integer, name}:=0)
   if type(t, integer) then return fn;
   else return plot(fn, gridlines);
   end if;
end proc:

graph(x^2);

x^2

graph(x^2,g);

 

Download param_default.mw

Of course there are other ways to accomplish the same effect. You could have used it as, say,       t::{truefalse,name}:=false

restart;
graph2 := proc(fn::anything, t::{truefalse, name}:=false)
   if t=false then return fn;
   else return plot(fn, gridlines);
   end if;
end proc:
graph2(x^2);
graph2(x^2,g);
graph2(x^2,false);
graph2(x^2,true);

You could also utilize a keyword parameter.

What purpose do you want the name to serve, when you pass that instead? For example, is passing the extra name g supposed to do something different than passing the extra name w? (If not then this definition might not seem graceful to everyone...)

I supplied the missing definition of the list xx of x-values.

This also runs about 3-3.5 times faster than the original, on my machine, but requests the same accuracy for computing the two final lists.

I also fixed the operator assignment syntax so that it wouldn't pester each time about operator-definition versus remember-table.

I used Maple 18.02, since the OP's original attachment was last saved in that version. (I suspect that the OP confuses Maple 18 with Maple 2018, which are two totally different versions, with their release dates separated by four years.)

restart

Digits := 10:

with(plots):

with(CurveFitting):

with(plottools):

v := 7/10:

Disp := 15:

esp := 800000:

k := 0:

E := proc (x, t) if not [x, t]::(list(numeric)) then return ('procname')(args) end if; evalf(Int(unapply(exp((-esp*w^4+Disp*w^2+k)*t)*cos(w*(x+v*t))/Pi, w), 0 .. infinity, epsilon = 0.1e-5)) end proc:

E(x, t)

E(4000, 3600)

0.6340431462e-11

f := proc (x) options operator, arrow; 20*exp(-(1/900000)*(x-10000)^2)+17*exp(-(1/900000)*(x-12000)^2) end proc

proc (x) options operator, arrow; 20*exp(-(1/900000)*(x-10000)^2)+17*exp(-(1/900000)*(x-12000)^2) end proc

u := proc (x, t) options operator, arrow; int(E(x-xi, t)*f(xi), xi = 0. .. 15000) end proc

proc (x, t) options operator, arrow; int(E(x-xi, t)*f(xi), xi = 0. .. 15000) end proc

u(12000, 7200);

-0.3891737146e-4

xx := [seq(i, i = 0 .. 15000, 100)]:

uu3600 := CodeTools:-Usage(map(proc (i) options operator, arrow; evalf(Int(unapply(E(i-xi, 3600)*f(xi), xi), 0 .. 15000, method = _NCrule, epsilon = 1/1000000)) end proc, xx)):

memory used=0.57GiB, alloc change=0 bytes, cpu time=9.50s, real time=9.31s, gc time=622.43ms

 

uu7200 := CodeTools:-Usage(map(proc (i) options operator, arrow; evalf(Int(E(i-xi, 7200)*f(xi), xi = 0 .. 15000, method = _NCrule, epsilon = 1/1000000)) end proc, xx)):

memory used=0.59GiB, alloc change=0 bytes, cpu time=8.61s, real time=8.46s, gc time=459.57ms

p1 := plot(f(x), x = 0 .. 15000, color = blue, legend = [''t = 0'']):

p2 := plot(xx, uu3600, color = red, legend = [''t = 3600'']):

p3 := plot(xx, uu7200, color = blue, legend = [''t = 0'']):

plots[display]({p1, p2, p3})

``

 

``

Download permanouuuuuuuuuuuuuuuuuun_ac.mw

The following runs around 4 times faster than the original, as another variant. permanouuuuuuuuuuuuuuuuuun_ac2.mw

Here is interpolation by piecewise splines. Using Maple 2019.1.

The interpolated curve is red. The first derivative of that interpolated curve is black. The orange diamonds indicate interior inflection points of that interpolated curve.

If you use a different method of curve-fitting then your interpolant (and its inflection points) may not be the same. That's a mathematical consequence, not a Maple quirk.

restart;

x := [ 7.0, 7.2, 7.4 ,7.6, 8.4, 8.8, 9.2, 9.6, 10.0,10.4,10.8,11.2]:
y := [ 0.692, 0.719, 0.723, 0.732, 0.719, 0.712,
       1.407, 1.714, 1.99,2.118, 2.305, 2.711]:

F:=Interpolation:-Interpolate(x,y,method=spline,degree=3):

plots:-display(
  plot(<<x>|<y>>,style=point,color=blue),
  plot(F,x[1]..x[-1]),
  size=[600,300]
);

pts:=Student:-Calculus1:-InflectionPoints('F'(t),t=x[1]..x[-1],numeric);

[7.349175938, 7.765875858, 8.461873414, 9.031452528, 9.511908737, 9.788460565, 10.31049449]

plots:-display(
  plot(<<x>|<y>>,style=point,color=blue),
  plot(<<pts>|<map(F,pts)>>,style=point,color="Orange",
       symbol=soliddiamond,symbolsize=20),
  plot(<<pts>|<map(D[1](F),pts)>>,style=point,color="Orange",
       symbol=diamond,symbolsize=20),
  plot(D[1](F),x[1]..x[-1],color=black),
  plot(F,x[1]..x[-1]),
  size=[600,300]
);

 

Download spline_interp.mw

Assigning values to some of the variables is not necessary for your problem. It is not really "substitution", nor does it create equations. It often just gets in the way or, in your case, leads to a circular muddle.

Equations are perfectly good expressions in Maple, and very useful. For example, step by step,

restart;

eqn := totalsalesx = 60.1 + tax + profit;

totalsalesx = 60.1+tax+profit

eval(eqn, [tax=0.3*profit]);

totalsalesx = 60.1+1.3*profit

eval(%, [profit=0.1*totalsalesx]);

totalsalesx = 60.1+.13*totalsalesx

solve({%});

{totalsalesx = 69.08045977}

eval(totalsalesx, %);

69.08045977

 

Download substitutions_eval.mw

Above, I used an equation for the solving step. And the substitutions were done using the other equations (with the eval command). None of your key variables profit, tax, or totalsalesx had to be assigned. Even the result from solve is an equation, which in turn can be used in eval.

There are lots of ways to do this. Here's another variant.

restart;

eqn1 := totalsalesx = 60.1 + tax + profit;

totalsalesx = 60.1+tax+profit

eqn2 := tax=0.3*profit;

tax = .3*profit

eqn3 := profit=0.1*totalsalesx;

profit = .1*totalsalesx

neweqn := eval(eqn1, eqn2);

totalsalesx = 60.1+1.3*profit

eval(neweqn, eqn3);

totalsalesx = 60.1+.13*totalsalesx

solve({%});

{totalsalesx = 69.08045977}

eval(totalsalesx, %);

69.08045977

 

Download substitutions_eval2.mw

This is not expert stuff. It is basic Maple praxis, worth learning.

 

If you want the same color scheme for both, and if you're willing to accept more of a density-plot style, then here is an easy way.

You could, of course, also merge the bottom 2D layer with contour lines, and also raise that to the height of the surface. (Neither of those is especially complicated -- Kitonum's shown you that way.)

restart;

lambda := 2*(1/10):

mu := -1:

beta := 10:

alpha := -25:

C := 1:

k := (1/12)*sqrt(6)/sqrt(beta*lambda*mu):

w := alpha/((10*sqrt(-lambda*mu))*beta):

A[0] := (1/2)*alpha/((10*sqrt(-lambda*mu))
                     *((1/12)*beta*sqrt(6)/sqrt(beta*lambda*mu))):

A[1] := -(1/10)*alpha/((1/12)*beta*mu*sqrt(6)
                       /sqrt(beta*lambda*mu)):

A[2] := -(12*((1/12)*sqrt(6)/sqrt(beta*lambda*mu)))
        *lambda^2*alpha/(10*sqrt(-lambda*mu)):

H := ln(sqrt(lambda/(-mu))*tanh(sqrt(-lambda*mu)*(xi+C))):

xi := k*x-t*w:

u[0] := A[0]+A[1]*exp(-H)+A[2]*exp(-H)*exp(-H):

scheme1 := ["zgradient",["Blue","Cyan","Green","Yellow","Orange","Red"]]:

P3:=plot3d(min(40,max(-40,Im(u[0]))), x=-10..10, t=-4..1,
            grid=[201,201], colorscheme=scheme1, style=surface):

plots:-display(P3,plottools:-transform((x,y,z)->[x,y,-50])(P3),
               view=-50..39, orientation=[30,75,0]);

 

Download denseasy.mw

Some other, fancier alternatives are here.

The taylor command produces the same sort of beast as the series command, and returns a special structure (which merely pretty-prints as you see it).

You can utilize the convert command to turn the result from taylor (or series) into simple sum of terms.

You can also use the series command to merge the difference into a new series structure.

restart;

E1 := taylor(ln(1+x),x=0,4);

series(x-(1/2)*x^2+(1/3)*x^3+O(x^4),x,4)

E2 := taylor(ln(1+sin(x)),x=0,4);

series(x-(1/2)*x^2+(1/6)*x^3+O(x^4),x,4)

convert(E1,polynom);

x-(1/2)*x^2+(1/3)*x^3

convert(E1,polynom)-convert(E2,polynom);

(1/6)*x^3

series(E1-E2,x);

series((1/6)*x^3+O(x^4),x,4)

 

Download seriesconvert.mw

Another way to get a simlar effect is to call   taylor(E1-E2,x) . Christian's Answer did that last call with the option 4 passed for the order. But that 3rd argument may be omitted on the comparison; you can compare the difference between E1 generated with 6 as third argument, and E2 generated with as 3rd argument).

E1 := taylor(ln(1+x),x=0,6);

series(x-(1/2)*x^2+(1/3)*x^3-(1/4)*x^4+(1/5)*x^5+O(x^6),x,6)

E2 := taylor(ln(1+sin(x)),x=0,5);

series(x-(1/2)*x^2+(1/6)*x^3-(1/12)*x^4+O(x^5),x,5)

series(E1-E2,x);

series((1/6)*x^3-(1/6)*x^4+O(x^5),x,5)

taylor(E1-E2,x);

series((1/6)*x^3-(1/6)*x^4+O(x^5),x,5)

Download seriesconvert2.mw

2 3 4 5 6 7 8 Last Page 4 of 200