acer

32343 Reputation

29 Badges

19 years, 327 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The term G*M/R^2 does not appear alone in your second expression. Before your second attempt, the value of work is actually G*M*m*h/R^2 . Mathematically G*M/R^2 divides that expression, but subs is a syntactic replacement mechanism. This is one of the reasons why the algsubs command exists.

Is this what you wanted to accomplish?

NULL

Justification for using mg as the force exerted by mass m in gravity field g

Using Newton's Law of Gravity, find NULL

work := `assuming`([int(G*M*m/r^2, r = R .. R+h)], [0 < R, 0 < h])

G*M*m*h/(R*(R+h))

NULL

R is >> h, so let R + h = R

work := subs(R+h = R, work)

G*M*m*h/R^2

NULL

G, M and R are all constants, so let GM/R² = g

work := algsubs(G*M/R^2 = g, work)

m*h*g

NULL

NULL

Download Gravity_ac.mw

The following all works ok for me using either Maple 2017.3, or Maple 2017.2, or Maple 2017.0 on 64bit Linux.

It also includes an example in which the color shading goes from green through purple to blue (by surface height), without using the colorscheme option at all.

All the examples which do not use the colorscheme option will work in Maple 17.02 (released 2013), including the one in which the color shading goes from green through purple to blue (by surface height).

Perhaps you could upload a .mw worksheet in which it does not work, so that we could try and diagnose the issue.

restart;

kernelopts(version);

`Maple 2017.2, X86 64 LINUX, Jul 19 2017, Build ID 1247392`

plots:-setoptions3d(lightmodel=none, orientation=[50,70,0]):

