acer

32385 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

For your first example, try,

   fsolve(f(x)=g(x))

For your second example, try,

   plot( [ Re(f(x)), Im(f(x)) ] )

f:=x->(x^2)-6*x+p+3: g:=x->(4*x^2)-(p-8)*x+7:

sol:=solve({ f(xf)=g(xg), D(f)(xf)=0, D(g)(xg)=0,
             (D@@2)(f)(xf)>0, (D@@2)(g)(xg)>0 });

     /                      -5\    /                     1\ 
    { p = -12, xf = 3, xg = -- }, { p = 12, xf = 3, xg = - }
     \                      2 /    \                     2/ 

eval({f(xf),g(xg)},sol[1])[];

            -18

eval({f(xf),g(xg)},sol[2])[];

              6

Maple's model of functional evaluation is inside-to-outside, and if you want to avoid some potential evaluation issues then I suggest reducing the inert operators from the inside out.

Here's an example, (based in part on this old code's idea). The inert=false option merely allows the output to render in the usual way, as opposed to the gray glyphs.

restart;

R := module() local f, T, S, ModuleApply;
  T := And(function,
           ':-satisfies'(f->evalb(convert(op(0,f),string)[1]="%")));
  S := t -> convert(convert(op(0,t),string)[2..],name);
  f := X -> subsindets(X,And(T,satisfies(e->hastype([op(e)],T)=false)),
                       t->S(t)(op(t)));
  ModuleApply:=proc(X, {inert::truefalse:=true})
    local res,old,temp;
    old := X;
    do print(InertForm:-Display(old,':-inert'=inert));
      temp := f(old);
      if temp=old then break;
      else old := temp; end if;
    end do;
    return temp;
  end proc;
end module:

 

expr := 12 %/ (1 %- %abs(2%^2 %- (3 %- 1 %- 1%^2)%^2))
        %+ %abs(-7) %/ %abs((x %- x) %- 2%^2)%^2:

InertForm:-Display(expr);

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

value(expr);

-89/16

R(expr):

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

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

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

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

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

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

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

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

-89/16

R(expr, inert=false):

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

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

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

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

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

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

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

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

-89/16

 

Download inert_value_recur_outwards1.mw

If you really want you can get the behaviour from the outside in, but something general has to be given up. You won't be able to use the inert form of every command (eg. fsolve), while retaining evaluation at each step. But if you're willing to allow inert forms of, say, just arithmetic operators and some simple things (that can return unevaluated) then something could be accomplished with recursion & state (operand list for position, and running expression) & subsop.

Note that the construction of 2^(2/3)/2 from input 2^(-1/3) happens as a consequence of automatic simplification.

As such it cannot be prevented by delaying evaluation, eg. by use of uneval quotes, etc.

You may be able to use the inert operators such as %^, etc, to construct something that can be displayed as you want.

'2^(-1/3)';

(1/2)*2^(2/3)

ee := 2%^(-1/3):

InertForm:-Display(ee, 'inert'=false);

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

Typesetting:-Typeset(Typesetting:-EV(ee));

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

Download inert_ex.mw

At this point you may care to inform us of how the expression is first formed, ie. do you want to type it in, or is it a result of a computation.

If I understand the question properly, here are some alternatives you might consider.

The first one changes only how it gets normally pretty-printed. The second actually strips off the outer call.

You only have to define the procedure once per session, and you don't have to do some extra step each time you want to create or print an inert expression.

restart;

`print/%+` := proc()
  if nargs=1 then args[1];
  else '`%+`'(args); end if;
end proc:

 

expr := `%+`(floor(5 %/ (2 %* 3 %* 5)));

`%+`(floor(`%/`(5, `%*`(`%*`(2, 3), 5))))

expr;

`%+`(floor(`%/`(5, `%*`(`%*`(2, 3), 5))))

InertForm:-Display(expr);

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

lprint(expr);

`%+`(floor(5 %/ ((2 %* 3) %* 5)))

`%+`(a,b,c);

`%+`(a, b, c)

lprint(%);

`%+`(a,b,c)

restart;

