<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: A sin function with various number of iterations in each cycle in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495749#M177640</link>
    <description>&lt;P&gt;Try a function like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LM_20171231_SineCycles1.png" style="width: 642px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/3946iC4767C21F97D5982/image-size/large?v=v2&amp;amp;px=999" role="button" title="LM_20171231_SineCycles1.png" alt="LM_20171231_SineCycles1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Where the third argument (PointsPerCycle) can be a scalar or an array, that determines the number of points per cycle.&lt;/P&gt;
&lt;P&gt;Here you see it called in both modes:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LM_20171231_SineCycles2.png" style="width: 729px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/3947i39A66FBD4C062003/image-size/large?v=v2&amp;amp;px=999" role="button" title="LM_20171231_SineCycles2.png" alt="LM_20171231_SineCycles2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And the resulting plots are:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LM_20171231_SineCycles3.png" style="width: 733px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/3948i62E3F887807A04DB/image-size/large?v=v2&amp;amp;px=999" role="button" title="LM_20171231_SineCycles3.png" alt="LM_20171231_SineCycles3.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see for the first cycle (15 points per cycle) the two point sets coincide.&lt;/P&gt;
&lt;P&gt;For the second cycle there are more boxes than x-es, in the third and following cycles there are twice as many boxes as there are x-es.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Success!&lt;BR /&gt;Luc&lt;/P&gt;</description>
    <pubDate>Sun, 31 Dec 2017 00:24:24 GMT</pubDate>
    <dc:creator>LucMeekes</dc:creator>
    <dc:date>2017-12-31T00:24:24Z</dc:date>
    <item>
      <title>A sin function with various number of iterations in each cycle</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495745#M177639</link>
      <description>&lt;P&gt;Hello everyone. I wonder how to have a sin function with 3&amp;nbsp; cycles (or more) that each cycle of it has different number of iterations. For example, I want iteration steps to be 1 in the first cycle and decrease to 0.5 in the second and third cycles (without decreasing or increasing the number of cycles).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Physical Mathematics&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 13:20:53 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495745#M177639</guid>
      <dc:creator>mzarrabi</dc:creator>
      <dc:date>2018-05-03T13:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: A sin function with various number of iterations in each cycle</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495749#M177640</link>
      <description>&lt;P&gt;Try a function like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LM_20171231_SineCycles1.png" style="width: 642px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/3946iC4767C21F97D5982/image-size/large?v=v2&amp;amp;px=999" role="button" title="LM_20171231_SineCycles1.png" alt="LM_20171231_SineCycles1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Where the third argument (PointsPerCycle) can be a scalar or an array, that determines the number of points per cycle.&lt;/P&gt;
&lt;P&gt;Here you see it called in both modes:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LM_20171231_SineCycles2.png" style="width: 729px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/3947i39A66FBD4C062003/image-size/large?v=v2&amp;amp;px=999" role="button" title="LM_20171231_SineCycles2.png" alt="LM_20171231_SineCycles2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And the resulting plots are:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LM_20171231_SineCycles3.png" style="width: 733px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/3948i62E3F887807A04DB/image-size/large?v=v2&amp;amp;px=999" role="button" title="LM_20171231_SineCycles3.png" alt="LM_20171231_SineCycles3.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see for the first cycle (15 points per cycle) the two point sets coincide.&lt;/P&gt;
&lt;P&gt;For the second cycle there are more boxes than x-es, in the third and following cycles there are twice as many boxes as there are x-es.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Success!&lt;BR /&gt;Luc&lt;/P&gt;</description>
      <pubDate>Sun, 31 Dec 2017 00:24:24 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495749#M177640</guid>
      <dc:creator>LucMeekes</dc:creator>
      <dc:date>2017-12-31T00:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: A sin function with various number of iterations in each cycle</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495760#M177641</link>
      <description>&lt;P&gt;That is exactly what I am looking for. Thank you so much&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/14826"&gt;@LucMeekes&lt;/a&gt;&amp;nbsp;for that. I just don't&amp;nbsp;understand some part of it, especially the first line. Actually, I have never used "not boolean operator". Beside that, you are using an "if" statement without&amp;nbsp;using an "otherwise" part for that. Also, what is the role of setting "Origin" to "r" in the middle of the function? Would you be so kind to briefly&amp;nbsp;explain these?&amp;nbsp; Best,&lt;/P&gt;</description>
      <pubDate>Sun, 31 Dec 2017 23:22:33 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495760#M177641</guid>
      <dc:creator>mzarrabi</dc:creator>
      <dc:date>2017-12-31T23:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: A sin function with various number of iterations in each cycle</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495769#M177642</link>
      <description>&lt;P&gt;The first line just asks if the parameter PointsPerCycle is an array (a vector) rather than a scalar. IF that is not the case, the statements of the body of the IF-statment are executed. This is a simple case with a constant number of points per cycle, for each cycle the same value. At the end of the IF, the resulting matrix with the x- and y-data is returned by the function. The function ends here.&lt;/P&gt;
&lt;P&gt;IF PointsPerCycle is an array, the body of the IF statement is not executed, but execution continues after the IF statement with the first assignment to r (which is used as the index to the matrix R) I preset it to ORIGIN. ORIGIN is a worksheet variable that points to the first element of an array (or first row and first column of a matrix). ORIGIN is usually set to 0, but you can set it to other values, the most common of which is 1. I want my functions to operate with any valye of ORIGIN (= be independent of the actual value of ORIGIN), hence I use its value, rather than assuming the user will have set it to 0...&lt;/P&gt;
&lt;P&gt;I don't need an OTHERWISE for the IF because when the IF test is TRUE, the function returns R as part of the last statement in the IF body. I could use it, and it is 'better programming practice'. It would mean that all statements from r&amp;lt;- ORIGIN to the end would move to the body of the OTHERWISE.&lt;/P&gt;
&lt;P&gt;But I usually choose to end the function when it's done, using the RETURN statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Success!&lt;/P&gt;
&lt;P&gt;Luc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jan 2018 09:24:58 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495769#M177642</guid>
      <dc:creator>LucMeekes</dc:creator>
      <dc:date>2018-01-01T09:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: A sin function with various number of iterations in each cycle</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495826#M177644</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/14826"&gt;@LucMeekes&lt;/a&gt;&amp;nbsp;for your thorough explanation. That was interesting&amp;nbsp;and helped me a lot. Best,&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 00:20:51 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/A-sin-function-with-various-number-of-iterations-in-each-cycle/m-p/495826#M177644</guid>
      <dc:creator>mzarrabi</dc:creator>
      <dc:date>2018-01-02T00:20:51Z</dc:date>
    </item>
  </channel>
</rss>

