<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Plotting Values from a Loop</title>
    <link>http://www.mapleprimes.com/questions/35615-Plotting-Values-From-A-Loop</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Wed, 10 Jun 2026 17:49:26 GMT</lastBuildDate>
    <pubDate>Wed, 10 Jun 2026 17:49:26 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Plotting Values from a Loop</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Plotting Values from a Loop</title>
      <link>http://www.mapleprimes.com/questions/35615-Plotting-Values-From-A-Loop</link>
    </image>
    <item>
      <title>Some possibilities</title>
      <link>http://www.mapleprimes.com/questions/35615-Plotting-Values-From-A-Loop?ref=Feed:MaplePrimes:Plotting Values from a Loop:Comments#answer44470</link>
      <itunes:summary>&lt;p&gt;If you want to do with your for loop you could do something like the following&lt;/p&gt;
&lt;p&gt;&amp;gt; result:=[]:&lt;br /&gt;
&amp;gt; for i from 0 to 25 do assign('result',[op(result),[i,evalf(eval(eq2,t=i))]]) end do:&lt;/p&gt;
&lt;p&gt;Now to plot these results you can just call&lt;/p&gt;
&lt;p&gt;&amp;gt; plots:-pointplot(result);&lt;/p&gt;
&lt;p&gt;You may also find that the for loop isn't the most effecient for all your tasks, for example you could use the &lt;a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=seq&amp;amp;term=seq"&gt;seq&lt;/a&gt; command to do the same thing in this way&lt;/p&gt;
&lt;p&gt;&amp;gt; result:= [seq([i,evalf(eval(eq2,t=i))], i=0..25)];&lt;br /&gt;
&amp;gt; plots:-pointplot(result);&lt;/p&gt;
&lt;p&gt;Since you have such a small number of points you are evaluating at, you may not notice too much of an improvement, but as you get to a larger number of points you may want to try this.&lt;/p&gt;
&lt;p&gt;Scott&lt;br /&gt;
Application Developer&lt;br /&gt;
Maplesoft&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;If you want to do with your for loop you could do something like the following&lt;/p&gt;
&lt;p&gt;&amp;gt; result:=[]:&lt;br /&gt;
&amp;gt; for i from 0 to 25 do assign('result',[op(result),[i,evalf(eval(eq2,t=i))]]) end do:&lt;/p&gt;
&lt;p&gt;Now to plot these results you can just call&lt;/p&gt;
&lt;p&gt;&amp;gt; plots:-pointplot(result);&lt;/p&gt;
&lt;p&gt;You may also find that the for loop isn't the most effecient for all your tasks, for example you could use the &lt;a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=seq&amp;amp;term=seq"&gt;seq&lt;/a&gt; command to do the same thing in this way&lt;/p&gt;
&lt;p&gt;&amp;gt; result:= [seq([i,evalf(eval(eq2,t=i))], i=0..25)];&lt;br /&gt;
&amp;gt; plots:-pointplot(result);&lt;/p&gt;
&lt;p&gt;Since you have such a small number of points you are evaluating at, you may not notice too much of an improvement, but as you get to a larger number of points you may want to try this.&lt;/p&gt;
&lt;p&gt;Scott&lt;br /&gt;
Application Developer&lt;br /&gt;
Maplesoft&lt;/p&gt;</description>
      <guid>44470</guid>
      <pubDate>Mon, 01 Mar 2010 20:22:12 Z</pubDate>
      <itunes:author>Scott03</itunes:author>
      <author>Scott03</author>
    </item>
    <item>
      <title>Good ideas</title>
      <link>http://www.mapleprimes.com/questions/35615-Plotting-Values-From-A-Loop?ref=Feed:MaplePrimes:Plotting Values from a Loop:Comments#answer44469</link>
      <itunes:summary>&lt;p&gt;The seq command you suggested is a better way of displaying the data, so thanks.&lt;/p&gt;
&lt;p&gt;However i still cant figure out how to draw a graph of n(t) vs t. What commands should i be using&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;The seq command you suggested is a better way of displaying the data, so thanks.&lt;/p&gt;
&lt;p&gt;However i still cant figure out how to draw a graph of n(t) vs t. What commands should i be using&lt;/p&gt;</description>
      <guid>44469</guid>
      <pubDate>Mon, 01 Mar 2010 22:23:45 Z</pubDate>
      <itunes:author>contact_petersen</itunes:author>
      <author>contact_petersen</author>
    </item>
    <item>
      <title>pointplot</title>
      <link>http://www.mapleprimes.com/questions/35615-Plotting-Values-From-A-Loop?ref=Feed:MaplePrimes:Plotting Values from a Loop:Comments#answer44468</link>
      <itunes:summary>&lt;p&gt;How do you want this graph to look like?&amp;nbsp; The &lt;a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=plots/pointplot&amp;amp;term=plots,pointplot"&gt;plots:-pointplot&lt;/a&gt; command will take the list of points (which is your n(t) vs t) and output the points on the plot.&amp;nbsp; If you want to connect a line between the points, you can use the connect=true option.&lt;/p&gt;
