cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

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

17-Peridot

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.

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:Cornel)

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
24-Ruby V
(To:Cornel)

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.

23-Emerald III
(To:Cornel)

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