tomleslie

12497 Reputation

19 Badges

12 years, 231 days

MaplePrimes Activity


These are replies submitted by tomleslie

@mehdibgh 

"symbolic format" can Matlab import?

Until you specify this, no progress can be made

to work out what you are trying to achieve, but I think that the fundamental problem with you code is in the lines

circle(C5,[reflection(P5, center(C3), L2), radius(C2)]):

detail(C5):
circle(C6, [point(P5, [0, R/3 - (2*R)/9]), radius(C2)]):

where P5 is defined in the creation of C5, and then redefined in the definition of C6 - so both C5 and C6 will now have the same centre, which will be the last one defined above.

Fixing this, guessing a little about what you are trying to achieve, and tidying up a bit results in the attached

  restart;
  with(plots):
  with(geometry):
  _EnvHorizontalName := x:
  _EnvVerticalName := y:
  R := 7:
  point(A, [0, R]):
  line(L1, y = sqrt(3)*x + R):
  line(L2, y = -sqrt(3)*x + R):
  line(L3, y = R/3):
  intersection(B, L1, L3):
  intersection(C, L2, L3):

  triangle(ABC, [A, B, C]):
  circle(C1, [point(P1, [0, 0]), R]):

  incircle(C2, ABC, 'centername'=P2);
  dsegment( ds1, [ point(sp1, [0, radius(C2)]), point(sp2, [0, -radius(C2)]) ]):

  circle(C3, [reflection(P3, center(C2), C),  radius(C2)]):
  circle(C4, [reflection(P4, center(C2), B),  radius(C2)]):
  circle(C5, [reflection(P5, center(C3), L2), radius(C2)]):
  circle(C6, [reflection(P6, center(C4), L1), radius(C2)]):

  translation(C7, C2, ds1):
  translation(C8, C7, ds1):
  translation(C9, C8, ds1):

  circle(Cir, [center(C8), 3*radius(C8)]):

  draw([ L1(color = blue),
         ABC(color = red, transparency = 0.5, filled = true),
         L2(color = blue), L3(color = blue),
         C1(color = blue, thickness = 3),
         C1(color = yellow, transparency = 0.8, filled = true),
         C2(color = blue, filled = true),
         C3(color = blue, filled = true),
         C4(color = blue, filled = true),
         C5(color = blue, filled = true),
         C6(color = blue, filled = true),
         C7(color = blue, filled = true),
         C8(color = blue, filled = true),
         C9(color = blue, filled = true),
         Cir(color = red,transparency = 0.5,filled=true)
       ],
       axes = normal,
       view = [-R .. R, -R .. R],
       scaling = constrained
     );

C2

 

 

 

Download refLCir3.mw

 

  1. I decide that this is a bug amd have reported it to Maplesoft, so (hopefully?!) it will be fixed in a future Maple release. However since there is such a simple workaround which achieves the same transformation (see my original worksheet), I did categorize this "bug" as minor
  2. There is a better(?) way to compute the "reference" circle C2, in your/my original worksheet - rather than having to supply explicit expressions for the centre and the radius, use the incircle() command appied to the triangle ABC - see the attached

  restart;
  with(plots):
  with(geometry):
  _EnvHorizontalName := x:
  _EnvVerticalName := y:

  R := 7:
  point(A, [0, R]):
  line(L1, y = sqrt(3)*x + R):
  line(L2, y = -sqrt(3)*x + R):
  line(L3, y = R/3):
  intersection(B, L1, L3):
  intersection(C, L2, L3):
  triangle(ABC, [A, B, C]):

  circle(C1, [point(P1, [0, 0]), R]):
  incircle(C2, ABC, 'centername'=P2):

  circle(C3, [ reflection(P3, center(C2), C), radius(C2)]):
  circle(C4, [ reflection(P4, center(C2), B), radius(C2)]):

  draw( [ L1(color = blue),
          ABC(color = red, transparency = 0.5, filled = true),
          L2(color = blue),
          L3(color = blue),
          C1(color = blue, thickness = 3),
          C1(color = yellow, transparency = 0.8, filled = true),
          C2(color = green, filled = true),
          C3(color = green, filled = true),
          C4(color = green, filled = true)
        ],
        axes = normal,
        view = [-R .. R, -R .. R],
        scaling = constrained
      );

 

 

 

Download reflCir2.mw

@David Mazziotti 

The brackets [[ ]]  do not appear in the worksheet - they are an artefact of how this website renders "unit" quantities.

Completely different expression, a different independent variable and different root locations - not surprising that my original code doesn't work. Furthermore, you have used cut-and-paste to convert 1D-code input to 2D-code input. Don't do this. If you must convert code then select it (one execution group at a time) and use the menu entries Format->Convert to->2D Math Input.

Results for your latest problem are shown in the attached: for most k-values, there are two roots, but one has one root and one has three roots.

restart;

x := -8.067362149*10^10*lambda^4 + 6.009288065*10^10*lambda^3 - 1.678591153*10^10*lambda^2 + 2.083931981*10^9*lambda - 9.701808295*10^7;

-0.8067362149e11*lambda^4+0.6009288065e11*lambda^3-0.1678591153e11*lambda^2+2083931981.*lambda-97018082.95

(1)

Q := lambda;

lambda

(2)

