Question: A problem with Grid:-Seq('f(i)', i = 1 .. n).

June 24 2014 Andriy 220
Maple 17
0

Code was computed on two different PC:
1) Win 8.1, Maple 17.02 x64
2) Win 8.1, Maple 18.01 x64

In brief:

n:=3: 
Grid:-Seq('f(i)', i = 1 .. n):

works well in Maple 17.02 but gives an error in Maple 18.01. Why?

However,

(j -> Grid:-Seq('f(i)', i = 1 .. j))(n):

works well for both Maple versions.

according to examples from Maple help page
http://www.maplesoft.com/support/help/Maple/view.aspx?path=Grid%2fSeq
we have to pass exactly 'f(i)' (not just f(i)) into Grid:-Seq(...). Why?

Why doesn't Digits:=30: work properly for Grid:-Seq(...)?

For details see attached file. Output was produced in Maple 17.02. In Maple 18.01 the output will differ.


restart; n := 3; f1 := proc (i) options operator, arrow; evalf(sqrt(i)) end proc; f2 := proc (i) options operator, arrow; evalf(sqrt(i+1)) end proc; f3 := proc (i) options operator, arrow; evalf(i*Pi) end proc; g1 := proc (f, n) local za, zb, zc, str; str := sprintf("g1(%a,n)", f); za := seq(f(i), i = 1 .. n); zb := Grid:-Seq(f(i), i = 1 .. n); zc := (proc (j) options operator, arrow; Grid:-Seq(f(i), i = 1 .. j) end proc)(n); print("------------------------------"); print(cat("(a):   ", str), za); print(cat("(b):   ", str), zb); print(cat("(c):   ", str), zc); print("------------------------------") end proc; g2 := proc (f, n) local za, zb, zc, str; str := sprintf("g2(%a,n)", f); za := seq('f(i)', i = 1 .. n); zb := Grid:-Seq('f(i)', i = 1 .. n); zc := (proc (j) options operator, arrow; Grid:-Seq('f(i)', i = 1 .. j) end proc)(n); print("------------------------------"); print(cat("(a):   ", str), za); print(cat("(b):   ", str), zb); print(cat("(c):   ", str), zc); print("------------------------------") end proc

3

(1)

g1(f1, n);

"------------------------------"

 

"(a):   g1(f1,n)", 1., 1.414213562, 1.732050808

 

"(b):   g1(f1,n)", 1, 2^(1/2), 3^(1/2)

 

"(c):   g1(f1,n)", 1, 2^(1/2), 3^(1/2)

 

"------------------------------"

 

"------------------------------"

 

"(a):   g1(f2,n)", 1.414213562, 1.732050808, 2.

 

"(b):   g1(f2,n)", 1.414213562, 1.732050808, 2.000000000

 

"(c):   g1(f2,n)", 1.414213562, 1.732050808, 2.000000000

 

"------------------------------"

 

"------------------------------"

 

"(a):   g1(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(b):   g1(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(c):   g1(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"------------------------------"

 

"+++++++++++++++++++++++++++++++++++++++++++"

 

"------------------------------"

 

"(a):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"(b):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"(c):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"------------------------------"

 

"------------------------------"

 

"(a):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"(b):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"(c):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"------------------------------"

 

"------------------------------"

 

"(a):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(b):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(c):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"------------------------------"

(2)

Digits := 30;

30

 

"------------------------------"

 

"(a):   g1(f1,n)", 1., 1.41421356237309504880168872421, 1.73205080756887729352744634151

 

"(b):   g1(f1,n)", 1, 2^(1/2), 3^(1/2)

 

"(c):   g1(f1,n)", 1, 2^(1/2), 3^(1/2)

 

"------------------------------"

 

"------------------------------"

 

"(a):   g1(f2,n)", 1.41421356237309504880168872421, 1.73205080756887729352744634151, 2.

 

"(b):   g1(f2,n)", 1.414213562, 1.732050808, 2.000000000

 

"(c):   g1(f2,n)", 1.414213562, 1.732050808, 2.000000000

 

"------------------------------"

 

"------------------------------"

 

"(a):   g1(f3,n)", 3.14159265358979323846264338328, 6.28318530717958647692528676656, 9.42477796076937971538793014984

 

"(b):   g1(f3,n)", 3.14159265358979323846264338328, 6.283185308, 9.424777962

 

"(c):   g1(f3,n)", 3.14159265358979323846264338328, 6.283185308, 9.424777962

 

"------------------------------"

 

"+++++++++++++++++++++++++++++++++++++++++++"

 

"------------------------------"

 

"(a):   g2(f1,n)", 1., 1.41421356237309504880168872421, 1.73205080756887729352744634151

 

"(b):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"(c):   g2(f1,n)", 1., 1.414213562, 1.732050808

 

"------------------------------"

 

"------------------------------"

 

"(a):   g2(f2,n)", 1.41421356237309504880168872421, 1.73205080756887729352744634151, 2.

 

"(b):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"(c):   g2(f2,n)", 1.414213562, 1.732050808, 2.

 

"------------------------------"

 

"------------------------------"

 

"(a):   g2(f3,n)", 3.14159265358979323846264338328, 6.28318530717958647692528676656, 9.42477796076937971538793014984

 

"(b):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"(c):   g2(f3,n)", 3.141592654, 6.283185308, 9.424777962

 

"------------------------------"

(3)

``

NULL


Download Grid[Seq].mw

Please Wait...