<?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 How to create custom function in Mathcad in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961150#M212906</link>
    <description>&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;Greetings, I tried to create custom functions in mathcad but I was able to do it, however I wanted to create that function fc and fc1 and I couldn't, I get an error message I understand how to compile and tried other functions but when I go to do it with results of vectors and matrices I have this problem here I attach the code in C only for the fc function, could you help me how to create both custom functions please?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jul 2024 07:49:06 GMT</pubDate>
    <dc:creator>DM_10631844</dc:creator>
    <dc:date>2024-07-15T07:49:06Z</dc:date>
    <item>
      <title>How to create custom function in Mathcad</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961150#M212906</link>
      <description>&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;Greetings, I tried to create custom functions in mathcad but I was able to do it, however I wanted to create that function fc and fc1 and I couldn't, I get an error message I understand how to compile and tried other functions but when I go to do it with results of vectors and matrices I have this problem here I attach the code in C only for the fc function, could you help me how to create both custom functions please?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 07:49:06 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961150#M212906</guid>
      <dc:creator>DM_10631844</dc:creator>
      <dc:date>2024-07-15T07:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom function in Mathcad</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961291#M212911</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1" style="width: 738px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107796i11587C86DACB981B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_16.png" alt="1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1" style="width: 683px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107793i35D23E686C4E80C3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_14.png" alt="1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DM_10631844_0-1721038678159.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107791i7ED6F5F7C2ABBDBA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DM_10631844_0-1721038678159.png" alt="DM_10631844_0-1721038678159.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 10:32:38 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961291#M212911</guid>
      <dc:creator>DM_10631844</dc:creator>
      <dc:date>2024-07-15T10:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom function in Mathcad</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961297#M212912</link>
      <description>&lt;P&gt;Use subscript rather than function notation when asking for components:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More like:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fc.png" style="width: 348px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107795i69F35B6772AF0F11/image-size/large?v=v2&amp;amp;px=999" role="button" title="fc.png" alt="fc.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 10:31:34 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961297#M212912</guid>
      <dc:creator>AlanStevens</dc:creator>
      <dc:date>2024-07-15T10:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom function in Mathcad</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961304#M212913</link>
      <description>&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1" style="width: 788px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107800iE6CBF9602910D549/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_20.png" alt="1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1" style="width: 750px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107799iA8496E1C6447CA9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_19.png" alt="1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1" style="width: 999px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107798iA6311B89C95E75AB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_18.png" alt="1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1" style="width: 893px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107797i8DAF0548E0844F1E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_17.png" alt="1" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 10:49:04 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961304#M212913</guid>
      <dc:creator>DM_10631844</dc:creator>
      <dc:date>2024-07-15T10:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom function in Mathcad</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961312#M212914</link>
      <description>&lt;P&gt;#include "mcadincl.h"&lt;/P&gt;&lt;P&gt;#define INTERRUPTED 1&lt;BR /&gt;#define INSUFFICIENT_MEMORY 2&lt;BR /&gt;#define MUST_BE_REAL 3&lt;BR /&gt;#define NUMBER_OF_ERRORS 3&lt;/P&gt;&lt;P&gt;// table of error messages&lt;BR /&gt;char * myErrorMessageTable[NUMBER_OF_ERRORS] =&lt;BR /&gt;{ "interrupted",&lt;BR /&gt;"insufficient memory",&lt;BR /&gt;"must be real"&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// this code executes the operation&lt;BR /&gt;LRESULT CreateVectorWithXSquare(COMPLEXARRAY * const Vector, LPCCOMPLEXSCALAR Scalar)&lt;BR /&gt;{&lt;BR /&gt;unsigned int i;&lt;/P&gt;&lt;P&gt;// check that the scalar argument is real&lt;BR /&gt;if (Scalar-&amp;gt;imag != 0.0)&lt;BR /&gt;return MAKELRESULT(MUST_BE_REAL, 1);&lt;/P&gt;&lt;P&gt;// allocate memory for the vector&lt;BR /&gt;if (!MathcadArrayAllocate(Vector, 4, 1, TRUE, FALSE))&lt;BR /&gt;return INSUFFICIENT_MEMORY;&lt;/P&gt;&lt;P&gt;// fill the vector with the square of the scalar&lt;BR /&gt;for (i = 0; i &amp;lt; 4; i++) {&lt;BR /&gt;if (isUserInterrupted()) {&lt;BR /&gt;MathcadArrayFree(Vector);&lt;BR /&gt;return INTERRUPTED;&lt;BR /&gt;}&lt;BR /&gt;Vector-&amp;gt;hReal[i][0] = Scalar-&amp;gt;real * Scalar-&amp;gt;real;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// normal return&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// fill out a FUNCTIONINFO structure with the information needed for registering the function with Mathcad&lt;BR /&gt;FUNCTIONINFO fc2 =&lt;BR /&gt;{&lt;BR /&gt;"fc2",&lt;BR /&gt;"x",&lt;BR /&gt;"returns a vector of length 4 with the square of the scalar x",&lt;BR /&gt;(LPCFUNCTION)CreateVectorWithXSquare,&lt;BR /&gt;COMPLEX_ARRAY,&lt;BR /&gt;1,&lt;BR /&gt;{ COMPLEX_SCALAR }&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// DLL entry point code&lt;BR /&gt;BOOL WINAPI _CRT_INIT(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved);&lt;/P&gt;&lt;P&gt;BOOL WINAPI DllEntryPoint(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)&lt;BR /&gt;{&lt;BR /&gt;switch (dwReason)&lt;BR /&gt;{&lt;BR /&gt;case DLL_PROCESS_ATTACH:&lt;BR /&gt;if (!_CRT_INIT(hDLL, dwReason, lpReserved))&lt;BR /&gt;return FALSE;&lt;BR /&gt;if (CreateUserErrorMessageTable(hDLL, NUMBER_OF_ERRORS, myErrorMessageTable))&lt;BR /&gt;CreateUserFunction(hDLL, &amp;amp;fc2);&lt;BR /&gt;break;&lt;/P&gt;&lt;P&gt;case DLL_THREAD_ATTACH:&lt;BR /&gt;case DLL_THREAD_DETACH:&lt;BR /&gt;case DLL_PROCESS_DETACH:&lt;BR /&gt;if (!_CRT_INIT(hDLL, dwReason, lpReserved))&lt;BR /&gt;return FALSE;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;return TRUE;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#undef INTERRUPTED&lt;BR /&gt;#undef INSUFFICIENT_MEMORY&lt;BR /&gt;#undef MUST_BE_REAL&lt;BR /&gt;#undef NUMBER_OF_ERRORS&lt;/P&gt;&lt;P&gt;#define INTERRUPTED 1&lt;BR /&gt;#define INSUFFICIENT_MEMORY 2&lt;BR /&gt;#define MUST_BE_REAL 3&lt;BR /&gt;#define NUMBER_OF_ERRORS 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 10:49:32 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961312#M212914</guid>
      <dc:creator>DM_10631844</dc:creator>
      <dc:date>2024-07-15T10:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom function in Mathcad</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961313#M212915</link>
      <description>&lt;P&gt;#include "mcadincl.h"&lt;/P&gt;&lt;P&gt;#define INTERRUPTED 1&lt;BR /&gt;#define INSUFFICIENT_MEMORY 2&lt;BR /&gt;#define MUST_BE_REAL 3&lt;BR /&gt;#define NUMBER_OF_ERRORS 3&lt;/P&gt;&lt;P&gt;// table of error messages&lt;BR /&gt;char * myErrorMessageTable[NUMBER_OF_ERRORS] =&lt;BR /&gt;{ "interrupted",&lt;BR /&gt;"insufficient memory",&lt;BR /&gt;"must be real"&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// this code executes the operation&lt;BR /&gt;LRESULT CreateRowMatrixWithXSquare(COMPLEXARRAY * const Matrix, LPCCOMPLEXSCALAR Scalar)&lt;BR /&gt;{&lt;BR /&gt;unsigned int i;&lt;/P&gt;&lt;P&gt;// check that the scalar argument is real&lt;BR /&gt;if (Scalar-&amp;gt;imag != 0.0)&lt;BR /&gt;return MAKELRESULT(MUST_BE_REAL, 1);&lt;/P&gt;&lt;P&gt;// allocate memory for the matrix&lt;BR /&gt;if (!MathcadArrayAllocate(Matrix, 1, 4, TRUE, FALSE))&lt;BR /&gt;return INSUFFICIENT_MEMORY;&lt;/P&gt;&lt;P&gt;// fill the row with the square of the scalar&lt;BR /&gt;for (i = 0; i &amp;lt; 4; i++) {&lt;BR /&gt;if (isUserInterrupted()) {&lt;BR /&gt;MathcadArrayFree(Matrix);&lt;BR /&gt;return INTERRUPTED;&lt;BR /&gt;}&lt;BR /&gt;Matrix-&amp;gt;hReal[0][i] = Scalar-&amp;gt;real * Scalar-&amp;gt;real;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// normal return&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// fill out a FUNCTIONINFO structure with the information needed for registering the function with Mathcad&lt;BR /&gt;FUNCTIONINFO fc1 =&lt;BR /&gt;{&lt;BR /&gt;"fc1",&lt;BR /&gt;"x",&lt;BR /&gt;"returns a 1x4 row matrix with the square of the scalar x",&lt;BR /&gt;(LPCFUNCTION)CreateRowMatrixWithXSquare,&lt;BR /&gt;COMPLEX_ARRAY,&lt;BR /&gt;1,&lt;BR /&gt;{ COMPLEX_SCALAR }&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// DLL entry point code&lt;BR /&gt;BOOL WINAPI _CRT_INIT(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved);&lt;/P&gt;&lt;P&gt;BOOL WINAPI DllEntryPoint(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)&lt;BR /&gt;{&lt;BR /&gt;switch (dwReason)&lt;BR /&gt;{&lt;BR /&gt;case DLL_PROCESS_ATTACH:&lt;BR /&gt;if (!_CRT_INIT(hDLL, dwReason, lpReserved))&lt;BR /&gt;return FALSE;&lt;BR /&gt;if (CreateUserErrorMessageTable(hDLL, NUMBER_OF_ERRORS, myErrorMessageTable))&lt;BR /&gt;CreateUserFunction(hDLL, &amp;amp;fc1);&lt;BR /&gt;break;&lt;/P&gt;&lt;P&gt;case DLL_THREAD_ATTACH:&lt;BR /&gt;case DLL_THREAD_DETACH:&lt;BR /&gt;case DLL_PROCESS_DETACH:&lt;BR /&gt;if (!_CRT_INIT(hDLL, dwReason, lpReserved))&lt;BR /&gt;return FALSE;&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;return TRUE;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#undef INTERRUPTED&lt;BR /&gt;#undef INSUFFICIENT_MEMORY&lt;BR /&gt;#undef MUST_BE_REAL&lt;BR /&gt;#undef NUMBER_OF_ERRORS&lt;/P&gt;&lt;P&gt;#define INTERRUPTED 1&lt;BR /&gt;#define INSUFFICIENT_MEMORY 2&lt;BR /&gt;#define MUST_BE_REAL 3&lt;BR /&gt;#define NUMBER_OF_ERRORS 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 10:51:19 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961313#M212915</guid>
      <dc:creator>DM_10631844</dc:creator>
      <dc:date>2024-07-15T10:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom function in Mathcad</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961314#M212916</link>
      <description>&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;The first code is fc2, it doesn't work, it gives an error and the 2nd is fc1, it works fine in C++&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DM_10631844_0-1721041023864.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/107802iA68D132EBDE8BD21/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DM_10631844_0-1721041023864.png" alt="DM_10631844_0-1721041023864.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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 10:58:35 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961314#M212916</guid>
      <dc:creator>DM_10631844</dc:creator>
      <dc:date>2024-07-15T10:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom function in Mathcad</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/962525#M212990</link>
      <description>&lt;P&gt;Hello &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/684477"&gt;@DM_10631844&lt;/a&gt;&lt;/SPAN&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you have a &lt;A href="https://community.ptc.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/961297#M212912" target="_blank"&gt;response &lt;/A&gt;from a community member. If it helped you solve your question please mark the reply as the Accepted Solution.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Vivek N.&lt;BR /&gt;Community Moderation Team.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 12:00:39 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/How-to-create-custom-function-in-Mathcad/m-p/962525#M212990</guid>
      <dc:creator>vnamboodheri</dc:creator>
      <dc:date>2024-07-22T12:00:39Z</dc:date>
    </item>
  </channel>
</rss>