`%+` := proc()
  if nargs=1 then args[1];
  else 'procname'(args); end if;
end proc:

 

expr := `%+`(floor(5 %/ (2 %* 3 %* 5)));

floor(`%/`(5, `%*`(`%*`(2, 3), 5)))

expr;

floor(`%/`(5, `%*`(`%*`(2, 3), 5)))

InertForm:-Display(expr);

floor(Typesetting:-_Hold([`%/`(5, `%*`(`%*`(2, 3), 5))]))

lprint(expr);

floor(5 %/ ((2 %* 3) %* 5))

`%+`(a,b,c);

`%+`(a, b, c)

lprint(%);

`%+`(a,b,c)

 

Download inert_plus_single.mw

You might also do something similar for `%*`.

The integervariables option of the LPSolve command allows you to specify (as a list) the names of the variables which must be integer-valued.

Eg,

with(Optimization):

obj := -4*x-5*y:

cons := {x+3/2*y<=6, 5*x+4*y<=20, x>=0, y>=0}:

LPSolve(obj, cons,integervariables=[x]);

   [-20.666666666666668, [x = 1, y = 3.3333333333333335]]


LPSolve(obj, cons, integervariables=[y]);

          [-21.0, [x = 1.4999999999999998, y = 3]]

LPSolve(obj, cons, integervariables=[x,y]);

                 [-20, [x = 0, y = 4]]

Your original attachment called implicitplot for first argument M (which implies M=0), and it called contourplot on first argument M with option contours=[1] (which implies M=1). That's a mismatch in the values/heights of the contours/level-curves, which makes the comparison invalid, and which I've corrected below.

Below are plots for M=1 and M=0, each done with both those commands for comparison.

I used a larger initial grid option size, for implicitplot, and bumped down the gridrefine option's value.

The results basically match, between implicitplot and contourplot, except the latter's curves are coarser. The former is much faster and smoother. And the latter produces a coarser result even with a large grid value, that consists of a very large plotting structure that places considerable burden on the GUI.

restart; with(plots)

beta[0] := ((cos(u)+sin(u)-1)*exp(2*u)-cos(u)+1+(-2*exp(u)+1)*sin(u))/(u*(exp(2*u)*cos(u)+cos(u)-2*exp(u))):

beta[1] := ((cos(u)+sin(u)-1)*exp(2*u)-cos(u)+1+(-2*exp(u)+1)*sin(u))/(u*(exp(2*u)*cos(u)+cos(u)-2*exp(u))):

delta[1] := ((-sin(u)+1)*exp(2*u)-2*exp(u)*cos(u)+sin(u)+1)/(u^2*(exp(2*u)*cos(u)+cos(u)-2*exp(u))):

delta[0] := ((sin(u)-1)*exp(2*u)+2*exp(u)*cos(u)-sin(u)-1)/(u^2*(exp(2*u)*cos(u)+cos(u)-2*exp(u))):

M := simplify((z^2*delta[0]+z*beta[0]+1)/(-z^2*delta[1]-z*beta[1]+1)):

 

Firstly, let's consider M=1.

 

i*mplicitplot(M = 1, z = -15 .. 15, u = -15 .. 15, filled = true, grid = [75, 75], gridrefine = 3, labels = [z, u], coloring = [blue, gray], axes = boxed)

contourplot(M, z = -15 .. 15, u = -15 .. 15, filled = true, grid = [150, 150], contours = [1], labels = [z, u], coloring = [blue, grey], axes = boxed)

NULL

And now for M=0

 

implicitplot(M, z = -15 .. 15, u = -15 .. 15, filled = true, grid = [75, 75], gridrefine = 3, labels = [z, u], coloring = [blue, gray], axes = boxed)

contourplot(M, z = -15 .. 15, u = -15 .. 15, filled = true, grid = [150, 150], contours = [0], labels = [z, u], coloring = [blue, grey], axes = boxed)

``

Here is a revision, done in Maple2016.2,

SDFFM_STAB_ac.mw

With your original grid=[5,5], gridrefine=8 some features/regions get missed. (Missed, I suspect, during initial analysis at the unfortunately-coarse initial [5,5], and hence subsequently also missed for refinement.)