P := -(((((-2*Q - 3*k)*R + (k + 1)*(-1 + B))*R^2*x^8)/16 - (((-2*Q - 3*k)*R + (k + 1)*(-1 + B))*R^2*x^7)/4 + 5*((-(26*Q)/5 - (39*k)/5 - 81/10)*R^2 - 2*(-1 + B)*(Q + k/5 - 4)*R + (-1 + B)^2*(k + 1))*R*x^6/8 - (3*R*((-(13*Q)/3 - (13*k)/2 - 15/2)*R^2 - 2*(-1 + B)*(Q + (5*k)/12 - 43/12)*R + (-1 + B)^2*(k + 1))*x^5)/2 + ((-72 - (519*k)/16 + (31*Q)/2)*R^3 - 175*(Q + (29*k)/35 - 107/175)*(-1 + B)*R^2/4 - 2*(-1 + B)^2*(Q - (151*k)/16 - 247/16)*R + (-1 + B)^3*(k + 1))*x^4 + ((243/4 + 30*k + (31*Q)/2)*R^3 + 22*(-1 + B)*(Q + (83*k)/88 - 85/88)*R^2 + 4*(-1 + B)^2*(Q - (5*k)/4 - 29/4)*R - 2*(-1 + B)^3*(k + 1))*x^3 + ((-4005/16 - (309*k)/4 + (469*Q)/4)*R^3 - 411*(-1 + B)*(Q + (662*k)/411 + 161/411)*R^2/4 - 76*(-1 + B)^2*(Q - (147*k)/608 - 1203/608)*R + 38*(-1 + B)^3*(k + 1))*x^2 + ((153/2 + 27*k - (45*Q)/2)*R^3 + 35*(-1 + B)*(Q + (201*k)/140 + 57/140)*R^2 + 20*(-1 + B)^2*(Q - (11*k)/40 - 107/40)*R - 10*(-1 + B)^3*(k + 1))*x + (-2025/8 - (243*k)/4 + (1557*Q)/8)*R^3 - 33*(-1 + B)*(Q + (1131*k)/44 + 915/44)*R^2/4 - 186*(-1 + B)^2*(Q + (133*k)/496 - 443/496)*R + 93*(-1 + B)^3*(k + 1))*exp(-R*(5*x^2 - 2*x + 17)/(-4 + 4*B)) + (-(((-2*Q + 3)*R + (k + 1)*(-1 + B))*R^2*x^8)/16 + (((-2*Q + 3)*R + (k + 1)*(-1 + B))*R^2*x^7)/4 - 5*((-(26*Q)/5 + 159/10)*R^2 - 2*(Q - (13*k)/10 - 11/2)*(-1 + B)*R + (-1 + B)^2*(k + 1))*R*x^6/8 + (3*R*((-(13*Q)/3 + 14)*R^2 - 2*(Q - (13*k)/12 - 61/12)*(-1 + B)*R + (-1 + B)^2*(k + 1))*x^5)/2 + ((-1671/16 + (235*Q)/4)*R^3 + 175*(Q - (47*k)/70 - 191/70)*(-1 + B)*R^2/4 + 2*(-1 + B)^2*(Q - (175*k)/16 - 271/16)*R - (-1 + B)^3*(k + 1))*x^4 + ((363/4 - (49*Q)/2)*R^3 - 22*(-1 + B)*(Q - (49*k)/88 - 433/88)*R^2 - 4*(-1 + B)^2*(Q - (11*k)/4 - 35/4)*R + 2*(-1 + B)^3*(k + 1))*x^3 + ((-5241/16 + (881*Q)/4)*R^3 + 1059*(-1 + B)*(Q - (881*k)/2118 - 4259/2118)*R^2/4 + 76*(Q - (1059*k)/608 - 2115/608)*(-1 + B)^2*R - 38*(-1 + B)^3*(k + 1))*x^2 + ((207/2 - (117*Q)/2)*R^3 - 71*(-1 + B)*(Q - (117*k)/284 - 693/284)*R^2 - 20*(Q - (71*k)/40 - 167/40)*(-1 + B)^2*R + 10*(-1 + B)^3*(k + 1))*x + (-2511/8 + (2205*Q)/8)*R^3 + 1833*(-1 + B)*(Q - (735*k)/2444 - 3543/2444)*R^2/4 + 186*(Q - (611*k)/496 - 1187/496)*(-1 + B)^2*R - 93*(-1 + B)^3*(k + 1))*exp(-R*(5*x^2 - 2*x + 29)/(-4 + 4*B)) + ((((-2*Q - 3*k)*R + (k + 1)*(-1 + B))*R^2*x^8)/16 - (((-2*Q - 3*k)*R + (k + 1)*(-1 + B))*R^2*x^7)/4 + (3*R*((-(26*Q)/3 - (29*k)/2 - 12)*R^2 - 2*(Q - (7*k)/6 - 37/6)*(-1 + B)*R + (-1 + B)^2*(k + 1))*x^6)/8 - (((-13*Q - 24*k - 18)*R^2 - 2*(Q - (13*k)/4 - 37/4)*(-1 + B)*R + (-1 + B)^2*(k + 1))*R*x^5)/2 + ((-117/2 - (735*k)/16 + (53*Q)/4)*R^3 - 121*(Q + (101*k)/242 - 331/242)*(-1 + B)*R^2/4 + 2*(-1 + B)^2*(Q + (169*k)/16 + 73/16)*R - (-1 + B)^3*(k + 1))*x^4 + ((36 + (219*k)/4 + (49*Q)/2)*R^3 - 6*(-1 + B)*(Q + (97*k)/24 + 217/24)*R^2 - 4*(Q + (9*k)/4 - 15/4)*(-1 + B)^2*R + 2*(-1 + B)^3*(k + 1))*x^3 + ((-180 - (2361*k)/16 + (271*Q)/4)*R^3 - 677*(-1 + B)*(Q + (397*k)/1354 - 1481/1354)*R^2/4 + 76*(-1 + B)^2*(Q + (1205*k)/608 + 149/608)*R - 38*(-1 + B)^3*(k + 1))*x^2 + ((36 + (135*k)/2 + (117*Q)/2)*R^3 - 19*(-1 + B)*(Q + (213*k)/76 + 357/76)*R^2 - 20*(Q + (29*k)/40 - 67/40)*(-1 + B)^2*R + 10*(-1 + B)^3*(k + 1))*x + (-162 - (1215*k)/8 + (99*Q)/8)*R^3 - 1023*(-1 + B)*(Q + (105*k)/1364 - 1407/1364)*R^2/4 + 186*(-1 + B)^2*(Q + (629*k)/496 + 53/496)*R - 93*(-1 + B)^3*(k + 1))*exp(-R*(x^2 - 2*x + 9)/(-4 + 4*B)) + (-(((-2*Q + 3)*R + (k + 1)*(-1 + B))*R^2*x^8)/16 + (((-2*Q + 3)*R + (k + 1)*(-1 + B))*R^2*x^7)/4 - (3*R*((-(26*Q)/3 + (3*k)/2 + 25)*R^2 - 2*(Q - (8*k)/3 - 23/3)*(-1 + B)*R + (-1 + B)^2*(k + 1))*x^6)/8 + (((-13*Q + (9*k)/2 + 75/2)*R^2 - 2*(-1 + B)*(Q - (19*k)/4 - 43/4)*R + (-1 + B)^2*(k + 1))*R*x^5)/2 + ((-1455/16 - (27*k)/2 + (113*Q)/2)*R^3 + 121*(Q - (167*k)/121 - 25/11)*(-1 + B)*R^2/4 - 2*(-1 + B)^2*(Q + (145*k)/16 + 49/16)*R + (-1 + B)^3*(k + 1))*x^4 + ((66 + (99*k)/4 - (31*Q)/2)*R^3 + 6*(-1 + B)*(Q + (133*k)/24 + 37/24)*R^2 + 4*(-1 + B)^2*(Q + (3*k)/4 - 21/4)*R - 2*(-1 + B)^3*(k + 1))*x^3 + ((-1029/4 - (1125*k)/16 + (683*Q)/4)*R^3 + 29*(-1 + B)*(Q - (727*k)/29 - 478/29)*R^2/4 - 76*(Q + (293*k)/608 - 763/608)*(-1 + B)^2*R + 38*(-1 + B)^3*(k + 1))*x^2 + ((63 + (81*k)/2 + (45*Q)/2)*R^3 + 55*(Q + (27*k)/44 - 153/220)*(-1 + B)*R^2 + 20*(-1 + B)^2*(Q - (31*k)/40 - 127/40)*R - 10*(-1 + B)^3*(k + 1))*x + (-891/4 - (729*k)/8 + (747*Q)/8)*R^3 - 777*(Q + (1005*k)/1036 - 75/1036)*(-1 + B)*R^2/4 - 186*(-1 + B)^2*(Q - (115*k)/496 - 691/496)*R + 93*(-1 + B)^3*(k + 1))*exp(-R*(x^2 - 2*x + 21)/(-4 + 4*B)) + ((((-2*Q - 3*k)*R + (k + 1)*(-1 + B))*R^2*x^8)/16 - (((-2*Q - 3*k)*R + (k + 1)*(-1 + B))*R^2*x^7)/4 - 3*(((26*Q)/3 + 25*k + 3/2)*R^2 - 2*(-1 + B)*(Q + (23*k)/3 + 8/3)*R + (-1 + B)^2*(k + 1))*R*x^6/8 + R*((13*Q + (75*k)/2 + 9/2)*R^2 - 2*(-1 + B)*(Q + (43*k)/4 + 19/4)*R + (-1 + B)^2*(k + 1))*x^5/2 + ((-27/2 - (1455*k)/16 - (113*Q)/2)*R^3 + 121*(-1 + B)*(Q + (25*k)/11 + 167/121)*R^2/4 + 2*(-1 + B)^2*(Q - (49*k)/16 - 145/16)*R - (-1 + B)^3*(k + 1))*x^4 + ((99/4 + 66*k + (31*Q)/2)*R^3 + 6*(-1 + B)*(Q - (37*k)/24 - 133/24)*R^2 - 4*(-1 + B)^2*(Q + (21*k)/4 - 3/4)*R + 2*(-1 + B)^3*(k + 1))*x^3 + ((-1125/16 - (1029*k)/4 - (683*Q)/4)*R^3 + 29*(-1 + B)*(Q + (478*k)/29 + 727/29)*R^2/4 + 76*(-1 + B)^2*(Q + (763*k)/608 - 293/608)*R - 38*(-1 + B)^3*(k + 1))*x^2 + ((81/2 + 63*k - (45*Q)/2)*R^3 + 55*(-1 + B)*(Q + (153*k)/220 - 27/44)*R^2 - 20*(-1 + B)^2*(Q + (127*k)/40 + 31/40)*R + 10*(-1 + B)^3*(k + 1))*x + (-729/8 - (891*k)/4 - (747*Q)/8)*R^3 - 777*(-1 + B)*(Q + (75*k)/1036 - 1005/1036)*R^2/4 + 186*(-1 + B)^2*(Q + (691*k)/496 + 115/496)*R - 93*(-1 + B)^3*(k + 1))*exp(-R*(x^2 + 2)/(-1 + B)) + (-(((-2*Q + 3)*R + (k + 1)*(-1 + B))*R^2*x^8)/16 + (((-2*Q + 3)*R + (k + 1)*(-1 + B))*R^2*x^7)/4 + (3*R*(((26*Q)/3 - 12*k - 29/2)*R^2 - 2*(-1 + B)*(Q + (37*k)/6 + 7/6)*R + (-1 + B)^2*(k + 1))*x^6)/8 - (((13*Q - 18*k - 24)*R^2 - 2*(-1 + B)*(Q + (37*k)/4 + 13/4)*R + (-1 + B)^2*(k + 1))*R*x^5)/2 + ((-735/16 - (117*k)/2 - (53*Q)/4)*R^3 - 121*(-1 + B)*(Q + (331*k)/242 - 101/242)*R^2/4 - 2*(-1 + B)^2*(Q - (73*k)/16 - 169/16)*R + (-1 + B)^3*(k + 1))*x^4 + ((219/4 + 36*k - (49*Q)/2)*R^3 - 6*(Q - (217*k)/24 - 97/24)*(-1 + B)*R^2 + 4*(-1 + B)^2*(Q + (15*k)/4 - 9/4)*R - 2*(-1 + B)^3*(k + 1))*x^3 + ((-2361/16 - 180*k - (271*Q)/4)*R^3 - 677*(Q + (1481*k)/1354 - 397/1354)*(-1 + B)*R^2/4 - 76*(-1 + B)^2*(Q - (149*k)/608 - 1205/608)*R + 38*(-1 + B)^3*(k + 1))*x^2 + ((135/2 + 36*k - (117*Q)/2)*R^3 - 19*(-1 + B)*(Q - (357*k)/76 - 213/76)*R^2 + 20*(-1 + B)^2*(Q + (67*k)/40 - 29/40)*R - 10*(-1 + B)^3*(k + 1))*x + (-1215/8 - 162*k - (99*Q)/8)*R^3 - 1023*(Q + (1407*k)/1364 - 105/1364)*(-1 + B)*R^2/4 - 186*(Q - (53*k)/496 - 629/496)*(-1 + B)^2*R + 93*(-1 + B)^3*(k + 1))*exp(-R*(x^2 + 5)/(-1 + B)) + (-(((-2*Q + 3)*R + (k + 1)*(-1 + B))*R^2*x^8)/16 + (((-2*Q + 3)*R + (k + 1)*(-1 + B))*R^2*x^7)/4 + (5*R*(((26*Q)/5 - (81*k)/10 - 39/5)*R^2 - 2*(Q + 4*k - 1/5)*(-1 + B)*R + (-1 + B)^2*(k + 1))*x^6)/8 - (3*R*(((13*Q)/3 - (15*k)/2 - 13/2)*R^2 - 2*(Q + (43*k)/12 - 5/12)*(-1 + B)*R + (-1 + B)^2*(k + 1))*x^5)/2 + ((-519/16 - 72*k - (31*Q)/2)*R^3 - 175*(-1 + B)*(Q + (107*k)/175 - 29/35)*R^2/4 + 2*(-1 + B)^2*(Q + (247*k)/16 + 151/16)*R - (-1 + B)^3*(k + 1))*x^4 + ((30 + (243*k)/4 - (31*Q)/2)*R^3 + 22*(-1 + B)*(Q + (85*k)/88 - 83/88)*R^2 - 4*(Q + (29*k)/4 + 5/4)*(-1 + B)^2*R + 2*(-1 + B)^3*(k + 1))*x^3 + ((-309/4 - (4005*k)/16 - (469*Q)/4)*R^3 - 411*(Q - (161*k)/411 - 662/411)*(-1 + B)*R^2/4 + 76*(-1 + B)^2*(Q + (1203*k)/608 + 147/608)*R - 38*(-1 + B)^3*(k + 1))*x^2 + ((27 + (153*k)/2 + (45*Q)/2)*R^3 + 35*(-1 + B)*(Q - (57*k)/140 - 201/140)*R^2 - 20*(-1 + B)^2*(Q + (107*k)/40 + 11/40)*R + 10*(-1 + B)^3*(k + 1))*x + (-243/4 - (2025*k)/8 - (1557*Q)/8)*R^3 - 33*(-1 + B)*(Q - (915*k)/44 - 1131/44)*R^2/4 + 186*(Q + (443*k)/496 - 133/496)*(-1 + B)^2*R - 93*(-1 + B)^3*(k + 1))*exp(-3*R/(-1 + B)) + (((-2*Q - 3*k)*R + (k + 1)*(-1 + B))*R^2*x^8)/16 - (((-2*Q - 3*k)*R + (k + 1)*(-1 + B))*R^2*x^7)/4 - 5*(((26*Q)/5 + (159*k)/10)*R^2 - 2*(-1 + B)*(Q + (11*k)/2 + 13/10)*R + (-1 + B)^2*(k + 1))*R*x^6/8 + 3*(((13*Q)/3 + 14*k)*R^2 - 2*(Q + (61*k)/12 + 13/12)*(-1 + B)*R + (-1 + B)^2*(k + 1))*R*x^5/2 + ((-(1671*k)/16 - (235*Q)/4)*R^3 + 175*(Q + (191*k)/70 + 47/70)*(-1 + B)*R^2/4 - 2*(-1 + B)^2*(Q + (271*k)/16 + 175/16)*R + (-1 + B)^3*(k + 1))*x^4 + (((363*k)/4 + (49*Q)/2)*R^3 - 22*(-1 + B)*(Q + (433*k)/88 + 49/88)*R^2 + 4*(-1 + B)^2*(Q + (35*k)/4 + 11/4)*R - 2*(-1 + B)^3*(k + 1))*x^3 + ((-(5241*k)/16 - (881*Q)/4)*R^3 + 1059*(-1 + B)*(Q + (4259*k)/2118 + 881/2118)*R^2/4 - 76*(-1 + B)^2*(Q + (2115*k)/608 + 1059/608)*R + 38*(-1 + B)^3*(k + 1))*x^2 + (((207*k)/2 + (117*Q)/2)*R^3 - 71*(-1 + B)*(Q + (693*k)/284 + 117/284)*R^2 + 20*(-1 + B)^2*(Q + (167*k)/40 + 71/40)*R - 10*(-1 + B)^3*(k + 1))*x + (-(2511*k)/8 - (2205*Q)/8)*R^3 + 1833*(-1 + B)*(Q + (3543*k)/2444 + 735/2444)*R^2/4 - 186*(-1 + B)^2*(Q + (1187*k)/496 + 611/496)*R + 93*(-1 + B)^3*(k + 1))*R*(x + 1)/(12*((B + (3*R)/2 - 1)*exp(-3*R/(-1 + B)) - B + (3*R)/2 + 1)*((1/2*R*x^2 + B + R - 1)*exp(-R*(x^2 + 2)/(-1 + B)) + R*x^2/2 - B + R + 1)*(x^2 - 2*x + 9)*(x^2 + 2)*((1/8*R*x^2 - 1/4*R*x + B + 9/8*R - 1)*exp(-R*(x^2 - 2*x + 9)/(-4 + 4*B)) + R*x^2/8 - R*x/4 - B + (9*R)/8 + 1)):

