{VERSION 2 3 "IBM INTEL NT" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 0 0 1 0 0 0 0 0 0 } {CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 }{CSTYLE " " 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 }{CSTYLE "Help Heading" -1 26 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 7 "Advice:" }{TEXT -1 21 " Last name evaluation" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 204 "Normally, when you enter an expression it is evaluated completely. If your expression contain s a variable that has a value, the variable is replaced by that value; if it contains a function call such as " }{MPLTEXT 0 21 4 "f(x)" } {TEXT -1 8 ", where " }{MPLTEXT 0 21 1 "f" }{TEXT -1 76 " is a procedu re or function, then this is replaced by the value returned by " } {MPLTEXT 0 21 1 "f" }{TEXT -1 15 " with argument " }{MPLTEXT 0 21 1 "x " }{TEXT -1 557 ". And if those values in turn contain variables or f unction calls, they are also evaluated. Eventually (we hope) Maple ob tains a form that does not require any further evaluation, and this is what it returns to us. However, certain types of object have special evaluation rules. In particular, tables, arrays (including vectors a nd matrices) and procedures use last name evaluation. This means that if the result of one level of evaluation of a name would be a table, \+ array or procedure, then the chain of evaluation stops with that name. For example:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "T:= array( [a,b,c]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"TG-%'VECTORG6#7%%\"aG %\"bG%\"cG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "S:= T;" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"SG%\"TG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "S;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%\"TG" }}} {PARA 0 "" 0 "" {TEXT -1 24 "In the first statement, " }{MPLTEXT 0 21 1 "T" }{TEXT -1 46 " is assigned a value which is an array. Then " } {MPLTEXT 0 21 1 "S" }{TEXT -1 23 " is assigned the value " }{MPLTEXT 0 21 1 "T" }{TEXT -1 1 "." }{TEXT -1 16 " Evaluation of " }{MPLTEXT 0 21 1 "T" }{TEXT -1 63 " stops at the name, rather than going all the way to the array " }{MPLTEXT 0 21 7 "[1,2,3]" }{TEXT -1 7 ". For " } {MPLTEXT 0 21 1 "S" }{TEXT -1 44 " there is one level of evaluation, y ielding " }{MPLTEXT 0 21 1 "T" }{TEXT -1 57 ", but again evaluation st ops there. If you want the next" }}{PARA 0 "" 0 "" {TEXT -1 63 "level of evaluation, the table or array structure, you can use " }{MPLTEXT 0 21 4 "eval" }{TEXT -1 1 ":" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "eval(S);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'VECTORG6#7%%\"aG%\"b G%\"cG" }}}{PARA 0 "" 0 "" {TEXT -1 118 "However, even this is not ful l evaluation, as the entries of this array were not evaluated. For th at you need to map " }{MPLTEXT 0 21 4 "eval" }{TEXT -1 6 " into " } {MPLTEXT 0 21 1 "S" }{TEXT -1 1 ":" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "b:= a: a:= sin(x): x:= Pi:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "eval(S);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'VECT ORG6#7%%\"aG%\"bG%\"cG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "m ap(eval,S);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'VECTORG6#7%\"\"!F'% \"cG" }}}{PARA 0 "" 0 "" {TEXT -1 244 "Last-name evaluation is usually not a problem, and can have significant benefits in efficiency by avo iding the copying of large tables or arrays. However, there are some \+ points to watch out for. One is that at first glance it may appear th at " }{MPLTEXT 0 21 1 "T" }{TEXT -1 42 " has not been assigned a value . Even the " }{MPLTEXT 0 21 8 "whattype" }{TEXT -1 29 " function does not help here:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "whattype( T);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%'stringG" }}}{PARA 0 "" 0 "" {TEXT -1 21 "Instead, you can use " }{MPLTEXT 0 21 8 "assigned" } {TEXT -1 31 ". Of course you could also use " }{MPLTEXT 0 21 7 "eval(T )" }{TEXT -1 1 "." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "assigne d(T);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%%trueG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "whattype(eval(T));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%&arrayG" }}}{PARA 0 "" 0 "" {TEXT -1 31 "Another commo n problem is that " }{MPLTEXT 0 21 4 "subs" }{TEXT -1 108 " will not s ee the table, array or procedure structure, but only the name. Again, you can fix this by using " }{MPLTEXT 0 21 4 "eval" }{TEXT -1 1 "." } }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "subs(c=4, S);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#%\"TG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "subs(c=4, eval(S));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'VECTORG6 #7%%\"aG%\"bG\"\"%" }}}}{PARA 3 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 9 "See also:" }{TEXT -1 1 " " }{HYPERLNK 17 "array " 2 "array" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "assigned" 2 "assigned" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "eval" 2 "eval" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "procedure" 2 "procedure" "" }{TEXT -1 2 ", " } {HYPERLNK 17 "table" 2 "table" "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {SECT 0 {PARA 0 "" 0 "" {TEXT 26 24 "Maple Advisor Database, " }{TEXT -1 15 " R. Israel 1997" }}}}{MARK "2 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }