acer

28100 Reputation

29 Badges

17 years, 244 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

You could make the following kinds of checks, using the is command.

restart;

is( -7.5 in RealRange(Open(-10),-5) )

true

is( -7.5 in RealRange(Open(-6),infinity) )

false

is( -7.5 in Or(RealRange(Open(-6),infinity),
               RealRange(Open(-10),-5)) );

true

is( A in Or(RealRange(Open(-6),infinity),
               RealRange(Open(-10),-5)) )
  assuming A>-9;

true

is( A in Or(RealRange(Open(-6),infinity),
               RealRange(Open(-10),-5)) )
  assuming A>-11;

false

coulditbe( A in Or(RealRange(Open(-6),infinity),
               RealRange(Open(-10),-5)) )
  assuming A>-11;

true

coulditbe( A in Or(RealRange(Open(-6),infinity),
               RealRange(Open(-10),-5)) )
  assuming A<-11;

false

Download RR_is.mw

You could also assign your disjunction (or other logical operator construction) to a name, and re-use it. Eg,

Dis := Or(RealRange(Open(-6),infinity),
          RealRange(Open(-10),-5)):

 

is( -7 in Dis );

true

is( A in Dis ) assuming A<-11;

false

is( A::Dis ) assuming A>-9;

true

 

It is unfortunate that Maple 2023.0 does not have cross-reference links from the Help page for topic RealRange to the Help pages with topics assume (is) and property.

Let's suppose that you have a worksheet with some Startup Code.

The "Maple Code Editor Diagnostics" panel shows syntax errors and some basic kinds of potential issues that might arise when the code is executed. A syntax error is different from an error raised when the code is executed.

If the code is executed using the Startup Code region's menu then runtime errors get reported to the "Maple Code Editor Console".

Those distinctions are why these appear in two separate bullet points in the Startup Code documentation; they relate to two different kinds of messages.

• 

The Diagnostics panel at the bottom of the Startup Code Editor window displays the output from code analysis done on any Maple code entered into the code editor.

• 

The Console panel displays output from the code entered in the Startup Code Editor. The Console can be used for prototyping and testing your code. To clear the Console, from the View menu, select Clear Console.


A simple (single, say) pass through the code may allow the code analyzer (here, mint, underneath) to deduce a few common and simple kinds of potential runtime problems -- procedure locals used before being initialized, unattainable code blocks, locals assigned values but then not used, etc. These kinds of issue are reported to the Diagnostics panel.

But these diagnostics don't execute the code in full. And hence they will certainly not find all kinds of future runtime error, since doing so without actual execution is logically impossible. Runtime error message get reported to the Console panel, if executed by the Startup Code's menu.

Code can be run under the debugger. Doing so can require learning its techniques.

I would prefer to pass {x} rather than unadorned x as the second argument to solve, for consistency of output, and then fix up the conversions to RealRange.

I don't know whether you'd prefer sets or Or to be used to denote logical disjunction. Having it be denoted by mere sequences seems dodgy to me, because more involved multiple solutions could become wrongly conflated. (I don't much like T1 below returning a mere sequence...)

I also don't know whether you'd want to handle univariate examples with names other than x. It's hardcoded in T3 at present. (Also, you can't sensibly have nameless RealRanges for multivariate examples, naturally.)

I also don't know what other, future, less trivial examples you'd want to handle.

restart;

#interface(prettyprint=0):

 

with(RealDomain):

 

RealRange(-infinity,infinity):='RealRange(-infinity,infinity)':

 

T1 := ()->subsindets([args],`<>`,u->(lhs(u)<rhs(u),lhs(u)>rhs(u)))[]:

T2 := ()->subsindets([args],And(name=name,':-satisfies'(evalb)),
                    RealRange(-infinity,infinity))[]:

T3 := ()->subsindets([args],`::`(identical(x),anything),rhs)[]:

A := ()->T3(convert(T2(T1([args])), RealRange)[]):

 

A( solve(x-1 > 0, {x}) );

{RealRange(Open(1),infinity)}

A( solve(1/x^2 > 0, {x}) );

{RealRange(-infinity,Open(0)), RealRange(Open(0),infinity)}

A( solve(1/(x^2-1) > 0, {x}) );

{RealRange(-infinity,Open(-1))}, {RealRange(Open(1),infinity)}

A( solve(x^2+1 > 0, {x}) );

{RealRange(-infinity,infinity)}

A( solve(x^2+1 < 0, {x}) ); # NULL

 

Download solve_RR.mw

You are trying to use an exact solving methodology on an expression containing float exponents. (That can make solving fully over the complex numbers be quite a demand.)