In Maple 2021.1, by the way, the implicitplot command has some trouble with the very large (+/-) values of M, or with the severe slope, I suspect. That can be accomodated by an adjustment, to pass it, say,
    max(min(M,2),-2) = 1
instead of just M=1. And similarly for M=0.

SDFFM_STAB_ac_2021.1.mw

These first two will not work directly in Maple 2015.2, but I'm going to mention them anyway since that version is getting quite out of date and some people might be interested in more current versions's behavior.

restart;

kernelopts(version);

`Maple 2021.1, X86 64 LINUX, May 19 2021, Build ID 1539851`

expr := -.27059805007310*sin(.12+epsilon)
        +.27059805007310*sqrt(1.-cos(.12+epsilon)^2);

-.27059805007310*sin(.12+epsilon)+.27059805007310*(1.-cos(.12+epsilon)^2)^(1/2)

kernelopts(floatPi=true):

simplify(convert(expr,rational)) assuming epsilon < Pi-12/100, epsilon > -12/100;

0

kernelopts(floatPi=false):

simplify(expr) assuming epsilon < Pi-0.12, epsilon > -0.12;

0.

Download simplify_floatPi.mw

[edit] Maple 2015 suffered from an additional weakness of needing a kick to get the trig identity applied. Here are two ways to do that kick, for each of the two approaches floatPi=true alongside rationals, and floatPi=false.

The approach below using freeze & thaw is an automation of a process to replace the sin & cos arguments temporarily with a symbol, which allows the trig identity simplification to succeed here. That's analogous to automating the steps subs(0.12 + epsilon=t, expr) and (potentially necessary) final replacement of t, in Kitonum's second approach.

For the applyrule apporach, note that the latter step involves simplify(...,trig) which succeeds, while simplify(...) without the option does not succeed in Maple 2015.2.

restart;

kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

expr := -.27059805007310*sin(.12+epsilon)
        +.27059805007310*sqrt(1.-cos(.12+epsilon)^2);

-.27059805007310*sin(.12+epsilon)+.27059805007310*(1.-cos(.12+epsilon)^2)^(1/2)

kernelopts(floatPi=true):

thaw(simplify(subsindets(convert(expr,rational),specfunc({sin,cos}),
                         u->op(0,u)(freeze(op(u))))));

(21732/80311)*sin(3/25+epsilon)*(-1+csgn(sin(3/25+epsilon)))

simplify(%) assuming epsilon < Pi-12/100, epsilon > -12/100;

0

applyrule(1-cos(p::anything)^2=sin(p)^2, convert(expr,rational));

-(21732/80311)*sin(3/25+epsilon)+(21732/80311)*(sin(3/25+epsilon)^2)^(1/2)

simplify(%, trig) assuming epsilon < Pi-12/100, epsilon > -12/100;

0

kernelopts(floatPi=false):

thaw(simplify(subsindets(expr,specfunc({sin,cos}),
                         u->op(0,u)(freeze(op(u))))));

-.2705980501*sin(.12+epsilon)+.2705980501*csgn(sin(.12+epsilon))*sin(.12+epsilon)

simplify(%) assuming epsilon < Pi-0.12, epsilon > -0.12;

0.

applyrule(1-cos(p::anything)^2=sin(p)^2, expr);

-.27059805007310*sin(.12+epsilon)+.27059805007310*(sin(.12+epsilon)^2)^(1/2)

simplify(%, trig) assuming epsilon < Pi-0.12, epsilon > -0.12;

0.

Download simplify_Pyth_floatPi_2015.mw

Lastly, a note on why floatPi matters here. Consider the following effect.

restart;

kernelopts(floatPi=true):

epsilon < Pi - 0.12;

epsilon < 3.021592654

kernelopts(floatPi=false):

epsilon < Pi - 0.12;

epsilon < Pi-.12

Download floatPi_consequence.mw

So, when floatPi=true (default) the inequality gets significantly altered. And in consequence some mixed floating-point & symbolic expressions can just be too much for the simplifier to recognize simplifications under mismatches due to roundoff error.

