tomleslie

8333 Reputation

17 Badges

11 years, 118 days

MaplePrimes Activity


These are answers submitted by tomleslie

but if you want to list the divisors of an integer 'n', then use the

NumberTheory:-Divisors(n)

command. This will return 'n' itself as a divisor, which yu do nt consider 'proper'. So if you want only proper divisors, then use

NumberTheory:-Divisors(n)[1..-2]

You state that your algorithm takes ~18secs to compute the proper divisors of 17^6. The NumberTheory:-Divisors() command will return the same answer in 5ms.

If you want to know how many divisors you have when when you construct a number as a product of primes, then this is a simple combination problem, so you can use the combinat:-numbcomb() command. This command will count the "empty combination" and the "all entries" combination, neither of which is a "proper" divisor. It will not include the value '1' which is a "proper" divisor. So logically, you need

combinat:-numbcomb([ p1, p2, p3,......pN]) - 2 +1= combinat:-numbcomb([ p1, p2, p3,......pN]) - 1

See the \attached for some examples

Download prims.mw

The following code

  restart;
  with(plots):
#
# Generate some random points
#
  r:= rand(-10.0..10.0):
  npts:= 100:
  pts1:= [seq( [r(), r()], n=1..npts)]:
#
# Compute the complex hull of these points
#
  lv:= ComputationalGeometry:-ConvexHull(pts1):
#
# Draw the original points and those on the polygon
# forming the complex hull
#
  display
  ( plot
    ( pts1[ convert( {$i=1..npts}
                     minus
                     convert(lv, set),
                     list
                   )
          ],
      style=point,
      symbol=solidcircle,
      symbolsize=16,
      color=blue
    ),
    plot
    ( [ pts1[lv][], pts1[lv[1]] ],
      style =pointline,
      symbol=solidcircle,
      symbolsize=16,
      color=red
    )
  );

produces the following figure

See the attached

ch.mw

 

 

 

I suspect you have not implemented Acer's suggetions correctly
 

Download anim.mw

yuo have to supply numeric values for all 'parameters' Your system contains 'k', 'lambda' and 'inifinity'. In the attached I have provided (arbitrary) numeric values for these quantities.

I also fixed a couple of typos.

  restart;
  with(plots):
  sys:= f(x) - x*diff(f(x), x) - 3*diff(g(x), x) = 0,
        f(x)^2 - f(x)*diff(f(x), x)*x + 3*g(x)*diff(f(x), x) = 3*diff(f(x), x $ 2) + 18*k*diff(f(x), x$2)*diff(f(x), x)^2,
        3*diff(h(x), x)*f(x) - diff(h(x), x)*f(x)*x + 3*g(x)*diff(h(x), x) = diff(h(x), x $ 2):
  bcs := f(0) = lambda,
         g(0) = 0,
         f(infinity) = 0,
         h(0) = 1,
         h(infinity) = 0:
  dsys := eval({bcs, sys}, [k = 2, lambda = 1, infinity = 5]):
  dsol := dsolve(dsys, numeric):
  odeplot( dsol,
           [ [x, f(x)],
             [x, g(x)],
             [x, h(x)]
           ],
           color=[red, green, blue]
         );

which produces

 

 

Download odeProb.mw

as the most "rediscovered" property of primes. Consider

  1. Any number greater than 5 can be written (modulo 6) as n=0, 1, 2 ,3, 4, 5 modulo 6
  2. Any number  greater than 5 which satisfies n=0,  2,  4 modulo 6 is even, so cannot be prime.
  3. Any number  greater than 5 which satisfies n=3 modulo 6, is divisible by 3 so cannot be prime.
  4. Hence prime greater than 5, can be written as either
    1. n=1 modulo 6: in other words it is 6*r+1, for some integer r
    2. n=5 modulo 6: in other words it is 6*r+5, which can also be written as 6*(r+1)-1, ie 6*q-1
  5. Hence any prime greater than 5 is of the form 6*r+1 or 6*r-1

is just to define a siimple function - see the attached

  restart;
  with(Logic):
  local O:
  P1 := (&not O) &and (&not C) &implies (&not Q);
#
# The contrapositive of
#
#    A -> B
#
# is
#
#   (not B) -> (not A)
#
# so define a function which performs this
#
   CP:= pr-> BooleanSimplify( &not op(2, pr) )
             &implies
             BooleanSimplify( &not op(1, pr) ):
#
# Contrapositive of P1
#
   CP(P1);

