<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Add further elements to a previously created array?</title>
    <link>http://www.mapleprimes.com/questions/35711-Add-Further-Elements-To-A-Previously</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Fri, 12 Jun 2026 19:14:25 GMT</lastBuildDate>
    <pubDate>Fri, 12 Jun 2026 19:14:25 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Add further elements to a previously created array?</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Add further elements to a previously created array?</title>
      <link>http://www.mapleprimes.com/questions/35711-Add-Further-Elements-To-A-Previously</link>
    </image>
    <item>
      <title>Array</title>
      <link>http://www.mapleprimes.com/questions/35711-Add-Further-Elements-To-A-Previously?ref=Feed:MaplePrimes:Add further elements to a previously created array?:Comments#answer44820</link>
      <itunes:summary>&lt;p&gt;Note that below I use an &lt;b&gt;Array &lt;/b&gt;(capitalized).&lt;/p&gt;
&lt;pre&gt;
&amp;gt; X:=Array(3): # originally with 3 elements only

&amp;gt; for i from 1 to 5 do
&amp;gt;  X(i):=i^2;
&amp;gt; end do:

&amp;gt; X; # using Maple 13, X can be &amp;quot;grown&amp;quot; to be of length 5
                        [1 4 9 16 25]
&lt;/pre&gt;
&lt;p&gt;In much older versions of Maple, I would not have been able to grow X in size, and would have been limited to its original 3 entry spots. And I would have had to use the syntax X[i]:=... instead of X(i):=... &lt;/p&gt;
&lt;p&gt;I could also have used a &lt;b&gt;table&lt;/b&gt; structure, which is yet another type of mutable structure with an open-ended number of entries.&lt;/p&gt;
&lt;p&gt;Note also that X was &lt;i&gt;not &lt;/i&gt;created using &lt;b&gt;X:=[...]&lt;/b&gt; as that would have created a &lt;b&gt;list &lt;/b&gt;rather than an Array. See &lt;a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=MaplePortal%2fTutorial6"&gt;here &lt;/a&gt; for a bit more about comparison between Maple's data structures.&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Note that below I use an &lt;b&gt;Array &lt;/b&gt;(capitalized).&lt;/p&gt;
&lt;pre&gt;
&amp;gt; X:=Array(3): # originally with 3 elements only

&amp;gt; for i from 1 to 5 do
&amp;gt;  X(i):=i^2;
&amp;gt; end do:

&amp;gt; X; # using Maple 13, X can be &amp;quot;grown&amp;quot; to be of length 5
                        [1 4 9 16 25]
&lt;/pre&gt;
&lt;p&gt;In much older versions of Maple, I would not have been able to grow X in size, and would have been limited to its original 3 entry spots. And I would have had to use the syntax X[i]:=... instead of X(i):=... &lt;/p&gt;
&lt;p&gt;I could also have used a &lt;b&gt;table&lt;/b&gt; structure, which is yet another type of mutable structure with an open-ended number of entries.&lt;/p&gt;
&lt;p&gt;Note also that X was &lt;i&gt;not &lt;/i&gt;created using &lt;b&gt;X:=[...]&lt;/b&gt; as that would have created a &lt;b&gt;list &lt;/b&gt;rather than an Array. See &lt;a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=MaplePortal%2fTutorial6"&gt;here &lt;/a&gt; for a bit more about comparison between Maple's data structures.&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>44820</guid>
      <pubDate>Tue, 16 Feb 2010 18:57:20 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>Hi, sorry I did mean a list</title>
      <link>http://www.mapleprimes.com/questions/35711-Add-Further-Elements-To-A-Previously?ref=Feed:MaplePrimes:Add further elements to a previously created array?:Comments#answer44821</link>
      <itunes:summary>&lt;p&gt;Hi, sorry I did mean a list not an array. (It was easier to do it that way)&lt;/p&gt;
