<?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: stepwise function, or better? in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041817#M219465</link>
    <description>&lt;P&gt;If you want to get rid of the if/else statements and have a more flexible way of expanding the set of layers, you may want to try this:&lt;/P&gt;
&lt;P&gt;Define:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_0-1762293894415.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130629iF3E5EDB114B1EC46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucMeekes_0-1762293894415.png" alt="LucMeekes_0-1762293894415.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and, just for the purpose of illustration:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_3-1762294149543.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130634i610A43C5127CE7B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucMeekes_3-1762294149543.png" alt="LucMeekes_3-1762294149543.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;then this function:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_4-1762294170188.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130635i6244F2D26FA4C9E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucMeekes_4-1762294170188.png" alt="LucMeekes_4-1762294170188.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;will give you gamma values for each value of z:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_5-1762294221853.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130636i6ADF28F3009A0EA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucMeekes_5-1762294221853.png" alt="LucMeekes_5-1762294221853.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Of course you can replace/redefine gamma.s with any other vector of expressions, just make sure there are as many as there are comparisons.&lt;BR /&gt;Your example would be covered by:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_7-1762295019057.png" style="width: 999px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130639i32C7E4D202B120B1/image-size/large?v=v2&amp;amp;px=999" role="button" title="LucMeekes_7-1762295019057.png" alt="LucMeekes_7-1762295019057.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There may be a more clever method to construct the vector with the gamma values, but it's late...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Success!&lt;BR /&gt;Luc&lt;/P&gt;</description>
    <pubDate>Tue, 04 Nov 2025 22:31:20 GMT</pubDate>
    <dc:creator>LucMeekes</dc:creator>
    <dc:date>2025-11-04T22:31:20Z</dc:date>
    <item>
      <title>stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041709#M219442</link>
      <description>&lt;P&gt;Hi folks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is a simple one - calculate the vertical overburden stress in a soil mass.&amp;nbsp; The simplified equation is just [ unit weight of soil ] * [ depth ].&amp;nbsp; However, in a layered system with a different unit weight for each layer, the calculation is best formed as the sum of the vertical stress increments. To me that looks like a stepwise function constructed as a series of IF-ELSEIF-ELSE statements as shown in my example below.&amp;nbsp; It works but there is surely a more clever way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets say the bottom of layer 1 is z1 and the stress is p1, and the stress at some mid-depth in layer 2, say&amp;nbsp;z2, is delta_p2, such that the stress at the point in question is p(z2) = p1 + delta_p2.&amp;nbsp; What is the most efficient way of structing that calculation as a function depth (z) so that it can be scaled to any number of layers.&amp;nbsp; My best idea so far is an "If" function to evaluate the stress at the bottom of each layer plus the portion of the n-th layer at the target depth.&amp;nbsp; Its&amp;nbsp; cumbersome.&amp;nbsp; In a 4 layer system, the function has 4 steps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obviously depth z and unit weight gamma are defined.&amp;nbsp; They are each single column matrices. For depth, z_top is the depth to the top of each layer, and the unit weight is define similarly. In this case z is negative to indicate depth &lt;U&gt;below&lt;/U&gt; ground surface.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AV_14389071_0-1762274430800.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130591iAA107EEE7D25991C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AV_14389071_0-1762274430800.png" alt="AV_14389071_0-1762274430800.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 16:51:35 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041709#M219442</guid>
      <dc:creator>AV_14389071</dc:creator>
      <dc:date>2025-11-04T16:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041742#M219454</link>
      <description>&lt;P&gt;There's at least one thing you can do better. Rename each of those sigma'(z) occurrences inside the program to something else, say R.&lt;/P&gt;
