Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
PTC Mathcad Prime 8.0.0.0
I have a function that depends on several variables, and I want to compute the partial derivative with respect to each variable and store the results in a matrix.
For example, the variables R1,R2,R3,R4,R5,R6,R7, and R8 are known.
F(R1, R2, R3, R4, R5, R6, R7, R8)=R5*R4/(R3+R4) +(R7-R8/2)*R1+R6/R2
I would like to create a matrix A_dif such that:
A_dif(1)= dF/dR1
A_dif(2)= dF/dR2
………………..
A-dif (8)=dF/dR8
Can this be done so we do not need to repeat the operation 8 times.
You can. It's a lot of typing!.
I had this as a solution, but I was expecting something that uses a for‑statement, because sometimes my functions have 100 variables. I would like to automate the process.
A function with 100 arguments?
So these arguments better are provided via an input vector instead of listing them individually.
As an example the same demo function with three arguments as posted before
P.S.: I am not sure if the gradient operator already exists in Prime 8, though.
EDIT: I just check and it seems that the gradient operator was not present in Prime 8
See: Solved: Representing Del Operations [curl(u), div(u), grad... - PTC Community
The operator actually was introduced in Prime 9.
Any chance you can upgrade your version of Prime?
This is what the Nabla/Gradient operator is to be used for. Can be used symbolically but also numerically
Hi Werner,
I have PTC Mathcad Prime 8.0.0.0 which does not have this operator that you suggested.
I have done the same way what was suggested by Fred but I want no to copy and pass 100 time if I have bigger function.
@TG_14487572 wrote:
Hi Werner,
I have PTC Mathcad Prime 8.0.0.0 which does not have this operator that you suggested.
I have done the same way what was suggested by Fred but I want no to copy and pass 100 time if I have bigger function.
Yes, I later noticed that the gradient operator was only introduced in Prime 9. See also my second answer above and the link provided there.
I'm afraid that there will be no convenient option in your version of Prime, as Prime does not provide all the necessary features—it does not allow vector elements as derivative variables and, unlike the old, genuine Mathcad, it does not allow symbolic evaluations within a program.
So if you don't have the option of upgrading to a newer version of Prime, it will probably be difficult or rather impossible to achieve.
As a supplement to what was shown earlier: If partial differentiation is to be performed for all variables, it is not necessary to list all variables individually in the Nabla operator; instead, the corresponding placeholder can be left empty in this case:
