tomleslie

13876 Reputation

20 Badges

15 years, 175 days

MaplePrimes Activity


These are answers submitted by tomleslie

as in your previous queestion

Try the following


 

restart;
r:=Record('a','b');
foo2:=proc(p)
           p:-b:=5;
           return(eval(p));
      end proc;
r:-b:=99;
print(r);
r:=foo2(r):
print(r);

Record(a = (In linePrint: not ready for GarbageDagFactory), b = (In linePrint: not ready for GarbageDagFactory))

 

proc (p) p:-b := 5; return eval(p) end proc

 

99

 

r

 

r

(1)

 


 

Download recProb.mw

I fixed the loop so that it generates a sequence of plots which are then displayed as an animation. The 'line' moves around a bit, but the curve doesn't change (much).

See the attached


 

  restart:
  with(plots):
  with(plottools):
  print(`Parametric ball - plot: no animation - no air resistance`);
  alfa:=Pi/6:
  Htmax:=40:g:=9.81:
  V:=(sqrt(2*g^3*Htmax/(2*g^2-1)))/sin(alfa):
  tmax:=V*sin(alfa)/g: plot([2*t,V*t-0.5*g*t^2, t=0..ceil(2*V/g)]);
  print(`Parametric ball - plot: no animation - with air resistance`);
  k:=.8:
  printf("Drag factor k=%5.3f\n",k);
  plot([Htmax*exp(k*(V/g-t)),V*t-0.5*g*t^2, t=0..ceil(2*V/g)]);

`Parametric ball - plot: no animation - no air resistance`

`Parametric ball - plot: no animation - with air resistance`

Drag factor k=0.800

 

allPlots:=NULL:
for i from 1 to 8 do # NB i=0 throws a warning
                     # because then k=0, and terms
                     # such as V/k in the specification
                     # of p1 become infinite
    k:=0.01*i:
    ranj:=Htmax*exp(k*V*sin(alfa)/g):
    t_end:=ceil(2*V*sin(alfa)/g):
    pl:=plot([V/k*cos(alfa)*sin(k*t),V*sin(alfa)*t-0.5*g*t^2, t=0..t_end]):
    pline:=line([ranj, Htmax/3],[ranj,0]):
  #
  # Combine p1 and pline into a single plot
  # and add this  to the sequence of plots
  # generated by this loop
  #
    allPlots:=allPlots, plots[display](pl, pline):
end do:
#
# Display all the plts generated by the loop
# as an animation
#
  plots[display]([allPlots], insequence=true);

 

 

 


 

Download plotProb.mws

Based on the picture you have provided, it looks as if your data is contained in an Excel spreadsheet. (I might be wrong!).

If the data is in Excel, you can import it into a Maple matrix using the ExcelTools:-Import() command, as in

M:=ExcelTools:-Import(fileName, sheetName, cellRange);

As 'nm' has stated, onve you have the data in the form of a Maple matrix, there are many ways to 'loop' over it using 'for' or possibly 'seq()'. The optimal choice depends on what kind of calculation you want to do, and how you want the output stored

 

on the nature of the first argument, there is an 'overlap' between the two commands. One (probably a bit sloppy) way to distinguish them is that is() tries to determine whether all possible values of the first argument have the property given by the second argument: on the other hand type() just checks that the 'type' of the first argument corresponds to the second argument.

Consider

restart;
assume(x::real);
is(x^2, nonnegative);
type(x^2, nonnegative);

The is() command returns true, because all possible values of the argument 'x^2' are non-negative.However the type command returns false, because the argument 'x^2' is of type '^': values of the argument are not relevant

Maple has two methods for plotting 'arrows'; plots:-arrow and plottools:-arrow.

Interpretation of parameters for these is subtly different. No way I can tell how you want the 'arrows' to appear, but the attached shows an alternative where the 'length' of the arrows is determined by the two points provided

restart

with(plots)

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(1)

with(plottools)

[annulus, arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse, ellipticArc, exportplot, extrude, getdata, hemisphere, hexahedron, homothety, hyperbola, icosahedron, importplot, line, octahedron, parallelepiped, pieslice, point, polygon, prism, project, rectangle, reflect, rotate, scale, sector, semitorus, sphere, stellate, tetrahedron, torus, transform, translate]

(2)

