<?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: Problem with defining index in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616256#M186260</link>
    <description>&lt;P&gt;In your example last(I) = 5.&lt;/P&gt;
&lt;P&gt;Si i runs from 1 to 5.&lt;/P&gt;
&lt;P&gt;If i=4 the you define j € 5,6 .. 5 which seems to be wrong but it works in Prime and gives you just i=5&lt;/P&gt;
&lt;P&gt;But if i=5 you define j € 6,7 .. 5 and this is it what throws that error because "6,7" means to count upwards but the end value 5 is lower than the start value.&lt;/P&gt;
&lt;P&gt;A workaround could be to let i run from 1 to i-1 but I fear that your routine has some other errors, too as the nested loops &lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class="" title=""&gt;incessantly&lt;/SPAN&gt;&lt;/SPAN&gt; overwrites values in "result" which dies not make much sense to me.&lt;/P&gt;
&lt;P&gt;What is the routine intended to do?&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jul 2019 01:47:23 GMT</pubDate>
    <dc:creator>Werner_E</dc:creator>
    <dc:date>2019-07-02T01:47:23Z</dc:date>
    <item>
      <title>Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616249#M186259</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to generate a vector based on certain conditions but I face with a problem that says as" This range should be defined in sequential values". In my understanding, I think I have done that but I do not know why it is showing the error. Please help me with it. My version is prime 4.0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Faisal&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 22:19:03 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616249#M186259</guid>
      <dc:creator>fahmed-2</dc:creator>
      <dc:date>2019-07-01T22:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616256#M186260</link>
      <description>&lt;P&gt;In your example last(I) = 5.&lt;/P&gt;
&lt;P&gt;Si i runs from 1 to 5.&lt;/P&gt;
&lt;P&gt;If i=4 the you define j € 5,6 .. 5 which seems to be wrong but it works in Prime and gives you just i=5&lt;/P&gt;
&lt;P&gt;But if i=5 you define j € 6,7 .. 5 and this is it what throws that error because "6,7" means to count upwards but the end value 5 is lower than the start value.&lt;/P&gt;
&lt;P&gt;A workaround could be to let i run from 1 to i-1 but I fear that your routine has some other errors, too as the nested loops &lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class="" title=""&gt;incessantly&lt;/SPAN&gt;&lt;/SPAN&gt; overwrites values in "result" which dies not make much sense to me.&lt;/P&gt;
&lt;P&gt;What is the routine intended to do?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 01:47:23 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616256#M186260</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2019-07-02T01:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616260#M186261</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Faisal&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First get rid of the equal sign.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 489px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/17436iCECEE78A2CEEA93D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Program needs as defined at least two remaining values i+1 and i+2&lt;/P&gt;
&lt;P&gt;You may need to refine the logic.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture-2.PNG" style="width: 446px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/17437i52A071D482817968/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture-2.PNG" alt="Capture-2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;Terry&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 01:44:27 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616260#M186261</guid>
      <dc:creator>terryhendicott</dc:creator>
      <dc:date>2019-07-02T01:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616262#M186262</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/269418"&gt;@terryhendicott&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First get rid of the equal sign.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not really necessary as he is defining a simple variable, not a function. Nonetheless is generally a good advice to avoid inline evaluations as Mathcad/Prime had some problems with that in the past (especially in combination with matrices).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;I class="lia-fa lia-fa-pencil lia-image-edit-icon"&gt;&lt;/I&gt;
&lt;P&gt;Program needs as defined at least two remaining values i+1 and i+2&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No need to decrement the end value by 2, running i from 1 to last(I)-1 is all thats needed. As I explained above the routine/range works OK if i = last(I)-1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I fear that there's more wrong with this program because it overwrites values in a manner which I suspect is not intended hat way.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="b.png" style="width: 314px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/17438i784403A93863ACD3/image-dimensions/314x351?v=v2" width="314" height="351" role="button" title="b.png" alt="b.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 01:56:38 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616262#M186262</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2019-07-02T01:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616272#M186263</link>
      <description>&lt;P&gt;My intent from the program is as follows :&lt;/P&gt;
&lt;P&gt;1) First, it will assign the first result as a1&lt;/P&gt;
&lt;P&gt;2) Second, it will assign the results based on the sign of "I"&lt;/P&gt;
&lt;P&gt;3) If the sign of "I" is positive it will assign a1 and will continue till the last "I", if not then it will assign a3.&lt;/P&gt;
&lt;P&gt;4) Once the condition enters the negative "I" domain, it will continue inside the negative "I" domain with the given condition that is given there. This will continue till the last "I".&lt;/P&gt;
&lt;P&gt;So, finally, if "I" has n values then the result will have n+1 values&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 04:11:16 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616272#M186263</guid>
      <dc:creator>fahmed-2</dc:creator>
      <dc:date>2019-07-02T04:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616338#M186266</link>
      <description>&lt;P&gt;Sorry, that explanation is not clear to me, especially he "negative domain" in 4).&lt;/P&gt;
&lt;P&gt;Your program ignores the first value of your vector I, sets result to a1.&lt;/P&gt;
&lt;P&gt;Then it sets result to a1 as long as the value of the next I's is positive.&lt;/P&gt;
&lt;P&gt;If an I is negative, result is a3 and then the next values of I are looked&amp;nbsp; at in the for-loop EVERY TIME a value in I is negative.&lt;/P&gt;
&lt;P&gt;So results already assigned are overwritten again and again.&lt;/P&gt;
&lt;P&gt;Can you explain which output vector you expect using your sample data I (and maybe a few more I's to make it clearer) and why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, is this something near to what you are looking for?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="B.png" style="width: 463px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/17452iA01B9C8F0CD31A40/image-dimensions/463x405?v=v2" width="463" height="405" role="button" title="B.png" alt="B.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 09:43:27 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616338#M186266</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2019-07-02T09:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616350#M186268</link>
      <description>&lt;P&gt;Thank you very much. I think this is the one I needed&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:10:03 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616350#M186268</guid>
      <dc:creator>fahmed-2</dc:creator>
      <dc:date>2019-07-02T10:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616380#M186269</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/199037"&gt;@fahmed-2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you very much. I think this is the one I needed&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I love my &lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class="" title=""&gt;Crystal ball&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To make it clear, the logic behind my function is:&lt;/P&gt;
&lt;P&gt;.) First element in result vector always is a1&lt;/P&gt;
&lt;P&gt;.) Now we go through the whole vector I. If the element there is positive, we add an element a1 to our result, otherwise a3&lt;/P&gt;
&lt;P&gt;.) The above is true until we come to the first negative Element in I. From then on, the game changes a little bit as positive elements in I result in a2 (and not a1) to be added - negative element still yield a3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may get rid of the variable "negative" in my function and use a3 instead. And of course you don't have it to be a function if you don't like that but turn it into a simple variable as you had it originally.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 12:52:04 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616380#M186269</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2019-07-02T12:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with defining index</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616420#M186271</link>
      <description>&lt;P&gt;Thank you again&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 14:26:26 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Problem-with-defining-index/m-p/616420#M186271</guid>
      <dc:creator>fahmed-2</dc:creator>
      <dc:date>2019-07-02T14:26:26Z</dc:date>
    </item>
  </channel>
</rss>