P := simplify(P):
plots:-display([seq(plot(eval(P/1e34, [R = 10, B = 0.5, k = j]), lambda = 0.15 .. 0.22, view=[0.15..0.22, -0.01..0.01]), j = 0.1 .. 1, 0.1)]);
r0 := 0.18:
for j from 0.1 by 0.1 to 1 do
    while true do
          r0 := RootFinding:-NextZero(unapply(eval(P, [R = 10, B = 0.5, k = j]), lambda), r0);
          if   r0 = FAIL
          then break;
          else printf(" k=%3.1f, root=%10.8f\n", j, r0);
          end if;
    end do;
    r0 := 0.18;
    printf("\n");
end do:

 

 k=0.1, root=0.18434835
 k=0.1, root=0.18847502

 k=0.2, root=0.18434835
 k=0.2, root=0.18847502

 k=0.3, root=0.18434835
 k=0.3, root=0.18847502

 k=0.4, root=0.18434835
 k=0.4, root=0.18847502

 k=0.5, root=0.18434835
 k=0.5, root=0.18847502

 k=0.6, root=0.18434835
 k=0.6, root=0.18847502
 k=0.6, root=0.19815995

 k=0.7, root=0.18434835
 k=0.7, root=0.18847502

 k=0.8, root=0.18434835
 k=0.8, root=0.18847502

 k=0.9, root=0.18353613

 k=1.0, root=0.18434835
 k=1.0, root=0.18847502
 

 

