Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Jun 30, 2022
08:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jun 30, 2022
08:30 AM

Calculation of Derivatives - Create Mathcad Program/Function

Hello,

I would like to get a program in Mathcad that: given being a function with a certain number of parameters and a certain symbolic expression, f (p1, p2, p3, p4, ..., pn): = a certain symbolic expression that involves these parameters: p1, p2, p3, ... ,pn, to automatically obtain the following:

1. Symbolic calculation of:

2. Numerical calculation of:

Given finally the numerical values for the parameters: p1, p2, p3, ..., pn, calculate the numerical values for the expressions of the derivatives from point 1.

Example for the case with 3 variables: p1, p2, p3:

1. Symbolic calculation:

2. Numerical calculation

The idea is that I want a Mathcad program that calculates automatically what I want regarding the two points above (point 1 and point 2), meaning to give me as output both the symbolic calculations and the numerical calculations, in the form of parameters, as shown for example in the example above (Sp1, Sp2, Sp3, Sp4, Sp5, Sp6), and not me each time to calculate in turn them one by one, line by line.

Attached is the Mathcad file in Mathcad 15, Mathcad 11 and Mathcad Prime 7.0.0 versions.

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Jun 30, 2022
03:59 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jun 30, 2022
03:59 PM

You could define a vector function and use the gradient/Nabla operator:

Of course you could also turn your existing function in a three separate arguments into a vector function

But I guess it would not hard to write a function which can deal with input functions with a variable number of arguments. Even if you provide that number as a separate argument to your function.

2 REPLIES 2

Jun 30, 2022
03:59 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jun 30, 2022
03:59 PM

You could define a vector function and use the gradient/Nabla operator:

Of course you could also turn your existing function in a three separate arguments into a vector function

But I guess it would not hard to write a function which can deal with input functions with a variable number of arguments. Even if you provide that number as a separate argument to your function.

Jul 07, 2022
05:23 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jul 07, 2022
05:23 PM

You can define such a function as follows (in Mathcad 11, may work in Mathcad 15, will NOT work in Prime):

Your example:

Another example:

Success!

Luc