Using fsolve is more suitable here.

fsolve(.2894606222 = .4090662520/((1+0.1481289280e-2*x)^5.034901366
                                  *(1/(1+0.1481289280e-2*x)^5.034901366)^.1986136226),
       x);

          60.41863487

Also note that converting to rationals (even "exactly") and forcing it through solve doesn't really help much to getting an accurate floating-point  result here.

expr := .2894606222 = .4090662520/((1+0.1481289280e-2*x)^5.034901366
                                  *(1/(1+0.1481289280e-2*x)^5.034901366)^.1986136226):

 

eval(solve(subsindets(expr,float,__K),
           {x}),
     __K=(x->x));

{x = (3125000000/4629029)*exp(.2478375329*ln(2045331260/1447303111))-675.0875832}

evalf(%);
evalf[10](evalf[50](%%));

{x = 60.4186348}

{x = 60.41863484}

eval(solve(subsindets(expr,float,
                      u->__K(convert(u,rational,exact))),
           {x}),
     __K=(x->x));

{x = (3125000000/6699608072609219)*2045331260^(2500000000000000000/10087253415662628821)*1447303111^(7587253415662628821/10087253415662628821)-3125000000/4629029}

evalf(%);
evalf[10](evalf[50](%%));

{x = 60.4186350}

{x = 60.41863487}

fsolve(expr);

60.41863487

evalf[10](evalf[50](fsolve(expr)));

60.41863487

Download fs_1.mw

Here is a brief way to do that.

   L := [seq(cos(x), x=0.1 .. 10.0, 0.1)];
   S := sort(L);
   S[35];

which produces -0.5885011173 as its last result.

Here's a slightly longer way, that shows a bit more. (figured that you're trying to learn some Maple. You could try and work out for yourself what these commands do...)

L := [seq([x,cos(x)], x=0.1 .. 10.0, 0.1)]:


Here is the list of 100 entries, cos(0.1) to cos(10.0)

L[..,2];

[.9950041653, .9800665778, .9553364891, .9210609940, .8775825619, .8253356149, .7648421873, .6967067093, .6216099683, .5403023059, .4535961214, .3623577545, .2674988286, .1699671429, 0.7073720167e-1, -0.2919952230e-1, -.1288444943, -.2272020947, -.3232895669, -.4161468365, -.5048461046, -.5885011173, -.6662760213, -.7373937155, -.8011436155, -.8568887534, -.9040721420, -.9422223407, -.9709581651, -.9899924966, -.9991351503, -.9982947758, -.9874797699, -.9667981926, -.9364566873, -.8967584163, -.8481000317, -.7909677119, -.7259323042, -.6536436209, -.5748239465, -.4902608213, -.4007991721, -.3073328700, -.2107957994, -.1121525269, -0.1238866346e-1, 0.8749898344e-1, .1865123694, .2836621855, .3779777427, .4685166713, .5543743362, .6346928759, .7086697743, .7755658785, .8347127848, .8855195169, .9274784307, .9601702867, .9832684384, .9965420970, .9998586364, .9931849188, .9765876257, .9502325920, .9143831482, .8693974903, .8157251001, .7539022543, .6845466664, .6083513145, .5260775174, .4385473276, .3466353178, .2512598426, .1533738620, 0.5395542056e-1, -0.4600212564e-1, -.1455000338, -.2435441537, -.3391548610, -.4313768450, -.5192886541, -.6020119027, -.6787200473, -.7486466456, -.8110930141, -.8654352092, -.9111302619, -.9477216021, -.9748436214, -.9922253255, -.9996930420, -.9971721562, -.9846878558, -.9623648798, -.9304262721, -.8891911526, -.8390715291]

S := sort( L, key=(u->op(2,u)) ):


Here is the sorted list.

S[..,2];

[-.9996930420, -.9991351503, -.9982947758, -.9971721562, -.9922253255, -.9899924966, -.9874797699, -.9846878558, -.9748436214, -.9709581651, -.9667981926, -.9623648798, -.9477216021, -.9422223407, -.9364566873, -.9304262721, -.9111302619, -.9040721420, -.8967584163, -.8891911526, -.8654352092, -.8568887534, -.8481000317, -.8390715291, -.8110930141, -.8011436155, -.7909677119, -.7486466456, -.7373937155, -.7259323042, -.6787200473, -.6662760213, -.6536436209, -.6020119027, -.5885011173, -.5748239465, -.5192886541, -.5048461046, -.4902608213, -.4313768450, -.4161468365, -.4007991721, -.3391548610, -.3232895669, -.3073328700, -.2435441537, -.2272020947, -.2107957994, -.1455000338, -.1288444943, -.1121525269, -0.4600212564e-1, -0.2919952230e-1, -0.1238866346e-1, 0.5395542056e-1, 0.7073720167e-1, 0.8749898344e-1, .1533738620, .1699671429, .1865123694, .2512598426, .2674988286, .2836621855, .3466353178, .3623577545, .3779777427, .4385473276, .4535961214, .4685166713, .5260775174, .5403023059, .5543743362, .6083513145, .6216099683, .6346928759, .6845466664, .6967067093, .7086697743, .7539022543, .7648421873, .7755658785, .8157251001, .8253356149, .8347127848, .8693974903, .8775825619, .8855195169, .9143831482, .9210609940, .9274784307, .9502325920, .9553364891, .9601702867, .9765876257, .9800665778, .9832684384, .9931849188, .9950041653, .9965420970, .9998586364]

S[35];

[2.2, -.5885011173]


The 35th term of the sorted list is -.5885011173, which
comes from cos(2.2)

cos(2.2);

-.5885011173

plots:-display(
  plots:-listplot(S[..,2], size=[500,200]),
  plots:-pointplot([[35,S[35][2]]],color=red,
                   symbol=solidcircle,symbolsize=15),
  axis[1]=[tickmarks=[seq(10..100,10)],
           gridlines=[[seq(5..100,10)]]]);

Download sort_cos_list.mw

You may have noticed that lists L and S each contain both the x-values as well as the cos(x) values. I only did it that way because I thought that it'd be fun/interesting to be able to immediately get the corresponding x-value which produced the 35th greatest cos-value, without doing any additional computation.

You've already assigned ics itself as a set., ie.
   ics := {V(0) = -65, h(0) = 0.6, m(0) = 0.05, n(0) = 0.32}

Having done that, you could pass either,
    {eq1, eq2, eq3, eq4} union ics
or,
    {eq1, eq2, eq3, eq4, op(ics)}
to dsolve.

That merges the differential equations and initial conditions together into a single (flat) set. 

Or you could assign only the expression sequence of conditions to ics (and not itself a set), ie,
   ics := V(0) = -65, h(0) = 0.6, m(0) = 0.05, n(0) = 0.32;
and then pass your original formulation to dsolve, ie.,
   {eq1, eq2, eq3, eq4, ics}

Adjust the rest, as desired. I didn't look to see if your system and the results made sense.

restart

Cm := 1.0; ENa := 50.0; EK := -77.0; ELeak := -54.387; gNa := 120.0; gK := 36.0; gLeak := .3

1.0

50.0

-77.0

-54.387

120.0

36.0

.3

II := piecewise(`and`(t >= 10, t <= 40), 10.0, 0.); alpha_m := proc (V) .1*(V+40.0)/(1.0-exp((-1)*(V+40.0)/10.0)) end proc; beta_m := proc (V) 4.0*exp((-1)*(V+65.0)/18.0) end proc; alpha_h := proc (V) 0.7e-1*exp((-1)*(V+65.0)/20.0) end proc; beta_h := proc (V) 1.0/(1.0+exp((-1)*(V+35.0)/10.0)) end proc; alpha_n := proc (V) 0.1e-1*(V+55.0)/(1.0-exp((-1)*(V+55.0)/10.0)) end proc; beta_n := proc (V) .125*exp((-1)*(V+65.0)/80.0) end proc

piecewise(10 <= t and t <= 40, 10.0, 0.)

proc (V) .1*(V+40.0)/(1.0-exp((-1)*(V+40.0)/10.0)) end proc

proc (V) 4.0*exp((-1)*(V+65.0)/18.0) end proc

proc (V) 0.7e-1*exp((-1)*(V+65.0)/20.0) end proc

proc (V) 1.0/(1.0+exp((-1)*(V+35.0)/10.0)) end proc

proc (V) 0.1e-1*(V+55.0)/(1.0-exp((-1)*(V+55.0)/10.0)) end proc

proc (V) .125*exp((-1)*(V+65.0)/80.0) end proc

eq1 := diff(V(t), t) = (II-gNa*m(t)^3*h(t)*(V(t)-ENa)-gK*n(t)^4*(V(t)-EK)-gLeak*(V(t)-ELeak))/Cm; eq2 := diff(m(t), t) = alpha_m(V(t))*(1-m(t))-beta_m(V(t))*m(t); eq3 := diff(h(t), t) = alpha_h(V(t))*(1-h(t))-beta_h(V(t))*h(t); eq4 := diff(n(t), t) = alpha_n(V(t))*(1-n(t))-beta_n(V(t))*n(t); ics := {V(0) = -65, h(0) = .6, m(0) = 0.5e-1, n(0) = .32}