``

Download kAndRoots2.mw

 

I think I'd declare 't' as global in the procedures - even although using globals "offends" me.

See the attached

  restart;

  A := Matrix([[2*t, 2, 3], [4, 5*t, 6], [7, 8*t, 9]]);
  B := Matrix([t, 2*t, 3*t])^%T;
  test1:=proc(n)
              local tau, s,M,V;
              global t;
              s:=1:
              for t from 1 to n do
                  M:=A+A^(-1);
                  V[s]:=(M.B):
                  s:=s+1:
              end do;
              V;
         end proc:

test2:=proc(n)
              local s,M,V;
              global t;
              s:=1:
              for t from 1 to n do
                  M:=A+A^(-1);
                  V[s]:=(M.B):
                  s:=s+1:
              end do;
              eval(V);
         end proc:

Matrix(3, 3, {(1, 1) = 2*t, (1, 2) = 2, (1, 3) = 3, (2, 1) = 4, (2, 2) = 5*t, (2, 3) = 6, (3, 1) = 7, (3, 2) = 8*t, (3, 3) = 9})

 

Matrix(%id = 36893488148094607476)

(1)

  R:=test1(4);
  R[1];

R := V

 

Matrix(%id = 36893488148094609996)

(2)

  R:=test2(4);

table(%id = 36893488148136360732)

