Đó cũng là một chuỗi đặc biệt gọi là dãy null. Đây là một chuỗi không có yếu tố, nhiều càng tập rỗng trong lý thuyết tập hợp là tập hợp không có yếu tố. Trình tự trống trong Maple được tham chiếu bởi từ khoá NULL. Như vậy, đưa dãy không theo bất kỳ thứ tự không thay đổi trình tự ở tất cả. > NULL, a, b, c; a, b, c, NULL; a, b, NULL, c a, b, c a, b, c a, b, cSử dụng một chuỗi không cho phép một danh sách để được xây dựng bởi các bộ phận trong một biến, một chútnhư biến tất cả vào tiểu mục trước đó.. > S: = NULL . > S: = S, a, b, c. > S: S, d, e = S: =S: = a, b, cS: = a, b, c, d, e Nếu chúng tôi muốn tạo ra một trình tự sau một mô hình khá dự đoán được, chúng tôi có một lệnh tiện dụng, và In ra các hình vuông mười lần đầu tiên chúng tôi chỉ đơn giản là đầu vào. > seq (k2, k = 1..10)1, 4, 9, 16, 25, 36, 49, 64, 81, 100hoặc cho một cái gì đó nhiều hơn một chút phức tạp. 2 k. > seq 3 • k + 2, k = 4..15 15550, 2, 111, 3012, 196, 4952, 305, 7372, 438, 10272, 595,b 1365 2 Nói chung, có Maple in ra chuỗi {xn} n = một chúng tôi sử dụng lệnhseq (xn, n = một.. b). là có một phím tắt có thể được áp dụng nếu chúng ta muốn lặp lại cùng mộtthuật ngữ nhiều lần, mà sẽ có ích khi chúng tôi làm một số tính toán. Để làm điều này, chúng tôi sử dụng các nhà điều hành chuỗi ($).. > x$ 4x, x, x, xNhà điều hành chuỗi này có thể được sử dụng như một phím tắt để lệnh seq, nhưng được cảnh báo rằng nó không phải là khá linh hoạt như seq lệnh (xem bài tập 5 và 6).Nếu chúng tôi có một chuỗi, chúng tôi có thể sử dụng chỉ là một subsequence của nó, hoặc có lẽ chỉ là một yếu tố duy nhất. Maple cho phép điều này thông qua chỉ mục bằng cách sử dụng [] nhà điều hành chỉ mục, hoặc subscripting trong trình soạn thảo đồ họa. Được cảnh báo, subscripting là viết tắt cho các nhà điều hành quảng trường khung. Nếu không chắc chắn, sử dụng dấu ngoặc vuông. Đối với subsequences, chúng tôi cũng sử dụng các nhà điều hành phạm vi (.).. > S: = seq (k2, k = 1..10);S: = 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 > S [3]; S4;16 8 lý thuyết số 1 > S [5..8]; S3... 7 > S [.. 4]; S.. 3; S [6...]; S7... 25, 36, 49, 649, 16, 25, 36, 491, 4, 9, 161, 4, 936, 49, 64, 81, 10049, 64, 81, 100 Trong ví dụ sau, "một nửa dãy"... n và m... có nghĩa là "các yếu tố n đầu tiên" và "từ mth cho phần tử cuối cùng," tương ứng. Khái niệm như vậy có ý nghĩa bởi vì chúng tôi lập chỉ mục một chuỗi có chứa chỉ là một số hữu hạn các yếu tố. Một cách thay thế của tư duy của các phạm vi này là để xem xét Maple tự động chèn vào đầu hoặc các chỉ số kết thúc cho số phù hợp.Chúng tôi bây giờ nhìn vào hai khái niệm có liên quan đến trình tự: danh sách và trình bày. Cú pháp, một danh sách hoặc tập hợp là chỉ một chuỗi các đính kèm trong [] hoặc (), tương ứng. Bộ được phân loại và bỏ quaduplication, as should be expected by the reader familiar with elementary set theory. Lists are ordered and allow duplications. Both lists and sets can be nested, which makes them distinct in behavior from sequences. Lists and sets are also useful for removing ambiguity when trying to have a function recognize a sequence as a single input, an example of which can be seen in Exercise 14. > L := [1, 1, 2, 2, 3, 3, 4, 4]; S := {1, 1, 2, 2, 3, 3, 4, 4} > [L, S]; {L, S} L := [1, 1, 2, 2, 3, 3, 4, 4]S := {1, 2, 3, 4}[[1, 1, 2, 2, 3, 3, 4, 4], {1, 2, 3, 4}]{[1, 1, 2, 2, 3, 3, 4, 4], {1, 2, 3, 4}} Lists and sets may be indexed exactly as with a sequence, with the difference that if a range (using the .. operator) is given for the index, then a list or set, respectively, is produced. Indexing a single element produces only the element as with a sequence. > L[1], L2, S[3], S4 . > L[3..5], L..3, S[3..], S2..3 1, 1, 2, 2[2, 2, 3], [1, 1, 2], {3, 4}, {2, 3} Observe that in the above two examples we have used a sequence to display the results of the calculations on a single line.If we wish to know whether a list or a set contains a particular element, we may use the in operator. This may be thought of as being the ∈ operator, and is even printedas such in Maple.. > 1 in S1 ∈ SThis command on its own does nothing but write itself out again with the elementsymbol. In order to have Maple actually tell us whether 1 ∈ S (in the above case) then we need to use the is or evalb commands. We saw is in Section 1.1.3. Both functionsreturn a value of either true or false. In fact the function evalb is short for “evaluateas Boolean” where a Boolean value is either true or false.
đang được dịch, vui lòng đợi..