&lt;p&gt;Scott&lt;br /&gt;
Application Developer&lt;br /&gt;
Maplesoft&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;How do you want this graph to look like?&amp;nbsp; The &lt;a href="http://www.maplesoft.com/support/help/AddOns/view.aspx?path=plots/pointplot&amp;amp;term=plots,pointplot"&gt;plots:-pointplot&lt;/a&gt; command will take the list of points (which is your n(t) vs t) and output the points on the plot.&amp;nbsp; If you want to connect a line between the points, you can use the connect=true option.&lt;/p&gt;
&lt;p&gt;Scott&lt;br /&gt;
Application Developer&lt;br /&gt;
Maplesoft&lt;/p&gt;</description>
      <guid>44468</guid>
      <pubDate>Tue, 02 Mar 2010 00:20:30 Z</pubDate>
      <itunes:author>Scott03</itunes:author>
      <author>Scott03</author>
    </item>
    <item>
      <title>cant see whats wrong</title>
      <link>http://www.mapleprimes.com/questions/35615-Plotting-Values-From-A-Loop?ref=Feed:MaplePrimes:Plotting Values from a Loop:Comments#answer44471</link>
      <itunes:summary>It seems not to want to plot the values i cant tell what i have done wrong. 
Heres the entire document.
&gt; eq1 := diff(n(t), t)+lambda*n(t) = 0;
                        / d      \                  
                        |--- n(t)| + lambda n(t) = 0
                        \ dt     /                  
&gt; eq2 := dsolve([subs(lambda = .1, eq1), n(0) = 10]);
                                         /  1   \
                            n(t) = 10 exp|- -- t|
                                         \  10  /
&gt; f(i) :=evalf(eval(eq2,t=i));
i -&gt; evalf(eval(eq2, t = i))
&gt; result := seq([i, f(i)], i = 0 .. 25);
[0, n(0) = 10.], [1, n(1) = 9.048374180], [2, n(2) = 8.187307531], 

  [3, n(3) = 7.408182207], [4, n(4) = 6.703200460], [5, n(5) = 6.065306597], 

  [6, n(6) = 5.488116361], [7, n(7) = 4.965853038], [8, n(8) = 4.493289641], 

  [9, n(9) = 4.065696597], [10, n(10) = 3.678794412], 

  [11, n(11) = 3.328710837], [12, n(12) = 3.011942119], 

  [13, n(13) = 2.725317930], [14, n(14) = 2.465969639], 

  [15, n(15) = 2.231301601], [16, n(16) = 2.018965180], 

  [17, n(17) = 1.826835241], [18, n(18) = 1.652988882], 

  [19, n(19) = 1.495686192], [20, n(20) = 1.353352832], 

  [21, n(21) = 1.224564283], [22, n(22) = 1.108031584], 

  [23, n(23) = 1.002588437], [24, n(24) = 0.9071795329], 

  [25, n(25) = 0.8208499862]
&gt; with(plots);
&gt; pointplot(result);
Error, (in plots/pointplot) incorrect first argument
&gt; 
</itunes:summary>
      <description>It seems not to want to plot the values i cant tell what i have done wrong. 
Heres the entire document.
&gt; eq1 := diff(n(t), t)+lambda*n(t) = 0;
                        / d      \                  
                        |--- n(t)| + lambda n(t) = 0
                        \ dt     /                  
&gt; eq2 := dsolve([subs(lambda = .1, eq1), n(0) = 10]);
                                         /  1   \
                            n(t) = 10 exp|- -- t|
                                         \  10  /
&gt; f(i) :=evalf(eval(eq2,t=i));
i -&gt; evalf(eval(eq2, t = i))
&gt; result := seq([i, f(i)], i = 0 .. 25);
[0, n(0) = 10.], [1, n(1) = 9.048374180], [2, n(2) = 8.187307531], 

  [3, n(3) = 7.408182207], [4, n(4) = 6.703200460], [5, n(5) = 6.065306597], 

  [6, n(6) = 5.488116361], [7, n(7) = 4.965853038], [8, n(8) = 4.493289641], 

  [9, n(9) = 4.065696597], [10, n(10) = 3.678794412], 

  [11, n(11) = 3.328710837], [12, n(12) = 3.011942119], 

  [13, n(13) = 2.725317930], [14, n(14) = 2.465969639], 

  [15, n(15) = 2.231301601], [16, n(16) = 2.018965180], 

  [17, n(17) = 1.826835241], [18, n(18) = 1.652988882], 

  [19, n(19) = 1.495686192], [20, n(20) = 1.353352832], 

  [21, n(21) = 1.224564283], [22, n(22) = 1.108031584], 

  [23, n(23) = 1.002588437], [24, n(24) = 0.9071795329], 

  [25, n(25) = 0.8208499862]