diff(V(t), t) = 1.000000000*piecewise(10 <= t and t <= 40, 10.0, 0.)-120.0000000*m(t)^3*h(t)*(V(t)-50.0)-36.00000000*n(t)^4*(V(t)+77.0)-.3000000000*V(t)-16.31610000

diff(m(t), t) = .1*(V(t)+40.0)*(1-m(t))/(1.0-exp(-.1000000000*V(t)-4.000000000))-4.0*exp(-0.5555555556e-1*V(t)-3.611111111)*m(t)

diff(h(t), t) = 0.7e-1*exp(-0.5000000000e-1*V(t)-3.250000000)*(1-h(t))-1.0*h(t)/(1.0+exp(-.1000000000*V(t)-3.500000000))

diff(n(t), t) = 0.1e-1*(V(t)+55.0)*(1-n(t))/(1.0-exp(-.1000000000*V(t)-5.500000000))-.125*exp(-0.1250000000e-1*V(t)-.8125000000)*n(t)

{V(0) = -65, h(0) = .6, m(0) = 0.5e-1, n(0) = .32}

sol := dsolve(`union`({eq1, eq2, eq3, eq4}, ics), {V(t), h(t), m(t), n(t)}, numeric)

plots:-odeplot(sol, [t, h(t)], t = 0 .. 60)

plots:-odeplot(sol, [t, m(t)], t = 0 .. 60)

plots:-odeplot(sol, [t, n(t)], t = 0 .. 60)

plots:-odeplot(sol, [t, V(t)], t = 0 .. 60)

Download Question1_ac.mw

Here's one way, collecting wrt the global :-diff.

The colon-minus prefix makes it refer to the global name diff rather than the Physics export going by the similar name.

restart;

Run the code with Physics loaded and it does not collect in diff but if you put a # infront of physics it works fine.

with(Physics):

CompactDisplay(varphi(X),psi(X))

varphi(X)*`will now be displayed as`*varphi

psi(X)*`will now be displayed as`*psi

X:=tau,x,y,z

tau, x, y, z

expr := (6*alpha)*varphi(X)*A^4*1/a(tau)^2 + (-12*diff(Phi(X), tau) - 12*diff(psi(X), tau))*alpha*A^3*1/a(tau)^2 + (-4*diff(diff(Phi(X), x), x) - 4*diff(diff(Phi(X), y), y) - 4*diff(diff(Phi(X), z), z) - 4*diff(diff(psi(X), x), x) - 4*diff(diff(psi(X), y), y) - 4*diff(diff(psi(X), z), z))*alpha*A^2*1/a(tau)^2 + (-(6*varphi(X))*H(tau)^4 - (12*H(tau)^3)*diff(psi(X), tau) + (4*H(tau)^2)*diff(diff(psi(X), x), x) + (4*H(tau)^2)*diff(diff(psi(X), y), y) + (4*H(tau)^2)*diff(diff(psi(X), z), z))*alpha*1/a(tau)^2 - (6*H(tau))*diff(psi(X), tau) + 2*diff(diff(psi(X), x), x) + 2*diff(diff(psi(X), y), y) + 2*diff(diff(psi(X), z), z)

6*alpha*varphi(tau, x, y, z)*A^4/a(tau)^2+(-12*(diff(Phi(tau, x, y, z), tau))-12*(diff(psi(tau, x, y, z), tau)))*alpha*A^3/a(tau)^2+(-4*(diff(diff(Phi(tau, x, y, z), x), x))-4*(diff(diff(Phi(tau, x, y, z), y), y))-4*(diff(diff(Phi(tau, x, y, z), z), z))-4*(diff(diff(psi(tau, x, y, z), x), x))-4*(diff(diff(psi(tau, x, y, z), y), y))-4*(diff(diff(psi(tau, x, y, z), z), z)))*alpha*A^2/a(tau)^2+(-6*varphi(tau, x, y, z)*H(tau)^4-12*H(tau)^3*(diff(psi(tau, x, y, z), tau))+4*H(tau)^2*(diff(diff(psi(tau, x, y, z), x), x))+4*H(tau)^2*(diff(diff(psi(tau, x, y, z), y), y))+4*H(tau)^2*(diff(diff(psi(tau, x, y, z), z), z)))*alpha/a(tau)^2-6*H(tau)*(diff(psi(tau, x, y, z), tau))+2*(diff(diff(psi(tau, x, y, z), x), x))+2*(diff(diff(psi(tau, x, y, z), y), y))+2*(diff(diff(psi(tau, x, y, z), z), z))