M := Matrix(60, 3, {(1, 1) = Vector(2, {(1) = -3, (2) = 5}), (1, 2) = Vector(2, {(1) = -2, (2) = -2}), (1, 3) = Vector(2, {(1) = 0, (2) = 0}), (2, 1) = Vector(2, {(1) = -5, (2) = 3}), (2, 2) = Vector(2, {(1) = -1, (2) = -3}), (2, 3) = Vector(2, {(1) = 1, (2) = -1}), (3, 1) = Vector(2, {(1) = -6, (2) = 0}), (3, 2) = Vector(2, {(1) = 0, (2) = -3}), (3, 3) = Vector(2, {(1) = 1, (2) = 0}), (4, 1) = Vector(2, {(1) = -6, (2) = -3}), (4, 2) = Vector(2, {(1) = 1, (2) = -2}), (4, 3) = Vector(2, {(1) = 1, (2) = 1}), (5, 1) = Vector(2, {(1) = -5, (2) = -5}), (5, 2) = Vector(2, {(1) = 2, (2) = -1}), (5, 3) = Vector(2, {(1) = 1, (2) = 1}), (6, 1) = Vector(2, {(1) = -3, (2) = -6}), (6, 2) = Vector(2, {(1) = 3, (2) = 0}), (6, 3) = Vector(2, {(1) = 1, (2) = 1}), (7, 1) = Vector(2, {(1) = 0, (2) = -6}), (7, 2) = Vector(2, {(1) = 3, (2) = 1}), (7, 3) = Vector(2, {(1) = 0, (2) = 1}), (8, 1) = Vector(2, {(1) = 3, (2) = -5}), (8, 2) = Vector(2, {(1) = 2, (2) = 2}), (8, 3) = Vector(2, {(1) = -1, (2) = 1}), (9, 1) = Vector(2, {(1) = 5, (2) = -3}), (9, 2) = Vector(2, {(1) = 1, (2) = 3}), (9, 3) = Vector(2, {(1) = -1, (2) = 1}), (10, 1) = Vector(2, {(1) = 6, (2) = 0}), (10, 2) = Vector(2, {(1) = 0, (2) = 3}), (10, 3) = Vector(2, {(1) = -1, (2) = 0}), (11, 1) = Vector(2, {(1) = 6, (2) = 3}), (11, 2) = Vector(2, {(1) = -1, (2) = 2}), (11, 3) = Vector(2, {(1) = -1, (2) = -1}), (12, 1) = Vector(2, {(1) = 5, (2) = 5}), (12, 2) = Vector(2, {(1) = -2, (2) = 1}), (12, 3) = Vector(2, {(1) = -1, (2) = -1}), (13, 1) = Vector(2, {(1) = 3, (2) = 6}), (13, 2) = Vector(2, {(1) = -3, (2) = 0}), (13, 3) = Vector(2, {(1) = -1, (2) = -1}), (14, 1) = Vector(2, {(1) = 0, (2) = 6}), (14, 2) = Vector(2, {(1) = -3, (2) = -1}), (14, 3) = Vector(2, {(1) = 0, (2) = -1}), (15, 1) = Vector(2, {(1) = -3, (2) = 5}), (15, 2) = Vector(2, {(1) = -2, (2) = -2}), (15, 3) = Vector(2, {(1) = 1, (2) = -1}), (16, 1) = Vector(2, {(1) = -5, (2) = 3}), (16, 2) = Vector(2, {(1) = -1, (2) = -3}), (16, 3) = Vector(2, {(1) = 1, (2) = -1}), (17, 1) = Vector(2, {(1) = -6, (2) = 0}), (17, 2) = Vector(2, {(1) = 0, (2) = -3}), (17, 3) = Vector(2, {(1) = 1, (2) = 0}), (18, 1) = Vector(2, {(1) = -6, (2) = -3}), (18, 2) = Vector(2, {(1) = 1, (2) = -2}), (18, 3) = Vector(2, {(1) = 1, (2) = 1}), (19, 1) = Vector(2, {(1) = -5, (2) = -5}), (19, 2) = Vector(2, {(1) = 2, (2) = -1}), (19, 3) = Vector(2, {(1) = 1, (2) = 1}), (20, 1) = Vector(2, {(1) = -3, (2) = -6}), (20, 2) = Vector(2, {(1) = 3, (2) = 0}), (20, 3) = Vector(2, {(1) = 1, (2) = 1}), (21, 1) = Vector(2, {(1) = 0, (2) = -6}), (21, 2) = Vector(2, {(1) = 3, (2) = 1}), (21, 3) = Vector(2, {(1) = 0, (2) = 1}), (22, 1) = Vector(2, {(1) = 3, (2) = -5}), (22, 2) = Vector(2, {(1) = 2, (2) = 2}), (22, 3) = Vector(2, {(1) = -1, (2) = 1}), (23, 1) = Vector(2, {(1) = 5, (2) = -3}), (23, 2) = Vector(2, {(1) = 1, (2) = 3}), (23, 3) = Vector(2, {(1) = -1, (2) = 1}), (24, 1) = Vector(2, {(1) = 6, (2) = 0}), (24, 2) = Vector(2, {(1) = 0, (2) = 3}), (24, 3) = Vector(2, {(1) = -1, (2) = 0}), (25, 1) = Vector(2, {(1) = 6, (2) = 3}), (25, 2) = Vector(2, {(1) = -1, (2) = 2}), (25, 3) = Vector(2, {(1) = -1, (2) = -1}), (26, 1) = Vector(2, {(1) = 5, (2) = 5}), (26, 2) = Vector(2, {(1) = -2, (2) = 1}), (26, 3) = Vector(2, {(1) = -1, (2) = -1}), (27, 1) = Vector(2, {(1) = 3, (2) = 6}), (27, 2) = Vector(2, {(1) = -3, (2) = 0}), (27, 3) = Vector(2, {(1) = -1, (2) = -1}), (28, 1) = Vector(2, {(1) = 0, (2) = 6}), (28, 2) = Vector(2, {(1) = -3, (2) = -1}), (28, 3) = Vector(2, {(1) = 0, (2) = -1}), (29, 1) = Vector(2, {(1) = -3, (2) = 5}), (29, 2) = Vector(2, {(1) = -2, (2) = -2}), (29, 3) = Vector(2, {(1) = 1, (2) = -1}), (30, 1) = Vector(2, {(1) = -5, (2) = 3}), (30, 2) = Vector(2, {(1) = -1, (2) = -3}), (30, 3) = Vector(2, {(1) = 1, (2) = -1}), (31, 1) = Vector(2, {(1) = -6, (2) = 0}), (31, 2) = Vector(2, {(1) = 0, (2) = -3}), (31, 3) = Vector(2, {(1) = 1, (2) = 0}), (32, 1) = Vector(2, {(1) = -6, (2) = -3}), (32, 2) = Vector(2, {(1) = 1, (2) = -2}), (32, 3) = Vector(2, {(1) = 1, (2) = 1}), (33, 1) = Vector(2, {(1) = -5, (2) = -5}), (33, 2) = Vector(2, {(1) = 2, (2) = -1}), (33, 3) = Vector(2, {(1) = 1, (2) = 1}), (34, 1) = Vector(2, {(1) = -3, (2) = -6}), (34, 2) = Vector(2, {(1) = 3, (2) = 0}), (34, 3) = Vector(2, {(1) = 1, (2) = 1}), (35, 1) = Vector(2, {(1) = 0, (2) = -6}), (35, 2) = Vector(2, {(1) = 3, (2) = 1}), (35, 3) = Vector(2, {(1) = 0, (2) = 1}), (36, 1) = Vector(2, {(1) = 3, (2) = -5}), (36, 2) = Vector(2, {(1) = 2, (2) = 2}), (36, 3) = Vector(2, {(1) = -1, (2) = 1}), (37, 1) = Vector(2, {(1) = 5, (2) = -3}), (37, 2) = Vector(2, {(1) = 1, (2) = 3}), (37, 3) = Vector(2, {(1) = -1, (2) = 1}), (38, 1) = Vector(2, {(1) = 6, (2) = 0}), (38, 2) = Vector(2, {(1) = 0, (2) = 3}), (38, 3) = Vector(2, {(1) = -1, (2) = 0}), (39, 1) = Vector(2, {(1) = 6, (2) = 3}), (39, 2) = Vector(2, {(1) = -1, (2) = 2}), (39, 3) = Vector(2, {(1) = -1, (2) = -1}), (40, 1) = Vector(2, {(1) = 5, (2) = 5}), (40, 2) = Vector(2, {(1) = -2, (2) = 1}), (40, 3) = Vector(2, {(1) = -1, (2) = -1}), (41, 1) = Vector(2, {(1) = 3, (2) = 6}), (41, 2) = Vector(2, {(1) = -3, (2) = 0}), (41, 3) = Vector(2, {(1) = -1, (2) = -1}), (42, 1) = Vector(2, {(1) = 0, (2) = 6}), (42, 2) = Vector(2, {(1) = -3, (2) = -1}), (42, 3) = Vector(2, {(1) = 0, (2) = -1}), (43, 1) = Vector(2, {(1) = -3, (2) = 5}), (43, 2) = Vector(2, {(1) = -2, (2) = -2}), (43, 3) = Vector(2, {(1) = 1, (2) = -1}), (44, 1) = Vector(2, {(1) = -5, (2) = 3}), (44, 2) = Vector(2, {(1) = -1, (2) = -3}), (44, 3) = Vector(2, {(1) = 1, (2) = -1}), (45, 1) = Vector(2, {(1) = -6, (2) = 0}), (45, 2) = Vector(2, {(1) = 0, (2) = -3}), (45, 3) = Vector(2, {(1) = 1, (2) = 0}), (46, 1) = Vector(2, {(1) = -6, (2) = -3}), (46, 2) = Vector(2, {(1) = 1, (2) = -2}), (46, 3) = Vector(2, {(1) = 1, (2) = 1}), (47, 1) = Vector(2, {(1) = -5, (2) = -5}), (47, 2) = Vector(2, {(1) = 2, (2) = -1}), (47, 3) = Vector(2, {(1) = 1, (2) = 1}), (48, 1) = Vector(2, {(1) = -3, (2) = -6}), (48, 2) = Vector(2, {(1) = 3, (2) = 0}), (48, 3) = Vector(2, {(1) = 1, (2) = 1}), (49, 1) = Vector(2, {(1) = 0, (2) = -6}), (49, 2) = Vector(2, {(1) = 3, (2) = 1}), (49, 3) = Vector(2, {(1) = 0, (2) = 1}), (50, 1) = Vector(2, {(1) = 3, (2) = -5}), (50, 2) = Vector(2, {(1) = 2, (2) = 2}), (50, 3) = Vector(2, {(1) = -1, (2) = 1}), (51, 1) = Vector(2, {(1) = 5, (2) = -3}), (51, 2) = Vector(2, {(1) = 1, (2) = 3}), (51, 3) = Vector(2, {(1) = -1, (2) = 1}), (52, 1) = Vector(2, {(1) = 6, (2) = 0}), (52, 2) = Vector(2, {(1) = 0, (2) = 3}), (52, 3) = Vector(2, {(1) = -1, (2) = 0}), (53, 1) = Vector(2, {(1) = 6, (2) = 3}), (53, 2) = Vector(2, {(1) = -1, (2) = 2}), (53, 3) = Vector(2, {(1) = -1, (2) = -1}), (54, 1) = Vector(2, {(1) = 5, (2) = 5}), (54, 2) = Vector(2, {(1) = -2, (2) = 1}), (54, 3) = Vector(2, {(1) = -1, (2) = -1}), (55, 1) = Vector(2, {(1) = 3, (2) = 6}), (55, 2) = Vector(2, {(1) = -3, (2) = 0}), (55, 3) = Vector(2, {(1) = -1, (2) = -1}), (56, 1) = Vector(2, {(1) = 0, (2) = 6}), (56, 2) = Vector(2, {(1) = -3, (2) = -1}), (56, 3) = Vector(2, {(1) = 0, (2) = -1}), (57, 1) = Vector(2, {(1) = -3, (2) = 5}), (57, 2) = Vector(2, {(1) = -2, (2) = -2}), (57, 3) = Vector(2, {(1) = 1, (2) = -1}), (58, 1) = Vector(2, {(1) = -5, (2) = 3}), (58, 2) = Vector(2, {(1) = -1, (2) = -3}), (58, 3) = Vector(2, {(1) = 1, (2) = -1}), (59, 1) = Vector(2, {(1) = -6, (2) = 0}), (59, 2) = Vector(2, {(1) = 0, (2) = -3}), (59, 3) = Vector(2, {(1) = 1, (2) = 0}), (60, 1) = Vector(2, {(1) = -6, (2) = -3}), (60, 2) = Vector(2, {(1) = 1, (2) = -2}), (60, 3) = Vector(2, {(1) = 1, (2) = 1})})

