# Revision history [back]

### Help with diff (user error or Sage failing at simple differentiation example?) ?

Hello,

Consider the following Sage code:

x = var('x') y = 2*x diff(y,x) #gives 2 as expected diff(x,y) #expected 1/2, complains: "argument symb must be a symbol"

Example above illustrates issue I keep having (Sage giving error where there exist a derivative)

Questions are:

1. Does example below shows "limitations" of what Sage can compute ?
2. Is there a way to help Sage "recognize" that diff(x,y) = 1/2 ? If yes, how?

P.S. (If 2 is "Yes") This seems very basic problem, yet I was unable to find any related examples online. Where can I find a guide to master calculus in Sage?

### Help with diff (user error or Sage failing at simple differentiation example?) ?

Hello,

Consider the following Sage code:

x = var('x') y = 2*x diff(y,x) #gives 2 as expected diff(x,y) #expected 1/2, complains: "argument symb must be a symbol"

Example above illustrates issue I keep having (Sage giving error where there exist a derivative)

Questions are:

1. Does example below shows "limitations" of what Sage can compute ?
2. Is there a way to help Sage "recognize" that diff(x,y) = 1/2 ? If yes, how?

P.S. (If 2 is "Yes") This seems very basic problem, yet I was unable to find any related examples online. Where can I find a guide to master calculus in Sage?

### Help with diff (user error or Sage failing at simple differentiation example?) (diff(y,x) vs diff(y)/diff(x), what is the difference) ?

Hello,

Consider the following Sage code:

x = var('x')
y = 2*x
diff(y,x) #gives 2 as expected
diff(x,y) #expected 1/2, complains: "argument symb must be a symbol"symbol"


This can be resolved via (kind-off) Leibniz's notation approach:

x = var('x')
y = 2*x
diff(y)/diff(x) #gives 2 as expected
diff(x)/diff(y) #gives 1/2 as expected


Example above illustrates issue I keep having (Sage expressions of type diff(x,y) giving error where there exist a derivative)

Questions are:

1. Does example below shows "limitations" of what Sage can compute ?

2. Is there a difference between diff(y)/diff(x) and diff(y,x) ?

3. Is there a way to help Sage "recognize" that diff(x,y) = 1/2 ? If yes, how?

P.S. (If 2 3 is "Yes") This seems very basic problem, yet I was unable to find any related examples online. Where can I find a guide to master calculus in Sage?

### Help with diff (diff(y,x) vs diff(y)/diff(x), what is the difference) ?

Hello,

Consider the following Sage code:

x = var('x')
y = 2*x
diff(y,x) #gives 2 as expected
diff(x,y) #expected 1/2, complains: "argument symb must be a symbol"


This can be resolved via (kind-off) Leibniz's notation approach:

x = var('x')
y = 2*x
diff(y)/diff(x) #gives 2 as expected
diff(x)/diff(y) #gives 1/2 as expected


Example above illustrates issue I keep having (Sage expressions of type diff(x,y) giving error where there exist a derivative)

Questions are:

1. Does example below shows "limitations" of what Sage can compute ?

2. Is there a difference between diff(y)/diff(x) and diff(y,x) ?

3. Is there a way to help Sage "recognize" that diff(x,y) = 1/2 ? If yes, how?

P.S. (If 3 is "Yes") This seems very basic problem, yet I was unable to find any related examples online. Where can I find a guide to master calculus in Sage?Is there a reference that explains described behavior o diff?

### Help with diff (diff(y,x) vs diff(y)/diff(x), what is the difference) ?

Hello,

Consider the following Sage code:

x = var('x')
y = 2*x
diff(y,x) #gives 2 as expected
diff(x,y) #expected 1/2, complains: "argument symb must be a symbol"


This can be resolved via (kind-off) Leibniz's notation approach:

x = var('x')
y = 2*x
diff(y)/diff(x) #gives 2 as expected
diff(x)/diff(y) #gives 1/2 as expected


Example above illustrates issue I keep having (Sage expressions of type diff(x,y) giving error where there exist a derivative)

Questions are:

1. Does example below shows "limitations" of what Sage can compute ?

2. Is there a difference between diff(y)/diff(x) and diff(y,x) ?

3. Is there a way to help Sage "recognize" that diff(x,y) = 1/2 ? If yes, how?

P.S. (If 3 is "Yes") This seems very basic problem, yet I was unable to find any related examples online. Is there a reference that explains described behavior o diff?

 6 None slelievre 16309 ●19 ●146 ●324 http://carva.org/samue...

### Help with diff (diff(y,x) vs diff(y)/diff(x), what is the difference) ?

Hello,

Consider the following Sage code:

x = var('x')
y = 2*x
diff(y,x) #gives 2 as expected
diff(x,y) #expected 1/2, complains: "argument symb must be a symbol"


This can be resolved via (kind-off) Leibniz's notation approach:

x = var('x')
y = 2*x
diff(y)/diff(x) #gives 2 as expected
diff(x)/diff(y) #gives 1/2 as expected


Example above illustrates issue I keep having (Sage expressions of type diff(x,y) giving error where there exist a derivative)

Questions are:

1. Does example below shows "limitations" of what Sage can compute ?

2. Is there a difference between diff(y)/diff(x) and diff(y,x) ?

3. Is there a way to help Sage "recognize" that diff(x,y) = 1/2 ? If yes, how?

P.S. (If 3 is "Yes") This seems very basic problem, yet I was unable to find any related examples online. Is there a reference that explains described behavior o diff?

### Help with diff (diff(y,x) vs diff(y)/diff(x), what is the difference) ?How do diff(y,x) and diff(y)/diff(x) differ?

Hello,

Consider the following Sage code:

x = var('x')
y = 2*x
diff(y,x) #gives 2 as expected
diff(x,y) #expected 1/2, complains: "argument symb must be a symbol"


This can be resolved via (kind-off) Leibniz's notation approach:

x = var('x')
y = 2*x
diff(y)/diff(x) #gives 2 as expected
diff(x)/diff(y) #gives 1/2 as expected


Example above illustrates issue I keep having (Sage expressions of type diff(x,y) giving error where there exist a derivative)

Questions are:

1. Does example below shows "limitations" of what Sage can compute ?

2. Is there a difference between diff(y)/diff(x) and diff(y,x) ?

3. Is there a way to help Sage "recognize" that diff(x,y) = 1/2 ? If yes, how?

P.S. (If 3 is "Yes") This seems very basic problem, yet I was unable to find any related examples online. Is there a reference that explains described behavior o diff?

It appears that I am conflicting symbolic "function" and "expression" types you mentioned, i.e. I expect diff(x) to return the total differential of f(x)=x. And it seems diff(...) does dive differential when defining x using "function" syntax (although both x(x)=x and var('x') cases have the same "<'...Expression'>" type).

x = var('x')
diff(x) #same as diff(x,x), as explained by Emmanuel Charpentier
type(x) #<class 'sage.symbolic.expression.Expression'>
x(x) = x
type(x) #<class 'sage.symbolic.expression.Expression'>
diff(x) #gives differential "x |--> 1", what I assumed it does for single argument diff()

#"function" approach works for multivirable where "expression" gave error
myCos(x,y) = cos(x*y)
diff(myCos) #gives differential "(x, y) |--> (-y*sin(x*y), -x*sin(x*y))"


My last remaining question is:

Given object "x", how to tell whether it's a "function" or "expression" ?

P.S. There is good reading on the "expression vs. function" business in docs. https://doc.sagemath.org/html/en/tutorial/tour_functions.html