(3)

 

Download procref2.mw

@AHSAN 

is, but I have absolutely no idea how you are associating this quantity with a Maple plot. The Maple plotting process is approximately as follows

  1. The function to be plotted is evaluated at a number of points. By defaults this is 200 points per curve, although the plotting algorithm is adaptive, so if there are "rapid changes" in the curve to be plotted, it is not unusual to see a few more. In the attached, on default settings, Maple generates 231 points per curve. You can see these "fixed points" if you use the style=point option. These points will correspond to specific pixels on your display
  2. Maple uses interpolation (probably cubic spline although I have to admit I don't actually know) to generate data between these fixed points. This turns on appropriate pixels between those of the fixed points mentioned above.
  3. Thus the DPI is always set by your screen resolution
  4. About the only thing you can change is the number of fixed points which Maple uses, via the numpoints option. This usually only makes much difference when there are "rapid changes" in one or more of the curves. In the attached I have produced two plots, one with numpoints on default and one with numpoints=2500. I don't really see much difference in "quality"
  5. My personal preference is not to use both colors and linestyles in a plot -one or othe, but not both. So I would prefer the third plot in the attached

(FYI plots render very differentlly on this site and in a Maple worksheet, so don't base much on what is shown below, download and rerun the worksheet)


 

restart

A := 3*We^2*(-27*beta*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)^3/(2*(1+(1/2)*x^2)^4)-15*beta*k^2*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(2*(1+(1/2)*x^2)^2)-15*beta*k*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(1+(1/2)*x^2)^2-15*beta*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(2*(1+(1/2)*x^2)^2)-20*lambda)/(20*(1+(1/2)*x^2)^3)-(3*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2))/(2*(1+(1/2)*x^2)^3)

(3/20)*We^2*(-(27/2)*beta*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)^3/(1+(1/2)*x^2)^4-(15/2)*beta*k^2*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(1+(1/2)*x^2)^2-15*beta*k*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(1+(1/2)*x^2)^2-(15/2)*beta*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(1+(1/2)*x^2)^2-20*lambda)/(1+(1/2)*x^2)^3-(3/2)*(k*(1+(1/2)*x^2)+2*Q-1-(1/2)*x^2)/(1+(1/2)*x^2)^3

(1)

p1 := plot([eval(A, [We = .1, beta = .2, Q = .5516, lambda = -0.41e-2, k = .1]), eval(A, [We = .1, beta = .2, Q = .4290, lambda = -0.45e-2, k = .3]), eval(A, [We = .1, beta = .2, Q = .3064, lambda = -0.42e-2, k = .5]), eval(A, [We = .1, beta = .2, Q = .1838, lambda = -0.32e-2, k = .7]), eval(A, [We = .1, beta = .2, Q = 0.612e-1, lambda = -0.13e-2, k = .9])], x = -8 .. 8, axes = boxed, labeldirections = ["horizontal", "horizontal"], colour = [black, red, blue, green, purple], style = [line], thickness = 2, linestyle = [solid, longdash, spacedash, dash, dashdot], legend = ["k= 0.1, λ= 0.5515", "k= 0.3, λ = 0.4289", "k = 0.5, λ = 0.3036", "k= 0.7, λ = 0.1837", "k= 0.9, λ = 0.0611"], legendstyle = [location = bottom, font = ["TIMES", "italic", 12]], size = 300*[3, 2]); op([1, 1], plottools:-getdata(p1)[1, 3]); p2 := plot([eval(A, [We = .1, beta = .2, Q = .5516, lambda = -0.41e-2, k = .1]), eval(A, [We = .1, beta = .2, Q = .4290, lambda = -0.45e-2, k = .3]), eval(A, [We = .1, beta = .2, Q = .3064, lambda = -0.42e-2, k = .5]), eval(A, [We = .1, beta = .2, Q = .1838, lambda = -0.32e-2, k = .7]), eval(A, [We = .1, beta = .2, Q = 0.612e-1, lambda = -0.13e-2, k = .9])], x = -8 .. 8, axes = boxed, labeldirections = ["horizontal", "horizontal"], colour = [black, red, blue, green, purple], style = [line], thickness = 2, linestyle = [solid, longdash, spacedash, dash, dashdot], legend = ["k= 0.1, λ= 0.5515", "k= 0.3, λ = 0.4289", "k = 0.5, λ = 0.3036", "k= 0.7, λ = 0.1837", "k= 0.9, λ = 0.0611"], legendstyle = [location = bottom, font = ["TIMES", "italic", 12]], size = 300*[3, 2], numpoints = 2000); op([1, 1], plottools:-getdata(p2)[1, 3]); p2 := plot([eval(A, [We = .1, beta = .2, Q = .5516, lambda = -0.41e-2, k = .1]), eval(A, [We = .1, beta = .2, Q = .4290, lambda = -0.45e-2, k = .3]), eval(A, [We = .1, beta = .2, Q = .3064, lambda = -0.42e-2, k = .5]), eval(A, [We = .1, beta = .2, Q = .1838, lambda = -0.32e-2, k = .7]), eval(A, [We = .1, beta = .2, Q = 0.612e-1, lambda = -0.13e-2, k = .9])], x = -8 .. 8, axes = boxed, labeldirections = ["horizontal", "horizontal"], colour = [black, red, blue, green, purple], style = [line], legend = ["k= 0.1, λ= 0.5515", "k= 0.3, λ = 0.4289", "k = 0.5, λ = 0.3036", "k= 0.7, λ = 0.1837", "k= 0.9, λ = 0.0611"], legendstyle = [location = bottom, font = ["TIMES", "italic", 12]], size = 300*[3, 2], numpoints = 2000); op([1, 1], plottools:-getdata(p2)[1, 3])

 