map(simplify, collect(expr, :-diff));

-12*alpha*A^3*(diff(Phi(tau, x, y, z), tau))/a(tau)^2-4*alpha*A^2*(diff(diff(Phi(tau, x, y, z), x), x))/a(tau)^2-4*alpha*A^2*(diff(diff(Phi(tau, x, y, z), y), y))/a(tau)^2-4*alpha*A^2*(diff(diff(Phi(tau, x, y, z), z), z))/a(tau)^2-4*(diff(diff(psi(tau, x, y, z), x), x))*(alpha*A^2-H(tau)^2*alpha-(1/2)*a(tau)^2)/a(tau)^2-4*(diff(diff(psi(tau, x, y, z), y), y))*(alpha*A^2-H(tau)^2*alpha-(1/2)*a(tau)^2)/a(tau)^2-4*(diff(diff(psi(tau, x, y, z), z), z))*(alpha*A^2-H(tau)^2*alpha-(1/2)*a(tau)^2)/a(tau)^2-12*(diff(psi(tau, x, y, z), tau))*(alpha*A^3+H(tau)^3*alpha+(1/2)*H(tau)*a(tau)^2)/a(tau)^2+6*alpha*varphi(tau, x, y, z)*A^4/a(tau)^2-6*varphi(tau, x, y, z)*H(tau)^4*alpha/a(tau)^2

collect(expr, :-diff, simplify);

-12*alpha*A^3*(diff(Phi(tau, x, y, z), tau))/a(tau)^2-4*alpha*A^2*(diff(diff(Phi(tau, x, y, z), x), x))/a(tau)^2-4*alpha*A^2*(diff(diff(Phi(tau, x, y, z), y), y))/a(tau)^2-4*alpha*A^2*(diff(diff(Phi(tau, x, y, z), z), z))/a(tau)^2+(-4*alpha*A^2/a(tau)^2+4*H(tau)^2*alpha/a(tau)^2+2)*(diff(diff(psi(tau, x, y, z), x), x))+(-4*alpha*A^2/a(tau)^2+4*H(tau)^2*alpha/a(tau)^2+2)*(diff(diff(psi(tau, x, y, z), y), y))+(-4*alpha*A^2/a(tau)^2+4*H(tau)^2*alpha/a(tau)^2+2)*(diff(diff(psi(tau, x, y, z), z), z))+(-12*alpha*A^3/a(tau)^2-12*H(tau)^3*alpha/a(tau)^2-6*H(tau))*(diff(psi(tau, x, y, z), tau))+6*alpha*varphi(tau, x, y, z)*(A^4-H(tau)^4)/a(tau)^2

Download CollectDiff_ac.mw

The following replaces all names of the form `x` followed by a positive integer.

It handles your set of names assigned to t, and it doesn't matter how many such names there are.

It also allows you to make such replacements within expressions more generally.

restart;

t:={seq(x||i,i=1..100)};

{x1, x10, x100, x11, x12, x13, x14, x15, x16, x17, x18, x19, x2, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x3, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39, x4, x40, x41, x42, x43, x44, x45, x46, x47, x48, x49, x5, x50, x51, x52, x53, x54, x55, x56, x57, x58, x59, x6, x60, x61, x62, x63, x64, x65, x66, x67, x68, x69, x7, x70, x71, x72, x73, x74, x75, x76, x77, x78, x79, x8, x80, x81, x82, x83, x84, x85, x86, x87, x88, x89, x9, x90, x91, x92, x93, x94, x95, x96, x97, x98, x99}

subsindets(t, 'suffixed(x,posint)',
           nm->cat('y',String(nm)[2..]));

{y1, y10, y100, y11, y12, y13, y14, y15, y16, y17, y18, y19, y2, y20, y21, y22, y23, y24, y25, y26, y27, y28, y29, y3, y30, y31, y32, y33, y34, y35, y36, y37, y38, y39, y4, y40, y41, y42, y43, y44, y45, y46, y47, y48, y49, y5, y50, y51, y52, y53, y54, y55, y56, y57, y58, y59, y6, y60, y61, y62, y63, y64, y65, y66, y67, y68, y69, y7, y70, y71, y72, y73, y74, y75, y76, y77, y78, y79, y8, y80, y81, y82, y83, y84, y85, y86, y87, y88, y89, y9, y90, y91, y92, y93, y94, y95, y96, y97, y98, y99}

expr := x1*x2 + x5^2 + sin(x117);

x1*x2+x5^2+sin(x117)

subsindets(expr, 'suffixed(x,posint)',
           nm->cat('y',String(nm)[2..]));

y1*y2+y5^2+sin(y117)

