0

I am attempting to differentiate the expression -1+3*x^2/1+x^2 with respect to x, but the output is incorrect. The correct output should be:

8x/(1+x^2)^2

#> library(mosaicCalc)
#>
#> l=D(-1+3*x^2/1+x^2 ~x)
#> l
function (x) 
8 * x

Edit: I have used parenthesis, but the output is still incorrect

#> t=D((-1+3*x^2)/1+x^2 ~x)
#> t
function (x) 
8 * x

Furthermore, I have used parenthesis for both the numerator and the denominator, and the output for the second derivative is incorrect.

> b = D((-1+3*x^2)/(1+x^2) ~x)
> b
function (x) 
{
    .e1 <- x^2
    .e2 <- 1 + .e1
    x * (6 - 2 * ((3 * .e1 - 1)/.e2))/.e2
}
> k = D(b~ x)
> k
function (x, t) 
0

The correct answer for the second derivative is 8(-3x^2+1)/(1+x^2)^3

https://www.symbolab.com/solver/step-by-step/%5Cfrac%7Bd%7D%7Bdx%7D%5Cfrac%7B8x%7D%7B%5Cleft(1%2Bx%5E%7B2%7D%5Cright)%5E%7B2%7D%7D?or=input

marabi
  • 3
  • 2
  • This is because you are plugging in incorrect equation. Use parenthesis to show how wide your division bar goes. eg `D((-1+3*x^2)/(1+x^2) ~x)`. example notice [here](https://www.wolframalpha.com/input?i=differentiate+%28-1%2B3*x%5E2%29%2F%281%2Bx%5E2%29) I placed the parenthesis. If you remove the parenthesis you get `8x` – Onyambu Feb 19 '23 at 06:52

1 Answers1

0

I think you need b(x) ~ x to get your second derivative. That will give you an expression in x that can be differentiated. As is, you are differentiating an expression that doesn’t depend on x, so the derivative is 0.

I might create an issue on GitHub to see if it is possible to emit a useful message in this case.

rpruim
  • 320
  • 2
  • 6