231

 

 

2000

 

 

2000

(2)

``

NULL


 

Download plotQual.mw

@nm 

in order to post a question, you have to be logged in to your Mapleprimes account. Maybe you inadvertently "logged out" somehow?

@acer 

Did pretty much the same as Acer

@C_R 

Most command will "evaluate". However when using cat(), Maple assumes that you want to create a new name (or whatever), not to evaluate that name.

@Carl Love 

original worksheet implements (more-or-less) Euclid's formal for generating Pythagorean triples - see here

https://en.wikipedia.org/wiki/Pythagorean_triple

So I have assumed this objective in the asnswer I supplied earlier

thsi procedure will do is to return the last value of the local variable 'w' which is calculated. And this is what is returned!! - so waht exactly is the problem?? See the attached.

BTW you should probably get into the habit of uploading your worksheets using the big green up-arrow in the MAleprimes toolbar. It makes life easier for responders

restart:

doCalc:= proc( xi )

                 # Import Packages
                 uses ArrayTools, Student:-Calculus1, LinearAlgebra,
                      ListTools, RootFinding, plots, ListTools:
                 local gamma__1:= .1093,
                       alpha__3:= -0.1104e-2,
                       k__1:= 6*10^(-12),
                       d:= 0.2e-3,
                       theta0:= 0.0001,
                       eta__1:= 0.240e-1,
                       alpha:= 1-alpha__3^2/(gamma__1*eta__1),
                       c:= alpha__3*xi*alpha/(eta__1*(4*k__1*q^2/d^2-alpha__3*xi/eta__1)),
                       theta_init:= theta0*sin(Pi*z/d),
                       n:= 30,
                       g, f, b1, b2, qstar, OddAsymptotes, ModifiedOddAsym,
                       qstarTemporary, indexOfqstar2, qstar2, AreThereComplexRoots,
                       soln1, soln2, qcomplex1, qcomplex2, gg, qq, m, pp, j, i,
                       AllAsymptotes, w, Efun, b, aa, F, A, B, Ainv, r, theta_sol, v, Vfun, v_sol,minp,nstar,
                       soln3, soln4, Imagroot1, Imagroot2;

# Assign g for q and plot g, Set q as a complex and Compute the Special Asymptotes

                       qq := [2.106333379+.6286420119*I, 2.106333379-.6286420119*I, 4.654463885, 7.843624703, 10.99193295,14.13546782, 17.27782732, 20.41978346, 23.56157073, 26.70327712, 29.84494078, 32.98658013,         36.12820481, 39.26982019, 42.41142944, 45.55303453, 48.69463669, 51.83623675, 54.97783528,                     58.11943264, 61.26102914, 64.40262495, 67.54422024, 70.68581510, 73.82740963,                                 76.96900389, 80.11059792, 83.25219177, 86.39378546, 89.53537903, 92.67697249];
                        m:= 30:

                        for i from 1 to m do
                        w := gamma__1*alpha/(4*k__1*qq[i]^2/d^2-alpha__3*xi/eta__1);
                        end do;

## Return all the plots
  return w;
  end proc:

ans:=[doCalc(0.06)];
ans[1];

[0.2270014307e-1]

 

0.2270014307e-1

(1)

 

Download oddProc.mw

@JAMET 

in the geometry() package is for rotating geometric objects created by commands within the geometry package. The object you want to rotate, ie 'pol1' is not a geometric object, it is a plot created by the plots:-polygonplot() command. If you want to rotate a plot then the appropriate command is plottools:-rotate().

I have added the lines
 

  pol2:= plottools:-rotate(pol1, 5*Pi/3, coordinates(o)):
  display( [pol1, pol2] );