M := Matrix(60, 3, {(1, 1) = Vector(2, {(1) = -3, (2) = 5}), (1, 2) = Vector(2, {(1) = -2, (2) = -2}), (1, 3) = Vector(2, {(1) = 0, (2) = 0}), (2, 1) = Vector(2, {(1) = -5, (2) = 3}), (2, 2) = Vector(2, {(1) = -1, (2) = -3}), (2, 3) = Vector(2, {(1) = 1, (2) = -1}), (3, 1) = Vector(2, {(1) = -6, (2) = 0}), (3, 2) = Vector(2, {(1) = 0, (2) = -3}), (3, 3) = Vector(2, {(1) = 1, (2) = 0}), (4, 1) = Vector(2, {(1) = -6, (2) = -3}), (4, 2) = Vector(2, {(1) = 1, (2) = -2}), (4, 3) = Vector(2, {(1) = 1, (2) = 1}), (5, 1) = Vector(2, {(1) = -5, (2) = -5}), (5, 2) = Vector(2, {(1) = 2, (2) = -1}), (5, 3) = Vector(2, {(1) = 1, (2) = 1}), (6, 1) = Vector(2, {(1) = -3, (2) = -6}), (6, 2) = Vector(2, {(1) = 3, (2) = 0}), (6, 3) = Vector(2, {(1) = 1, (2) = 1}), (7, 1) = Vector(2, {(1) = 0, (2) = -6}), (7, 2) = Vector(2, {(1) = 3, (2) = 1}), (7, 3) = Vector(2, {(1) = 0, (2) = 1}), (8, 1) = Vector(2, {(1) = 3, (2) = -5}), (8, 2) = Vector(2, {(1) = 2, (2) = 2}), (8, 3) = Vector(2, {(1) = -1, (2) = 1}), (9, 1) = Vector(2, {(1) = 5, (2) = -3}), (9, 2) = Vector(2, {(1) = 1, (2) = 3}), (9, 3) = Vector(2, {(1) = -1, (2) = 1}), (10, 1) = Vector(2, {(1) = 6, (2) = 0}), (10, 2) = Vector(2, {(1) = 0, (2) = 3}), (10, 3) = Vector(2, {(1) = -1, (2) = 0}), (11, 1) = Vector(2, {(1) = 6, (2) = 3}), (11, 2) = Vector(2, {(1) = -1, (2) = 2}), (11, 3) = Vector(2, {(1) = -1, (2) = -1}), (12, 1) = Vector(2, {(1) = 5, (2) = 5}), (12, 2) = Vector(2, {(1) = -2, (2) = 1}), (12, 3) = Vector(2, {(1) = -1, (2) = -1}), (13, 1) = Vector(2, {(1) = 3, (2) = 6}), (13, 2) = Vector(2, {(1) = -3, (2) = 0}), (13, 3) = Vector(2, {(1) = -1, (2) = -1}), (14, 1) = Vector(2, {(1) = 0, (2) = 6}), (14, 2) = Vector(2, {(1) = -3, (2) = -1}), (14, 3) = Vector(2, {(1) = 0, (2) = -1}), (15, 1) = Vector(2, {(1) = -3, (2) = 5}), (15, 2) = Vector(2, {(1) = -2, (2) = -2}), (15, 3) = Vector(2, {(1) = 1, (2) = -1}), (16, 1) = Vector(2, {(1) = -5, (2) = 3}), (16, 2) = Vector(2, {(1) = -1, (2) = -3}), (16, 3) = Vector(2, {(1) = 1, (2) = -1}), (17, 1) = Vector(2, {(1) = -6, (2) = 0}), (17, 2) = Vector(2, {(1) = 0, (2) = -3}), (17, 3) = Vector(2, {(1) = 1, (2) = 0}), (18, 1) = Vector(2, {(1) = -6, (2) = -3}), (18, 2) = Vector(2, {(1) = 1, (2) = -2}), (18, 3) = Vector(2, {(1) = 1, (2) = 1}), (19, 1) = Vector(2, {(1) = -5, (2) = -5}), (19, 2) = Vector(2, {(1) = 2, (2) = -1}), (19, 3) = Vector(2, {(1) = 1, (2) = 1}), (20, 1) = Vector(2, {(1) = -3, (2) = -6}), (20, 2) = Vector(2, {(1) = 3, (2) = 0}), (20, 3) = Vector(2, {(1) = 1, (2) = 1}), (21, 1) = Vector(2, {(1) = 0, (2) = -6}), (21, 2) = Vector(2, {(1) = 3, (2) = 1}), (21, 3) = Vector(2, {(1) = 0, (2) = 1}), (22, 1) = Vector(2, {(1) = 3, (2) = -5}), (22, 2) = Vector(2, {(1) = 2, (2) = 2}), (22, 3) = Vector(2, {(1) = -1, (2) = 1}), (23, 1) = Vector(2, {(1) = 5, (2) = -3}), (23, 2) = Vector(2, {(1) = 1, (2) = 3}), (23, 3) = Vector(2, {(1) = -1, (2) = 1}), (24, 1) = Vector(2, {(1) = 6, (2) = 0}), (24, 2) = Vector(2, {(1) = 0, (2) = 3}), (24, 3) = Vector(2, {(1) = -1, (2) = 0}), (25, 1) = Vector(2, {(1) = 6, (2) = 3}), (25, 2) = Vector(2, {(1) = -1, (2) = 2}), (25, 3) = Vector(2, {(1) = -1, (2) = -1}), (26, 1) = Vector(2, {(1) = 5, (2) = 5}), (26, 2) = Vector(2, {(1) = -2, (2) = 1}), (26, 3) = Vector(2, {(1) = -1, (2) = -1}), (27, 1) = Vector(2, {(1) = 3, (2) = 6}), (27, 2) = Vector(2, {(1) = -3, (2) = 0}), (27, 3) = Vector(2, {(1) = -1, (2) = -1}), (28, 1) = Vector(2, {(1) = 0, (2) = 6}), (28, 2) = Vector(2, {(1) = -3, (2) = -1}), (28, 3) = Vector(2, {(1) = 0, (2) = -1}), (29, 1) = Vector(2, {(1) = -3, (2) = 5}), (29, 2) = Vector(2, {(1) = -2, (2) = -2}), (29, 3) = Vector(2, {(1) = 1, (2) = -1}), (30, 1) = Vector(2, {(1) = -5, (2) = 3}), (30, 2) = Vector(2, {(1) = -1, (2) = -3}), (30, 3) = Vector(2, {(1) = 1, (2) = -1}), (31, 1) = Vector(2, {(1) = -6, (2) = 0}), (31, 2) = Vector(2, {(1) = 0, (2) = -3}), (31, 3) = Vector(2, {(1) = 1, (2) = 0}), (32, 1) = Vector(2, {(1) = -6, (2) = -3}), (32, 2) = Vector(2, {(1) = 1, (2) = -2}), (32, 3) = Vector(2, {(1) = 1, (2) = 1}), (33, 1) = Vector(2, {(1) = -5, (2) = -5}), (33, 2) = Vector(2, {(1) = 2, (2) = -1}), (33, 3) = Vector(2, {(1) = 1, (2) = 1}), (34, 1) = Vector(2, {(1) = -3, (2) = -6}), (34, 2) = Vector(2, {(1) = 3, (2) = 0}), (34, 3) = Vector(2, {(1) = 1, (2) = 1}), (35, 1) = Vector(2, {(1) = 0, (2) = -6}), (35, 2) = Vector(2, {(1) = 3, (2) = 1}), (35, 3) = Vector(2, {(1) = 0, (2) = 1}), (36, 1) = Vector(2, {(1) = 3, (2) = -5}), (36, 2) = Vector(2, {(1) = 2, (2) = 2}), (36, 3) = Vector(2, {(1) = -1, (2) = 1}), (37, 1) = Vector(2, {(1) = 5, (2) = -3}), (37, 2) = Vector(2, {(1) = 1, (2) = 3}), (37, 3) = Vector(2, {(1) = -1, (2) = 1}), (38, 1) = Vector(2, {(1) = 6, (2) = 0}), (38, 2) = Vector(2, {(1) = 0, (2) = 3}), (38, 3) = Vector(2, {(1) = -1, (2) = 0}), (39, 1) = Vector(2, {(1) = 6, (2) = 3}), (39, 2) = Vector(2, {(1) = -1, (2) = 2}), (39, 3) = Vector(2, {(1) = -1, (2) = -1}), (40, 1) = Vector(2, {(1) = 5, (2) = 5}), (40, 2) = Vector(2, {(1) = -2, (2) = 1}), (40, 3) = Vector(2, {(1) = -1, (2) = -1}), (41, 1) = Vector(2, {(1) = 3, (2) = 6}), (41, 2) = Vector(2, {(1) = -3, (2) = 0}), (41, 3) = Vector(2, {(1) = -1, (2) = -1}), (42, 1) = Vector(2, {(1) = 0, (2) = 6}), (42, 2) = Vector(2, {(1) = -3, (2) = -1}), (42, 3) = Vector(2, {(1) = 0, (2) = -1}), (43, 1) = Vector(2, {(1) = -3, (2) = 5}), (43, 2) = Vector(2, {(1) = -2, (2) = -2}), (43, 3) = Vector(2, {(1) = 1, (2) = -1}), (44, 1) = Vector(2, {(1) = -5, (2) = 3}), (44, 2) = Vector(2, {(1) = -1, (2) = -3}), (44, 3) = Vector(2, {(1) = 1, (2) = -1}), (45, 1) = Vector(2, {(1) = -6, (2) = 0}), (45, 2) = Vector(2, {(1) = 0, (2) = -3}), (45, 3) = Vector(2, {(1) = 1, (2) = 0}), (46, 1) = Vector(2, {(1) = -6, (2) = -3}), (46, 2) = Vector(2, {(1) = 1, (2) = -2}), (46, 3) = Vector(2, {(1) = 1, (2) = 1}), (47, 1) = Vector(2, {(1) = -5, (2) = -5}), (47, 2) = Vector(2, {(1) = 2, (2) = -1}), (47, 3) = Vector(2, {(1) = 1, (2) = 1}), (48, 1) = Vector(2, {(1) = -3, (2) = -6}), (48, 2) = Vector(2, {(1) = 3, (2) = 0}), (48, 3) = Vector(2, {(1) = 1, (2) = 1}), (49, 1) = Vector(2, {(1) = 0, (2) = -6}), (49, 2) = Vector(2, {(1) = 3, (2) = 1}), (49, 3) = Vector(2, {(1) = 0, (2) = 1}), (50, 1) = Vector(2, {(1) = 3, (2) = -5}), (50, 2) = Vector(2, {(1) = 2, (2) = 2}), (50, 3) = Vector(2, {(1) = -1, (2) = 1}), (51, 1) = Vector(2, {(1) = 5, (2) = -3}), (51, 2) = Vector(2, {(1) = 1, (2) = 3}), (51, 3) = Vector(2, {(1) = -1, (2) = 1}), (52, 1) = Vector(2, {(1) = 6, (2) = 0}), (52, 2) = Vector(2, {(1) = 0, (2) = 3}), (52, 3) = Vector(2, {(1) = -1, (2) = 0}), (53, 1) = Vector(2, {(1) = 6, (2) = 3}), (53, 2) = Vector(2, {(1) = -1, (2) = 2}), (53, 3) = Vector(2, {(1) = -1, (2) = -1}), (54, 1) = Vector(2, {(1) = 5, (2) = 5}), (54, 2) = Vector(2, {(1) = -2, (2) = 1}), (54, 3) = Vector(2, {(1) = -1, (2) = -1}), (55, 1) = Vector(2, {(1) = 3, (2) = 6}), (55, 2) = Vector(2, {(1) = -3, (2) = 0}), (55, 3) = Vector(2, {(1) = -1, (2) = -1}), (56, 1) = Vector(2, {(1) = 0, (2) = 6}), (56, 2) = Vector(2, {(1) = -3, (2) = -1}), (56, 3) = Vector(2, {(1) = 0, (2) = -1}), (57, 1) = Vector(2, {(1) = -3, (2) = 5}), (57, 2) = Vector(2, {(1) = -2, (2) = -2}), (57, 3) = Vector(2, {(1) = 1, (2) = -1}), (58, 1) = Vector(2, {(1) = -5, (2) = 3}), (58, 2) = Vector(2, {(1) = -1, (2) = -3}), (58, 3) = Vector(2, {(1) = 1, (2) = -1}), (59, 1) = Vector(2, {(1) = -6, (2) = 0}), (59, 2) = Vector(2, {(1) = 0, (2) = -3}), (59, 3) = Vector(2, {(1) = 1, (2) = 0}), (60, 1) = Vector(2, {(1) = -6, (2) = -3}), (60, 2) = Vector(2, {(1) = 1, (2) = -2}), (60, 3) = Vector(2, {(1) = 1, (2) = 1})})