logic1.mw

Looks like the inline display is broken on this site again :-(

I agree with your remarks about the second question - the output of

Canonicalize(P5, {O, C, Q}, form=MOD2)

js just wrong!

 

if I fix a couple of typos to remove some discontinuities in the function definition, and to ensure that i i defined for all values of the parameter 'A' in the range -6..6, then restructure the code a bit, I come up with the attached. Be aware that the animation is not as "smooth" as I would expect, even when I use a frame count whihc means that the file is too big for the animation to display inline on this site.


Download anim.mw

is shown in the attached

  restart:
  aProc:=  proc()
                local j:
                unapply
                ( piecewise
                  ( x<=0,
                    0,
                    seq( [x<j*h, _passed[j]][], j=1.._npassed),
                    0
                  ),
                  x, h
                );
           end proc:
          

  B[0]:=  (1/6)*x^3/h^3:
  B[1]:=  (1/6)*(4*h^3-12*h^2*x+12*h*x^2-3*x^3)/h^3:
  B[2]:= -(1/6)*(44*h^3-60*h^2*x+24*h*x^2-3*x^3)/h^3:
  B[3]:=  (1/6)*(64*h^3-48*h^2*x+12*h*x^2-x^3)/h^3:

  func:= aProc( entries(B, nolist, indexorder));
  func(4,2);

func := proc (x, h) options operator, arrow; piecewise(x <= 0, 0, x < h, (1/6)*x^3/h^3, x < 2*h, (1/6)*(4*h^3-12*h^2*x+12*h*x^2-3*x^3)/h^3, x < 3*h, -(1/6)*(44*h^3-60*h^2*x+24*h*x^2-3*x^3)/h^3, x < 4*h, (1/6)*(64*h^3-48*h^2*x+12*h*x^2-x^3)/h^3, 0) end proc

 

2/3

(1)

  B[0]:=  (1/24)*x^4/h^4:
  B[1]:= -(1/24)*(5*h^4-20*h^3*x+30*h^2*x^2-20*h*x^3+4*x^4)/h^4:
  B[2]:=  (1/24)*(155*h^4-300*h^3*x+210*h^2*x^2-60*h*x^3+6*x^4)/h^4:
  B[3]:= -(1/24)*(655*h^4-780*h^3*x+330*h^2*x^2-60*h*x^3+4*x^4)/h^4:
  B[4]:=  (1/24)*(625*h^4-500*h^3*x+150*h^2*x^2-20*h*x^3+x^4)/h^4:
 
  func:= aProc( entries(B, nolist, indexorder));
  func(4,2);

func := proc (x, h) options operator, arrow; piecewise(x <= 0, 0, x < h, (1/24)*x^4/h^4, x < 2*h, -(1/24)*(5*h^4-20*h^3*x+30*h^2*x^2-20*h*x^3+4*x^4)/h^4, x < 3*h, (1/24)*(155*h^4-300*h^3*x+210*h^2*x^2-60*h*x^3+6*x^4)/h^4, x < 4*h, -(1/24)*(655*h^4-780*h^3*x+330*h^2*x^2-60*h*x^3+4*x^4)/h^4, x < 5*h, (1/24)*(625*h^4-500*h^3*x+150*h^2*x^2-20*h*x^3+x^4)/h^4, 0) end proc

 

11/24

(2)

 

Download pwFunc.mw

 

when plotting/manipulating more-or-less standard geometric objects, it is usually a good idea to check out the plottools() package.

See the attached

  with(plots):
  with(plottools):
  display
  ( reflect
    ( hemisphere
      ( [0, 0, 0],
        3
      ),
      [0,0,0]
    ),
    style=surface,
    scaling=constrained,
    axes=boxed,
    color=red
  );

 

 


Download hemi.mw

 

From the Excel help

Formula

Description

Result

=MROUND(10, 3)

Rounds 10 to the nearest multiple of 3.

9

=MROUND(-10, -3)

Rounds -10 to the nearest multiple of -3.

-9

=MROUND(1.3, 0.2)

Rounds 1.3 to the nearest multiple of 0.2.

1.4

=MROUND(5, -2)

Returns the #NUM! error message because -2 and 5 have different signs.

#NUM!

Unfortunately

  1. The code supplied by CarlLove requires the second argument to be positive, which the Excel MROUND() command does not require
  2. The code supplied by vv, "works" when the two arguments are of opposite sign - which it shouldn't

It is trivial to fix either of the above. One way is in the attached

  restart;
  MROUND := (x,m) -> `if`( signum(x)=signum(m),
                           round(x/m)*m,
                           "Error must be same sign"
                         ):
  MROUND(10,3);
  MROUND(-10,-3);
  MROUND(1.3,0.2);
  MROUND(5, -2);

9

 

-9

 

1.4

 

"Error must be same sign"

(1)

 

Download mround.mw

I have added an execution group which performs the iteration you require, but a few caveats are necessary

  1. This (probably?, almost certainly?) won't give the same answer as a call to fsolve(), since fsolve() may well use techniques other than iteration to obtain a solution
  2. You will  (probably?) get a different answer for more or less every initial point
  3. I have made tno attempt to restrict values to specific ranges - although that wouldn't be too difficult

So for what ti is worth -


 

``

restart

``

sys1 := {y[1] = 33/(100*sqrt(y[1])*y[3]^(3/2)*(33/(50*y[1]^(3/2)*y[3]^(3/2))+2/(5*y[2]^(3/2)*y[4]^(3/2))))+11/(40*sqrt(y[1])*y[3]^(3/2)*(11/(20*y[1]^(3/2)*y[3]^(3/2))+1/(2*y[2]^(3/2)*y[4]^(3/2))))+33*y[2]/(200*y[1]^(3/2)*y[3]^(3/2)*(11/(50*y[1]^(3/2)*y[3]^(3/2))+4/(5*y[2]^(3/2)*y[4]^(3/2))))+33*y[2]/(100*y[1]^(3/2)*y[3]^(3/2)*(11/(25*y[1]^(3/2)*y[3]^(3/2))+3/(5*y[2]^(3/2)*y[4]^(3/2)))), y[2] = 2*y[1]/(15*y[2]^(3/2)*y[4]^(3/2)*(33/(50*y[1]^(3/2)*y[3]^(3/2))+2/(5*y[2]^(3/2)*y[4]^(3/2))))+y[1]/(6*y[2]^(3/2)*y[4]^(3/2)*(11/(20*y[1]^(3/2)*y[3]^(3/2))+1/(2*y[2]^(3/2)*y[4]^(3/2))))+2/(5*sqrt(y[2])*y[4]^(3/2)*(11/(50*y[1]^(3/2)*y[3]^(3/2))+4/(5*y[2]^(3/2)*y[4]^(3/2))))+3/(10*sqrt(y[2])*y[4]^(3/2)*(11/(25*y[1]^(3/2)*y[3]^(3/2))+3/(5*y[2]^(3/2)*y[4]^(3/2))))}

{y[1] = (33/100)/(y[1]^(1/2)*y[3]^(3/2)*((33/50)/(y[1]^(3/2)*y[3]^(3/2))+(2/5)/(y[2]^(3/2)*y[4]^(3/2))))+(11/40)/(y[1]^(1/2)*y[3]^(3/2)*((11/20)/(y[1]^(3/2)*y[3]^(3/2))+(1/2)/(y[2]^(3/2)*y[4]^(3/2))))+(33/200)*y[2]/(y[1]^(3/2)*y[3]^(3/2)*((11/50)/(y[1]^(3/2)*y[3]^(3/2))+(4/5)/(y[2]^(3/2)*y[4]^(3/2))))+(33/100)*y[2]/(y[1]^(3/2)*y[3]^(3/2)*((11/25)/(y[1]^(3/2)*y[3]^(3/2))+(3/5)/(y[2]^(3/2)*y[4]^(3/2)))), y[2] = (2/15)*y[1]/(y[2]^(3/2)*y[4]^(3/2)*((33/50)/(y[1]^(3/2)*y[3]^(3/2))+(2/5)/(y[2]^(3/2)*y[4]^(3/2))))+(1/6)*y[1]/(y[2]^(3/2)*y[4]^(3/2)*((11/20)/(y[1]^(3/2)*y[3]^(3/2))+(1/2)/(y[2]^(3/2)*y[4]^(3/2))))+(2/5)/(y[2]^(1/2)*y[4]^(3/2)*((11/50)/(y[1]^(3/2)*y[3]^(3/2))+(4/5)/(y[2]^(3/2)*y[4]^(3/2))))+(3/10)/(y[2]^(1/2)*y[4]^(3/2)*((11/25)/(y[1]^(3/2)*y[3]^(3/2))+(3/5)/(y[2]^(3/2)*y[4]^(3/2))))}

(1)

sys2 := {y[3] = 1/(33/(50*y[1]^(3/2)*y[3]^(3/2))+2/(5*y[2]^(3/2)*y[4]^(3/2)))^(1/3), y[4] = 1/(11/(50*y[1]^(3/2)*y[3]^(3/2))+4/(5*y[2]^(3/2)*y[4]^(3/2)))^(1/3)}

{y[3] = 1/((33/50)/(y[1]^(3/2)*y[3]^(3/2))+(2/5)/(y[2]^(3/2)*y[4]^(3/2)))^(1/3), y[4] = 1/((11/50)/(y[1]^(3/2)*y[3]^(3/2))+(4/5)/(y[2]^(3/2)*y[4]^(3/2)))^(1/3)}

(2)

sys := `union`(sys1, sys2)

v := [indets(sys, name)[]]

[y[1], y[2], y[3], y[4]]

(3)

vz := `~`[subsop](0 = z, v)

[z[1], z[2], z[3], z[4]]

(4)

# Replace y's with z's (taken to a power of 2) to translate the system into a polynomial form (to get rid of the square roots and facilitate the computation):

sysP := (`@`(`~`[numer], simplify))(subs(`~`[`=`](v, `~`[`^`](vz, 2)), `~`[lhs-rhs](sys)), symbolic)

{-z[3]*(50^(1/3)*z[1]*z[2]*z[4]-(20*z[1]^3*z[3]^3+33*z[2]^3*z[4]^3)^(1/3)*z[3]), -z[4]*(50^(1/3)*z[1]*z[2]*z[3]-(40*z[1]^3*z[3]^3+11*z[2]^3*z[4]^3)^(1/3)*z[4]), -480000*z[1]^14*z[3]^12-1144000*z[1]^11*z[2]^3*z[3]^9*z[4]^3+363000*z[1]^9*z[2]^5*z[3]^9*z[4]^3-762300*z[1]^8*z[2]^6*z[3]^6*z[4]^6+1143450*z[1]^6*z[2]^8*z[3]^6*z[4]^6-133100*z[1]^5*z[2]^9*z[3]^3*z[4]^9+1058145*z[1]^3*z[2]^11*z[3]^3*z[4]^9+263538*z[2]^14*z[4]^12, 480000*z[1]^14*z[3]^12+1144000*z[1]^11*z[2]^3*z[3]^9*z[4]^3-363000*z[1]^9*z[2]^5*z[3]^9*z[4]^3+762300*z[1]^8*z[2]^6*z[3]^6*z[4]^6-1143450*z[1]^6*z[2]^8*z[3]^6*z[4]^6+133100*z[1]^5*z[2]^9*z[3]^3*z[4]^9-1058145*z[1]^3*z[2]^11*z[3]^3*z[4]^9-263538*z[2]^14*z[4]^12}

(5)

NULL

fsolve(sysP, `~`[`=`]({vz[]}, 1 .. infinity))

{z[1] = 1.076207559, z[2] = 1.052719262, z[3] = 1.047573288, z[4] = 1.050128957}

(6)

# These are the final values of the 4 unknowns, which should be matched with an iterative process (i.e., transfer z's back to y's):

solve(subs({z[1] = 1.076207559, z[2] = 1.052719262, z[3] = 1.047573288, z[4] = 1.050128957}, subs(`~`[`=`](vz, `~`[`^`](v, 1/2)))), {y[1], y[2], y[3], y[4]})

{y[1] = 1.158222710, y[2] = 1.108217845, y[3] = 1.097409794, y[4] = 1.102770826}

(7)

# I'm not sure whether it's of any importance for the solution, but I noticed that the values vary if I start from a different initial point (here 1.01 instead of 1):                           

fsolve(sysP, `~`[`=`]({vz[]}, 1.01 .. infinity))

{z[1] = 1.092072175, z[2] = 1.068237633, z[3] = 1.063015801, z[4] = 1.065609143}

(8)

solve(subs({z[1] = 1.092072175, z[2] = 1.068237633, z[3] = 1.063015801, z[4] = 1.065609143}, subs(`~`[`=`](vz, `~`[`^`](v, 1/2)))), {y[1], y[2], y[3], y[4]})

{y[1] = 1.192621635, y[2] = 1.141131641, y[3] = 1.130002593, y[4] = 1.135522846}

(9)

# However, the solution is the same up-to-scale:

ratio_y1 = 1.192621635/(1.158222710), ratio_y2 = 1.141131641/(1.108217845), ratio_y3 = 1.130002593/(1.097409794), ratio_y4 = 1.135522846/(1.102770826)

ratio_y1 = 1.029699750, ratio_y2 = 1.029699753, ratio_y3 = 1.029699752, ratio_y4 = 1.029699752

(10)

fsolve(sysP)

{z[1] = -1.212997331, z[2] = 1.186523590, z[3] = -1.180723544, z[4] = 1.183604047}

(11)

 

#
# Limit the number of iterations (just in
# case the required tolerance cannot be achieved
#
  numIters:= 100:
#
# Supply a starting point
#
  initialGuess:= [1, 1, 1, 1]:
#
# Specify a tolerance for termination
#
  breakTol:= 1.0e-06:
#
# Convert the original 'sys' to a list
#
  sysL:= rhs~(convert(sys, list)):
#
# Initialize an array to hold the results
#
  vals:= Array(1..numIters, 1..4, [[ y__1, y__2, y__3, y__4], initialGuess]):
#
# Run the iteration
#
  for j from 3 by 1 to numIters do
      vals[j, 1..4]:= Array( evalf( eval( sysL, [ seq( y[k]=vals[j-1,k], k=1..4 )])));
    #
    # If required tolerance has been achieved, then
    # exit loop 9using root mean square)
    #
      if   sqrt(add((vals[j,..]-~vals[j-1,..])^~2)/4) < breakTol
      then break
      fi;
  od:
#
# Display final result
#
  vals[j,..];
#
# Display error - actually the discrpancy between
# the last two iterates, and the rms error
#
  vals[j,..]-~vals[j-1,..];
  sqrt(add((vals[j,..]-~vals[j-1,..])^~2)/4);
#
# Display all values of the iteration
#
  interface(rtablesize=j):
  vals[1..j, 1..4];
  interface(rtablesize=10):

Vector[row](4, {(1) = 1.026593850, (2) = .9822707691, (3) = .9726913817, (4) = .9774433589})

 

Vector[row](4, {(1) = 0.1521e-5, (2) = -0.10139e-5, (3) = -0.2474000000e-6, (4) = 0.2227000000e-6})

 

9.290097228*10^(-7)

 

Array(%id = 36893488148333066228)

(12)

 

NULL


 

Download iterEQ.mw

is shown in the attached figure, produced by Maple.

Calculating the coordinates of the relevant points iin this figure took much less code than actually producing the figure itself!

is shown in the attached - where pretty much everything is defined in matrix form

  restart;
#
# Matrix of dependent variables
#
  X:= Matrix( 2,1, [x__1(t), x__2(t)]);
#
# "Coefficient" matrix
#
  Mcoeff:= Matrix(2,2, [[1, -1], [12,-8]]);
#
# "Scalar addition" matrix
#
  b:=Matrix(2,1, [-3,4]);
#
# Define ode system in terms of above matrices
#
  ode:= diff(X,t) = Mcoeff.X + b;
#
# Solve ode system
#
  dsolve(ode);

Vector(2, {(1) = `#msub(mi("x"),mi("1"))`(t), (2) = `#msub(mi("x"),mi("2"))`(t)})

 

Matrix(2, 2, {(1, 1) = 1, (1, 2) = -1, (2, 1) = 12, (2, 2) = -8})

 

Vector(2, {(1) = -3, (2) = 4})

 

Matrix(%id = 36893488148078258884) = Matrix(%id = 36893488148078259124)

 

{x__1(t) = exp((1/2)*(-7+33^(1/2))*t)*_C2+exp(-(1/2)*(7+33^(1/2))*t)*_C1-7, x__2(t) = -(1/2)*exp((1/2)*(-7+33^(1/2))*t)*_C2*33^(1/2)+(1/2)*exp(-(1/2)*(7+33^(1/2))*t)*_C1*33^(1/2)+(9/2)*exp((1/2)*(-7+33^(1/2))*t)*_C2+(9/2)*exp(-(1/2)*(7+33^(1/2))*t)*_C1-10}

(1)

 


Download matode2.mw

In future please upload your worksheet using the big green up-arrow in the Mapleprimes toolbar - very few (if any!) people here are prepared to retype your code,

If I run your "simple" example in Maple 2021, then all three integrals "work". See the attached

  restart:
  interface(version);
  

`Standard Worksheet Interface, Maple 2021.0, Windows 7, March 5 2021 Build ID 1523359`

(1)

  R:= 7.5;
  f:= z->z;
  a:= [1,2,3,4,5];
  b:= [2,1,1,2,4];
  g:= z-> CurveFitting:-Spline(a, b, z, degree=1);

7.5

 

proc (z) options operator, arrow; z end proc

 

[1, 2, 3, 4, 5]

 

[2, 1, 1, 2, 4]

 

proc (z) options operator, arrow; CurveFitting:-Spline(a, b, z, degree = 1) end proc

(2)

#
# Example 1
#
  Int( Int( Int( arctan(f(r)),r=RR..R)/RR, RR), RR=0..R);
  evala(value(%));
#
# Example 2
#
  Int( Int( Int( g(r),r=RR..R)/RR, RR), RR=0..R);
  evala(value(%));
#
# Example 3
#
  Int( Int( Int( g(r)+arctan(f(r)),r=RR..R)/RR, RR), RR=0..R);
  evala(value(%));

Int(Int((Int(arctan(r), r = RR .. 7.5))/RR, RR), RR = 0 .. 7.5)

 

47.55857943

 

Int(Int((Int(piecewise(r < 2, 3-r, r < 3, 1, r < 4, -2+r, -6+2*r), r = RR .. 7.5))/RR, RR), RR = 0 .. 7.5)

 

135.0979765

 

Int(Int((Int(piecewise(r < 2, 3-r, r < 3, 1, r < 4, -2+r, -6+2*r)+arctan(r), r = RR .. 7.5))/RR, RR), RR = 0 .. 7.5)

 

-1165.637136

(3)

 

 


Download intProb.mw

 

 

However if I run the same worksheet in Maple 2020, I get an *interesting* error which you don't seem to experience, see the attached

  restart:
  interface(version);
  

`Standard Worksheet Interface, Maple 2020.2, Windows 7, November 11 2020 Build ID 1502365`

(1)

  R:= 7.5;
  f:= z->z;
  a:= [1,2,3,4,5];
  b:= [2,1,1,2,4];
  g:= z-> CurveFitting:-Spline(a, b, z, degree=1);

7.5

 

proc (z) options operator, arrow; z end proc

 

[1, 2, 3, 4, 5]

 

[2, 1, 1, 2, 4]

 

proc (z) options operator, arrow; CurveFitting:-Spline(a, b, z, degree = 1) end proc

(2)

#
# Example 1
#
  Int( Int( Int( arctan(f(r)),r=RR..R)/RR, RR), RR=0..R);
  evala(value(%));
#
# Example 2
#
  Int( Int( Int( g(r),r=RR..R)/RR, RR), RR=0..R);
  evala(value(%));
#
# Example 3
#
  Int( Int( Int( g(r)+arctan(f(r)),r=RR..R)/RR, RR), RR=0..R);
  evala(value(%));

Int(Int((Int(arctan(r), r = RR .. 7.5))/RR, RR), RR = 0 .. 7.5)

 

47.55857943

 

Int(Int((Int(piecewise(r < 2, 3-r, r < 3, 1, r < 4, -2+r, -6+2*r), r = RR .. 7.5))/RR, RR), RR = 0 .. 7.5)

 

135.0979765

 

Int(Int((Int(piecewise(r < 2, 3-r, r < 3, 1, r < 4, -2+r, -6+2*r)+arctan(r), r = RR .. 7.5))/RR, RR), RR = 0 .. 7.5)

 

Error, (in Handlers:-hasPiecewise) mismatched multiple assignment of 2 variables on the left side and 1 value on the right side

 

 

 

Download intProb2020.mw

Some are shown in the attached (but there are others!)

  restart;
  JointNum:= 3:
  alpha:= table( [seq(j=0, j=1..JointNum)]):
#
# test
#
  alpha[1];
  alpha[2];
  alpha[3];

0

 

0

 

0

(1)

  restart;
  JointNum := 3:
  seq( (alpha[j]:=0), j=1..JointNum):
#
# test
#
  alpha[1];
  alpha[2];
  alpha[3];

0

 

0

 

0

(2)

  restart;
  JointNum:= 3:
  seq( assign(alpha[j], 0), j=1..JointNum):
#
# test
#
  alpha[1];
  alpha[2];
  alpha[3];

0

 

0

 

0

(3)

  restart;
  JointNum:= 3:
  alpha:= Array(1..3, fill=0):
#
# test
#
  alpha[1];
  alpha[2];
  alpha[3];

0

 

0

 

0

(4)

 

 

Download assgn.mw

 

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