Why does:
Reduce[4 x^3 - 9 x^2 + 4 = 0, x]
Yield:
Set::write: Tag Plus in 4-9 x^2+4 x^3 is Protected. >>
Reduce::naqs: 0 is not a quantified system of equations and inequalities. >>
??
Why does:
D[4 x - 3 x^3 + x^4, x]
Give an answer of 0?
?x gives
Global`x
So it’s not that x is evaluating to some number. This is also proved by typing
4 x^3 - 9 x^2 + 4
and getting
4 - 9 x^2 + 4 x^3
back.
By the way:
D[x^4,x]
results in
4x^3
And
D[x^4-3x^3,x]
results in
-9x^2+4x^3
Only when I append the “+4x” to the expression does the program seem to lose its mind!
There must be something wrong in the post - perhaps the type setting. You are writing
f[x_]=4x-3x^3+x*4
This is different from what you said before, because the polynomial was:
4x-3x^3+x^4
Also to define a function you should use:
f[x_] :=4x-3x^3+x^4
so the delayed assignment “:=” instead of “=”. Then you say
“D[f[x],x] gives 0, but D[f[x],x] gives the expected answer”. That is the same (!!!) expression. How can it give two different answers?
I think that it would be easier if you attached the notebook. Small typos can make it difficult to find the error. I’ll attach a notebook that does work.
Also, Marco: I tried your notebook with the same result. And you can note, from my notebook that I get correct answers if the final term (4x) is either not there or is 4, rather than 4x.
All the outputs are as expected. D[f,x] evaluates to zero because you haven’t given the independent variable a name. So that is as expected.
D[f[X],x] evaluates to zero because I calculate the derivative with respect to a variable that is not in the function as X and x are different.
is quite the same as mine apart from the offending output where D[f[x],x] which evaluates to zero. If I re-evaluate your notebook the zero changes into the correct output.
Have you restarted your kernel? Have you tried using
Thanks for your work on this problem. Restarting the kernel did the trick. I suspect that, at one point, I said something like:
D[f[x],x]=0
That is, I made an assignment to the derivative, rather than a comparison, and that might be the root of the problem. I did try the ClearAll function, but that did not clear whatever was the issue with the bad command. Restarting the kernel seems to have cured it.
So I think it’s mostly explained, at least to the point that I can move on to other things now.