(3)

xmin := 0; xmax := 0; ymin := 0; ymax := 0; for i from 2 while M[i, 1] <> M[1, 1] and i < 25 do xmin := min(M[i, 1][1], xmin); ymin := min(M[i, 1][2], ymin); xmax := max(M[i, 1][1], xmax); ymax := max(M[i, 1][1], ymax) end do; i, xmin, xmax, ymin, ymax

25, -6, 6, -6, 6

(4)

orb := plot(([seq])([M[j, 1][1], M[j, 1][2]], j = 1 .. i), colour = blue); l1 := plot(sqrt(2-sqrt(2))*x/sqrt(2+sqrt(2)), x = xmin .. xmax, colour = green); l2 := plot(-sqrt(2-sqrt(2))*x/sqrt(2+sqrt(2)), x = xmin .. xmax, colour = green); l3 := plot(sqrt(2+sqrt(2))*x/sqrt(2-sqrt(2)), x = xmin .. xmax, y = ymin .. ymax, colour = green); l4 := plot(-sqrt(2+sqrt(2))*x/sqrt(2-sqrt(2)), x = xmin .. xmax, y = ymin .. ymax, colour = green); display(orb, l1, l2, l3, l4, scaling = constrained)

 

accel := display([orb, seq(plots:-arrow(M[j, 1], M[j, 3], colour = red, width = .1), j = 1 .. i)], scaling = constrained, axes = none)

 

