ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 06 Aug 2023 17:52:25 +0200How to substitute diff(y(x),x) with another expression in first and second order implicit differentiation?https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-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)
answer_1 = solve(diff(f,x,1),diff(y,x))
show(answer_1)
equation_1 = symbolic_expression(answer_1)
answer_2 = diff(equation_1 ,x)
show(answer_2)
equation_2 = symbolic_expression(answer_2[0])
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())
which is not the right way. please help :).
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())
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)Fri, 04 Aug 2023 19:47:05 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/Comment by mein_uzerneim for <p>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.</p>
<p>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 :</p>
<pre><code>y = function('y')(x);
f = x^2+y^2==1;
print('f is')
show(f)
df=diff(f,x,1);
show(df)
answer_1 = solve(diff(f,x,1),diff(y,x))
show(answer_1)
equation_1 = symbolic_expression(answer_1)
answer_2 = diff(equation_1 ,x)
show(answer_2)
equation_2 = symbolic_expression(answer_2[0])
show(equation_2.expand())
</code></pre>
<p>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.</p>
<pre><code>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())
</code></pre>
<p>which is not the right way. please help :).</p>
<p>if you are looking for the source of the problem. it is from Thomas' calculus 11th edition. Exercise 3.6 no 37-42</p>
<p>Edit -
here is a solved example from the book
https://pasteboard.co/VXDe8HN0Vytn.png</p>
<p>here is the questions I was referring to:
https://pasteboard.co/ecXwH8W1ZRjI.png</p>
<p>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.</p>
<pre><code> 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())
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)
</code></pre>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72026#post-id-72026No, this is not a homework. This is not a hard problem. I just couldn't figure out the problem with type of the output. Sometimes it becomes a free form ring and and sometimes it is a generic sequence. other times something that won't be recognized as symbolic. what ever it is, it might be related to how I defined Y(x).
I am relearning calculus for myself. I just wanted to provide the context of the problem, and by the way I think that most of these problems might be in a course for Differential equations not Calculus I. Cause I remember solving for d2y/dx2 somewhere else.
what level of homework can make me do this :D
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())Sat, 05 Aug 2023 18:23:05 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72026#post-id-72026Comment by Emmanuel Charpentier for <p>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.</p>
<p>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 :</p>
<pre><code>y = function('y')(x);
f = x^2+y^2==1;
print('f is')
show(f)
df=diff(f,x,1);
show(df)
answer_1 = solve(diff(f,x,1),diff(y,x))
show(answer_1)
equation_1 = symbolic_expression(answer_1)
answer_2 = diff(equation_1 ,x)
show(answer_2)
equation_2 = symbolic_expression(answer_2[0])
show(equation_2.expand())
</code></pre>
<p>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.</p>
<pre><code>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())
</code></pre>
<p>which is not the right way. please help :).</p>
<p>if you are looking for the source of the problem. it is from Thomas' calculus 11th edition. Exercise 3.6 no 37-42</p>
<p>Edit -
here is a solved example from the book
https://pasteboard.co/VXDe8HN0Vytn.png</p>
<p>here is the questions I was referring to:
https://pasteboard.co/ecXwH8W1ZRjI.png</p>
<p>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.</p>
<pre><code> 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())
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)
</code></pre>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72024#post-id-72024Whene reffering to an external text, please *do **not** assume* that your readers have your reference text available. Add a pointer to an available source or quote sufficiently (via pastebin if necessary).
Thank you !
BTW : is this homework ?Sat, 05 Aug 2023 17:14:56 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72024#post-id-72024Answer by Emmanuel Charpentier for <p>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.</p>
<p>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 :</p>
<pre><code>y = function('y')(x);
f = x^2+y^2==1;
print('f is')
show(f)
df=diff(f,x,1);
show(df)
answer_1 = solve(diff(f,x,1),diff(y,x))
show(answer_1)
equation_1 = symbolic_expression(answer_1)
answer_2 = diff(equation_1 ,x)
show(answer_2)
equation_2 = symbolic_expression(answer_2[0])
show(equation_2.expand())
</code></pre>
<p>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.</p>
<pre><code>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())
</code></pre>
<p>which is not the right way. please help :).</p>
<p>if you are looking for the source of the problem. it is from Thomas' calculus 11th edition. Exercise 3.6 no 37-42</p>
<p>Edit -
here is a solved example from the book
https://pasteboard.co/VXDe8HN0Vytn.png</p>
<p>here is the questions I was referring to:
https://pasteboard.co/ecXwH8W1ZRjI.png</p>
<p>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.</p>
<pre><code> 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())
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)
</code></pre>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?answer=72029#post-id-72029What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :
sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.
And none of this is necessary to solve for `y(x)`, but I *suppose* (not having your reference on hand) that it's not the point of the exercise...
**EDIT :** FWIW, [sample implementation](https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==) in Sagecell...
Sat, 05 Aug 2023 18:43:16 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?answer=72029#post-id-72029Comment by mein_uzerneim for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72098#post-id-72098"Can you pastebin this (or at least give a reference in "the book", which I managed to find and steal (all 1563 pages of it !)."
:)Sun, 06 Aug 2023 17:52:25 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72098#post-id-72098Comment by mein_uzerneim for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72097#post-id-72097I feel like I'm doing something wrong and I can't just see it probably something with substitution. I will try to look at it another day. thank you for your answer.Sun, 06 Aug 2023 17:49:46 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72097#post-id-72097Comment by mein_uzerneim for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72094#post-id-72094I tried the Sagecell you linked and for x^2+y^2=1 it returned -2x for the first derivative and -2 for the second derivative. Both of them are wrong. dy/dx = -x/y and the second derivative after taking the derivative and substitution of dy/dx and (x^2=1-y^2) in the second derivative the equation will be d2y/dx2 = -1/y^3
this is the image for the sage cell you provided.
https://pasteboard.co/l5ycv4QuUvbK.png
here is the same code in sage cell you provide run on cocalc(which is the same thing but I did it anyway)
https://pasteboard.co/8XyaxexOrdac.png
when I try my code in sage 9.2 it works and I could get the right answer with changing the type to string and doing the substitution by replacing the strings.
https://pasteboard.co/FI4rWE2cbG89.pngSun, 06 Aug 2023 17:02:53 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72094#post-id-72094Comment by mein_uzerneim for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72095#post-id-72095however the sage 10 on cocalc returns error running my code :
TypeError: Substitution using function-call syntax and unnamed arguments has been removed. You can use named arguments instead, like EXPR(x=..., y=...)
here is image for this error :
https://pasteboard.co/0HmdzFOgLXeJ.pngSun, 06 Aug 2023 17:04:50 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72095#post-id-72095Comment by Emmanuel Charpentier for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72074#post-id-72074@mein_uzemein :
> I tried it also with Sage 10 on cocalc.The function d1d2 doesn't result in (-1/y^3). it instead show's -2x for dy/dx which should be "-x", and differentiates the "-2x" further that results in -2. it should result in " xdiff(y(x), x)/y(x)^2 - 1/y(x))" for the second derivative.
I cannot reproduce this. Could you post a link ? Could you also try Sagecell ?Sun, 06 Aug 2023 10:39:21 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72074#post-id-72074Comment by Emmanuel Charpentier for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72066#post-id-72066Never mind. Found it (section 3_6 pp 206-211).Sun, 06 Aug 2023 08:21:16 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72066#post-id-72066Comment by Emmanuel Charpentier for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72065#post-id-72065> the thing I understood from the book
Can you pastebin this (or at least give a reference in "the book", which I managed to find and steal (all 1563 pages of it !).Sun, 06 Aug 2023 08:12:08 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72065#post-id-72065Comment by mein_uzerneim for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72041#post-id-72041I tried it also with Sage 10 on cocalc.The function d1d2 doesn't result in (-1/y^3). it instead show's -2x for dy/dx which should be "-x", and differentiates the "-2*x" further that results in -2. it should result in " x*diff(y(x), x)/y(x)^2 - 1/y(x))" for the second derivative.
the thing I understood from the book is that the first time taking the implicit derivation, we can reach an equation where dy=dx*f'(x,y) can be of use in two ways.
first, getting to dy/dx=f'x for proceeding to higher order differentiation, and second when we substitute dy/dx in f'' with f(x,y) we can simplify f''(x,y,f') to f''(x,y). I hope I am making sense here.Sun, 06 Aug 2023 00:25:31 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72041#post-id-72041Comment by Emmanuel Charpentier for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72037#post-id-72037FWIW, [sample implementation](https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==) in Sagecell...
HTH,Sat, 05 Aug 2023 21:19:36 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72037#post-id-72037Comment by Emmanuel Charpentier for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72036#post-id-72036> I uploaded the questions...
Thanks a lot !
But these are only the *questions* (and answers) ; what I was reffering to was the *method teaching*, to see where I could explain better how to "translate" it to Sage.Sat, 05 Aug 2023 21:07:04 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72036#post-id-72036Comment by Emmanuel Charpentier for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72035#post-id-72035Did you try my solution ? What were the results ?
> I am using 9.2 on windows
That may be a bit antique...
Nowadays, the "right" way to use Sage on Windows is to install Linux Windows on WSL (needs an up-to-date Windows 10 or (better) Windows 11). The heroic efforts to maintain the Cygwin port have been abandoned.
I suggest to install from source (tedious but allows for installation of optional packages). See for example this [recent answer](https://ask.sagemath.org/question/71978/cannot-start-jupyterlab-notebook/?answer=71993#post-id-71993) of Eric Gourgoulhon to a Windows-related question.
HTH,Sat, 05 Aug 2023 21:04:21 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72035#post-id-72035Comment by mein_uzerneim for <p>What version of Sage do you use ? With 10.1.beta8, the substitution is unproblematic. I changed notations a bit :</p>
<pre><code>sage: reset()
sage: y=function("y")
sage: Eq=x^2+y(x)^2-1 ; Eq
x^2 + y(x)^2 - 1
sage: S1=Eq.diff(x).solve(diff(y(x))) ; S1
[diff(y(x), x) == -x/y(x)]
sage: S2=S1[0].diff(x).subs(S1) ; S2
diff(y(x), x, x) == -x^2/y(x)^3 - 1/y(x)
</code></pre>
<p>BTW, neither Sage, Sympy nor Mathematica seem to be able to solve this ODE, at least under this form.</p>
<p>And none of this is necessary to solve for <code>y(x)</code>, but I <em>suppose</em> (not having your reference on hand) that it's not the point of the exercise...</p>
<p><strong>EDIT :</strong> FWIW, <a href="https://sagecell.sagemath.org/?z=eJxVkE1qAzEMhfeB3EG4G5sMpp5lwcvQA2RZGnAqmRpST-qfiX37ajJpaLWyPus9PdTs7JIUTajtpltf40cJU5SiLwDJAxoc5X4Ab_sAgYdtUy_bDXAJIdbHa5gpgotA39UtemCBg1836PyHDJASO9wQGwV3OhO0YfVIVGqKUD4JfEi5QLlOD8FMGSbPPleddNHQHqvR2L3G4L1csimdp_NM8gbuaE2t1Nvz-10yWjT_NPWUJRr1Nwj3A08ye4KD-7pw0pqJT7Kcox3HXZdNHY21Rv0A7o1fXw==&lang=sage&interacts=eJyLjgUAARUAuQ==">sample implementation</a> in Sagecell...</p>
https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72030#post-id-72030I am using 9.2 on windows
I uploaded the questions that I was referring to here :
https://pasteboard.co/ecXwH8W1ZRjI.png
I also put a solved example here :
https://pasteboard.co/VXDe8HN0Vytn.pngSat, 05 Aug 2023 18:45:26 +0200https://ask.sagemath.org/question/71748/how-to-substitute-diffyxx-with-another-expression-in-first-and-second-order-implicit-differentiation/?comment=72030#post-id-72030