&lt;p&gt;I managed to figure it out, in case anyone else is interested I used&lt;br /&gt;
N:=[op(N),a] to add a onto my list of elements.&lt;/p&gt;
&lt;p&gt;Thankyou for your help though.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Hi, sorry I did mean a list not an array. (It was easier to do it that way)&lt;/p&gt;
&lt;p&gt;I managed to figure it out, in case anyone else is interested I used&lt;br /&gt;
N:=[op(N),a] to add a onto my list of elements.&lt;/p&gt;
&lt;p&gt;Thankyou for your help though.&lt;/p&gt;</description>
      <guid>44821</guid>
      <pubDate>Wed, 17 Feb 2010 03:49:29 Z</pubDate>
      <itunes:author>plummie</itunes:author>
      <author>plummie</author>
    </item>
    <item>
      <title>can you increase the size of an array</title>
      <link>http://www.mapleprimes.com/questions/35711-Add-Further-Elements-To-A-Previously?ref=Feed:MaplePrimes:Add further elements to a previously created array?:Comments#answer44824</link>
      <itunes:summary>&lt;p&gt;Can you increase the size of array or&amp;nbsp;Matrix&amp;nbsp;without changing it's contents?&amp;nbsp; I seem to recall reading something somewhere in the last two weeks&amp;nbsp;on this exact topic, I am unable to find it.&amp;nbsp; Is there a way?&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Can you increase the size of array or&amp;nbsp;Matrix&amp;nbsp;without changing it's contents?&amp;nbsp; I seem to recall reading something somewhere in the last two weeks&amp;nbsp;on this exact topic, I am unable to find it.&amp;nbsp; Is there a way?&lt;/p&gt;</description>
      <guid>44824</guid>
      <pubDate>Wed, 17 Feb 2010 22:18:30 Z</pubDate>
      <itunes:author>Christopher2222</itunes:author>
      <author>Christopher2222</author>
    </item>
    <item>
      <title>expansion</title>
      <link>http://www.mapleprimes.com/questions/35711-Add-Further-Elements-To-A-Previously?ref=Feed:MaplePrimes:Add further elements to a previously created array?:Comments#answer44826</link>
      <itunes:summary>&lt;p&gt;ooops yes,&amp;nbsp;scanned it too quickly.&amp;nbsp; Thanks yes the maple 12 page was exactly where I saw it.&lt;/p&gt;
&lt;p&gt;a:=Matrix([m1,m2,m3,m4]);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [m1,m2,m3,m4]&lt;br /&gt;
&lt;br /&gt;
a(1,9):=m9:&lt;br /&gt;
a;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ m1 , m2 , m3 , m4 , 0&amp;nbsp;, 0 , 0 , 0 , m9 ]&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
To better reference&amp;nbsp;the location with&amp;nbsp;some nice&amp;nbsp;examples.&amp;nbsp; It is located here, linked from the page that was referenced:&amp;nbsp;&amp;nbsp;&lt;a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=rtable_indexing"&gt;http://www.maplesoft.com/support/help/AddOns/view.aspx?path=rtable_indexing&lt;/a&gt;&amp;nbsp;with&amp;nbsp;the&amp;nbsp;heading indexing&amp;nbsp;Arrays, Matricies, and Vectors.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The maple help system is a little broken up and segmented,&amp;nbsp;sometimes the answer is&amp;nbsp;burried deep into an unknown category totally unrelated and&amp;nbsp;sometimes never in a location&amp;nbsp;you might think it should&amp;nbsp;be.&amp;nbsp;&amp;nbsp;Just&amp;nbsp;one of the interesting and sometimes hairpulling quirks&amp;nbsp;in Maple... &amp;quot;hmm now where did I see that example again?&amp;quot;&amp;nbsp; I've had that&amp;nbsp;happen actually a number of times and not always easy to find my answer, sometimes Mapleprimes is the best&amp;nbsp;and fastest way to get the answer. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;ooops yes,&amp;nbsp;scanned it too quickly.&amp;nbsp; Thanks yes the maple 12 page was exactly where I saw it.&lt;/p&gt;
&lt;p&gt;a:=Matrix([m1,m2,m3,m4]);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [m1,m2,m3,m4]&lt;br /&gt;
&lt;br /&gt;
a(1,9):=m9:&lt;br /&gt;
a;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ m1 , m2 , m3 , m4 , 0&amp;nbsp;, 0 , 0 , 0 , m9 ]&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
To better reference&amp;nbsp;the location with&amp;nbsp;some nice&amp;nbsp;examples.&amp;nbsp; It is located here, linked from the page that was referenced:&amp;nbsp;&amp;nbsp;&lt;a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=rtable_indexing"&gt;http://www.maplesoft.com/support/help/AddOns/view.aspx?path=rtable_indexing&lt;/a&gt;&amp;nbsp;with&amp;nbsp;the&amp;nbsp;heading indexing&amp;nbsp;Arrays, Matricies, and Vectors.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The maple help system is a little broken up and segmented,&amp;nbsp;sometimes the answer is&amp;nbsp;burried deep into an unknown category totally unrelated and&amp;nbsp;sometimes never in a location&amp;nbsp;you might think it should&amp;nbsp;be.&amp;nbsp;&amp;nbsp;Just&amp;nbsp;one of the interesting and sometimes hairpulling quirks&amp;nbsp;in Maple... &amp;quot;hmm now where did I see that example again?&amp;quot;&amp;nbsp; I've had that&amp;nbsp;happen actually a number of times and not always easy to find my answer, sometimes Mapleprimes is the best&amp;nbsp;and fastest way to get the answer. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;</description>
      <guid>44826</guid>
      <pubDate>Sat, 27 Feb 2010 07:20:07 Z</pubDate>
      <itunes:author>Christopher2222</itunes:author>
      <author>Christopher2222</author>
    </item>
    <item>
      <title>Inefficient</title>
      <link>http://www.mapleprimes.com/questions/35711-Add-Further-Elements-To-A-Previously?ref=Feed:MaplePrimes:Add further elements to a previously created array?:Comments#comment44822</link>
      <itunes:summary>&lt;p&gt;That does work, but it is inefficient, because the whole list must be recreated to add one element.&amp;nbsp; This may begin to get significant when the number of elements gets into the thousands.&amp;nbsp; For example:&lt;/p&gt;