&gt; with(plots);
&gt; pointplot(result);
Error, (in plots/pointplot) incorrect first argument
&gt; 
</description>
      <guid>44471</guid>
      <pubDate>Wed, 10 Mar 2010 04:53:35 Z</pubDate>
      <itunes:author>contact_peterson</itunes:author>
      <author>contact_peterson</author>
    </item>
    <item>
      <title>yes</title>
      <link>http://www.mapleprimes.com/questions/35615-Plotting-Values-From-A-Loop?ref=Feed:MaplePrimes:Plotting Values from a Loop:Comments#answer44473</link>
      <itunes:summary>that has solved the first argument problem, however i must still have made a mistake somewhere because it still doesnt want to plot, what am i doing wrong.

&gt; points := seq([i, rhs(f(i))], i = 0 .. 25);
[0, 10.], [1, 9.048374180], [2, 8.187307531], [3, 7.408182207], 

  [4, 6.703200460], [5, 6.065306597], [6, 5.488116361], [7, 4.965853038], 

  [8, 4.493289641], [9, 4.065696597], [10, 3.678794412], [11, 3.328710837], 

  [12, 3.011942119], [13, 2.725317930], [14, 2.465969639], [15, 2.231301601], 

  [16, 2.018965180], [17, 1.826835241], [18, 1.652988882], [19, 1.495686192], 

  [20, 1.353352832], [21, 1.224564283], [22, 1.108031584], [23, 1.002588437], 

  [24, 0.9071795329], [25, 0.8208499862]

&gt; with(plots);

&gt; pointplot(points);

Error, (in plot/options2d) unexpected options: [[3, 7.408182207], [4, 6.703200460], [5, 6.065306597], [6, 5.488116361], [7, 4.965853038], [8, 4.493289641], [9, 4.065696597], [10, 3.678794412], [11, 3.328710837], [12, 3.011942119], [13, 2.725317930], [14, 2.465969639], [15, 2.231301601], [16, 2.018965180], [17, 1.826835241], [18, 1.652988882], [19, 1.495686192], [20, 1.353352832], [21, 1.224564283], [22, 1.108031584], [23, 1.002588437], [24, .9071795329], [25, .8208499862]]
&gt; 
</itunes:summary>
      <description>that has solved the first argument problem, however i must still have made a mistake somewhere because it still doesnt want to plot, what am i doing wrong.

&gt; points := seq([i, rhs(f(i))], i = 0 .. 25);
[0, 10.], [1, 9.048374180], [2, 8.187307531], [3, 7.408182207], 

  [4, 6.703200460], [5, 6.065306597], [6, 5.488116361], [7, 4.965853038], 

  [8, 4.493289641], [9, 4.065696597], [10, 3.678794412], [11, 3.328710837], 

  [12, 3.011942119], [13, 2.725317930], [14, 2.465969639], [15, 2.231301601], 

  [16, 2.018965180], [17, 1.826835241], [18, 1.652988882], [19, 1.495686192], 

  [20, 1.353352832], [21, 1.224564283], [22, 1.108031584], [23, 1.002588437], 

  [24, 0.9071795329], [25, 0.8208499862]

&gt; with(plots);

&gt; pointplot(points);

Error, (in plot/options2d) unexpected options: [[3, 7.408182207], [4, 6.703200460], [5, 6.065306597], [6, 5.488116361], [7, 4.965853038], [8, 4.493289641], [9, 4.065696597], [10, 3.678794412], [11, 3.328710837], [12, 3.011942119], [13, 2.725317930], [14, 2.465969639], [15, 2.231301601], [16, 2.018965180], [17, 1.826835241], [18, 1.652988882], [19, 1.495686192], [20, 1.353352832], [21, 1.224564283], [22, 1.108031584], [23, 1.002588437], [24, .9071795329], [25, .8208499862]]
&gt; 
</description>
      <guid>44473</guid>
      <pubDate>Wed, 10 Mar 2010 07:04:51 Z</pubDate>
      <itunes:author>contact_peterson</itunes:author>
      <author>contact_peterson</author>
    </item>
    <item>
      <title>yep</title>
      <link>http://www.mapleprimes.com/questions/35615-Plotting-Values-From-A-Loop?ref=Feed:MaplePrimes:Plotting Values from a Loop:Comments#answer44475</link>
      <itunes:summary>yes it was that simple, thanks everyone for helping me out.
sorry for being such an idiot.</itunes:summary>
      <description>yes it was that simple, thanks everyone for helping me out.
sorry for being such an idiot.</description>
      <guid>44475</guid>
      <pubDate>Wed, 10 Mar 2010 21:15:32 Z</pubDate>
      <itunes:author>contact_peterson</itunes:author>
      <author>contact_peterson</author>
    </item>
  </channel>
</rss>