<?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: Integral is not converging to a solution in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048136#M220006</link>
    <description>&lt;P&gt;What happens if you choose an alternative integration method (I've only got Mathcad Express, so can't check)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(right-click on integral to bring up the context menu)&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="2025 12 19 A.png" style="width: 838px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/132567i025FDD76D08918F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025 12 19 A.png" alt="2025 12 19 A.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stuart&lt;/P&gt;</description>
    <pubDate>Thu, 18 Dec 2025 00:24:37 GMT</pubDate>
    <dc:creator>StuartBruff</dc:creator>
    <dc:date>2025-12-18T00:24:37Z</dc:date>
    <item>
      <title>Integral is not converging to a solution</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048121#M220003</link>
      <description>&lt;P&gt;I have two similar integrals, one with sin function and one with cos function, but for some reason integral with cos causes an error, but with a sin does not. I would be very grateful for help. Integrals are at the end of the attached worksheet. I'm using MathCad Prime 11 if it matter&lt;/P&gt;</description>
      <pubDate>Wed, 17 Dec 2025 21:30:22 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048121#M220003</guid>
      <dc:creator>OB_14322202</dc:creator>
      <dc:date>2025-12-17T21:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Integral is not converging to a solution</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048125#M220004</link>
      <description>&lt;P&gt;Note that B[k=0 for all your k.&lt;/P&gt;
&lt;P&gt;For some reason Prime has a problem with calculating A[15 (that is, A for k=15).&lt;/P&gt;
&lt;P&gt;If you limit k to 14, you'll get a result.&lt;/P&gt;
&lt;P&gt;You may also get a result if you set t.i to 14.999...&lt;/P&gt;
&lt;P&gt;Probably a numerical error.&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;</description>
      <pubDate>Wed, 17 Dec 2025 22:43:24 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048125#M220004</guid>
      <dc:creator>LucMeekes</dc:creator>
      <dc:date>2025-12-17T22:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: Integral is not converging to a solution</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048128#M220005</link>
      <description>&lt;P&gt;The error stems from the numeric algorithm used for the integration.&lt;/P&gt;
&lt;P&gt;If fails for k=15&amp;nbsp;We have often seen this behavior in non-continuous integrands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case it helps to change the value of the system variable TOL (default is 10&lt;SUP&gt;-3&lt;/SUP&gt;).&lt;/P&gt;
&lt;P&gt;Interestingly the calculation does not only converge if we set it to a larger value like 10&lt;SUP&gt;-2&lt;/SUP&gt; but it also works with TOL = 10&lt;SUP&gt;-4&lt;/SUP&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can set the value via the menu or simply write TOL:=10&lt;SUP&gt;-4&lt;/SUP&gt; somewhere at the top of the sheet (at least in front of the integral),&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Now you can define the FOURIER approximation of the periodic signal and compare the results with the original signal.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_0-1766011992857.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/132561iF6DEF53D73C2CC35/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Werner_E_0-1766011992857.png" alt="Werner_E_0-1766011992857.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_0-1766012884325.png" style="width: 619px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/132563i27CD736221FE736A/image-dimensions/619x294?v=v2" width="619" height="294" role="button" title="Werner_E_0-1766012884325.png" alt="Werner_E_0-1766012884325.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Or even better make advantage of the symmetry of the signal (no sine wave components.&lt;/P&gt;
&lt;P&gt;Just for demonstration I turned A into a function of k. While this may be more compact, needs no range variable and does not limit N, its less efficient and much more time consuming because A has to be calculated from anew every time f(t,..) is called.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_0-1766014251274.png" style="width: 670px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/132564iD891E6E158E6CC6F/image-dimensions/670x494?v=v2" width="670" height="494" role="button" title="Werner_E_0-1766014251274.png" alt="Werner_E_0-1766014251274.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You may also increase the accuracy of the numerical integration if you use t&lt;SUB&gt;i&lt;/SUB&gt; as upper integral limit instead of T/2 (the integrand is now continuous).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Werner_E_0-1766014975821.png" style="width: 364px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/132565iE55C17E1DF331DEF/image-dimensions/364x92?v=v2" width="364" height="92" role="button" title="Werner_E_0-1766014975821.png" alt="Werner_E_0-1766014975821.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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The approach of using symmetry and to integrate from 0 to T/2 or&amp;nbsp;t&lt;SUB&gt;i&lt;/SUB&gt;&amp;nbsp;works OK even with the default value for TOL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now that we have limited the signal to one simple linear function only, we can also use Prime's symbolics (would not work using the "if" statement in the definition of the signal).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Werner_E_1-1766016301575.png" style="width: 711px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/132566i2B52460D9F87CB68/image-dimensions/711x624?v=v2" width="711" height="624" role="button" title="Werner_E_1-1766016301575.png" alt="Werner_E_1-1766016301575.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;Prime 11 sheet attached&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2025 00:05:54 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048128#M220005</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2025-12-18T00:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Integral is not converging to a solution</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048136#M220006</link>
      <description>&lt;P&gt;What happens if you choose an alternative integration method (I've only got Mathcad Express, so can't check)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(right-click on integral to bring up the context menu)&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="2025 12 19 A.png" style="width: 838px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/132567i025FDD76D08918F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025 12 19 A.png" alt="2025 12 19 A.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stuart&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2025 00:24:37 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048136#M220006</guid>
      <dc:creator>StuartBruff</dc:creator>
      <dc:date>2025-12-18T00:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Integral is not converging to a solution</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048139#M220007</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/14769"&gt;@StuartBruff&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;What happens if you choose an alternative integration method (I've only got Mathcad Express, so can't check)?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Unfortunately none of the options would do the trick. As explained above, changing TOL from 10^-3 to another value (either larger or smaller - the latter was a surprise!) cures that problem. We have seen it quite often here when dealing with discontinuities in the integrand. In combination with the quite small abscissa values involved inaccuracies and nasty round-offs are to expected anyway.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2025 00:39:22 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Integral-is-not-converging-to-a-solution/m-p/1048139#M220007</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2025-12-18T00:39:22Z</dc:date>
    </item>
  </channel>
</rss>