NULL

Download arrows.mw

You use the phrase "desired ordering for any given set ". A mathematical set has no concept of 'ordering' (just membership): so {x,cos(x)} is identical to {cos(x),x}.

As a practical matter, Maple will display sets based on the 'type' of elements, eg expressions, names, strings. Within each type the display order will be based on a combination of "complexity" and "lexicographics". So for example

  1. the set entered as {cos(x), x} will display as {x, cos(x)}.
  2. the set entered as {sin(x), cos(x)} will display as  {cos(x), sin(x)}
  3. the set entered as {x^3,"b",d, x^2, x, cos(x), "a", c} will display as {"a", "b", c, d, x, x^2, x^3, cos(x)}

A set does imply uniqueness of elements - so the set {b, b, b, a, a} is identical to the set {a, b.}

Lists are completely different: order is enforced, and uniqueness is irrelevant, so the list [b, b, b, a, a] is completely different from the list [a,b].

It is possible to 'uniquify' a list (see ListTools:-MakeUnique): duplicate elements will be removed, and subsequent elements will be left-shifted

  1. Use plottools:-rectangle() to generate the basic shape
  2. Use plottools:-rotate() to rotate the 'rectangle' by any angle, about any centre of rotation
  3. Use plots:-display() to display multiple plot structures
  4. Use the option scaling=constrained to ensure that your (rotated) rectangles appear 'rectangular' - if x-axis and y-axis scaling are mismatched then your rectangles will appear as parallelograms

As in the following (NB plots *render* much better within Maple than they do on this site)

  with(plottools):
  with(plots):