&lt;pre&gt;
&amp;gt; ti:= time():
&amp;nbsp;A:= &amp;lt;1&amp;gt;:
&amp;nbsp;for i from 2 to 30000 do A(i):= i end do:
&amp;nbsp;time()-ti;

     .032
&lt;/pre&gt;
&lt;pre&gt;
&amp;gt; ti:= time():
&amp;nbsp;L:= [1]:
&amp;nbsp;for i from 2 to 30000 do L:= [op(L),i] end do:
&amp;nbsp;time()-ti;
&lt;/pre&gt;
&lt;pre&gt;
    10.967
&lt;/pre&gt;
&lt;p&gt;Building an Array of size 30000 by adding one element at a time took only .032 seconds on my machine.&amp;nbsp; The same thing with a list took 10.967 seconds.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;That does work, but it is inefficient, because the whole list must be recreated to add one element.&amp;nbsp; This may begin to get significant when the number of elements gets into the thousands.&amp;nbsp; For example:&lt;/p&gt;
&lt;pre&gt;
&amp;gt; ti:= time():
&amp;nbsp;A:= &amp;lt;1&amp;gt;:
&amp;nbsp;for i from 2 to 30000 do A(i):= i end do:
&amp;nbsp;time()-ti;

     .032
&lt;/pre&gt;
&lt;pre&gt;
&amp;gt; ti:= time():
&amp;nbsp;L:= [1]:
&amp;nbsp;for i from 2 to 30000 do L:= [op(L),i] end do:
&amp;nbsp;time()-ti;
&lt;/pre&gt;
&lt;pre&gt;
    10.967
&lt;/pre&gt;
&lt;p&gt;Building an Array of size 30000 by adding one element at a time took only .032 seconds on my machine.&amp;nbsp; The same thing with a list took 10.967 seconds.&lt;/p&gt;</description>
      <guid>44822</guid>
      <pubDate>Wed, 17 Feb 2010 04:21:39 Z</pubDate>
      <itunes:author>Robert Israel</itunes:author>
      <author>Robert Israel</author>
    </item>
    <item>
      <title>which is a shame</title>
      <link>http://www.mapleprimes.com/questions/35711-Add-Further-Elements-To-A-Previously?ref=Feed:MaplePrimes:Add further elements to a previously created array?:Comments#comment44823</link>
      <itunes:summary>&lt;p&gt;And that is a shame, because as far as efficiency goes you've almost certainly chosen a suboptimal structure and method. Every time you add an element you create a new list, which involves overhead for creation, possibly simultaneous storage, and eventual garbage collection (memory management). For example, it can make a task that optimally uses linear storage have quadratic memory use, with potential for worse effects in performance due to memory management needs. It is perhaps one of the more famous of less desirable programming techniques (in Maple).&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;And that is a shame, because as far as efficiency goes you've almost certainly chosen a suboptimal structure and method. Every time you add an element you create a new list, which involves overhead for creation, possibly simultaneous storage, and eventual garbage collection (memory management). For example, it can make a task that optimally uses linear storage have quadratic memory use, with potential for worse effects in performance due to memory management needs. It is perhaps one of the more famous of less desirable programming techniques (in Maple).&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>44823</guid>
      <pubDate>Wed, 17 Feb 2010 04:27:56 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
  </channel>
</rss>