I used the particular formulation  epsilon<Pi-0.12  in above assumptions only because you had that in your Question. If you accept the formulation as  epsilon+0.12<Pi  and you replace that with a symbol then floatPi may not be relevant. Programatically picking off all arguments to sin&cos calls and freezing them may also get you those replacements. Earlier I used subsindets above on sin&cos calls, but indets can also work, also helping in programmatically generating assumptions.

So, as a more general and programmatic revision of one of my earlier four methods for Maple 2015,

restart;

kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

expr := -.27059805007310*sin(.12+epsilon)
        +.27059805007310*sqrt(1.-cos(.12+epsilon)^2);

-.27059805007310*sin(.12+epsilon)+.27059805007310*(1.-cos(.12+epsilon)^2)^(1/2)

fcns := op~(indets(expr,specfunc({sin,cos}))):
conds := map(u->(u>0,u<Pi),fcns)[]:
R := fcns=~(freeze~(fcns)):
thaw(simplify(eval(expr,R))) assuming eval(conds,R);

0.

Download simplify_trig_float_2015.mw

In the case of multiple trig calls with differing operands you could handle contradictory generated assumptions, say by catching the relevent error thrown by assuming.

I'm not really sure what you mean by "Polynomiograph".

Do you mean something like a Newton method iterative fractal image, which could be produced using the Newton command from the Fractals:-EscapeTime package?

Suppose you wanted to use you given list of colors to shade the escape-time values for some polynomial.

You could use the Statistics:-HeatMap command for this.

First, let's see that that command acting on a small Matrix.

restart;

m:= Matrix([[1, 2, 3], [4, 5, 6]]):

cm := ["aquamarine","blue","brown",
       "coral","cyan","black"]:

#Statistics:-HeatMap(m,color=cm,axes=none,size=[600,400]);

Statistics:-HeatMap(m,color=cm,
                    axes=none,method=polygons,size=[600,400]);

Now lets apply that command to the first layer results from the Newton command.

with(Fractals:-EscapeTime):

bl, ur := -6 - 6*I, 6 + 6*I:

f := t^3 - t^2 - 12;

                           3    2     
                          t  - t  - 12

temp := Newton(400, bl, ur, f, output=layer1):

cm := ["aquamarine","blue","brown",
       "coral","cyan","black"]:

Statistics:-HeatMap(temp,color=cm,axes=none,size=[400,400]):

That use of (undocumented) method=polygons is there as a workaround for a Maple 2021.1 bug in which the default background image (method=image) extends ouside the axes. That might not be appealing if you remove the axes=none option.

You might also look at the various ColorTools color Palettes, as there are some alternatives for your named colors.

It's also possible that you might want to color by the particular root to which each point might converge. If that's the case then you should explain clearly what you want and how you expect the colors to be used. I recall once implementing that in a few ways (densityplot+caseswitch+colorscheme, or IterativeMaps+caseswitch), but I'd have to try and dig them out.

For now, you might change the (forced) order that the determinate functions appear in the list passed as second argument to dsolve.

analytic_sol:=dsolve(sys, [Sy(t), Xc(t)]);

plot(eval([Sy(t), Xc(t)], analytic_sol), t=0..10);

Curiously, the alternative of using a set (rather than a list) also works. It seems to work even if the lexicographic set-ordering matches the list order that fails. (I rename, to illustrate.)

restart:

sys:=[diff(c(t),t) = - y(t),
      diff(y(t),t) = -c(t) * (1  - c(t)^2),
      c(0)=0, y(0)=1]:

simplify(dsolve(sys, [c(t), y(t)]));

Error, (in dsolve) numeric exception: division by zero

{c(t), y(t)};

{c(t), y(t)}

simplify(dsolve(sys, {c(t), y(t)}));

{c(t) = (1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z)*2^(1/2)*(4-(2*I)*2^(1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z))^(1/2)*JacobiSN(((1/2)*I)*t*(4-(2*I)*2^(1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z))^(1/2), RootOf(_Z^2+1+I*2^(1/2)*_Z)), y(t) = JacobiCN(((1/2)*I)*t*(4-(2*I)*2^(1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z))^(1/2), RootOf(_Z^2+1+I*2^(1/2)*_Z))*JacobiDN(((1/2)*I)*t*(4-(2*I)*2^(1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z))^(1/2), RootOf(_Z^2+1+I*2^(1/2)*_Z))}

simplify(dsolve(sys, [y(t), c(t)]));

{c(t) = (1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z)*2^(1/2)*(4-(2*I)*2^(1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z))^(1/2)*JacobiSN(((1/2)*I)*t*(4-(2*I)*2^(1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z))^(1/2), RootOf(_Z^2+1+I*2^(1/2)*_Z)), y(t) = JacobiCN(((1/2)*I)*t*(4-(2*I)*2^(1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z))^(1/2), RootOf(_Z^2+1+I*2^(1/2)*_Z))*JacobiDN(((1/2)*I)*t*(4-(2*I)*2^(1/2)*RootOf(_Z^2+1+I*2^(1/2)*_Z))^(1/2), RootOf(_Z^2+1+I*2^(1/2)*_Z))}

 

Download div_by_zero_alt.mw

If you have a problem with your particular example then it would be better to upload and attach your worksheet. That can also help with syntax issues.

Here I've squinted and tried to reproduce the input for the int call from your image, in plaintext Maple notation. I prefer to use a different name for the upper limit of integration. 

restart;

kernelopts(version);

`Maple 2020.2, X86 64 LINUX, Nov 11 2020, Build ID 1502365`

simplify( combine( int( -(C__A*K+1)/(k*C__A), C__A=C__A0..C__AA ) ), size )
  assuming C__A0>0, C__AA>C__A0;

(ln(C__A0/C__AA)+(-C__AA+C__A0)*K)/k

Download integral_ex1.mw

I'm not sure whether you are trying to simplify or improve the code you gave, or obtain code to produce a table of a variety of such curves.

Here, procedure L produces the curve for a particular set of parameter values, from t=0 to t=T some final value. You could call L with some choice of parameter values, to see that. Procedure LL makes a table of different calls to L, using names lists of parameter choices. And LL can be animated across T values. (There are several other ways you could code this, expecially w.r.t. you choice of parameters for a table. Adjust as you see fit.)

restart;
dlist:=[0,1*Pi/4,2*Pi/4,3*Pi/4,4*Pi/4]:
ablist:=[[1,1],[2,1],[3,1],[3,2],[4,3],[5,3],[6,5]]:
adj:=[0,Pi/2,0,Pi/4,Pi/2,Pi,-Pi/2]:
L := proc(A,B,a,b,d,T) local ee,t; uses plots;
  display(subsindets(
            plot([A*sin(a*t+d),B*sin(b*t),t=0..T],
                 'color'="white",'thickness'=1),
            'specfunc(:-anything,:-THICKNESS)',u->':-THICKNESS(0.9)'),
          pointplot([A*sin(a*T+d),B*sin(b*T)],'color'="cyan",
                    'symbol'=':-circle','symbolsize'=6),
          'axes'=':-none','scaling'=':-constrained',background=black);
end proc:
LL := proc(T) local i,j; uses plots, plottools;
  display(seq(seq(translate(L(1,1,ablist[j][],dlist[i]+adj[j],T),
                            (nops(dlist)-i+1)*3,(nops(abslist)-j+1)*3),
                  i=1..nops(dlist)),j=1..nops(ablist)),
          'size'=[nops(dlist),nops(ablist)]*125,'axes'=':-none',
          'scaling'=':-constrained','background'="black");
end proc:
## A single call to LL
#LL(2*Pi/3);
plots:-animate(LL,[T],T=0..2*Pi,'paraminfo'=false,'frames'=51,
               'background'="black",'size'=[nops(dlist),nops(ablist)]*125);

Lissajous_anim1.mw

The code above is slightly more verbose than necessary, so that a few possible modifications might be a little more clear. If you wanted to get fancier you could also color the curves according to certain parameter values, or add captions below each to show values.

