Help with Derivatives in Mathcad

AI Thread Summary
Mathcad only computes partial derivatives, which can lead to confusion when defining functions. The user initially defined L as L:= x(t) but encountered issues when trying to take derivatives with respect to both time and specific variables. When attempting to differentiate L with respect to x, the program returned 0 instead of the expected 1, indicating that L was treated as a constant. To resolve this, it was suggested to redefine L as L(t) := x(t), clarifying that L is a function dependent on the parameter t. However, this still resulted in 0 for dL/dx. Further advice indicated that L should be defined as L(t,x) := x to allow for both total and partial derivatives, ensuring that each derivative operation recognizes the appropriate parameters. This approach allows for correct differentiation with respect to both time and specific variables.
czechman45
Messages
12
Reaction score
0
I know that Mathcad only takes partial derivatives. I set up my equations using this general format:

L:= x(t)

Then, I take the derivative of L with respect to t and get the following:

dL/dt -> d/dt*x(t)

However, when I take the derivative of L with respect to x, I should get 1, but am getting 0.

dL/dx -> 0

I've also tried typing dL/d(x(t)), but the program gets mad at me saying that I'm not using a name. Please help. I need Mathcad to take the derivatives of some big expressions with respect to both time and specific variables.

Thank you.
 
Physics news on Phys.org
Hi czechman45, welcome to PF :smile:

czechman45 said:
I know that Mathcad only takes partial derivatives. I set up my equations using this general format:

L:= x(t)

Then, I take the derivative of L with respect to t and get the following:

dL/dt -> d/dt*x(t)

However, when I take the derivative of L with respect to x, I should get 1, but am getting 0.

dL/dx -> 0

I've also tried typing dL/d(x(t)), but the program gets mad at me saying that I'm not using a name. Please help. I need Mathcad to take the derivatives of some big expressions with respect to both time and specific variables.

Thank you.

Since you have defined L without a parameter, as far as Mathcad knows, L is not dependent on any parameter, meaning it is treated as a constant.

To fix it you need to define:
L(t) := x(t)

This explains to Mathcad that L is a function with a parameter, and that x(t) is supposed to be used with this parameter.
 
@I like Serena
I tried your suggestion. It works for dL/dt, but it still gives me 0 for dL/dx, where I'm supposed to be getting 1. Any other suggestions?
 
czechman45 said:
@I like Serena
I tried your suggestion. It works for dL/dt, but it still gives me 0 for dL/dx, where I'm supposed to be getting 1. Any other suggestions?

I'm guessing a bit, since I don't know what your large expressions look like.

I suspect you need L to be of the form:

L(t,x) := x

Now you can take d/dt from L(t,x(t)) and you can take d/dx from L(t,x).
The first derivative would be a total derivative, while the second is a partial derivative.

In particular each derivative you want to take requires L to have a parameter with the same name.
 
Back
Top