#
# Define some arbtirary rectangles.
#
  r1:=rectangle( [0.0,  1.0], [7.0, 3.0], color=red,   style=line):
  r2:=rectangle( [1.0, -2.0], [4.0, 5.0], color=blue,  style=line):
  r3:=rectangle( [-1.0, 2.0], [0.0, 6.0], color=green, style=line):
#
# Above rectangles always have edges which
# are parallel/perpendicular to xy-axes
#
  display( [ r1, r2, r3 ],
           scaling=constrained
         );
#
# but the same rectangles can be rotated by
# any angle, about any centre of rotation
#
  display( [ rotate(r1, Pi/4,   [ 0.0,  0.0]),
             rotate(r2, 2*Pi/3, [ 1.0, -2.0]),
             rotate(r3, 3*Pi/2, [ 1.0,  2.0])
           ],
           scaling=constrained
         );

 

 

 

Download rectPlot.mw

 

I do so enjoy (not) soling problems where only partial information is given. It means I can indulge in all sorts of random (possibly irrelevant) speculations. After all, life would be too easy if all ncessary information were provided!

Since you *seem* to be able to use the statement bound1<=bound2, there is an implication that you expect(?) bound1 and bound2 to have numerical values (or possibly NULL). For this reason it would probably be bettter to generate these using fsolve() rather than solve().

Using fsolve() rather than solve() also means that one can search for solutions in a specified numerical range, rather than using the complicated (and syntactially incorrect) mess of assumptions in your original post. Thus your solve() statements should probably be replaced by something very like

bound1:=fsolve( tau(x)=(Intv||j)[1] ,x, (Intv||i)[1]..(Intv||i)[2] )
bound2:=fsolve( tau(x)=(Intv||j)[2], x ,(Intv||i)[1]
..(Intv||i)[2] )

These will solve the equation specified by the first argument, for the variable specified by the second argument, in the range specified by the third argument. (NB Use of the concatentaion operator '||' has been deprecated for the last few Maple releases and should be avoided if possible - use cat() instead.)

You have the most complicated method I have seen to select the upper/lower of two values - all you really need is min() and max(), as in

if bound1<>NULL and bound2<>NULL
then lower:=min(bound1, bound2):
        upper:=max(bound1, bound2)
fi;

So the complete code for your problem, which of course I cannot test (since you provide insufficient information), would be

bound1:=fsolve( tau(x)=(Intv||j)[1] ,x, (Intv||i)[1]..(Intv||i)[2] ):
bound2:=fsolve( tau(x)=(Intv||j)[2], x ,(Intv||i)[1]
..(Intv||i)[2] ):
if bound1<>NULL and bound2<>NULL
then lower:=min(bound1, bound2):
        upper:=max(bound1, bound2):
fi;

 

does NOT correspond to schematic.

In the attached I have corrected the netlist. I left the component names unchanged, but renumbered some/all of the nodes to correspond to the schematic in your Design.pdf attachment

Graph at the end of the attached shows

  1. Gain =~10dB (more or less)
  2. Passband centre 60kHz