&lt;P&gt;As it is now, I suspect the program never ends, because it calls itself repeatedly, recursively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Success!&lt;BR /&gt;Luc&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 18:50:26 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041742#M219454</guid>
      <dc:creator>LucMeekes</dc:creator>
      <dc:date>2025-11-04T18:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041759#M219459</link>
      <description>&lt;P&gt;A better option might be determine which layers are below the required depth. &amp;nbsp;Use the built in function match , for example to find all those layers whose tops are below z. &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The use the summation operator to calculate the cumulative stress for those layers (if there are any) and add it to the stress at the bottom of the layer in which z lies. &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Stuart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(&lt;EM&gt;I’m not near my PC at the moment, and I’ve only got Mathcad Express, anyway. Mathcad Express has no programming, which can make solutions somewhat convoluted for those used to standard programming, as Express encourages functional programming&lt;/EM&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 19:39:33 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041759#M219459</guid>
      <dc:creator>StuartBruff</dc:creator>
      <dc:date>2025-11-04T19:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041795#M219463</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;BR /&gt;
&lt;P&gt;As it is now, I suspect the program never ends, because it calls itself repeatedly, recursively.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would have thought so to that this would happen if no local function is defined which is the case for z&amp;gt;z.top[0.&lt;/P&gt;
&lt;P&gt;But both MC15 and P11 throw an error in this case:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_0-1762291135009.png" style="width: 505px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130623iDC791BACF261AF75/image-dimensions/505x197?v=v2" width="505" height="197" role="button" title="Werner_E_0-1762291135009.png" alt="Werner_E_0-1762291135009.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_1-1762291230149.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130624iBA25BB231CC912B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Werner_E_1-1762291230149.png" alt="Werner_E_1-1762291230149.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The error message in MC15 ("Type "2" can not be loaded.") is a bit strange but both seem to refuse to refer recursively to the main/worksheet function if a first pass showed that a function with that name is defined in one of the if branches.&lt;/P&gt;
&lt;P&gt;Both programs detect the infinite recursion in case no local function of that name is defined anywhere in the program&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_2-1762291547869.png" style="width: 493px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130625i0DBE4D73B3234860/image-dimensions/493x223?v=v2" width="493" height="223" role="button" title="Werner_E_2-1762291547869.png" alt="Werner_E_2-1762291547869.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_3-1762291565474.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130626i39F515DF1EFABCC3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Werner_E_3-1762291565474.png" alt="Werner_E_3-1762291565474.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Its also remarkable that the first error message from MC15 came in German (the language set in Windows) even though my language settings for Mathcad are to be in English.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I guess that the program made by&amp;nbsp;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/1021244"&gt;@AV_14389071&lt;/a&gt;&amp;nbsp; works OK for him as long as he does not provide a z value larger than z.top_0.&lt;/P&gt;
&lt;P&gt;But nonetheless I agree that he should replace the local sigma function definitions for a simple variable or simply do without and use the return statement (which also means that he could do without the if_else and just use a couple of ifs).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 21:30:38 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041795#M219463</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2025-11-04T21:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041800#M219464</link>
      <description>&lt;P&gt;Speaking of recursion, we can use it to make the function definition a little bit smaller which can be especially useful if there would be even more layers:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_4-1762293164650.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130628i7C3A30EC4CB0452E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Werner_E_4-1762293164650.png" alt="Werner_E_4-1762293164650.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or even shorter using a for-loop which works for any number of layers&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_7-1762294557151.png" style="width: 487px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130637iA4ACD459F1A83B50/image-dimensions/487x273?v=v2" width="487" height="273" role="button" title="Werner_E_7-1762294557151.png" alt="Werner_E_7-1762294557151.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;stacking minus infinity on top of ztop was necessary because Prime unfortunately does not use short curcuit evaluation of combined Boolean expressions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 22:17:19 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041800#M219464</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2025-11-04T22:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041817#M219465</link>
      <description>&lt;P&gt;If you want to get rid of the if/else statements and have a more flexible way of expanding the set of layers, you may want to try this:&lt;/P&gt;
&lt;P&gt;Define:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_0-1762293894415.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130629iF3E5EDB114B1EC46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucMeekes_0-1762293894415.png" alt="LucMeekes_0-1762293894415.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and, just for the purpose of illustration:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_3-1762294149543.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130634i610A43C5127CE7B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucMeekes_3-1762294149543.png" alt="LucMeekes_3-1762294149543.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;then this function:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_4-1762294170188.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130635i6244F2D26FA4C9E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucMeekes_4-1762294170188.png" alt="LucMeekes_4-1762294170188.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;will give you gamma values for each value of z:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_5-1762294221853.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130636i6ADF28F3009A0EA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LucMeekes_5-1762294221853.png" alt="LucMeekes_5-1762294221853.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Of course you can replace/redefine gamma.s with any other vector of expressions, just make sure there are as many as there are comparisons.&lt;BR /&gt;Your example would be covered by:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LucMeekes_7-1762295019057.png" style="width: 999px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130639i32C7E4D202B120B1/image-size/large?v=v2&amp;amp;px=999" role="button" title="LucMeekes_7-1762295019057.png" alt="LucMeekes_7-1762295019057.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There may be a more clever method to construct the vector with the gamma values, but it's late...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Success!&lt;BR /&gt;Luc&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 22:31:20 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041817#M219465</guid>
      <dc:creator>LucMeekes</dc:creator>
      <dc:date>2025-11-04T22:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041901#M219472</link>
      <description>&lt;P&gt;Like this is one way:-&lt;/P&gt;
&lt;P&gt;Just negate z layer to positive depth.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 562px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130681i8E4387951B265E99/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;Terry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2025 10:21:47 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041901#M219472</guid>
      <dc:creator>terryhendicott</dc:creator>
      <dc:date>2025-11-05T10:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041960#M219476</link>
      <description>&lt;P&gt;Here are some ways to achieve what you are looking for.&lt;/P&gt;
&lt;P&gt;All three approaches work, regardless of the number of layers, provided that the number of elements in ztop and gamma is the same, and that the values in ztop are in descending order.&lt;/P&gt;
&lt;P&gt;All three functions are defined in a way so they return a zero value in case z is larger than the first (largest) value in ztop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I already posted the solution using recursion:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_0-1762348723133.png" style="width: 490px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130697iCE1BA2DADB383458/image-dimensions/490x302?v=v2" width="490" height="302" role="button" title="Werner_E_0-1762348723133.png" alt="Werner_E_0-1762348723133.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here an approach inspired by Terry using linear interpolation&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_1-1762348800440.png" style="width: 813px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130698i5212B54FE44E4819/image-dimensions/813x322?v=v2" width="813" height="322" role="button" title="Werner_E_1-1762348800440.png" alt="Werner_E_1-1762348800440.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here a version using the "match" function as suggested by Stuart&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_2-1762348879494.png" style="width: 816px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130699iA4BC8640DF5CE663/image-dimensions/816x400?v=v2" width="816" height="400" role="button" title="Werner_E_2-1762348879494.png" alt="Werner_E_2-1762348879494.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: Added a further variant. Probable more conventional, using a for-loop and taking advantage of the fact the program execution is stopped when a "return" statement is encountered (otherwise we had to use a while-loop).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_0-1762358068765.png" style="width: 568px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130705i9F8F2D69037124B5/image-dimensions/568x453?v=v2" width="568" height="453" role="button" title="Werner_E_0-1762358068765.png" alt="Werner_E_0-1762358068765.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Comparison of the various methods&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_2-1762358250281.png" style="width: 673px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/130707i4086A31CDA9741F2/image-dimensions/673x570?v=v2" width="673" height="570" role="button" title="Werner_E_2-1762358250281.png" alt="Werner_E_2-1762358250281.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Prime 11 worksheet attached&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2025 15:58:01 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1041960#M219476</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2025-11-05T15:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1042107#M219493</link>
      <description>&lt;P&gt;Thought I would add some text and allow for the negative values of depth.&lt;/P&gt;
&lt;P&gt;See file.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2025 10:01:10 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1042107#M219493</guid>
      <dc:creator>terryhendicott</dc:creator>
      <dc:date>2025-11-06T10:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: stepwise function, or better?</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1042966#M219577</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/1021244"&gt;@AV_14389071&lt;/a&gt;&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to see if you got the help you needed.&lt;/P&gt;
&lt;P&gt;If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.&lt;BR /&gt;Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.&lt;BR /&gt;Of course, if you have more to share on your issue, please pursue the conversation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Anurag&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 04:51:52 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/stepwise-function-or-better/m-p/1042966#M219577</guid>
      <dc:creator>anursingh</dc:creator>
      <dc:date>2025-11-12T04:51:52Z</dc:date>
    </item>
  </channel>
</rss>