Download subsind_ex.mw

If you know that there are just that particular 100 such names then you could do it more tersely like, say,

   subs('x||i=y||i'$i=1..100,t);
or,
   subs('x||i=y||i'$i=1..100,expr);

Or, using it more than once,

   S:='x||i=y||i'$i=1..100:
   subs(S,t);
   subs(S,expr);

Don't make the assignment to C if you want it to remain as an unassigned name.

It looks as if you wanted to use only an equation involving C, not an assignment.

restart;

rho := `&rho;g`*ng + `&rho;p`*np + `&rho;w`*nw;

`&rho;g`*ng+`&rho;p`*np+`&rho;w`*nw

B := np/Kp + nw/Kw + ng/Kg;

np/Kp+nw/Kw+ng/Kg

eqn := C = (B/rho)^(1/2);

C = ((np/Kp+nw/Kw+ng/Kg)/(`&rho;g`*ng+`&rho;p`*np+`&rho;w`*nw))^(1/2)

isolate( eqn, ng );

ng = -Kg*(`&rho;p`*C^2*Kp*Kw*np+`&rho;w`*C^2*Kp*Kw*nw-Kp*nw-Kw*np)/(Kw*Kp*(`&rho;g`*C^2*Kg-1))

Download isol.mw

You wrote of expressing them in terms of each other.

I'd be interested to know whether your wider investigations might have any use for expressing them all ("compactly") in terms of additional temporary variables.

For example,

restart

t__1 := (`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

t__2 := -`&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]*`&sigma;__&epsilon;1`^2/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

