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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Derivative of a Function with Many Variables

MrichCD
4-Participant

Derivative of a Function with Many Variables

image.png

Let's say I have a generic system block diagram as shown above, where I have two unknown inputs generating one output based on several scaling, offset and addition blocks. M1-3 and B1-3 are known parameters that do not change. I'd like to take the derivative of of the output with respect to M1 with some known inputs as setpoints. That's easy to do with the following:

MrichCD_2-1716475316200.png

MrichCD_1-1716475300154.png

MrichCD_0-1716474560418.png

My problem arises when I try and define that same equation as a function of the inputs:

MrichCD_1-1716474733429.png

MrichCD_2-1716474740950.png

 

I can get around this issue by defining the function with ALL variables, but this is tedious and cumbersome especially as the equations grow with many more variables

MrichCD_3-1716474973125.png

MrichCD_4-1716474980742.png

 

Is there another way to do what I am trying to do without having to define a function with every variable? I've attached my sample mathcad showing this example in detail.

 

 

 

4 REPLIES 4

This is the only way can work...as when you define like that:

Cornel_1-1716475859908.png

Answer will be 0, as your function does not have any dependency of M1:

Cornel_2-1716475983479.png

Cornel_0-1716475752489.png

But if we put like this there is still no dependency of M1, and thus I think that Mathcad engine makes firstly a symbolic calculation for the derivative, and then will assignee the values, but as long as in the function parameters there is no present M1 as variable in the function you defined then this means that the derivative will be 0

Cornel_0-1716476345340.png

 

MrichCD
4-Participant
(To:Cornel)

I was limiting my example a bit, I eventually will want to take the derivative with respect to all known parameters (M1-3, B1-3) so what you're saying is the only way to do that is the final example I gave in my worksheet. That's unfortunate,,,

Thats math - you can only take the derivative of a function with respect to an argument of it (otherwise you get zero) and all arguments must be given in the argument parentheses of the function whenever you define it or use it.

Maybe it helps if you collect some of the variables involved in vector arguments. Prime unfortunately does not allow to take the derivative with respect to a vector element but you can use the Nabla operator to see the derivatives with respect to all elements of a vector:

Werner_E_0-1716479769635.png

Maybe you also want to see the symbolic results

Werner_E_0-1716480233481.png

 

 

Hi @MrichCD,

 

I wanted to follow up with you on your post to see if your question has been answered. 
If so, please mark the appropriate reply as the Accepted Solution. 
Of course, if you have more to share on your issue, please let the Community know so that we can continue to help you. 

 

Thanks,
Anurag
 

Top Tags