# Revision history [back]

### How to substitute diff(y(x),x) with another expression in first and second order implicit differentiation?

I want to use implicit differentiation to find a dy/dx and d2y/dx2. Usually the solution on paper involves finding a replacement for y' that would eventually simplifies the final answer to some simple function of y.

so, for first and second derivative of x^2+y^2=1: there comes an issue where I got sequence instead of expression and I had to convert it to symbolic expression. which ended up with this :

y = function('y')(x);
f = x^2+y^2==1;
print('f is')
show(f)
df=diff(f,x,1);
show(df)

show(equation_2.expand())


I couldn't find a way to substitute the "diff(y,x)" with another expression which only contains y which eventually goes to simplifies the expression to -1/y**3. my workaround this issue was converting the equation to strings and replace the strings with what I wanted.

show(symbolic_expression(str(equation_2.rhs()).replace(str(diff(y(x),x)),str(answer_1[0].rhs()))).substitute(solve(f,x**2)).simplify_full())


if you are looking for the source of the problem. it is from Thomas' calculus 11th edition. Exercise 3.6 no 37-42

### How to substitute diff(y(x),x) with another expression in first and second order implicit differentiation?

I want to use implicit differentiation to find a dy/dx and d2y/dx2. Usually the solution on paper involves finding a replacement for y' that would eventually simplifies the final answer to some simple function of y.

so, for first and second derivative of x^2+y^2=1: there comes an issue where I got sequence instead of expression and I had to convert it to symbolic expression. which ended up with this :

y = function('y')(x);
f = x^2+y^2==1;
print('f is')
show(f)
df=diff(f,x,1);
show(df)

show(equation_2.expand())


I couldn't find a way to substitute the "diff(y,x)" with another expression which only contains y which eventually goes to simplifies the expression to -1/y**3. my workaround this issue was converting the equation to strings and replace the strings with what I wanted.

show(symbolic_expression(str(equation_2.rhs()).replace(str(diff(y(x),x)),str(answer_1[0].rhs()))).substitute(solve(f,x**2)).simplify_full())


if you are looking for the source of the problem. it is from Thomas' calculus 11th edition. Exercise 3.6 no 37-42

Edit - here is a solved example from the book https://pasteboard.co/VXDe8HN0Vytn.png

here is the questions I was referring to: https://pasteboard.co/ecXwH8W1ZRjI.png

### How to substitute diff(y(x),x) with another expression in first and second order implicit differentiation?

I want to use implicit differentiation to find a dy/dx and d2y/dx2. Usually the solution on paper involves finding a replacement for y' that would eventually simplifies the final answer to some simple function of y.

so, for first and second derivative of x^2+y^2=1: there comes an issue where I got sequence instead of expression and I had to convert it to symbolic expression. which ended up with this :

y = function('y')(x);
f = x^2+y^2==1;
print('f is')
show(f)
df=diff(f,x,1);
show(df)

show(equation_2.expand())


I couldn't find a way to substitute the "diff(y,x)" with another expression which only contains y which eventually goes to simplifies the expression to -1/y**3. my workaround this issue was converting the equation to strings and replace the strings with what I wanted.

show(symbolic_expression(str(equation_2.rhs()).replace(str(diff(y(x),x)),str(answer_1[0].rhs()))).substitute(solve(f,x**2)).simplify_full())


if you are looking for the source of the problem. it is from Thomas' calculus 11th edition. Exercise 3.6 no 37-42

Edit - here is a solved example from the book https://pasteboard.co/VXDe8HN0Vytn.png

here is the questions I was referring to: https://pasteboard.co/ecXwH8W1ZRjI.png

Second Edit: ok there my 9.2 sagemath is kinda old. I tried with SageMath 10 on cocalc, the problem is eventhough I'm giving the right code, it doesn't change the derivative with something else.

y = function('y')(x);
f = x^2+y^2==1;
dydx = solve(diff(f,x,1),diff(y,x,1))
show(dydx[0].rhs())
show(f)
df=diff(dydx[0].rhs(),x,1)
show(df)
df=diff(df,x,1)
df.substitute(diff(y,x,1)==dydx[0].rhs())
show(df)
df.substitute(x^2==1-y^2)
show(df)


### How to substitute diff(y(x),x) with another expression in first and second order implicit differentiation?

I want to use implicit differentiation to find a dy/dx and d2y/dx2. Usually the solution on paper involves finding a replacement for y' that would eventually simplifies the final answer to some simple function of y.

so, for first and second derivative of x^2+y^2=1: there comes an issue where I got sequence instead of expression and I had to convert it to symbolic expression. which ended up with this :

y = function('y')(x);
f = x^2+y^2==1;
print('f is')
show(f)
df=diff(f,x,1);
show(df)

show(equation_2.expand())


I couldn't find a way to substitute the "diff(y,x)" with another expression which only contains y which eventually goes to simplifies the expression to -1/y**3. my workaround this issue was converting the equation to strings and replace the strings with what I wanted.

show(symbolic_expression(str(equation_2.rhs()).replace(str(diff(y(x),x)),str(answer_1[0].rhs()))).substitute(solve(f,x**2)).simplify_full())


if you are looking for the source of the problem. it is from Thomas' calculus 11th edition. Exercise 3.6 no 37-42

Edit - here is a solved example from the book https://pasteboard.co/VXDe8HN0Vytn.png

here is the questions I was referring to: https://pasteboard.co/ecXwH8W1ZRjI.png

Second Edit: ok there my 9.2 sagemath is kinda old. I tried with SageMath 10 on cocalc, the problem is eventhough I'm giving the right code, it doesn't change the derivative with something else.

 y = function('y')(x);
f = x^2+y^2==1;
dydx = solve(diff(f,x,1),diff(y,x,1))
show(dydx[0].rhs())
show(f)
df=diff(dydx[0].rhs(),x,1)
show(df)
df=diff(df,x,1)
df.substitute(diff(y,x,1)==dydx[0].rhs())
show(df)
df.substitute(x^2==1-y^2)
show(df)
d2y = solve(df,diff(y,x,2))
show(d2y)
d2y[0].rhs().substitute(diff(y,x,1)==dydx[0].rhs())
d2y[0].rhs().substitute(x^2==1-y^2)
show(d2y)