t__3 := (`&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]*`&sigma;__&epsilon;1`^2*`&nu;__0`[2]-`&nu;__0`[1]*`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))/((`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2))

 

a1 := `&sigma;__&epsilon;1`^2

a2 := `&sigma;__&epsilon;2`^2+`&sigma;__v`[2]^2

a3 := (`&sigma;__v`[2]^2*(`&rho;__v`[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*`&sigma;__v`[1]^2

a4 := 1/(-a1*a2+a3)

a5 := a1*a4

a6 := `&sigma;__v`[1]*`&rho;__v`[1, 2]*`&sigma;__v`[2]

[a3*a4, -a5*a6, a5*(-a2*`&nu;__0`[1]+a6*`&nu;__0`[2])]

[(sigma__v[2]^2*(rho__v[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*sigma__v[1]^2/((sigma__v[2]^2*(rho__v[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*sigma__v[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+sigma__v[2]^2)), -sigma__v[1]*rho__v[1, 2]*sigma__v[2]*`&sigma;__&epsilon;1`^2/((sigma__v[2]^2*(rho__v[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*sigma__v[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+sigma__v[2]^2)), `&sigma;__&epsilon;1`^2*(-(`&sigma;__&epsilon;2`^2+sigma__v[2]^2)*nu__0[1]+sigma__v[1]*rho__v[1, 2]*sigma__v[2]*nu__0[2])/((sigma__v[2]^2*(rho__v[1, 2]^2-1)-`&sigma;__&epsilon;2`^2)*sigma__v[1]^2-`&sigma;__&epsilon;1`^2*(`&sigma;__&epsilon;2`^2+sigma__v[2]^2))]

Download rearrangingterms_q2.mw

I made those additional temporary substitutions as assignments. But they could also be formulated as a sequence of equations (for substitution into each other, up the chain).

You could optionally (telescopically) collapse a portion of that sequence of subsitutions, from the top down.  Eg, you could retain only the knowledge in a5 & a6, or what have you.

Also, such a scheme can also support a wider set of operations (expression forms) than just mere polynomials. For polynomials there are various techniques (basis, triangularization, etc) to produce such a substituion chain. But there are also mechanisms for doing it for a wider (non-polynomial) class.

The five you cited can be found pretty quickly, and exactly, as follows.

restart;

nsd := 16*a*b*c*(9 + a^2 + b^2 + c^2)*(b*c + a*(b + c) + 3*(a + b + c))
       - (3 + a + b + c)^2*(a*b + 3*c)*(3*b + a*c)*(3*a + b*c):

nsdac := eval(nsd,{c=a}):
rawac := solve({nsdac,a>0,b>0},[a,b]):
solac := map(s->{s[],c=eval(a,s)},rawac);

    solac := [{a = 1, b = 1, c = 1}, {a = 3, b = 3, c = 3}, 
              {a = 3, b = 9, c = 3}]

eval~(nsd, solac);

                 [0, 0, 0]

The remaining pair can be had immediately by noticing/proving the symmetry, or by re-running with each of the corresponding substitutions c=b and b=a.

Proving that there are no other solutions seems difficult or time-consuming. Let's see...

You mistakenly placed the call to polygonplot inside the call to draw.

restart;

with(geometry):  

with(plots):  

_EnvHorizontalName = 'x':  _EnvVerticalName = 'y':

point(A, -1, 9):
point(B, -5, 0):
point(C, 6, 0):
triangle(ABC,[A,B,C]):
midpoint(M1,A,C): midpoint(M2,B,C):midpoint(M3,A,B):
rotation(J, C, Pi/2, 'counterclockwise', M1):triangle(AJC,[A,J,C]):
rotation(Ii, C, Pi/2, 'counterclockwise', M2):triangle(BIC,[B,Ii,C]):
rotation(K, A, Pi/2, 'counterclockwise', M3):triangle(AKB,[A,K,B]):
midpoint(O1,K,J): coordinates(O1):
midpoint(O2,A,Ii): coordinates(O2):  
poly:=[coordinates(A),coordinates(J),coordinates(Ii),coordinates(K)]:

display(
  draw([A(color = black, symbol = solidcircle, symbolsize = 12),
        B(color = black, symbol = solidcircle, symbolsize = 12),
        C(color = black, symbol = solidcircle, symbolsize = 12),
        J(color = black, symbol = solidcircle, symbolsize = 12),
        ABC(color = red ),
        BIC(color = green),
        AKB(color = grey),
        AJC(color =blue)]),
  polygonplot(poly,color = "DarkGreen", transparency = 0.5),
  textplot([[coordinates(A)[], "A"],[coordinates(J)[], "J"],[coordinates(Ii)[], "I"],   
  [coordinates(B)[], "B"], [coordinates(K)[], "K"],
  [coordinates(C)[], "C"]],
  align = [above, right]),  axes = none);

 

Download jamet_ex.mw

Are you trying to get an effect something like one of these?

restart:

aa := alpha[1]*(cos(theta(x, y, t))^4*dudx^2+2*cos(theta(x, y, t))^3*dudx*sin(theta(x, y, t))*dvdx+2*cos(theta(x, y, t))^3*dudx*sin(theta(x, y, t))*dudy+2*cos(theta(x, y, t))^2*dudx*sin(theta(x, y, t))^2*dvdy+cos(theta(x, y, t))^2*sin(theta(x, y, t))^2*dvdx^2+2*cos(theta(x, y, t))^2*sin(theta(x, y, t))^2*dvdx*dudy+2*cos(theta(x, y, t))*sin(theta(x, y, t))^3*dvdx*dvdy+cos(theta(x, y, t))^2*sin(theta(x, y, t))^2*dudy^2+2*cos(theta(x, y, t))*sin(theta(x, y, t))^3*dudy*dvdy+sin(theta(x, y, t))^4*dvdy^2)+(alpha[2]+alpha[3]+gamma[2])*(-dudx*cos(theta(x, y, t))*sin(theta(x, y, t))*thetadot-(1/2)*dudx*cos(theta(x, y, t))*sin(theta(x, y, t))*dudy+(1/2)*dudx*cos(theta(x, y, t))*sin(theta(x, y, t))*dvdx+(1/2)*cos(theta(x, y, t))^2*dvdx*thetadot-(1/4)*cos(theta(x, y, t))^2*dvdx^2+(1/2)*cos(theta(x, y, t))^2*dudy*thetadot+(1/4)*cos(theta(x, y, t))^2*dudy^2-(1/2)*sin(theta(x, y, t))^2*dvdx*thetadot+(1/4)*sin(theta(x, y, t))^2*dvdx^2-(1/2)*sin(theta(x, y, t))^2*dudy*thetadot-(1/4)*sin(theta(x, y, t))^2*dudy^2+dvdy*sin(theta(x, y, t))*cos(theta(x, y, t))*thetadot-(1/2)*dvdy*sin(theta(x, y, t))*cos(theta(x, y, t))*dvdx+(1/2)*dvdy*sin(theta(x, y, t))*cos(theta(x, y, t))*dudy)+alpha[4]*(dudx^2+(1/2)*dvdx^2+dvdx*dudy+(1/2)*dudy^2+dvdy^2)+(alpha[5]+alpha[6])*(cos(theta(x, y, t))^2*dudx^2+2*cos(theta(x, y, t))*dudx*((1/2)*dvdx+(1/2)*dudy)*sin(theta(x, y, t))+cos(theta(x, y, t))^2*((1/2)*dvdx+(1/2)*dudy)^2+2*cos(theta(x, y, t))*((1/2)*dvdx+(1/2)*dudy)*dvdy*sin(theta(x, y, t))+sin(theta(x, y, t))^2*((1/2)*dvdx+(1/2)*dudy)^2+sin(theta(x, y, t))^2*dvdy^2)+gamma[1]*(sin(theta(x, y, t))^2*thetadot^2+sin(theta(x, y, t))^2*dudy*thetadot-sin(theta(x, y, t))^2*dvdx*thetadot+(1/4)*sin(theta(x, y, t))^2*dudy^2-(1/2)*sin(theta(x, y, t))^2*dudy*dvdx+(1/4)*sin(theta(x, y, t))^2*dvdx^2+cos(theta(x, y, t))^2*thetadot^2-cos(theta(x, y, t))^2*dvdx*thetadot+cos(theta(x, y, t))^2*dudy*thetadot+(1/4)*cos(theta(x, y, t))^2*dvdx^2-(1/2)*cos(theta(x, y, t))^2*dudy*dvdx+(1/4)*cos(theta(x, y, t))^2*dudy^2)+xi*(cos(theta(x, y, t))^2*dudx+2*cos(theta(x, y, t))*sin(theta(x, y, t))*((1/2)*dvdx+(1/2)*dudy)+sin(theta(x, y, t))^2*dvdy):

temp1 := (coeff(aa,dudy^2))*dudy^2 + (coeff(aa,dudy^2))*dvdx^2:

eq := dudy^2+dvdx^2=PP: reveq := (rhs=lhs)(eq):

 

subs(reveq,collect(algsubs(eq,temp1),PP,simplify));

(-cos(theta(x, y, t))^4*alpha[1]+(1/4)*(2*gamma[2]+4*alpha[1]+2*alpha[2]+2*alpha[3])*cos(theta(x, y, t))^2+(1/4)*gamma[1]-(1/4)*gamma[2]-(1/4)*alpha[2]-(1/4)*alpha[3]+(1/2)*alpha[4]+(1/4)*alpha[5]+(1/4)*alpha[6])*(dudy^2+dvdx^2)

subs(reveq,collect(algsubs(eq,temp1),PP,u->simplify(u,size)));

((1/4)*(4*sin(theta(x, y, t))^2*alpha[1]+gamma[1]+gamma[2]+alpha[2]+alpha[3]+alpha[5]+alpha[6])*cos(theta(x, y, t))^2+(1/4)*(gamma[1]-gamma[2]-alpha[2]-alpha[3]+alpha[5]+alpha[6])*sin(theta(x, y, t))^2+(1/2)*alpha[4])*(dudy^2+dvdx^2)

temp2 := subs({gamma[1] = alpha[3]-alpha[2],
         gamma[2] = alpha[6]-alpha[5]}, temp1):

 

subs(reveq,collect(algsubs(eq,temp2),[PP],u->simplify(u,size)));

((1/2)*(2*sin(theta(x, y, t))^2*alpha[1]+alpha[3]+alpha[6])*cos(theta(x, y, t))^2+(1/2)*(-alpha[2]+alpha[5])*sin(theta(x, y, t))^2+(1/2)*alpha[4])*(dudy^2+dvdx^2)

subs(reveq,collect(algsubs(eq,temp2),PP,simplify));

(-cos(theta(x, y, t))^4*alpha[1]+(1/2)*(2*alpha[1]+alpha[2]+alpha[3]-alpha[5]+alpha[6])*cos(theta(x, y, t))^2-(1/2)*alpha[2]+(1/2)*alpha[4]+(1/2)*alpha[5])*(dudy^2+dvdx^2)

Download somecoll.mw

If you actually wanted to "collect" that term within a modification of the original expression assigned to aa, then you could follow that up with either of,

  subs(reveq,collect(algsubs(eq,expand(aa)),PP,simplify));

or,

  subs(reveq,collect(algsubs(eq,temp1),PP,simplify))
   + simplify(aa-temp1);

This can be done in your Maple 18 simply by,

   convert([sol],rational)[]

 

You have an expression sequence assigned to sol, not a list or a set. By wrapping it in square backets you get [sol] as a list. This allows you to pass them all together, without any being misinterpreted as options to the command.

By prepending [] to the call you can turn the result from a list back into a mere expression sequence (if you so want...).

problem1_ac.mw

This issue is covered quite clearly on the Help page for topic if, in the section Nested Selection Statements. See also the Help page for topic printlevel.

I'll mention that the inner conditional code does indeed get executed. The effects you're seeing only relate to the display of the inner results.

These effects also cover such nesting involving do-loops.

A good place to start looking for details, when you have an issue with a particular command, would be the Help page for that command.

1 2 3 4 5 6 7 Last Page 2 of 292