which corresponds (more or less to the info in your Design.pdf attachment. I only really  checked the dB-magnitude characteristic

My conclusions would be

  1. Analog Devices filter design wizard - OK
  2. Syrup -OK
  3. User - Problem

By the way, the output graph "renders" a lot better within Maple than it does  on this site

## Filter Requirements for Band-Pass, 4th order Butterworth
## Specifications: Optimize for Power, +Vs= 5, -Vs= -5
## Gain: 10 dB
## Passband: -3dB at 2kHz
## Stopband: -40dB at 40kHz
## Component Tolerances: Capacitor = 5%; Resistor = 1%; Inductor = 5%; Op Amp GBW = 20%

restart;
with(Syrup): Version:
with(DynamicSystems):

ckt := "*60 kHz Band Pass Filter  \n\
vin 1   0 \n\
R1A 1   2 165k \n\
R1B 3   6 169k \n\
R2A 2   0 976 \n\
R2B 6   0 1k \n\
R3A 5   0 221 \n\
R3B 9   0 226 \n\
R4A 5   3 12.7k \n\
R4B 7   9 12.7k \n\
R5A 4   3 97.6k \n\
R5B 7   8 100k \n\
C1A 2   3 270pF \n\
C1B 6   7 270pF \n\
C2A 2   4 270pF \n\
C2B 6   8 270pF \n\
* \n\
X1A 5  4 3  NonIdealOpAmp \n\
X1B 9  8 7 NonIdealOpAmp \n\
.include Library:-NonIdealOpAmp \n\
.end":

volts, others := Solve(ckt, 'ac', 'returnall'):
gain := eval(v[7]/vin, volts):
H := subs({A=80000, f0=15*10^6, Ro=100}, gain):
#evalf(H);
tf := evalf(H);
sys := TransferFunction(tf);
#PrintSystem(sys);
#plotsetup(maplet):
MagnitudePlot(sys, range=1e04..1e06, hertz=true, );

tf := 3.713536062*10^11*s^2*(2.846016000*10^18*s^4+4.335217672*10^23*s^3-1.986892290*10^34*s^2-1.513276405*10^39*s+3.467784028*10^49)/(3.630218106*10^36*s^6+6.313062129*10^44*s^5+2.745269702*10^52*s^4+6.236198010*10^56*s^3+7.453006706*10^63*s^2+7.286203539*10^67*s+5.053183418*10^74)

 

_m752448000

 

 

 


 

Download syrupProb2.mw

 

 

and gave your code a general tidy-up, whihc reulted in the attached

  restart;
  with(plots):
  with(plottools):

  makeM:=proc(x0, y0, h, b, w)
              local  Hm, opts:
              Hm:=h/3:
              opts:= scaling=constrained,linestyle=1, thickness=1:
              display( [ polygon( [ [x0,   y0],
                                    [x0,   y0+h],
                                    [x0+w, y0+h],
                                    [x0+w, y0]
                                  ],
                                  color=red
                                ),
                         polygon( [ [x0+b/2, y0+Hm],
                                    [x0+w,   y0+3*h/4],
                                    [x0+w,   y0+h],
                                    [x0+b/2, y0+Hm+2*w*(h-Hm)/b]
                                  ],
                                  color=white
                                ),
                         polygon( [ [x0+b/2, y0+Hm+2*w*(h-Hm)/b],
                                    [x0+b-w, y0+ h],
                                    [x0+b-w, y0+3*h/4],
                                    [x0+b/2, y0+Hm]
                                  ],
                                  color=blue
                                ),
                         polygon( [ [x0+b-w, y0+ h],
                                    [x0+b,   y0+h],
                                    [x0+b,   y0],
                                    [x0+b-w, y0]],
                                  color=turquoise
                                )
                       ],
                       opts
                    ):
         end proc:
  nframes:=47:
  LiaM:=[ seq(j,j=1..24), seq(j, j=23..1,-1)]:
  x0:=0: y0:=0: b:=7.8: w:=1.2: Hm:=4: h:=12:
  for i from  1 to nframes do   #was 0 to nframes?
      h:=  12-0.37*i*(nframes-i)/nframes:
      Hm:= h/3:
      lM[i]:= makeM(x0, y0, h, b, w):
  end do:
  display( seq(lM[i],i=1..nframes),
           scaling=constrained,
           insequence=true
         );

 

 

 

Download mPlot.mws

  1. You got an error?
  2. No error but results weren't what you expect?

I haven't had the Syrup package installed for the the last few Maple releases. So I downloaded/installed this package and converted its 'help' database from '.hdb' format to '.help' format. Then I ran your worksheet and it executed with no problems - see the attached. I have converted a few ';' to ':' because the output looked a little cluttered

The resulting filter characteristic is not what you have "specified" in your comments section; eg a non-exhaustive list

  1. roll-of rates are about 40dB/decade - implies second order?
  2. passband gain is about 0.1, ie -20dB(ish)
  3. passband centre is ~5*10^rads/sec

My immediate reaction is that the discrepancies are more likely to be a result of netlist topology or the component values you have used.

## Filter Requirements for Band-Pass, 4th order Butterworth
## Specifications: Optimize for Power, +Vs= 5, -Vs= -5
## Gain: 10 dB
## Passband: -3dB at 2kHz
## Stopband: -40dB at 40kHz
## Component Tolerances: Capacitor = 5%; Resistor = 1%; Inductor = 5%; Op Amp GBW = 20%

restart;
with(Syrup): Version:
with(DynamicSystems):

ckt := "*60 kHz Band Pass Filter  \n\
vin 1   0 \n\
R1A 1   2 165k \n\
R1B 5   7 169k \n\
R2A 2   0 976 \n\
R2B 7   0 1k \n\
R3A 6   0 221 \n\
R3B 11  0 226 \n\
R4A 5   6 12.7k \n\
R4B 10 11 12.7k \n\
R5A 4   3 97.6k \n\
R5B 9   8 100k \n\
R98 3   0 1e9 \n\
R99 8   0 1e9 \n\
C1A 2   4 270pF \n\
C1B 7   9 270pF \n\
C2A 2   3 270pF \n\
C2B 7   8 270pF \n\
* \n\
X1A 6  3 5  NonIdealOpAmp \n\
X1B 11 8 10 NonIdealOpAmp \n\
.include Library:-NonIdealOpAmp \n\
.end":

volts, others := Solve(ckt, 'ac', 'returnall'):
gain := eval(v[10]/vin, volts):
H := subs({A=80000, f0=15*10^6, Ro=100}, gain):
#evalf(H);
tf := evalf(H);
sys := TransferFunction(tf);
#PrintSystem(sys);
#plotsetup(maplet):
MagnitudePlot(sys);

tf := 8.444420784*10^52*s^2*(27.*s+2.000000*10^6)*(1647.*s+1.25000000*10^8)/((-1.291708861*10^23*s^3+1.967839884*10^29*s^2+1.528613029*10^34*s+2.830623806*10^34)*(1.702772184*10^15-1.042080000*10^9*s)*(9.225992382*10^13*s^2+7.002460997*10^18*s+1.296687500*10^19))

 

_m754951936

 

 

 

Download syrupProb.mw

on how complicated the applied functions are expected to be.

In particular if you want to combine information from multiple columns and/or rows.

  1. Functions of one column/row - trivial, see attached
  2. Functions of two columns/rows - pretty easy, see attached
  3. Functions of more than two columns/rows - not difficult, but getting more awkward to do the general case, so for this, I'd want you to provide a specific example

Note: I downloaded your data and parked it on my machine at C:/Users/TomLeslie/Desktop/Inquiry1.xls. To successfully execute the attached, you will have to change the file paths to correspond to where you have the data file stored

  restart:
  with(ExcelTools):
#
# Import the data (skip the headers). OP will
# have to change the file paths in order to
# execute
#
  M1A:= Import("C:/Users/TomLeslie/Desktop/Inquiry1.xls", "Sheet1", "A3:E9");
  M2A:= Import("C:/Users/TomLeslie/Desktop/Inquiry1.xls", "Sheet2", "A3:E8");
#
#
# Define a function whichh does something on
# a single argument. Just for the hell of it,
# lets say I want to take the square root
# and add 1
#
  f:=(x)->sqrt(x)+1:
#
# Apply the above function to the fifth
# column in the input matrices, and append
# the result as an "additional" column
#
  M1B:=<M1A|f~(M1A[..,5])>;
  M2B:=<M2A|f~(M2A[..,5])>;
#
# Define a function which does something
# with data in two column - say square the
# entry in the first column and add the
# entry in the second column
#
  g:=(x,y)-> zip( (i,j)-> i^2+j, x, y):
#
# Apply the above function to the second
# and fourth columns in the data, and
# append the result as an additional column
#
  M1C:= <M1A| g( M1A[..,2], M1A[..,4])>;
  M2C:= <M2A| g( M2A[..,2], M2A[..,4])>;

Matrix(7, 5, {(1, 1) = "JUNE", (1, 2) = 28.9, (1, 3) = 32.8, (1, 4) = 27.7, (1, 5) = 30.0, (2, 1) = "JULY", (2, 2) = 27.3, (2, 3) = 31.9, (2, 4) = 26.7, (2, 5) = 30.5, (3, 1) = "AUG", (3, 2) = 27.1, (3, 3) = 31.5, (3, 4) = 26.6, (3, 5) = 30.0, (4, 1) = "SEPT.", (4, 2) = 27.8, (4, 3) = 33.3, (4, 4) = 27.2, (4, 5) = 31.7, (5, 1) = "OCT.", (5, 2) = 28.8, (5, 3) = 34.9, (5, 4) = 28.0, (5, 5) = 33.1, (6, 1) = "NOV.", (6, 2) = 29.8, (6, 3) = 35.6, (6, 4) = 29.1, (6, 5) = 34.4, (7, 1) = "DEC.", (7, 2) = 28.5, (7, 3) = 35.1, (7, 4) = 27.9, (7, 5) = 33.7})

 

Matrix(6, 5, {(1, 1) = "JAN", (1, 2) = 29.1, (1, 3) = 36.9, (1, 4) = 29.2, (1, 5) = 35.1, (2, 1) = "FEB", (2, 2) = 32.1, (2, 3) = 39.1, (2, 4) = 30.0, (2, 5) = 37.4, (3, 1) = "MAR", (3, 2) = 31.9, (3, 3) = 39.5, (3, 4) = 31.6, (3, 5) = 37.7, (4, 1) = "APRIL", (4, 2) = 32.0, (4, 3) = 39.5, (4, 4) = 31.5, (4, 5) = 37.7, (5, 1) = "MAY", (5, 2) = 30.6, (5, 3) = 372.0, (5, 4) = 30.1, (5, 5) = 35.3, (6, 1) = "JUNE", (6, 2) = 28.3, (6, 3) = 33.1, (6, 4) = 28.3, (6, 5) = 32.0})

 

Matrix(7, 6, {(1, 1) = "JUNE", (1, 2) = 28.9, (1, 3) = 32.8, (1, 4) = 27.7, (1, 5) = 30.0, (1, 6) = 6.477225575, (2, 1) = "JULY", (2, 2) = 27.3, (2, 3) = 31.9, (2, 4) = 26.7, (2, 5) = 30.5, (2, 6) = 6.522680509, (3, 1) = "AUG", (3, 2) = 27.1, (3, 3) = 31.5, (3, 4) = 26.6, (3, 5) = 30.0, (3, 6) = 6.477225575, (4, 1) = "SEPT.", (4, 2) = 27.8, (4, 3) = 33.3, (4, 4) = 27.2, (4, 5) = 31.7, (4, 6) = 6.630275304, (5, 1) = "OCT.", (5, 2) = 28.8, (5, 3) = 34.9, (5, 4) = 28.0, (5, 5) = 33.1, (5, 6) = 6.753259945, (6, 1) = "NOV.", (6, 2) = 29.8, (6, 3) = 35.6, (6, 4) = 29.1, (6, 5) = 34.4, (6, 6) = 6.865151319, (7, 1) = "DEC.", (7, 2) = 28.5, (7, 3) = 35.1, (7, 4) = 27.9, (7, 5) = 33.7, (7, 6) = 6.805170109})

 

Matrix(6, 6, {(1, 1) = "JAN", (1, 2) = 29.1, (1, 3) = 36.9, (1, 4) = 29.2, (1, 5) = 35.1, (1, 6) = 6.924525297, (2, 1) = "FEB", (2, 2) = 32.1, (2, 3) = 39.1, (2, 4) = 30.0, (2, 5) = 37.4, (2, 6) = 7.115553941, (3, 1) = "MAR", (3, 2) = 31.9, (3, 3) = 39.5, (3, 4) = 31.6, (3, 5) = 37.7, (3, 6) = 7.140032573, (4, 1) = "APRIL", (4, 2) = 32.0, (4, 3) = 39.5, (4, 4) = 31.5, (4, 5) = 37.7, (4, 6) = 7.140032573, (5, 1) = "MAY", (5, 2) = 30.6, (5, 3) = 372.0, (5, 4) = 30.1, (5, 5) = 35.3, (5, 6) = 6.941380311, (6, 1) = "JUNE", (6, 2) = 28.3, (6, 3) = 33.1, (6, 4) = 28.3, (6, 5) = 32.0, (6, 6) = 6.656854249})

 

Matrix(7, 6, {(1, 1) = "JUNE", (1, 2) = 28.9, (1, 3) = 32.8, (1, 4) = 27.7, (1, 5) = 30.0, (1, 6) = 862.91, (2, 1) = "JULY", (2, 2) = 27.3, (2, 3) = 31.9, (2, 4) = 26.7, (2, 5) = 30.5, (2, 6) = 771.99, (3, 1) = "AUG", (3, 2) = 27.1, (3, 3) = 31.5, (3, 4) = 26.6, (3, 5) = 30.0, (3, 6) = 761.01, (4, 1) = "SEPT.", (4, 2) = 27.8, (4, 3) = 33.3, (4, 4) = 27.2, (4, 5) = 31.7, (4, 6) = 800.04, (5, 1) = "OCT.", (5, 2) = 28.8, (5, 3) = 34.9, (5, 4) = 28.0, (5, 5) = 33.1, (5, 6) = 857.44, (6, 1) = "NOV.", (6, 2) = 29.8, (6, 3) = 35.6, (6, 4) = 29.1, (6, 5) = 34.4, (6, 6) = 917.14, (7, 1) = "DEC.", (7, 2) = 28.5, (7, 3) = 35.1, (7, 4) = 27.9, (7, 5) = 33.7, (7, 6) = 840.15})

 

Matrix(%id = 18446744074405736446)

(1)

 

Download xlFunc.mw

Put the restart command in its own execution group. See attached

restart:

Digits:= 30:
interface(displayprecision=6):

C:= 2;
rho:= 1e3;
xi__d:= 1/2*rho*C*W__d^2;
xi__d:= 0.5*rho*C*W__d^2

2

 

0.1e4

 

1000.00000000000000000000000000*W__d^2

 

0.10e4*W__d^2

(1)

 


Download disprec.mw

The help file for ?restart does state

It must be executed in a separate prompt (or line) from all other commands, since all commands in a prompt are passed to the kernel at once; entering other commands in the prompt could cause unexpected results.

I've certainly been caught by this a few times (and I suspect so have many others), because, a lot of the time, having additional commands in the same execution group as the 'restart' doesn't *seem* to cause any problem - but every once in a while doing this will "bite" you

The attached contains quite a lot of work - but I can't guarantee that it contains everything in your original. Only you can tell

recover.mw

In your first example

restart;
foo:=proc()
  local a, inner_proc;

  inner_proc := proc()
     local b;
     b   := ithprime(10);
     a   := b; #this assiged the global (to this proc)
               #variable, which is "a" correctly
  end proc;

  inner_proc();

  return(a);
end proc;

the highlighted comment is misleading, because there is no concept of "global (to this proc)". The variable 'a' was declared as 'local' in the 'outer' procedure, so is available both in the outer procedure, and any procedures defined within it - but it isn't global!

I'm sure you have tried this, but modifying your second example slightly

restart;
foo:=proc()
  local a, inner_proc;

  inner_proc := proc()
     local b;
     global a;
     b   := ithprime(10);
     a   := b;                
  end proc;

  inner_proc();

  return(a);
end proc;
foo();
a;

The foo() command will return 'a' because this is declared as 'local to foo()' and 'locally to foo' it is unassigned. However 'a;' will return 29, because inner_proc was defined to treat occurrences of 'a' as references to the global variable 'a'  The local variable 'a'  in 'foo' and the (explicitly-defined) global variable 'a' in 'inner_proc' are two completely different variables

 

 

 

First 131 132 133 134 135 136 137 Last Page 133 of 207