in the attached.


 

  restart:
  with(plots): with(geometry):
  _EnvHorizontalName := 'x':
  _EnvVerticalName := 'y':
  a := 7:
  point(E, 0, a*sqrt(3)/2):
  point(B, -a/2, 0):
  point(C, a/2, 0):
  point(o, 0, a*sqrt(3)/6):
  point(A, 0, a/2):
  point(H, 0, 0):
  R := (3-sqrt(3))*sqrt(2)*a/12:
  point(J, 0, a*sqrt(3)/6 - R):
  line(L1, -(7*x*sqrt(3))/6 + (7*y)/2 - (49*sqrt(3))/12 = 0):
  reflection(J1, J, L1):
  coordJ1:=coordinates(J1):
  
  line(L2, -(7*x*sqrt(3))/6 - (7*y)/2 + (49*sqrt(3))/12 = 0):
  reflection(J2, J, L2):coordJ2:=coordinates(J2):
  triangle(Tr1, [E, B, C]):
  triangle(Tr2, [A, B, C]):
  StretchRotation(E1, E, B, Pi/4, clockwise, sqrt(2)/2):
  coordinates(E1):
  StretchRotation(E2, E, C, Pi/4, counterclockwise, sqrt(2)/2):
  coordinates(E2):
  triangle(Tr3, [E, B, E1]):
  triangle(Tr4, [E, C, E2]):
  triangle(Tr5, [B, C, J]):
  circle(cir, [point(P1,[0,a*sqrt(3)/6]), R]):
  poly1 := Matrix( [ [0, a*sqrt(3)/2],
                     coordJ1,
                    [0, a/2],
                    coordJ2
                  ],
                  datatype = float
                ):
  pol1 := polygonplot(poly1, colour = green, transparency = 0.7, gridlines):
  pol2:= plottools:-rotate(pol1, 5*Pi/3, coordinates(o)):
  display( [pol1, pol2] );
(*  poly2 := Matrix([ coordinates(J),coordinates(E1), coordJ2,|-a/2,0]],
                  datatype = float
                ):
    pol2 := polygonplot(poly2, colour = green, transparency = 0.7, gridlines):
*)
  tex := textplot([[0, a*sqrt(3)/2, "E"],[0,a*sqrt(3)/6 - R,"J"],
                    [-7/4 + (7*sqrt(3))/4, -7/4 + (7*sqrt(3))/4,"E1"],
                    [7/4 - (7*sqrt(3))/4, -7/4 + (7*sqrt(3))/4,"E2"],
                    [-7/4 + (((7*sqrt(3))/6 - 7*(3 - sqrt(3))*sqrt(2)/12)*sqrt(3))/2,
                    (7*sqrt(3))/6 + 7*(3 - sqrt(3))*   sqrt(2)/24,"J1"],
                    [7/4 - (((7*sqrt(3))/6 - 7*(3 - sqrt(3))*sqrt(2)/12)*sqrt(3))/2,
                    (7*sqrt(3))/6 + 7*(3 - sqrt(3))*   sqrt(2)/24,"J2"]], 'align' = {'above', 'right'}):
  display( [ draw( [ Tr1(color = cyan),
                     Tr3(color = green),
                     cir(color=blue),
                     Tr2(color = red),
                     Tr4(color = grey),
                     Tr1(color=blue)],'view' = [-5 .. 5, 0 .. 7
                   ],
                   axes = normal,
                   scaling = constrained,
                   size=[800,800]
                   ),
            tex
           ]
          );
  line(L1, [B, o]):
  Equation(L1):
  line(L1, -(7*x*sqrt(3))/6 + (7*y)/2 - (49*sqrt(3))/12 = 0):
  reflection(J1, J, L1):coordinates(J1):
  triangle(Tr6, [B, J1, E]):
  line(L2, [C, o]):
  Equation(L2):
  line(L2, -(7*x*sqrt(3))/6 - (7*y)/2 + (49*sqrt(3))/12 = 0):
  reflection(J2, J, L2):coordinates(J2):
  triangle(Tr7, [C, J2, E]):
  triangle(T1, [E, J1, A]):
  triangle(T2, [E, C, E2]):
  triangle(T3, [B, H, J]):
  triangle(T4, [C, H, J]):

  display( [ draw( [ cir(color = orange, filled = true, transparency = 0.1),
                     Tr6(color = blue, filled = true, transparency = 0.2),
                     Tr5(color = blue, filled = true, transparency = 0.2),
                     Tr7(color = blue, filled = true, transparency = 0.2)
                     
                   ],
                   axes = none,
                   scaling = constrained
                 ),
             pol1
           ]
         );

 

 

 

 

 

[0, (7/6)*3^(1/2)]

(1)

 

Download geomDraw5.mw

@JAMET 

for a single command, as here

 #poly2 := Matrix([ coordinates(J),coordinates(E1), coordJ2,|-a/2,0]],
                  datatype = float
                ):
  #pol2 := polygonplot(poly2, colour = green, transparency = 0.7, gridlines):

then you have to comment them all out, as in

 #poly2 := Matrix([ coordinates(J),coordinates(E1), coordJ2,|-a/2,0]],
 #                  datatype = float
 #                ):
 #pol2 := polygonplot(poly2, colour = green, transparency = 0.7, gridlines):

or use the multiline comment constuction (*..*) as here

(* poly2 := Matrix([ coordinates(J),coordinates(E1), coordJ2,|-a/2,0]],
                   datatype = float
                 ):
   pol2 := polygonplot(poly2, colour = green, transparency = 0.7, gridlines):
*)

The multiline comment construction is particularly useful for isolating simple syntax errors, when execution groups contain multiple lines of code. Note that it can only be invoked if you are using 1-D Maple input. If you are using 2D input with multiline commands then you need the '#' character as the first character in every line, like the second example above.

The attached fixes your code with the multiline comment character method

  restart:
  with(plots): with(geometry):
  _EnvHorizontalName := 'x':
  _EnvVerticalName := 'y':
  a := 7:
  point(E, 0, a*sqrt(3)/2):
  point(B, -a/2, 0):
  point(C, a/2, 0):
  point(o, 0, a*sqrt(3)/6):
  point(A, 0, a/2):
  point(H, 0, 0):
  R := (3-sqrt(3))*sqrt(2)*a/12:
  point(J, 0, a*sqrt(3)/6 - R):
  line(L1, -(7*x*sqrt(3))/6 + (7*y)/2 - (49*sqrt(3))/12 = 0):
  reflection(J1, J, L1):
  coordJ1:=coordinates(J1):
  
  line(L2, -(7*x*sqrt(3))/6 - (7*y)/2 + (49*sqrt(3))/12 = 0):
  reflection(J2, J, L2):coordJ2:=coordinates(J2):
  triangle(Tr1, [E, B, C]):
  triangle(Tr2, [A, B, C]):
  StretchRotation(E1, E, B, Pi/4, clockwise, sqrt(2)/2):
  coordinates(E1):
  StretchRotation(E2, E, C, Pi/4, counterclockwise, sqrt(2)/2):
  coordinates(E2):
  triangle(Tr3, [E, B, E1]):
  triangle(Tr4, [E, C, E2]):
  triangle(Tr5, [B, C, J]):
  circle(cir, [point(P1,[0,a*sqrt(3)/6]), R]):
  poly1 := Matrix( [ [0, a*sqrt(3)/2],
                     coordJ1,
                    [0, a/2],
                    coordJ2
                  ],
                  datatype = float
                ):
  pol1 := polygonplot(poly1, colour = green, transparency = 0.7, gridlines):