As for the code you originally supplied, I think that merging a multitude of calls to plots:-animate makes the coding unnecessarily complicated. One difficulty it brings is that the various curves and points cannot be easily seen together (as a visual check of correctness) as a single frame for a single value of the animating parameter.

As an alternative approach, the procedure F below generates any single frame, taking the animating parameter as its sole argument. Thus a call to F generates a single frame, which makes for a much easier and quicker way to test that a given frame looks right.

Also, the various plot and pointplot calls could be merged. An easy edit, but a bit tidier.

restart;

with(plots):

base := display(plot([cos(x), sin(2*x),x=0..2*Pi], thickness=2),
                display(plot([cos(t),t,t=0..2*Pi]),
                        plot([t,sin(2*t),t=0..2*Pi]), thickness=0)):

F := a -> display(base,
  plot([[[0,sin(2*a)],[cos(a),sin(2*a)]],[[0,a],[cos(a),a]],
        [[cos(a),sin(2*a)],[cos(a),a]],
        [[cos(a),0],[cos(a),sin(2*a)]],[[a,0],[a,sin(2*a)]],
        [[cos(a),sin(2*a)],[a,sin(2*a)]]], thickness=3,
       color=[green$3,red$3], linestyle=[seq([solid,solid,dash][],1..2)]),
  pointplot([[cos(a),sin(2*a)],[0,sin(2*a)],[0,a],[cos(a),a],
             [cos(a),0],[a,0],[a,sin(2*a)]], color=[blue,green$3,red$3],
            symbolsize=23, symbol=solidcircle)):

F(Pi/3);

animate(F, [a], a=0..2*Pi, frames=100);

 

Download Lissajous_ac.mw

restart;
with(plots,display): with(geom3d):
point(A, [1, 2, 3]):
point(B, [-2, 3, -1]):
point(C, [0,-3, 1]):
segment(S1, A, B):
segment(S2, A, C):
display(
  display(draw(A(symbol=solidsphere, symbolsize=15)), colour=green),
  display(draw(B(symbol=solidsphere, symbolsize=30)), colour=red),
  display(draw(C(symbol=solidsphere, symbolsize=20)), colour=magenta),
  draw([S1(thickness=4, color=red),
        S2(thickness=4, color=blue)]));

The leading minus sign gets generated depending on what Maple considers the sign of some expressions (or subexpressions) involved in the computation (here, by solve).

If you can find a lexicographic ordering for which the sign of (say...) the numerator is -1 then you might apply sort w.r.t that ordering and reconstruct.

For example,

restart;

ee := -(C__iss2*V__gs_th2-Q__total)/i__GateDriveN;

-(C__iss2*V__gs_th2-Q__total)/i__GateDriveN

inds := [op(indets(ee,And(name,Not(constant),
                          satisfies(nm->type(ee,polynom(anything,nm))))))];

[C__iss2, Q__total, V__gs_th2]

cand := [Q__total, C__iss2, V__gs_th2, i__GateDriveN];

[Q__total, C__iss2, V__gs_th2, i__GateDriveN]

sign(numer(ee), inds);

-1

sign(numer(ee), cand);

1

ee := sort(numer(ee), order=plex(op(cand)))/denom(ee);

(Q__total-C__iss2*V__gs_th2)/i__GateDriveN

Download sign_sort.mw

I have not included code that might search (loop) through candidate orderings (say, permutations) until the desired sign might be found.

Maple's design in this regard is for efficiency over beautification of the final display. Note that the application above of the sort command will transform the uniquified expression that was numer(ee). This reorders the terms of that polynomial. That is done to the unique representation stored in the kernel, for that expression. Uniquification of expressions is for effiiciency. Reordering expressions for the purpose of beautification of display is a performance killer in general since in general that might require repeated waste of time as the same expression could get sorted and resorted for situations that vie against each other. Even for mere printing effects, searching for beautification may get expensive in the multivariate case, and being inconsistent in that regard would be very poor.

note: One might also (have to) examine sign(ee), and sign(denom(ee)), depending on the example.

First 81 82 83 84 85 86 87 Last Page 83 of 336