Implicit Differentiation with Mathematica

Click For Summary
Implicit differentiation in Mathematica requires careful attention to how equations are structured. Using "==" instead of "=" is essential for Mathematica to interpret the equation correctly. Users have encountered recursion depth errors when improperly defining variables or equations, indicating the need for a fresh notebook to clear previous definitions. The correct approach involves rewriting the equation, such as transforming it to y^2 - y = -x, to avoid misinterpretation. Overall, understanding the syntax and structure is crucial for successful implicit differentiation in Mathematica.
flyingpig
Messages
2,574
Reaction score
1

Homework Statement




I tried using D[x = y - y^2, x, NonConstants -> {y}] and it keeps telling me that y - y^2 is not a valid variable.
 
Physics news on Phys.org
I'm pretty sure you need to explicitly say y is y[x].
 
I tried again using

D[x = y[x] - y[x]^2, x, NonConstants -> {y}]

And it says

$RecursionLimit::reclim: Recursion depth of 256 exceeded. >>

Further output of $RecursionLimit::reclim will be suppressed during this calculation. >>
 
oops I read what you wrote incorrectly. I have no idea how mathematica would even try to do implicit differentiation.
 
flyingpig said:
I tried again using

D[x = y[x] - y[x]^2, x, NonConstants -> {y}]

And it says

$RecursionLimit::reclim: Recursion depth of 256 exceeded. >>

Further output of $RecursionLimit::reclim will be suppressed during this calculation. >>

Try D[x == y[x] - y[x]^2, x, NonConstants -> {y}]. Symbolic equations to be manipulated need "==" instead of "=".
 
Argh still not working, it's giving me

1 == D[y[x], x, NonConstants -> {y}] -
2 D[y[x], x, NonConstants -> {y}] y[x]
 
flyingpig said:
Argh still not working, it's giving me

1 == D[y[x], x, NonConstants -> {y}] -
2 D[y[x], x, NonConstants -> {y}] y[x]

What do you want it to say?

D[y[x], x, NonConstants -> {y}] represents the derivative of y with respect to x.
 
I am trying to differentiate x = y - y^2
 
flyingpig said:
I am trying to differentiate x = y - y^2

Is the answer not 1=y^\prime-2yy^\prime? That's what Mathematica outputs. Incidentally, the NonConstant part is redundant when you already specify that y is a function of x by writing y[x]. If you plug in D[x == y[x] - y[x]^2, x], you'll get 1 == y'[x] -2y[x]y'[x].

Try experimenting more with Mathematica. It's the only way to learn it and get the training wheels off.
 
  • #10
In[1]:= D[x==y[x]-y[x]^2,x]
Out[1]= 1==y'[x]-2y[x]y'[x]

and if you need it

In[2]:= Solve[%,y'[x]]
Out[2]= {{y'[x]->1/(1-2 y[x])}}
 
  • #11
flyingpig said:
I am trying to differentiate x = y - y^2

EDIT#3::

Ok, I got the same problem with the recursion.

EDIT #4::

I know what's wrong.

You have to use y^2 - y = -x, otherwise Mathematica tries to assign y - y^2 into x.

you also need to start a new notebook in-case variables like x (or y) have values or equations in them. Starting a new notebook clears all variables.

EDIT #5::

basically, if you're going to do implicit differentiation in mathematica, you need to be careful what you put on the left hand side or right hand side of the equal sign. Putting a single variable on the left side, mathematica will interpret that as putting the whole right hand side into that single variable on the left hand side.

EDIT#6::

In[3]:= D[y[x]^2 - y[x] == -x, x]
output[3]:= -y'[x] + 2y[x]y'[x] = -1

Implicit differentiation is tricky in Mathematica because you might need to rewrite the original equation several times before Mathematica will interpret your intentions correctly.

EDIT #7::

actually I have no clue what I just previously said, because D[x==y[x]-y[x]^2,x] works as well. I think the original problem just need a new notebook (so all variables are cleared), and just need the user to enter the equations correctly, and use the built-in functions properly.
 
Last edited:

Similar threads

  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
49
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K