plot3d(sin(x)*cos(y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       colorscheme = ["xgradient", ["Green", "Purple", "Blue"]]);

plot3d(sin(x)*cos(y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       colorscheme = ["zgradient", ["Green", "Purple", "Blue"]]);

 

The next example is shaded from green through purple to blue, z-wise,
but doesn't require the colorscheme option.

 

f := proc(x,y) option remember, system;
       sin(x)*cos(y);
     end proc:

F := proc(x,y)
       if not (x::numeric and y::numeric) then
         return 'procname'(args);
       end if;
       (1+f(x,y))/2;
     end proc: # normalize
v := F(x,y):

redpw := piecewise(v<1/2, v, 1-v):
greenpw := piecewise(v<1/2, 1-2*v, 0):
bluepw := v:

plot3d(f(x,y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       color=[redpw,greenpw,bluepw,colortype=RGB]);

 

The rest are just for fun.

 

f := (x,y)->sin(x)*cos(y):
F := (x,y)->0.3+0.4*(1+f(x,y))/2:

plot3d(f(x,y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       color=[F(x,y),1,1,colortype=HSV]);

f := (x,y)->sin(x)*cos(y):
F := (x,y)->(1+f(x,y))/2:

plot3d(f(x,y), x = 0 .. 4*Pi, y = 0 .. 4*Pi,
       view = [default, default, -3 .. 3],
       color=[1-(abs(F(x,y)-1/2))^(1/2),
              1-(abs(F(x,y)))^(1/2),
              1-(abs(F(x,y)-3/4))^(1/4),
              colortype=RGB]);

 

Download plot3d_color_20172.mw

 

You need to use := instead of just = when making an assignment.

The concatenation operator (with evaluation of the suffix) in modern Maple is done using the cat command. (It was dot in the very distant past, but not now. In modern Maple the dot is used for multiplication.)

The name index is protected. Use another name.

Is this what you were trying to do?

restart;

G := unapply((x-y+1)*X/binomial(x, y)+1-(x-y+1)/binomial(x, y), x, y):

PSI := G(3, 2)^10*G(4, 2)^4*G(4, 3)^2*G(5, 2)^2*G(5, 4)
       *G(5, 3)*G(6, 2)^4*G(7, 3)*G(8, 2)*G(9, 2)*G(9, 3)
       *G(9, 4)*G(10, 2)^2*G(11, 2)*G(11, 3)*G(12, 3)*G(13, 3)*G(15, 2)^2:

for i from 0 to degree(PSI,X) do
  cat(D,i) := evalf(coeff(PSI, X, i));
end do:

Dmax := 0:

for i from 0 to degree(PSI,X) do
  if eval(cat(D,i)) > Dmax then
    Index := i;
    Dmax := cat(D,i);
  end if;
end do;

Index, Dmax, evalf(coeff(PSI,X,Index));

14, .1499364076, .1499364076

 

Download coeff_max1.mw

It's more effiecient to use an indexed name rather than a concatenated name, but in that case use another name since D is protected and has a particular meaning.

restart;

G := unapply((x-y+1)*X/binomial(x, y)+1-(x-y+1)/binomial(x, y), x, y):

PSI := G(3, 2)^10*G(4, 2)^4*G(4, 3)^2*G(5, 2)^2*G(5, 4)
       *G(5, 3)*G(6, 2)^4*G(7, 3)*G(8, 2)*G(9, 2)*G(9, 3)
       *G(9, 4)*G(10, 2)^2*G(11, 2)*G(11, 3)*G(12, 3)*G(13, 3)*G(15, 2)^2:

for i from 0 to degree(PSI,X) do
  DD[i] := evalf(coeff(PSI, X, i));
end do:

Dmax := 0:

for i from 0 to degree(PSI,X) do
  if DD[i] > Dmax then
    Index := i;
    Dmax := DD[i];
  end if;
end do;

Index, Dmax, evalf(coeff(PSI,X,Index));

14, .1499364076, .1499364076

 

Download coeff_max2.mw

If you have no other reason to retain the coefficients then there's no need to assign them separately to any new names.

restart;

G := unapply((x-y+1)*X/binomial(x, y)+1-(x-y+1)/binomial(x, y), x, y):

PSI := G(3, 2)^10*G(4, 2)^4*G(4, 3)^2*G(5, 2)^2*G(5, 4)
       *G(5, 3)*G(6, 2)^4*G(7, 3)*G(8, 2)*G(9, 2)*G(9, 3)
       *G(9, 4)*G(10, 2)^2*G(11, 2)*G(11, 3)*G(12, 3)*G(13, 3)*G(15, 2)^2:

Dmax := 0:

for i from 0 to degree(PSI,X) do
  temp := coeff(PSI, X, i);
  if temp > Dmax then
    Index := i;
    Dmax := temp;
  end if;
end do:

Index, evalf(Dmax), evalf(coeff(PSI,X,Index));

14, .1499364076, .1499364076

 

Download coeff_max3.mw

I find that manual rotation (or even selection) of an implicitplot3d t makes my Linux machine bog down, especially when the grid or numpoints setting is high.

But, here, the jaggedness of the boundary can be reduced quite a bit with a higher grid setting of an explicit plot3d or contourplot3d result. And manual rotation, etc, seems to behave better.

I include a few small contour values, to illustrate the restricted domain better.

I zip the worksheet because the saved file is large, due to large plot structure which present a problem for inlining here.

3d_cont.zip

restart:
with(plots):
Omega:=5*Pi:
gamma1:=8*Pi:
gamma2:=0.002*Pi:
x1:=100*Pi:
omega2:=200*Pi:
gamma0:=0.2*Pi:
G:=20*Pi:

lambda1:=(1/(2*Pi))^2*(G*Omega*gamma0/(2*(0.25*gamma0^2+Delta^2))):
lambda2:=(1/(2*Pi))^2*(-G*Omega*Delta/((0.25*gamma0^2+Delta^2))):
lambda3:=(1/(2*Pi))^2*gamma1+lambda1:
lambda4:=(1/(2*Pi))^2*(0.2*omega2-G^2*Delta/(0.25*gamma0^2+Delta^2)):
lambda5:=(1/(2*Pi))^2*(2*x1^2*omega2/((omega2^2+gamma2^2))):
f:=epsilon-(lambda1+sqrt(-lambda2^2+Y*(lambda3^2+(lambda4-lambda5*Y)^2)))^2:
contourplot(solve(f,epsilon), Delta =-25*Pi .. 25*Pi, Y=0..1,
            contours=[0.01,0.1,0.5,1,4,8,12,16,20], axes=boxed, color=black,
            tickmarks=[3, 3], linestyle=1, grid=[501,501],
            gridlines=false, view=[-25*Pi .. 25*Pi,0..1]);

plot3d(solve(f,epsilon), Y = 0 .. 1.0, Delta=-25*Pi..25*Pi,
       style=surfacecontour, color=khaki, labels=[Y,Delta,E1],
       tickmarks=[3,3,3], grid=[351,351], view=0..20,
       orientation=[180,0,-180], lightmodel=none);

plots:-contourplot3d(solve(f,epsilon), Y = 0 .. 1.0, Delta=-25*Pi..25*Pi,
                     contours=[0.01,0.1,0.5,1,4,8,12,16,20], color=khaki,
                     labels=[Y,Delta,E1],
                     tickmarks=[3,3,3], grid=[551,551], view=0..20,
                     color=black, thickness=2, orientation=[180,0,-180]);

If you are still using Maple 13 (released in the year 2009) then remove the option size=[...] which I added only to try and make the offset a little better. I figured that you didn't want the text to cross the y-axis.

restart:

with(plots):

p1:=plot(sin(2*x), x = -Pi .. Pi):
p2:= textplot([0,1.2,typeset("effect of ",alpha=3,",",gamma=5," in the flow")]):
display(p1,p2,
        plot(0, x = -Pi .. Pi, color=black),
        axes=box, view=[default,-1..1.5]);

p1:=plot(sin(2*x), x = -Pi .. Pi):
p2:= textplot([2.2,1.2,typeset("effect of ",alpha=3,",",gamma=5," in the flow")]):
display(p1,p2, size=[450,400]);

 

Download gk_text.mw

If I'm not mistaken then (to use your terminology) below I create functions Y(H,S,C) as opposed to Y(C,S,H).

First I use the fact that the data is regularly spaced (even if not evenly spaced) and call the Interpolation:-SplineInterpolation command added in Maple 2018. This produces a value of 0.897 for H=4, S=5, C=4.5 I think. And an animation of an interpolated surface seems to go from CPC level to level reasonably nicely.

Then I treat the data as if it were irregularly spaced, and call the Interpolation:-RadialBasisFunctionInterpolation and Interpolation:-Kriging commands, also added in Maple 2018. Results for H=4, S=5, C=4.5 are close to 0.89  and 0.9 respectively. But the animated interpolations (animated over CPC values) get a little goofy. I suspect that the dearth of data points might do them in.

Let me know if I've made a mistake.

restart;

kernelopts(version);

`Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750`

Y := Vector([.83, .53, .11, .93, .78, .46, .97, .89, .69,
             .86, .58, 0.9e-1, .94, .82, .5, .97, .91, .73,
             .87, .61, 0.8e-1, .95, .83, .52, .97, .91, .75]):

CPC := Vector([3, 10, 30, 3, 10, 30, 3, 10, 30, 3, 10, 30, 3, 10,
               30, 3, 10, 30, 3, 10, 30, 3, 10, 30, 3, 10, 30]):

SIZE := Vector([2, 2, 2, 5, 5, 5, 10, 10, 10, 2, 2, 2, 5,
                5, 5, 10, 10, 10, 2, 2, 2, 5, 5, 5, 10, 10, 10]):

SH := Vector([4, 4, 4, 4, 4, 4, 4, 4, 4, 4.61, 4.61, 4.61, 4.61, 4.61,
              4.61, 4.61, 4.61, 4.61, 5.04, 5.04, 5.04, 5.04, 5.04, 5.04, 5.04, 5.04, 5.04]):

with(Interpolation):
with(plots):

YY := copy(Y):
ArrayTools :- DataTranspose(YY,9,3):
YY := ArrayTools:-Reshape(YY,[3,3,3]):
YY[..,..,1]:=YY[..,..,1]^%T:
YY[..,..,2]:=YY[..,..,2]^%T:
YY[..,..,3]:=YY[..,..,3]^%T:
Cfun := Interpolation:-CubicInterpolation([<4,4.61,5.04>,<2,5,10>,<3,10,30>],YY);

Interpolation:-CubicInterpolation([Vector(3, {(1) = 4.0, (2) = 4.61, (3) = 5.04}), Vector(3, {(1) = 2.0, (2) = 5.0, (3) = 10.0}), Vector(3, {(1) = 3.0, (2) = 10.0, (3) = 30.0})], `Array(1..3, 1..3, 1..3, {(1, 1, 1) = HFloat(0.83), (1, 1, 2) = HFloat(0.83), (1, 1, 3) = HFloat(0.83), (1, 2, 1) = HFloat(0.93), (1, 2, 2) = HFloat(0.93), (1, 2, 3) = HFloat(0.93), (1, 3, 1) = HFloat(0.97), (1, 3, 2) = HFloat(0.97), (1, 3, 3) = HFloat(0.97), (2, 1, 1) = HFloat(0.86), (2, 1, 2) = HFloat(0.86), (2, 1, 3) = HFloat(0.86), (2, 2, 1) = HFloat(0.94), (2, 2, 2) = HFloat(0.94), (2, 2, 3) = HFloat(0.94), (2, 3, 1) = HFloat(0.97), (2, 3, 2) = HFloat(0.97), (2, 3, 3) = HFloat(0.97), (3, 1, 1) = HFloat(0.87), (3, 1, 2) = HFloat(0.87), (3, 1, 3) = HFloat(0.87), (3, 2, 1) = HFloat(0.95), (3, 2, 2) = HFloat(0.95), (3, 2, 3) = HFloat(0.95), (3, 3, 1) = HFloat(0.97), (3, 3, 2) = HFloat(0.97), (3, 3, 3) = HFloat(0.97)})`, verify = false)

Cfun(4, 5, 4.5);

HFloat(0.8968415937803764)

#
# The above value seems to agree with the OP's expectation (90%).
#
# Let's have more fun.
#

data := <SH|SIZE|CPC|Y>:

# fixing CPC to value of 3
#
fixedCPC[1] := data[[seq(1+3*(i-1),i=1..9)],..]:
Pfix[1] := display(
  plot3d((x,y)->Cfun(x,y,3), 4..5.04, 2..10, color=blue),
  pointplot3d(fixedCPC[1][..,[1,2,4]], symbolsize=25, color=red),
  view=0.0 .. 1.0,
  labels=["SH", "SIZE", "Y"]
):
#Pfix[1];

# fixing CPC to value of 10
#
fixedCPC[2] := data[[seq(2+3*(i-1),i=1..9)],..]:
Pfix[2] := display(
  plot3d((x,y)->Cfun(x,y,10), 4..5.04, 2..10, color=blue),
  pointplot3d(fixedCPC[2][..,[1,2,4]], symbolsize=25, color=red),
  view=0.0 .. 1.0,
  labels=["SH", "SIZE", "Y"]
):
#Pfix[2];

# fixing CPC to value of 30
#
fixedCPC[3] := data[[seq(3+3*(i-1),i=1..9)],..]:
Pfix[3] := display(
  plot3d((x,y)->Cfun(x,y,30), 4..5.04, 2..10, color=blue),
  pointplot3d(fixedCPC[3][..,[1,2,4]], symbolsize=25, color=red),
  view=0.0 .. 1.0,
  labels=["SH", "SIZE", "Y"]
):
#Pfix[3];

bg := display(seq(Pfix[i],i=1..3),transparency=0.9):

animate(plot3d,
        ['Cfun'(x,y,CPC_param), x=4..5.04, y=2..10, color=blue, grid=[15,15]],
        CPC_param=3..30, frames=28,
        background=bg,
        labels=["SH", "SIZE", "Y"]
       );

Rfun := RadialBasisFunctionInterpolation(Matrix(<SH|SIZE|CPC>,datatype=float[8]), Y, multiquadric, 0.999);

"Rfun:=([[Radial Basis Function interpolation object with 27 sample points],[Radial Basis Function: multiquadric]])"

Rfun(4, 5, 4.5);

.884809770358211178

# This gets a little goofy, midway. Too few CPC data points, I suspect.
#animate(plot3d,
#        ['Rfun'(x,y,CPC_param), x=4..5.04, y=2..10, color=blue, grid=[15,15]],
#        CPC_param=3..30, frames=28,
#        background=bg,
#        labels=["SH", "SIZE", "Y"]
#       );

Kfun := Kriging(Matrix(<SH|SIZE|CPC>,datatype=float[8]), Y);

"Kfun:=([[Kriging interpolation object with 27 sample points],[Variogram: Spherical(.0064,.1764,10.63014581)]])"

Kfun(4, 5, 4.5);

.899318323205218428

 

Download law_ac.mw

It means e[1..-1, 2] which means all the rows (entries from row position -1 to 1) and column 2. 

The "-1" means the last entry, and is a handy way to program since you don't have to remember/use the total number of rows.

In 2D Input mode that indexed reference is typeset as subscripted.

Inside the Maple Help window there is an icon at the top of the displayed help-page, which allows you to toggle between 2D Input mode and 1D Maple Notation (plaintext, red code) for the input of the Examples. If you hover over the top icons you can tell which does which.

When toggled to 1D Maple Notation that subscripted reference in the input should appear as the plaintext red code containing e[1..-1, 2] .

If you have a 3x3 Matrix assigned to the name e, then e[1..3, 2] denotes the whole of the second column, and is equivalent to e[1..-1, 2] as well as e[.., 2] .

You can type it in as e[1..-1, 2] whether in 2D or 1D input mode.

If you would like to have the typeset 2D Input display in the subscripted forn then use the key-strokes   e Ctrl-Shift-underscore -1 . . 1 , 2 .  You can read more on the Help page for topic worksheet,documenting,2DMathShortcutKeys .

For the given example, since e has been assigned the Matrix of eigenvectors, then the second column is an eigenvector associated with the second eigenvalue v[2] (the second entry of the Vector v of eigenvalues).

I suspect that it is recognizing that point-release Maple 2018.2 is available, but the label in the popup is outdated.

 

Here's a 3D point-plot with the A[i] values used to determine a hue.

I rescaled so that the smallest A[i] gets red (hue value = 0.0), and the largest gets (roughly) magenta (hue value = 0.85).

But of course you can make any rescaling you want from the A[i] values into the 0.0 .. 1.0 range.

NULL

NULL

restart; st := time(); with(geometry); with(plots); with(LinearAlgebra); with(plottools)

ms := 4; ns := 8; ks := 5

 

 

 

wrs := (1/1000)*`<,>`(30, 60, 90, 120, 150)

 

 

 

wt := (1/180)*Pi*`<,>`(seq(0 .. 360, 45))

 

``

wz := (1/1000)*`<,>`(0, 10, 20, 30, 40, 50)

``

``

``NULL

``

 

ii := 0

NULL

for k to ks do for i to ms do for j to ns do ii := ii+1; nods[i, j, k] := j+(i-1)*ns+(k-1)*ms*ns; l := nods[i, j, k]; xss[l] := evalf(((wrs[i+1]+wrs[i])*(1/2))*cos((wt[j+1]+wt[j])*(1/2))); yss[l] := evalf(((wrs[i+1]+wrs[i])*(1/2))*sin((wt[j+1]+wt[j])*(1/2))); zss[l] := evalf((wz[k+1]+wz[k])*(1/2)); A[l] := (300*cos(.5*xss[l])+270*sin(2*yss[l]))*exp(-zss[l]) end do end do end do

NULL

NULL

NULL

NULL

points := [seq(seq(seq([xss[nods[i, j, k]], yss[nods[i, j, k]], zss[nods[i, j, k]]], j = 1 .. ns), i = 1 .. ms), k = 1 .. ks)]

``

``

AAA := Array(1 .. ns*ms*ks, proc (i) options operator, arrow; A[i] end proc, datatype = float[8]); minAAA, maxAAA := min(AAA), max(AAA); AAA := map[evalhf](proc (u) options operator, arrow; .85*(u-minAAA)/(maxAAA-minAAA) end proc, AAA)

Array(%id = 18446884565150188718)

pointplot3d(points, symbolsize = 20, labels = ["x", "y", "z"], color = COLOR(HUE, AAA))

pointplot3d([seq([xss[i], yss[i], zss[i]], i = 1 .. ns*ms*ks)], symbolsize = 20, labels = ["x", "y", "z"], color = COLOR(HUE, AAA))

``

Download essai_ac.mw

The way in which the result is formatted for pretty-printed display as 2D Math output should be not be a primary concern for how the output expression will be handled in further computation.

For further computation, it is the structure that matters. The lprint command can provide a more accurate representation of the actual structure than does 2D typesetting/pretty-printing.

If both examples make sense in context, then as long as they are handled OK then why worry?

If you really prefer a form where both are displayed in the same manner then how about using D (either when inputting, or by using convert on the diff form)?

  D[1](u)(0,t) = A(t);

  D[1](u)(L,t) = A(t);

 

There were syntax mistakes in your piecewise construction.

NULL

``

 

 

restart:

with(plots):

with(IntegrationTools):

Phi(t):=1+e*cos(t);

1+e*cos(t)

(1)

e:=0.1: alpha:=0.1: r:=0.1:Vs:=0.05:

 

 

R:=z->piecewise( z<=1,    1-H*cos(Pi*z)^2,  1):

 

a1:=(1/2)*Phi(t)*(R(z)^2-r^2);

a1 := (1/2*(1+e*cos(t)))*(piecewise(z <= 1, 1-H*cos(Pi*z)^2, 1)^2-0.1e-1)

(2)

a2:=(-4/3)*tauy^(1/2)*Phi(t)^(1/2)*(R(z)^(3/2)-r^(3/2))+tauy*(R(z)-r):

a3:=((1/2)*diff(Phi(t),t)*((3*R(z)^4/16)-(1*R(z)^2*r^2/4)+(r^4/16))):

a41:=((2*tauy^(1/2)*diff(Phi(t),t)*Phi(t)^(-1/2))/3):

a42:=((33*R(z)^(7/2)/196)-(1*R(z)^(3/2)*r^2/4)+(4*r^(7/2)/49)):

a4:=a41*a42:

a51:=((tauy^(1/2)*diff(Phi(t),t)*Phi(t)^(-1/2))/2):

a52:=((11*R(z)^(7/2)/42)-(1*r^(3/2)*R(z)^2/3)+(r^(7/2)/14)):

a5:=a51*a52:

a61:=((2*tauy*diff(Phi(t),t)*Phi(t)^(-1))/3):

a62:=((5*R(z)^(3)/21)-(1*r^(3/2)*R(z)^(3/2)/3)+2*(r^(3)/21)):

a6:=a61*a62:

b1:=a1+a2+Vs+alpha^2*(a3-a4-a5+a6):

t:=Pi/3;

(1/3)*Pi

(3)

 

plot( [seq(seq(eval(b1, tauy=j), j in [0.01,0.02,0.03]), H in [0.10,0.15,0.20])], z=0..1,legend = ["tauy=0.01","tauy=0.02","tauy=0.03",""$6],title = "Variation of axial velocity ", titlefont = ["ROMAN", 15], labels = ["z ", "Vc"], labeldirections = ["horizontal", "vertical"], labelfont = ["ROMAN", 11], linestyle = [solid,longdash,dashdot],thickness = 2,symbol = [BOX,CROSS,CIRCLE],color=[black$3,red$3,blue$3], axNULLesfont = ["HELVETICA", "ROMAN", 10], axes=boxed, gridlines=false);

 

``

 

NULL

Download waseem_test_ac.mw

Here are some ideas. (This site won't render it inline, as its backend Maplenet is old...)

student_md_question_2_ac.mw

Replace all instance in your code of lower with Lower, and all instances of upper with Upper.

There seems to be a problem with some procedure under Eigenvectors using the unquoted global name lower when invoking the Matrix constructior. (A bug, which I shall report.)

While you're making changes, you could also create your Matrix with the option shape=symmetric. Ie,
    M:=Matrix(2*n+1, shape=symmetric);
That way, if you ever decide to instead call Eigenvectors(evalf[15](M)) to get floating-point results there will be no zero imaginary components, ie. the results will be real floats.

The bug with the name lower only seems to affect the exact case, and Eigenvectors(evalf[15](M)) seems to not suffer from it. (We could probably find the offending line quickly in the debugger...)

[edited] I'll adjust my surmise about the precise cause. It goes wrong under LUDecomposition, but not because the option value contains the name lower unquoted, or in how it calls the Matrix constructor. Rather, it looks like a bug in the Matrix constructor itself. Eg,

restart;
lower := 1:

Matrix(2,'shape'='triangular'['lower']);
Error, (in Matrix) triangular[] storage expects name parameters
restart;

lower := 1:

interface(prettyprint=1):
trace(rtable):

Matrix(2, shape=triangular['lower']);
  execute rtable, args = triangular[lower], 1 .. 2, 1 .. 2, fill = 0,
  storage = triangular[1], subtype = Matrix
Error, (in Matrix) triangular[] storage expects name parameters

Matrix(2, shape=triangular['lower'], storage=triangular['lower']);
  execute rtable, args = triangular[lower], 1 .. 2, 1 .. 2, fill = 0,
  storage = triangular[lower], subtype = Matrix
                                   [0  0]
                                   [    ]
                                   [0  0]

There are internal routines of SolveTools:-Inequality , for linear systems, which are unprepared for arguments that contain relations which are a function of `<>`.

After such `<>` relations are generated internally, then as they get passed to such an internal procedure then that kind of error message attains.

I can reproduce the error message you've seen. (I edited the inequalities in your Question, and inserted a missing comma after what is now the first in your list.)

I did a cursory look through the related internal routines, and did not see any obvious reason why they shouldn't be able to handled `<>` present in their primary input. But I see one of two things which make me a little suspicious. If I simply change the parameter specification of those procedures to allow `<>` alongside the other kinds of relation in the input then I so obtain some result for your system.

It is not as quickly solved as the new system generated from the substitutions you suggested. I am unsure of the best way to try and verify whether the two answers (when re-expressed in the original variables, say) represent the same solution space.

restart;

kernelopts(version);

`Maple 2018.0, X86 64 LINUX, Mar 9 2018, Build ID 1298750`

plots:-setoptions(gridlines=false):

kernelopts(opaquemodules=false):
unprotect(SolveTools:-Inequality:-LinearMultivariateSystemInternal);
unprotect(SolveTools:-Inequality:-LinearUnivariateSystemInternal);
unprotect(SolveTools:-Inequality:-LinearUnivariateSystem);
unprotect(SolveTools:-Inequality:-LinearUnivariateInternal);

augstruct:=[_Inert_ASSIGNEDNAME("<", "PROC",
              _Inert_ATTRIBUTE(_Inert_NAME("protected",
                               _Inert_ATTRIBUTE(_Inert_NAME("protected"))))),
            _Inert_ASSIGNEDNAME("<>", "PROC",
              _Inert_ATTRIBUTE(_Inert_NAME("protected",
                               _Inert_ATTRIBUTE(_Inert_NAME("protected")))))]:

SolveTools:-Inequality:-LinearMultivariateSystemInternal:=
FromInert(subsop([1,1,2,2,1,1,1]=augstruct[],
                 ToInert(eval(SolveTools:-Inequality:-LinearMultivariateSystemInternal)))):

SolveTools:-Inequality:-LinearUnivariateSystemInternal:=
FromInert(subsop([1,1,2,2,1,1,1]=augstruct[],
                 ToInert(eval(SolveTools:-Inequality:-LinearUnivariateSystemInternal)))):

SolveTools:-Inequality:-LinearUnivariateSystem:=
FromInert(subsop([1,1,2,2,1,1,1]=augstruct[],
                 ToInert(eval(SolveTools:-Inequality:-LinearUnivariateSystem)))):

SolveTools:-Inequality:-LinearUnivariateInternal:=
FromInert(subsop([1,1,2,1,1]=augstruct[],
                 ToInert(eval(SolveTools:-Inequality:-LinearUnivariateInternal)))):

protect(SolveTools:-Inequality:-LinearMultivariateSystemInternal);
protect(SolveTools:-Inequality:-LinearUnivariateSystemInternal);
protect(SolveTools:-Inequality:-LinearUnivariateSystem);
protect(SolveTools:-Inequality:-LinearUnivariateInternal);
kernelopts(opaquemodules=true):

inequalities := [-a1-a2+a3+a4 <= 2, a1+a2 <= 3, -2*a1 <= -1, -2*a2 <= -1,
                 -2*a3 <= -1, -2*a4 <= -1, -a1+a2+a3-a4 <= 4,
                 -a1+a2-a3+a4 <= 4, a1-a2+a3-a4 <= 4, a1-a2-a3+a4 <= 4]:

vars := [a1,a2,a3,a4]:

ans1 := CodeTools:-Usage(
           SolveTools:-Inequality:-LinearMultivariateSystem(inequalities, vars)
                        );

memory used=8.92GiB, alloc change=324.01MiB, cpu time=75.78s, real time=72.01s, gc time=7.19s

{[{a1}, {a2 = a1}, {a3}, {1/2 <= a4, a4 <= 2+2*a1-a3}], [{a1 = 3/2}, {a2 = 3/2}, {a3 = 1/2}, {1/2 <= a4, a4 <= 9/2}], [{a1 = 3/2}, {a2 = 3/2}, {a3 = 9/2}, {a4 = 1/2}], [{a1 = 3/2}, {1/2 <= a2, a2 <= 3/2}, {1/2 <= a3}, {1/2 <= a4, a4 <= 5/2+a2+a3}], [{a1 = 3/2}, {1/2 <= a2, a2 < 3/2}, {a3 = 1/2}, {1/2 <= a4, a4 <= 3+a2}], [{a1 = 3/2}, {1/2 <= a2, a2 < 3/2}, {a3 = 3+a2}, {a4 = 1/2}], [{a1 = 3/2}, {1/2 <= a2, a2 < 3/2}, {1/2 < a3, a3 < 3+a2}, {1/2 <= a4, a4 <= 7/2+a2-a3}], [{a1 = 11/2}, {a2}, {a3}, {a4 <= -3/2+a2+a3, 3/2-a2+a3 <= a4}], [{a1 = 11/2}, {a2}, {a3}, {a4 <= 15/2+a2-a3, 3/2-a2+a3 <= a4}], [{a1 = 19/2}, {a2}, {a3}, {a4 <= -11/2+a2+a3, 11/2-a2+a3 <= a4}], [{a1 <> 11/2}, {a2 = a1}, {a3}, {1/2 <= a4, a4 <= 4+a3}], [{1/2 <= a1, a1 < 3/2}, {1/2 <= a2, a2 <= a1}, {1/2 <= a3, a3 <= 3/2+a1+a2}, {1/2 <= a4, a4 <= 2+a1+a2-a3}], [{1/2 <= a1, a1 < 3/2}, {3/2 <= a2, a2 <= 3-a1}, {1/2 <= a3, a3 <= -1+a2}, {1/2 <= a4, a4 <= 4+a1-a2+a3}], [{1/2 <= a1, a1 < 3/2}, {3/2 <= a2, a2 <= 3-a1}, {a3 <= 3+a1, 9/2+a1-a2 <= a3}, {a4 <= 2+a1+a2-a3, -4-a1+a2+a3 <= a4}], [{1/2 <= a1, a1 < 3/2}, {3/2 <= a2, a2 <= 3-a1}, {a3 < 9/2+a1-a2, -1+a2 < a3}, {1/2 <= a4, a4 <= 2+a1+a2-a3}], [{1/2 <= a1, a1 < 3/2}, {a1 < a2, a2 < 3/2}, {1/2 <= a3, a3 <= 3/2+a1+a2}, {1/2 <= a4, a4 <= 2+a1+a2-a3}], [{a1 <= 5/2, 3/2 < a1}, {1/2 <= a2, a2 <= 3-a1}, {1/2 <= a3, a3 <= -1+a1}, {1/2 <= a4, a4 <= 4-a1+a2+a3}], [{a1 <= 5/2, 3/2 < a1}, {1/2 <= a2, a2 <= 3-a1}, {a3 <= 3+a2, 9/2-a1+a2 <= a3}, {a4 <= 2+a1+a2-a3, -4+a1-a2+a3 <= a4}], [{a1 <= 5/2, 3/2 < a1}, {1/2 <= a2, a2 <= 3-a1}, {a3 < 9/2-a1+a2, -1+a1 < a3}, {1/2 <= a4, a4 <= 2+a1+a2-a3}]}

S := [t1 = a1-a2, t2 = a1+a2, r1 = a3-a4, r2 = a3+a4];

[t1 = a1-a2, t2 = a1+a2, r1 = a3-a4, r2 = a4+a3]

new := [-t2+r2 <= 2, t2 <= 3, -2*(t1+t2)/2 <= -1, -2*(t2-t1)/2 <= -1,
        -2*(r1+r2)/2 <= -1, -2*(r2-r1)/2 <= -1, -t1+r1 <= 4,
        -t1-r1 <= 4, t1+r1 <= 4, t1-r1 <= 4];

[-t2+r2 <= 2, t2 <= 3, -t1-t2 <= -1, -t2+t1 <= -1, -r1-r2 <= -1, -r2+r1 <= -1, -t1+r1 <= 4, -t1-r1 <= 4, t1+r1 <= 4, t1-r1 <= 4]

eval(new, S) - inequalities;

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

ans2 := CodeTools:-Usage(
           SolveTools:-Inequality:-LinearMultivariateSystem(new, [t1,t2,r1,r2])
                        );

memory used=1.21GiB, alloc change=0 bytes, cpu time=9.74s, real time=9.22s, gc time=933.69ms

{[{t1 = -1}, {2 <= t2, t2 <= 3}, {-3 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 = -1}, {2 <= t2, t2 <= 3}, {r1 <= 3, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 = 0}, {t2 = 3}, {-4 <= r1, r1 < -3}, {r2 <= 5, 1-r1 <= r2}], [{t1 = 0}, {t2 = 3}, {r1 <= 4, 3 < r1}, {r2 <= 5, 1+r1 <= r2}], [{t1 = 0}, {1 <= t2, t2 <= 3}, {-2 <= r1, r1 < 0}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 = 0}, {1 <= t2, t2 <= 3}, {r1 <= 2, 0 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 = 0}, {2 < t2, t2 < 3}, {r1 <= 1+t2, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 = 0}, {2 < t2, t2 < 3}, {-1-t2 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 = 1}, {2 <= t2, t2 <= 3}, {-3 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 = 1}, {2 <= t2, t2 <= 3}, {r1 <= 3, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-2 <= t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {r1 = 0}, {1 <= r2, r2 <= 2+t2}], [{-2 <= t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {-2 <= r1, r1 < 0}, {r2 <= 2+t2, 1-r1 <= r2}], [{-2 <= t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {r1 <= 2, 0 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 <= t1, t1 <= 2}, {t2 <= 3, 1+t1 <= t2}, {r1 = 0}, {1 <= r2, r2 <= 2+t2}], [{t1 <= 0, -1 < t1}, {2 <= t2, t2 <= 3}, {-3 <= r1, r1 < -2+t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 <= 0, -1 < t1}, {2 <= t2, t2 <= 3}, {r1 <= 3, 2-t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 <= 0, -1 < t1}, {t2 < 2, 1-t1 < t2}, {r1 <= 1+t2, 2-t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{t1 <= 0, -1 < t1}, {t2 < 2, 1-t1 < t2}, {-1-t2 <= r1, r1 < -2+t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 <= 2, 0 < t1}, {t2 <= 3, 1+t1 <= t2}, {-2 <= r1, r1 < -2+t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{t1 <= 2, 0 < t1}, {t2 <= 3, 1+t1 <= t2}, {r1 <= 2, 2-t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-2 < t1, t1 < -1}, {t2 <= 3, 1-t1 <= t2}, {r1 <= t1+4, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-2 < t1, t1 < -1}, {t2 <= 3, 1-t1 <= t2}, {-t1-4 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {r1 <= 2-t1, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= 3, 1-t1 <= t2}, {-2+t1 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= 3, t1+3 < t2}, {r1 <= t1+4, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= 3, t1+3 < t2}, {-t1-4 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= t1+3, 2 < t2}, {r1 <= 1+t2, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{-1 < t1, t1 < 0}, {t2 <= t1+3, 2 < t2}, {-1-t2 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {2 <= t2, t2 <= 3}, {-3 <= r1, r1 < -2-t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {2 <= t2, t2 <= 3}, {r1 <= 3, 2+t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= 3, 1+t1 <= t2}, {r1 <= 2+t1, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= 3, 1+t1 <= t2}, {-2-t1 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= 3, -t1+3 < t2}, {r1 <= -t1+4, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= 3, -t1+3 < t2}, {t1-4 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= -t1+3, 2 < t2}, {r1 <= 1+t2, 3 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 <= -t1+3, 2 < t2}, {-1-t2 <= r1, r1 < -3}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 1}, {t2 < 2, 1+t1 < t2}, {r1 <= 1+t2, 2+t1 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 1}, {t2 < 2, 1+t1 < t2}, {-1-t2 <= r1, r1 < -2-t1}, {r2 <= 2+t2, 1-r1 <= r2}], [{0 < t1, t1 < 2}, {t2 <= 3, 1+t1 <= t2}, {r1 <= 2-t1, 0 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{0 < t1, t1 < 2}, {t2 <= 3, 1+t1 <= t2}, {-2+t1 <= r1, r1 < 0}, {r2 <= 2+t2, 1-r1 <= r2}], [{1 < t1, t1 < 2}, {t2 <= 3, 1+t1 <= t2}, {r1 <= -t1+4, 2 < r1}, {r2 <= 2+t2, 1+r1 <= r2}], [{1 < t1, t1 < 2}, {t2 <= 3, 1+t1 <= t2}, {t1-4 <= r1, r1 < -2}, {r2 <= 2+t2, 1-r1 <= r2}]}

reverb := eval(ans2, S):

eval(reverb, [a3=2, a4=2]):
map(s->solve(map(op,s)), %);

{{a1 = 1, a2 <= 2, 1 < a2}, {a1 = 1/2, 3/2 <= a2, a2 <= 5/2}, {a1 = a2, a2 <= 3/2, 1 < a2}, {a1 = 2-a2, a2 <= 1, 1/2 < a2}, {a1 = -a2+3, 1 < a2, a2 < 3/2}, {a1 = -a2+3, 1/2 < a2, a2 < 1}, {a2 = 1, a1 <= 2, 1 < a1}, {a2 = 1/2, 3/2 <= a1, a1 <= 5/2}, {a2 = 2-a1, 1/2 < a1, a1 < 1}, {a2 = -a1+3, 1 < a1, a1 < 3/2}, {a2 = -a1+3, 1/2 < a1, a1 < 1}, {1 < a1, a1 < 3/2, a1 < a2, a2 < -a1+3}, {1 < a2, a1 < -a2+3, a2 < 3/2, a2 < a1}, {1/2 < a1, a1 < 1, a2 < -a1+3, 2-a1 < a2}, {1/2 < a2, a1 < -a2+3, a2 < 1, 2-a2 < a1}}

plots:-display(
  seq(plots:-inequal(s, a1=-3..3, a2=-3..3, view=[-3..3, -3..3]), s=%) );

eval(ans1, [a3=2, a4=2]):
map(s->solve(map(op,s)), %);

{{a1 = 1, 1 < a2, a2 < 3/2}, {a1 = 1/2, a2 <= 5/2, 3/2 < a2}, {a1 = 3/2, 1/2 <= a2, a2 <= 3/2}, {a1 = 3/2, 1/2 <= a2, a2 < 3/2}, {a1 = -a2+3, 3/2 < a2, a2 < 5/2}, {a2 = 1/2, a1 <= 5/2, 3/2 < a1}, {a2 = 3/2, 1/2 <= a1, a1 < 3/2}, {a2 = a1, 1 < a1, a1 < 3/2}, {a2 = 2-a1, 1 <= a1, a1 < 3/2}, {a2 = 2-a1, 1/2 < a1, a1 < 1}, {a2 = -a1+3, 3/2 < a1, a1 < 5/2}, {1 < a1, a1 < 3/2, a1 < a2, a2 < 3/2}, {1 < a1, a1 < 3/2, a2 < a1, 2-a1 < a2}, {1/2 < a1, 3/2 < a2, a1 < -a2+3, a2 < 5/2}, {1/2 < a1, a1 < 1, a2 < 3/2, 2-a1 < a2}, {1/2 < a2, 3/2 < a1, a1 < 5/2, a2 < -a1+3}}

plots:-display(
  seq(plots:-inequal(s, a1=-3..3, a2=-3..3, view=[-3..3, -3..3]), s=%) );

eval([inequalities], [a3=2, a4=2]);
plots:-display(
  seq(plots:-inequal(s, a1=-3..3, a2=-3..3, view=[-3..3, -3..3]), s=%) );

[[-a1-a2 <= -2, a1+a2 <= 3, -2*a1 <= -1, -2*a2 <= -1, -4 <= -1, -4 <= -1, -a1+a2 <= 4, -a1+a2 <= 4, -a2+a1 <= 4, -a2+a1 <= 4]]

showstat((SolveTools::Inequality)::LinearUnivariateInternal, 17..18);


LinearUnivariateInternal := proc(eq::{`<`, `<=`, `<>`, `=`}, var::name, ineqs := {}, listset := 'set')
local eqn, a, b, rel, cond, solution;
       ...
  17   if rel = `<=` and member(false,map(coulditbe,SolveTools:-Substitute(var = b/a,ineqs))) then
  18       rel := `<`
       end if;
       ...
end proc

 

Download ineqsystem.mw

If plots:-inequal is correct (especially in its lines) above then there may be some discrepencies in some part of the computed distinction between inequality and strict inequality. It might be better/necessary to have the altered routines convert all `<>` relations into alternate form, as their very first step.

 

A := unapply(eval(C(2,3),:-t=T),T):

A(0), A(0.5), A(0.3);

It would be less awkward if you did not have the unnecessary creation of Ld as an operator (using unapply) inside the procedure C., as well as not assign to Ld(t)[i]. I suspect that does not accomplish what you're expecting.

restart;
with(LinearAlgebra):
C:=proc(k,M) local N,P,m,L,T,j,Ld,n,i; 
N:=2^(k-1)*M:
P[0]:= t -> 1:
P[1]:= t -> t:
for m from 2 to M-1 do
   P[m]:= unapply(expand((2*m-1)*t*P[m-1](t)/m - (m-1)*P[m-2](t)/m), t)
end do: 
L:=proc(n,m) local a,b; 
  a := (2*n-2)/2^k; 
  b := 2*n/2^k; 
  return piecewise(a <= t and t <= b, P[m](2^k*t-2*n+1)*sqrt(((m+1)/2)*2^k))
end proc:
T := Vector(N):
for j from 1 to N do T[j] := (j-1/2)/N end do; 
Ld := Vector(N);
for n from 1 to 2^(k-1) do 
  for m from 0 to M-1 do
i := n+2^(k-1)*m:
Ld[i] := L(n,m)
     end do
end do:

return Ld:  
end proc:

A := unapply(C(2,3),t):
A(0), A(0.5), A(0.3);
First 166 167 168 169 170 171 172 Last Page 168 of 336