(*  poly2 := Matrix([ coordinates(J),coordinates(E1), coordJ2,|-a/2,0]],
                  datatype = float
                ):
    pol2 := polygonplot(poly2, colour = green, transparency = 0.7, gridlines):
*)
  tex := textplot([[0, a*sqrt(3)/2, "E"],[0,a*sqrt(3)/6 - R,"J"],
                    [-7/4 + (7*sqrt(3))/4, -7/4 + (7*sqrt(3))/4,"E1"],
                    [7/4 - (7*sqrt(3))/4, -7/4 + (7*sqrt(3))/4,"E2"],
                    [-7/4 + (((7*sqrt(3))/6 - 7*(3 - sqrt(3))*sqrt(2)/12)*sqrt(3))/2,
                    (7*sqrt(3))/6 + 7*(3 - sqrt(3))*   sqrt(2)/24,"J1"],
                    [7/4 - (((7*sqrt(3))/6 - 7*(3 - sqrt(3))*sqrt(2)/12)*sqrt(3))/2,
                    (7*sqrt(3))/6 + 7*(3 - sqrt(3))*   sqrt(2)/24,"J2"]], 'align' = {'above', 'right'}):
  display( [ draw( [ Tr1(color = cyan),
                     Tr3(color = green),
                     cir(color=blue),
                     Tr2(color = red),
                     Tr4(color = grey),
                     Tr1(color=blue)],'view' = [-5 .. 5, 0 .. 7
                   ],
                   axes = normal,
                   scaling = constrained,
                   size=[800,800]
                   ),
            tex
           ]
          );
  line(L1, [B, o]):
  Equation(L1):
  line(L1, -(7*x*sqrt(3))/6 + (7*y)/2 - (49*sqrt(3))/12 = 0):
  reflection(J1, J, L1):coordinates(J1):
  triangle(Tr6, [B, J1, E]):
  line(L2, [C, o]):
  Equation(L2):
  line(L2, -(7*x*sqrt(3))/6 - (7*y)/2 + (49*sqrt(3))/12 = 0):
  reflection(J2, J, L2):coordinates(J2):
  triangle(Tr7, [C, J2, E]):
  triangle(T1, [E, J1, A]):
  triangle(T2, [E, C, E2]):
  triangle(T3, [B, H, J]):
  triangle(T4, [C, H, J]):

  display( [ draw( [ cir(color = orange, filled = true, transparency = 0.1),
                     Tr6(color = blue, filled = true, transparency = 0.2),
                     Tr5(color = blue, filled = true, transparency = 0.2),
                     Tr7(color = blue, filled = true, transparency = 0.2)
                     
                   ],
                   axes = none,
                   scaling = constrained
                 ),
             pol1
           ]
         );

 

 

 

Download geomDraw4.mw

 

 

@FDS 

does not seem to do anything "vectorial", and you only seem to require one-dimensional data containers. I'd probably go for the simplest in Maple, which would be lists of values. You can then perform the necessary calculations using seq() commands, or use the elementwise approach suggested by Carl Love - both will work.

If you only have one combination of lists to deal with then it probably doesn't matter which of these approaches you choose. If you are planning on doing the same cacluation multiple times in the saem worksheet with different inputs, then obviously it is better to use the elementwise procedure approach - it will save typing.

The attached shows everything converted to lists, along with my original suggestion using seq() commands, and Carl's approach using a procedure which is applied elementwise, Obviouosly they give the same answer

  restart:
  N := 2.7:
#
# Data as lists
#
  Hb := [0.076, 0.083]:
  k := [0.00003400566801, 0.00003424620533]:
  P50a := [20.78938475, 21.39546041]:
  P50v := [21.20711722, 22.06793197]:
  nu := [0.02042461957, 0.02120393111]:
  Df := [0.00001617321837, 0.00001607066092]:
  P__baro := [759.062, 759.062]:
  PaCor := [94.82734101, 90.40928915]:
  PvCor := [35.32630403, 35.55779803]:
 

#
# My original calculation, using seq() commands to
# step through lists
#
  f := [ seq( 1.34*N*Hb[j]*(p/((P50a[j] + P50v[j])/2))^(N - 1)/((P50a[j] + P50v[j])/2*k[j]*(1 + (p/((P50a[j] + P50v[j])/2))^N)^2),
              j = 1 .. 2
            )
       ]:
  result := [seq( Por*phi*(nu[j]/Df[j])^(2/3)*int( (1 + f[j])^(2/3)/(P__baro[j] - p),
                                                    p = PvCor[j] .. PaCor[j]
                                                 )/(4*(1 - Por)*BP__length),
                  j = 1 .. 2
                )
            ];

[10.73322004*Por*phi/((1-Por)*BP__length), 11.59819487*Por*phi/((1-Por)*BP__length)]

(1)

#
# Carl Love's code - define a procedure for the calculation and
# apply it elementwise (works for lists as well as vectors)
#
  MyProc:= proc(N, Hb, k, P50a, P50v, nu, Df, P__baro, PaCor, PvCor)
                local p, P:= (2*p/(P50a+P50v))^N;
                Por*phi/4/(1-Por)/BP__length*(nu/Df)^(2/3) * int( (1+1.34*Hb*N*P/k/p/(1+P)^2)^(2/3)/(P__baro - p),
                                                                   p= PvCor..PaCor
                                                                )
           end proc:
  MyProc~(N, Hb, k, P50a, P50v, nu, Df, P__baro, PaCor, PvCor);

[10.73322003*Por*phi/((1-Por)*BP__length), 11.59819488*Por*phi/((1-Por)*BP__length)]

(2)

 

Download oddCode2.mw

 

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